google-cloudevents 0.2.0

Prost/Serde structs for Google CloudEvent types with axum integration
Documentation
// This file is @generated by prost-build.
/// Workflow program to be executed by Workflows.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Workflow {
    /// The resource name of the workflow.
    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Description of the workflow provided by the user.
    /// Must be at most 1000 unicode characters long.
    #[prost(string, tag = "2")]
    pub description: ::prost::alloc::string::String,
    /// Output only. State of the workflow deployment.
    #[prost(enumeration = "workflow::State", tag = "3")]
    pub state: i32,
    /// Output only. The revision of the workflow.
    /// A new revision of a workflow is created as a result of updating the
    /// following properties of a workflow:
    ///
    /// - [Service account][google.cloud.workflows.v1.Workflow.service_account]
    /// - [Workflow code to be
    /// executed][google.cloud.workflows.v1.Workflow.source_contents]
    ///
    /// The format is "000001-a4d", where the first 6 characters define
    /// the zero-padded revision ordinal number. They are followed by a hyphen and
    /// 3 hexadecimal random characters.
    #[prost(string, tag = "4")]
    pub revision_id: ::prost::alloc::string::String,
    /// Output only. The timestamp of when the workflow was created.
    #[prost(message, optional, tag = "5")]
    pub create_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Output only. The last update timestamp of the workflow.
    #[prost(message, optional, tag = "6")]
    pub update_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Output only. The timestamp that the latest revision of the workflow
    /// was created.
    #[prost(message, optional, tag = "7")]
    pub revision_create_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Labels associated with this workflow.
    /// Labels can contain at most 64 entries. Keys and values can be no longer
    /// than 63 characters and can only contain lowercase letters, numeric
    /// characters, underscores and dashes. Label keys must start with a letter.
    /// International characters are allowed.
    #[prost(map = "string, string", tag = "8")]
    pub labels: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// The service account associated with the latest workflow version.
    /// This service account represents the identity of the workflow and determines
    /// what permissions the workflow has.
    /// Format: projects/{project}/serviceAccounts/{account} or {account}
    ///
    /// Using `-` as a wildcard for the `{project}` or not providing one at all
    /// will infer the project from the account. The `{account}` value can be the
    /// `email` address or the `unique_id` of the service account.
    ///
    /// If not provided, workflow will use the project's default service account.
    /// Modifying this field for an existing workflow results in a new workflow
    /// revision.
    #[prost(string, tag = "9")]
    pub service_account: ::prost::alloc::string::String,
    /// Required. Location of the workflow source code.
    /// Modifying this field for an existing workflow results in a new workflow
    /// revision.
    #[prost(oneof = "workflow::SourceCode", tags = "10")]
    pub source_code: ::core::option::Option<workflow::SourceCode>,
}
/// Nested message and enum types in `Workflow`.
pub mod workflow {
    /// Describes the current state of workflow deployment. More states may be
    /// added in the future.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum State {
        /// Invalid state.
        Unspecified = 0,
        /// The workflow has been deployed successfully and is serving.
        Active = 1,
    }
    impl State {
        /// String value of the enum field names used in the ProtoBuf definition.
        ///
        /// The values are not transformed in any way and thus are considered stable
        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
        pub fn as_str_name(&self) -> &'static str {
            match self {
                Self::Unspecified => "STATE_UNSPECIFIED",
                Self::Active => "ACTIVE",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "STATE_UNSPECIFIED" => Some(Self::Unspecified),
                "ACTIVE" => Some(Self::Active),
                _ => None,
            }
        }
    }
    /// Required. Location of the workflow source code.
    /// Modifying this field for an existing workflow results in a new workflow
    /// revision.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum SourceCode {
        /// Workflow code to be executed. The size limit is 128KB.
        #[prost(string, tag = "10")]
        SourceContents(::prost::alloc::string::String),
    }
}
/// The data within all Workflow events.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkflowEventData {
    /// Optional. The Workflow event payload. Unset for deletion events.
    #[prost(message, optional, tag = "1")]
    pub payload: ::core::option::Option<Workflow>,
}
/// The CloudEvent raised when a Workflow is created.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkflowCreatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<WorkflowEventData>,
}
/// The CloudEvent raised when a Workflow is deleted.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkflowDeletedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<WorkflowEventData>,
}
/// The CloudEvent raised when a Workflow is updated.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkflowUpdatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<WorkflowEventData>,
}