1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
// This file is @generated by prost-build.
/// Workflow program to be executed by Workflows.
#[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 fields of a workflow:
    /// - `source_code`
    /// - `service_account`
    /// 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<::prost_types::Timestamp>,
    /// Output only. The last update timestamp of the workflow.
    #[prost(message, optional, tag = "6")]
    pub update_time: ::core::option::Option<::prost_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<::prost_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(btree_map = "string, string", tag = "8")]
    pub labels: ::prost::alloc::collections::BTreeMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Name of 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}
    ///
    /// Using `-` as a wildcard for the `{project}` 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(
        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 {
                State::Unspecified => "STATE_UNSPECIFIED",
                State::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(Clone, PartialEq, ::prost::Oneof)]
    pub enum SourceCode {
        /// Workflow code to be executed. The size limit is 32KB.
        #[prost(string, tag = "10")]
        SourceContents(::prost::alloc::string::String),
    }
}
/// Request for the
/// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListWorkflowsRequest {
    /// Required. Project and location from which the workflows should be listed.
    /// Format: projects/{project}/locations/{location}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Maximum number of workflows to return per call. The service may return
    /// fewer than this value. If the value is not specified, a default value of
    /// 500 will be used. The maximum permitted value is 1000 and values greater
    /// than 1000 will be coerced down to 1000.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// A page token, received from a previous `ListWorkflows` call.
    /// Provide this to retrieve the subsequent page.
    ///
    /// When paginating, all other parameters provided to `ListWorkflows` must
    /// match the call that provided the page token.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
    /// Filter to restrict results to specific workflows.
    #[prost(string, tag = "4")]
    pub filter: ::prost::alloc::string::String,
    /// Comma-separated list of fields that that specify the order of the results.
    /// Default sorting order for a field is ascending. To specify descending order
    /// for a field, append a " desc" suffix.
    /// If not specified, the results will be returned in an unspecified order.
    #[prost(string, tag = "5")]
    pub order_by: ::prost::alloc::string::String,
}
/// Response for the
/// [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListWorkflowsResponse {
    /// The workflows which match the request.
    #[prost(message, repeated, tag = "1")]
    pub workflows: ::prost::alloc::vec::Vec<Workflow>,
    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
    /// Unreachable resources.
    #[prost(string, repeated, tag = "3")]
    pub unreachable: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Request for the
/// [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkflowRequest {
    /// Required. Name of the workflow which information should be retrieved.
    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request for the
/// [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateWorkflowRequest {
    /// Required. Project and location in which the workflow should be created.
    /// Format:  projects/{project}/locations/{location}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. Workflow to be created.
    #[prost(message, optional, tag = "2")]
    pub workflow: ::core::option::Option<Workflow>,
    /// Required. The ID of the workflow to be created. It has to fulfill the
    /// following requirements:
    ///
    /// * Must contain only letters, numbers, underscores and hyphens.
    /// * Must start with a letter.
    /// * Must be between 1-64 characters.
    /// * Must end with a number or a letter.
    /// * Must be unique within the customer project and location.
    #[prost(string, tag = "3")]
    pub workflow_id: ::prost::alloc::string::String,
}
/// Request for the
/// [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteWorkflowRequest {
    /// Required. Name of the workflow to be deleted.
    /// Format: projects/{project}/locations/{location}/workflows/{workflow}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request for the
/// [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow]
/// method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateWorkflowRequest {
    /// Required. Workflow to be updated.
    #[prost(message, optional, tag = "1")]
    pub workflow: ::core::option::Option<Workflow>,
    /// List of fields to be updated. If not present, the entire workflow
    /// will be updated.
    #[prost(message, optional, tag = "2")]
    pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Represents the metadata of the long-running operation.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationMetadata {
    /// The time the operation was created.
    #[prost(message, optional, tag = "1")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
    /// The time the operation finished running.
    #[prost(message, optional, tag = "2")]
    pub end_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Server-defined resource path for the target of the operation.
    #[prost(string, tag = "3")]
    pub target: ::prost::alloc::string::String,
    /// Name of the verb executed by the operation.
    #[prost(string, tag = "4")]
    pub verb: ::prost::alloc::string::String,
    /// API version used to start the operation.
    #[prost(string, tag = "5")]
    pub api_version: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod workflows_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Workflows is used to deploy and execute workflow programs.
    /// Workflows makes sure the program executes reliably, despite hardware and
    /// networking interruptions.
    #[derive(Debug, Clone)]
    pub struct WorkflowsClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl<T> WorkflowsClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> WorkflowsClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            WorkflowsClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Lists Workflows in a given project and location.
        /// The default order is not specified.
        pub async fn list_workflows(
            &mut self,
            request: impl tonic::IntoRequest<super::ListWorkflowsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListWorkflowsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.workflows.v1beta.Workflows/ListWorkflows",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.workflows.v1beta.Workflows",
                        "ListWorkflows",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Gets details of a single Workflow.
        pub async fn get_workflow(
            &mut self,
            request: impl tonic::IntoRequest<super::GetWorkflowRequest>,
        ) -> std::result::Result<tonic::Response<super::Workflow>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.workflows.v1beta.Workflows/GetWorkflow",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.workflows.v1beta.Workflows",
                        "GetWorkflow",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Creates a new workflow. If a workflow with the specified name already
        /// exists in the specified project and location, the long running operation
        /// will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
        pub async fn create_workflow(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateWorkflowRequest>,
        ) -> std::result::Result<
            tonic::Response<super::super::super::super::longrunning::Operation>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.workflows.v1beta.Workflows/CreateWorkflow",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.workflows.v1beta.Workflows",
                        "CreateWorkflow",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Deletes a workflow with the specified name.
        /// This method also cancels and deletes all running executions of the
        /// workflow.
        pub async fn delete_workflow(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteWorkflowRequest>,
        ) -> std::result::Result<
            tonic::Response<super::super::super::super::longrunning::Operation>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.workflows.v1beta.Workflows/DeleteWorkflow",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.workflows.v1beta.Workflows",
                        "DeleteWorkflow",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Updates an existing workflow.
        /// Running this method has no impact on already running executions of the
        /// workflow. A new revision of the workflow may be created as a result of a
        /// successful update operation. In that case, such revision will be used
        /// in new workflow executions.
        pub async fn update_workflow(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateWorkflowRequest>,
        ) -> std::result::Result<
            tonic::Response<super::super::super::super::longrunning::Operation>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.workflows.v1beta.Workflows/UpdateWorkflow",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.workflows.v1beta.Workflows",
                        "UpdateWorkflow",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}