google_workflowexecutions1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all WorkflowExecutions related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_workflowexecutions1 as workflowexecutions1;
49/// use workflowexecutions1::api::CancelExecutionRequest;
50/// use workflowexecutions1::{Result, Error};
51/// # async fn dox() {
52/// use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = WorkflowExecutions::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = CancelExecutionRequest::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_workflows_executions_cancel(req, "name")
88///              .doit().await;
89///
90/// match result {
91///     Err(e) => match e {
92///         // The Error enum provides details about what exactly happened.
93///         // You can also just use its `Debug`, `Display` or `Error` traits
94///          Error::HttpError(_)
95///         |Error::Io(_)
96///         |Error::MissingAPIKey
97///         |Error::MissingToken(_)
98///         |Error::Cancelled
99///         |Error::UploadSizeLimitExceeded(_, _)
100///         |Error::Failure(_)
101///         |Error::BadRequest(_)
102///         |Error::FieldClash(_)
103///         |Error::JsonDecodeError(_, _) => println!("{}", e),
104///     },
105///     Ok(res) => println!("Success: {:?}", res),
106/// }
107/// # }
108/// ```
109#[derive(Clone)]
110pub struct WorkflowExecutions<C> {
111    pub client: common::Client<C>,
112    pub auth: Box<dyn common::GetToken>,
113    _user_agent: String,
114    _base_url: String,
115    _root_url: String,
116}
117
118impl<C> common::Hub for WorkflowExecutions<C> {}
119
120impl<'a, C> WorkflowExecutions<C> {
121    pub fn new<A: 'static + common::GetToken>(
122        client: common::Client<C>,
123        auth: A,
124    ) -> WorkflowExecutions<C> {
125        WorkflowExecutions {
126            client,
127            auth: Box::new(auth),
128            _user_agent: "google-api-rust-client/6.0.0".to_string(),
129            _base_url: "https://workflowexecutions.googleapis.com/".to_string(),
130            _root_url: "https://workflowexecutions.googleapis.com/".to_string(),
131        }
132    }
133
134    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
135        ProjectMethods { hub: self }
136    }
137
138    /// Set the user-agent header field to use in all requests to the server.
139    /// It defaults to `google-api-rust-client/6.0.0`.
140    ///
141    /// Returns the previously set user-agent.
142    pub fn user_agent(&mut self, agent_name: String) -> String {
143        std::mem::replace(&mut self._user_agent, agent_name)
144    }
145
146    /// Set the base url to use in all requests to the server.
147    /// It defaults to `https://workflowexecutions.googleapis.com/`.
148    ///
149    /// Returns the previously set base url.
150    pub fn base_url(&mut self, new_base_url: String) -> String {
151        std::mem::replace(&mut self._base_url, new_base_url)
152    }
153
154    /// Set the root url to use in all requests to the server.
155    /// It defaults to `https://workflowexecutions.googleapis.com/`.
156    ///
157    /// Returns the previously set root url.
158    pub fn root_url(&mut self, new_root_url: String) -> String {
159        std::mem::replace(&mut self._root_url, new_root_url)
160    }
161}
162
163// ############
164// SCHEMAS ###
165// ##########
166/// An instance of a Callback created by an execution.
167///
168/// This type is not used in any activity, and only used as *part* of another schema.
169///
170#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
171#[serde_with::serde_as]
172#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
173pub struct Callback {
174    /// Output only. The payloads received by the callback that have not been processed by a waiting execution step.
175    #[serde(rename = "availablePayloads")]
176    pub available_payloads: Option<Vec<String>>,
177    /// Output only. The method accepted by the callback. For example: GET, POST, PUT.
178    pub method: Option<String>,
179    /// Output only. The resource name of the callback. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/callback/{callback}
180    pub name: Option<String>,
181    /// Output only. Number of execution steps waiting on this callback.
182    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
183    pub waiters: Option<i64>,
184}
185
186impl common::Part for Callback {}
187
188/// Request for the CancelExecution method.
189///
190/// # Activities
191///
192/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
193/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
194///
195/// * [locations workflows executions cancel projects](ProjectLocationWorkflowExecutionCancelCall) (request)
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct CancelExecutionRequest {
200    _never_set: Option<bool>,
201}
202
203impl common::RequestValue for CancelExecutionRequest {}
204
205/// Error describes why the execution was abnormally terminated.
206///
207/// This type is not used in any activity, and only used as *part* of another schema.
208///
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct Error {
213    /// Human-readable stack trace string.
214    pub context: Option<String>,
215    /// Error message and data returned represented as a JSON string.
216    pub payload: Option<String>,
217    /// Stack trace with detailed information of where error was generated.
218    #[serde(rename = "stackTrace")]
219    pub stack_trace: Option<StackTrace>,
220}
221
222impl common::Part for Error {}
223
224/// Exception describes why the step entry failed.
225///
226/// This type is not used in any activity, and only used as *part* of another schema.
227///
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct Exception {
232    /// Error message represented as a JSON string.
233    pub payload: Option<String>,
234}
235
236impl common::Part for Exception {}
237
238/// A running instance of a [Workflow](https://cloud.google.com/workflows/docs/reference/rest/v1/projects.locations.workflows).
239///
240/// # Activities
241///
242/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
243/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
244///
245/// * [locations workflows executions cancel projects](ProjectLocationWorkflowExecutionCancelCall) (response)
246/// * [locations workflows executions create projects](ProjectLocationWorkflowExecutionCreateCall) (request|response)
247/// * [locations workflows executions get projects](ProjectLocationWorkflowExecutionGetCall) (response)
248/// * [locations workflows trigger pubsub execution projects](ProjectLocationWorkflowTriggerPubsubExecutionCall) (response)
249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
250#[serde_with::serde_as]
251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
252pub struct Execution {
253    /// Input parameters of the execution represented as a JSON string. The size limit is 32KB. *Note*: If you are using the REST API directly to run your workflow, you must escape any JSON string value of `argument`. Example: `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
254    pub argument: Option<String>,
255    /// The call logging level associated to this execution.
256    #[serde(rename = "callLogLevel")]
257    pub call_log_level: Option<String>,
258    /// Output only. Marks the creation of the execution.
259    #[serde(rename = "createTime")]
260    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
261    /// Optional. If set to true, the execution will not be backlogged when the concurrency quota is exhausted. The backlog execution starts when the concurrency quota becomes available.
262    #[serde(rename = "disableConcurrencyQuotaOverflowBuffering")]
263    pub disable_concurrency_quota_overflow_buffering: Option<bool>,
264    /// Output only. Measures the duration of the execution.
265    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
266    pub duration: Option<chrono::Duration>,
267    /// Output only. Marks the end of execution, successful or not.
268    #[serde(rename = "endTime")]
269    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
270    /// Output only. The error which caused the execution to finish prematurely. The value is only present if the execution's state is `FAILED` or `CANCELLED`.
271    pub error: Option<Error>,
272    /// Labels associated with this execution. 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. By default, labels are inherited from the workflow but are overridden by any labels associated with the execution.
273    pub labels: Option<HashMap<String, String>>,
274    /// Output only. The resource name of the execution. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
275    pub name: Option<String>,
276    /// Output only. Output of the execution represented as a JSON string. The value can only be present if the execution's state is `SUCCEEDED`.
277    pub result: Option<String>,
278    /// Output only. Marks the beginning of execution.
279    #[serde(rename = "startTime")]
280    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
281    /// Output only. Current state of the execution.
282    pub state: Option<String>,
283    /// Output only. Error regarding the state of the Execution resource. For example, this field will have error details if the execution data is unavailable due to revoked KMS key permissions.
284    #[serde(rename = "stateError")]
285    pub state_error: Option<StateError>,
286    /// Output only. Status tracks the current steps and progress data of this execution.
287    pub status: Option<Status>,
288    /// Output only. Revision of the workflow this execution is using.
289    #[serde(rename = "workflowRevisionId")]
290    pub workflow_revision_id: Option<String>,
291}
292
293impl common::RequestValue for Execution {}
294impl common::ResponseResult for Execution {}
295
296/// Response for the ExportData method.
297///
298/// # Activities
299///
300/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
301/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
302///
303/// * [locations workflows executions export data projects](ProjectLocationWorkflowExecutionExportDataCall) (response)
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct ExportDataResponse {
308    /// The JSON string with customer data and metadata for an execution with the given name
309    pub data: Option<String>,
310}
311
312impl common::ResponseResult for ExportDataResponse {}
313
314/// RPC response object for the ListCallbacks method.
315///
316/// # Activities
317///
318/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
319/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
320///
321/// * [locations workflows executions callbacks list projects](ProjectLocationWorkflowExecutionCallbackListCall) (response)
322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
323#[serde_with::serde_as]
324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
325pub struct ListCallbacksResponse {
326    /// The callbacks which match the request.
327    pub callbacks: Option<Vec<Callback>>,
328    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
329    #[serde(rename = "nextPageToken")]
330    pub next_page_token: Option<String>,
331}
332
333impl common::ResponseResult for ListCallbacksResponse {}
334
335/// Response for the ListExecutions method.
336///
337/// # Activities
338///
339/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
340/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
341///
342/// * [locations workflows executions list projects](ProjectLocationWorkflowExecutionListCall) (response)
343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
344#[serde_with::serde_as]
345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
346pub struct ListExecutionsResponse {
347    /// The executions which match the request.
348    pub executions: Option<Vec<Execution>>,
349    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
350    #[serde(rename = "nextPageToken")]
351    pub next_page_token: Option<String>,
352}
353
354impl common::ResponseResult for ListExecutionsResponse {}
355
356/// Response message for ExecutionHistory.ListStepEntries.
357///
358/// # Activities
359///
360/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
361/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
362///
363/// * [locations workflows executions step entries list projects](ProjectLocationWorkflowExecutionStepEntryListCall) (response)
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct ListStepEntriesResponse {
368    /// A token to retrieve next page of results. Pass this value in the ListStepEntriesRequest.page_token field in the subsequent call to `ListStepEntries` method to retrieve the next page of results.
369    #[serde(rename = "nextPageToken")]
370    pub next_page_token: Option<String>,
371    /// The list of entries.
372    #[serde(rename = "stepEntries")]
373    pub step_entries: Option<Vec<StepEntry>>,
374    /// Indicates the total number of StepEntries that matched the request filter. For running executions, this number shows the number of StepEntries that are executed thus far.
375    #[serde(rename = "totalSize")]
376    pub total_size: Option<i32>,
377}
378
379impl common::ResponseResult for ListStepEntriesResponse {}
380
381/// NavigationInfo describes what steps if any come before or after this step, or what steps are parents or children of this step.
382///
383/// This type is not used in any activity, and only used as *part* of another schema.
384///
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct NavigationInfo {
389    /// Step entries that can be reached by "stepping into" e.g. a subworkflow call.
390    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
391    pub children: Option<Vec<i64>>,
392    /// The index of the next step in the current workflow, if any.
393    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
394    pub next: Option<i64>,
395    /// The step entry, if any, that can be reached by "stepping out" of the current workflow being executed.
396    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
397    pub parent: Option<i64>,
398    /// The index of the previous step in the current workflow, if any.
399    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
400    pub previous: Option<i64>,
401}
402
403impl common::Part for NavigationInfo {}
404
405/// Position contains source position information about the stack trace element such as line number, column number and length of the code block in bytes.
406///
407/// This type is not used in any activity, and only used as *part* of another schema.
408///
409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
410#[serde_with::serde_as]
411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
412pub struct Position {
413    /// The source code column position (of the line) the current instruction was generated from.
414    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
415    pub column: Option<i64>,
416    /// The number of bytes of source code making up this stack trace element.
417    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
418    pub length: Option<i64>,
419    /// The source code line number the current instruction was generated from.
420    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
421    pub line: Option<i64>,
422}
423
424impl common::Part for Position {}
425
426/// A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits.
427///
428/// This type is not used in any activity, and only used as *part* of another schema.
429///
430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
431#[serde_with::serde_as]
432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
433pub struct PubsubMessage {
434    /// Optional. Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.
435    pub attributes: Option<HashMap<String, String>>,
436    /// Optional. The message data field. If this field is empty, the message must contain at least one attribute.
437    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
438    pub data: Option<Vec<u8>>,
439    /// ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.
440    #[serde(rename = "messageId")]
441    pub message_id: Option<String>,
442    /// Optional. If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value. For more information, see [ordering messages](https://cloud.google.com/pubsub/docs/ordering).
443    #[serde(rename = "orderingKey")]
444    pub ordering_key: Option<String>,
445    /// The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.
446    #[serde(rename = "publishTime")]
447    pub publish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
448}
449
450impl common::Part for PubsubMessage {}
451
452/// A collection of stack elements (frames) where an error occurred.
453///
454/// This type is not used in any activity, and only used as *part* of another schema.
455///
456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
457#[serde_with::serde_as]
458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
459pub struct StackTrace {
460    /// An array of stack elements.
461    pub elements: Option<Vec<StackTraceElement>>,
462}
463
464impl common::Part for StackTrace {}
465
466/// A single stack element (frame) where an error occurred.
467///
468/// This type is not used in any activity, and only used as *part* of another schema.
469///
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct StackTraceElement {
474    /// The source position information of the stack trace element.
475    pub position: Option<Position>,
476    /// The routine where the error occurred.
477    pub routine: Option<String>,
478    /// The step the error occurred at.
479    pub step: Option<String>,
480}
481
482impl common::Part for StackTraceElement {}
483
484/// Describes an error related to the current state of the Execution resource.
485///
486/// This type is not used in any activity, and only used as *part* of another schema.
487///
488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
489#[serde_with::serde_as]
490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
491pub struct StateError {
492    /// Provides specifics about the error.
493    pub details: Option<String>,
494    /// The type of this state error.
495    #[serde(rename = "type")]
496    pub type_: Option<String>,
497}
498
499impl common::Part for StateError {}
500
501/// Represents the current status of this execution.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct Status {
509    /// A list of currently executing or last executed step names for the workflow execution currently running. If the workflow has succeeded or failed, this is the last attempted or executed step. Presently, if the current step is inside a subworkflow, the list only includes that step. In the future, the list will contain items for each step in the call stack, starting with the outermost step in the `main` subworkflow, and ending with the most deeply nested step.
510    #[serde(rename = "currentSteps")]
511    pub current_steps: Option<Vec<Step>>,
512}
513
514impl common::Part for Status {}
515
516/// Represents a step of the workflow this execution is running.
517///
518/// This type is not used in any activity, and only used as *part* of another schema.
519///
520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
521#[serde_with::serde_as]
522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
523pub struct Step {
524    /// Name of a routine within the workflow.
525    pub routine: Option<String>,
526    /// Name of a step within the routine.
527    pub step: Option<String>,
528}
529
530impl common::Part for Step {}
531
532/// An StepEntry contains debugging information for a step transition in a workflow execution.
533///
534/// # Activities
535///
536/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
537/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
538///
539/// * [locations workflows executions step entries get projects](ProjectLocationWorkflowExecutionStepEntryGetCall) (response)
540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
541#[serde_with::serde_as]
542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
543pub struct StepEntry {
544    /// Output only. The creation time of the step entry.
545    #[serde(rename = "createTime")]
546    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
547    /// Output only. The numeric ID of this step entry, used for navigation.
548    #[serde(rename = "entryId")]
549    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
550    pub entry_id: Option<i64>,
551    /// Output only. The exception thrown by the step entry.
552    pub exception: Option<Exception>,
553    /// Output only. The full resource name of the step entry. Each step entry has a unique entry ID, which is a monotonically increasing counter. Step entry names have the format: `projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/stepEntries/{step_entry}`.
554    pub name: Option<String>,
555    /// Output only. The NavigationInfo associated to this step.
556    #[serde(rename = "navigationInfo")]
557    pub navigation_info: Option<NavigationInfo>,
558    /// Output only. The name of the routine this step entry belongs to. A routine name is the subworkflow name defined in the YAML source code. The top level routine name is `main`.
559    pub routine: Option<String>,
560    /// Output only. The state of the step entry.
561    pub state: Option<String>,
562    /// Output only. The name of the step this step entry belongs to.
563    pub step: Option<String>,
564    /// Output only. The StepEntryMetadata associated to this step.
565    #[serde(rename = "stepEntryMetadata")]
566    pub step_entry_metadata: Option<StepEntryMetadata>,
567    /// Output only. The type of the step this step entry belongs to.
568    #[serde(rename = "stepType")]
569    pub step_type: Option<String>,
570    /// Output only. The most recently updated time of the step entry.
571    #[serde(rename = "updateTime")]
572    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
573}
574
575impl common::ResponseResult for StepEntry {}
576
577/// StepEntryMetadata contains metadata information about this step.
578///
579/// This type is not used in any activity, and only used as *part* of another schema.
580///
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct StepEntryMetadata {
585    /// Expected iteration represents the expected number of iterations in the step's progress.
586    #[serde(rename = "expectedIteration")]
587    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
588    pub expected_iteration: Option<i64>,
589    /// Progress number represents the current state of the current progress. eg: A step entry represents the 4th iteration in a progress of PROGRESS_TYPE_FOR.
590    #[serde(rename = "progressNumber")]
591    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
592    pub progress_number: Option<i64>,
593    /// Progress type of this step entry.
594    #[serde(rename = "progressType")]
595    pub progress_type: Option<String>,
596    /// Child thread id that this step entry belongs to.
597    #[serde(rename = "threadId")]
598    pub thread_id: Option<String>,
599}
600
601impl common::Part for StepEntryMetadata {}
602
603/// Request for the TriggerPubsubExecution method.
604///
605/// # Activities
606///
607/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
608/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
609///
610/// * [locations workflows trigger pubsub execution projects](ProjectLocationWorkflowTriggerPubsubExecutionCall) (request)
611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
612#[serde_with::serde_as]
613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
614pub struct TriggerPubsubExecutionRequest {
615    /// Required. LINT: LEGACY_NAMES The query parameter value for __GCP_CloudEventsMode, set by the Eventarc service when configuring triggers.
616    #[serde(rename = "GCPCloudEventsMode")]
617    pub gcp_cloud_events_mode: Option<String>,
618    /// The number of attempts that have been made to deliver this message. This is set by Pub/Sub for subscriptions that have the "dead letter" feature enabled, and hence provided here for compatibility, but is ignored by Workflows.
619    #[serde(rename = "deliveryAttempt")]
620    pub delivery_attempt: Option<i32>,
621    /// Required. The message of the Pub/Sub push notification.
622    pub message: Option<PubsubMessage>,
623    /// Required. The subscription of the Pub/Sub push notification. Format: projects/{project}/subscriptions/{sub}
624    pub subscription: Option<String>,
625}
626
627impl common::RequestValue for TriggerPubsubExecutionRequest {}
628
629// ###################
630// MethodBuilders ###
631// #################
632
633/// A builder providing access to all methods supported on *project* resources.
634/// It is not used directly, but through the [`WorkflowExecutions`] hub.
635///
636/// # Example
637///
638/// Instantiate a resource builder
639///
640/// ```test_harness,no_run
641/// extern crate hyper;
642/// extern crate hyper_rustls;
643/// extern crate google_workflowexecutions1 as workflowexecutions1;
644///
645/// # async fn dox() {
646/// use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
647///
648/// let secret: yup_oauth2::ApplicationSecret = Default::default();
649/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
650///     secret,
651///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
652/// ).build().await.unwrap();
653///
654/// let client = hyper_util::client::legacy::Client::builder(
655///     hyper_util::rt::TokioExecutor::new()
656/// )
657/// .build(
658///     hyper_rustls::HttpsConnectorBuilder::new()
659///         .with_native_roots()
660///         .unwrap()
661///         .https_or_http()
662///         .enable_http1()
663///         .build()
664/// );
665/// let mut hub = WorkflowExecutions::new(client, auth);
666/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
667/// // like `locations_workflows_executions_callbacks_list(...)`, `locations_workflows_executions_cancel(...)`, `locations_workflows_executions_create(...)`, `locations_workflows_executions_export_data(...)`, `locations_workflows_executions_get(...)`, `locations_workflows_executions_list(...)`, `locations_workflows_executions_step_entries_get(...)`, `locations_workflows_executions_step_entries_list(...)` and `locations_workflows_trigger_pubsub_execution(...)`
668/// // to build up your call.
669/// let rb = hub.projects();
670/// # }
671/// ```
672pub struct ProjectMethods<'a, C>
673where
674    C: 'a,
675{
676    hub: &'a WorkflowExecutions<C>,
677}
678
679impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
680
681impl<'a, C> ProjectMethods<'a, C> {
682    /// Create a builder to help you perform the following task:
683    ///
684    /// Returns a list of active callbacks that belong to the execution with the given name. The returned callbacks are ordered by callback ID.
685    ///
686    /// # Arguments
687    ///
688    /// * `parent` - Required. Name of the execution for which the callbacks should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
689    pub fn locations_workflows_executions_callbacks_list(
690        &self,
691        parent: &str,
692    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
693        ProjectLocationWorkflowExecutionCallbackListCall {
694            hub: self.hub,
695            _parent: parent.to_string(),
696            _page_token: Default::default(),
697            _page_size: Default::default(),
698            _delegate: Default::default(),
699            _additional_params: Default::default(),
700            _scopes: Default::default(),
701        }
702    }
703
704    /// Create a builder to help you perform the following task:
705    ///
706    /// Gets a step entry.
707    ///
708    /// # Arguments
709    ///
710    /// * `name` - Required. The name of the step entry to retrieve. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/stepEntries/{step_entry}
711    pub fn locations_workflows_executions_step_entries_get(
712        &self,
713        name: &str,
714    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C> {
715        ProjectLocationWorkflowExecutionStepEntryGetCall {
716            hub: self.hub,
717            _name: name.to_string(),
718            _delegate: Default::default(),
719            _additional_params: Default::default(),
720            _scopes: Default::default(),
721        }
722    }
723
724    /// Create a builder to help you perform the following task:
725    ///
726    /// Lists step entries for the corresponding workflow execution. Returned entries are ordered by their create_time.
727    ///
728    /// # Arguments
729    ///
730    /// * `parent` - Required. Name of the workflow execution to list entries for. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/stepEntries/
731    pub fn locations_workflows_executions_step_entries_list(
732        &self,
733        parent: &str,
734    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
735        ProjectLocationWorkflowExecutionStepEntryListCall {
736            hub: self.hub,
737            _parent: parent.to_string(),
738            _skip: Default::default(),
739            _page_token: Default::default(),
740            _page_size: Default::default(),
741            _order_by: Default::default(),
742            _filter: Default::default(),
743            _delegate: Default::default(),
744            _additional_params: Default::default(),
745            _scopes: Default::default(),
746        }
747    }
748
749    /// Create a builder to help you perform the following task:
750    ///
751    /// Cancels an execution of the given name.
752    ///
753    /// # Arguments
754    ///
755    /// * `request` - No description provided.
756    /// * `name` - Required. Name of the execution to be cancelled. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
757    pub fn locations_workflows_executions_cancel(
758        &self,
759        request: CancelExecutionRequest,
760        name: &str,
761    ) -> ProjectLocationWorkflowExecutionCancelCall<'a, C> {
762        ProjectLocationWorkflowExecutionCancelCall {
763            hub: self.hub,
764            _request: request,
765            _name: name.to_string(),
766            _delegate: Default::default(),
767            _additional_params: Default::default(),
768            _scopes: Default::default(),
769        }
770    }
771
772    /// Create a builder to help you perform the following task:
773    ///
774    /// Creates a new execution using the latest revision of the given workflow. For more information, see Execute a workflow.
775    ///
776    /// # Arguments
777    ///
778    /// * `request` - No description provided.
779    /// * `parent` - Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the workflow will be used.
780    pub fn locations_workflows_executions_create(
781        &self,
782        request: Execution,
783        parent: &str,
784    ) -> ProjectLocationWorkflowExecutionCreateCall<'a, C> {
785        ProjectLocationWorkflowExecutionCreateCall {
786            hub: self.hub,
787            _request: request,
788            _parent: parent.to_string(),
789            _delegate: Default::default(),
790            _additional_params: Default::default(),
791            _scopes: Default::default(),
792        }
793    }
794
795    /// Create a builder to help you perform the following task:
796    ///
797    /// Returns all metadata stored about an execution, excluding most data that is already accessible using other API methods.
798    ///
799    /// # Arguments
800    ///
801    /// * `name` - Required. Name of the execution for which data is to be exported. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
802    pub fn locations_workflows_executions_export_data(
803        &self,
804        name: &str,
805    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C> {
806        ProjectLocationWorkflowExecutionExportDataCall {
807            hub: self.hub,
808            _name: name.to_string(),
809            _delegate: Default::default(),
810            _additional_params: Default::default(),
811            _scopes: Default::default(),
812        }
813    }
814
815    /// Create a builder to help you perform the following task:
816    ///
817    /// Returns an execution of the given name.
818    ///
819    /// # Arguments
820    ///
821    /// * `name` - Required. Name of the execution to be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
822    pub fn locations_workflows_executions_get(
823        &self,
824        name: &str,
825    ) -> ProjectLocationWorkflowExecutionGetCall<'a, C> {
826        ProjectLocationWorkflowExecutionGetCall {
827            hub: self.hub,
828            _name: name.to_string(),
829            _view: Default::default(),
830            _delegate: Default::default(),
831            _additional_params: Default::default(),
832            _scopes: Default::default(),
833        }
834    }
835
836    /// Create a builder to help you perform the following task:
837    ///
838    /// Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).
839    ///
840    /// # Arguments
841    ///
842    /// * `parent` - Required. Name of the workflow for which the executions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}
843    pub fn locations_workflows_executions_list(
844        &self,
845        parent: &str,
846    ) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
847        ProjectLocationWorkflowExecutionListCall {
848            hub: self.hub,
849            _parent: parent.to_string(),
850            _view: Default::default(),
851            _page_token: Default::default(),
852            _page_size: Default::default(),
853            _order_by: Default::default(),
854            _filter: Default::default(),
855            _delegate: Default::default(),
856            _additional_params: Default::default(),
857            _scopes: Default::default(),
858        }
859    }
860
861    /// Create a builder to help you perform the following task:
862    ///
863    /// Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.
864    ///
865    /// # Arguments
866    ///
867    /// * `request` - No description provided.
868    /// * `workflow` - Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow}
869    pub fn locations_workflows_trigger_pubsub_execution(
870        &self,
871        request: TriggerPubsubExecutionRequest,
872        workflow: &str,
873    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {
874        ProjectLocationWorkflowTriggerPubsubExecutionCall {
875            hub: self.hub,
876            _request: request,
877            _workflow: workflow.to_string(),
878            _delegate: Default::default(),
879            _additional_params: Default::default(),
880            _scopes: Default::default(),
881        }
882    }
883}
884
885// ###################
886// CallBuilders   ###
887// #################
888
889/// Returns a list of active callbacks that belong to the execution with the given name. The returned callbacks are ordered by callback ID.
890///
891/// A builder for the *locations.workflows.executions.callbacks.list* method supported by a *project* resource.
892/// It is not used directly, but through a [`ProjectMethods`] instance.
893///
894/// # Example
895///
896/// Instantiate a resource method builder
897///
898/// ```test_harness,no_run
899/// # extern crate hyper;
900/// # extern crate hyper_rustls;
901/// # extern crate google_workflowexecutions1 as workflowexecutions1;
902/// # async fn dox() {
903/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
904///
905/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
906/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
907/// #     secret,
908/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
909/// # ).build().await.unwrap();
910///
911/// # let client = hyper_util::client::legacy::Client::builder(
912/// #     hyper_util::rt::TokioExecutor::new()
913/// # )
914/// # .build(
915/// #     hyper_rustls::HttpsConnectorBuilder::new()
916/// #         .with_native_roots()
917/// #         .unwrap()
918/// #         .https_or_http()
919/// #         .enable_http1()
920/// #         .build()
921/// # );
922/// # let mut hub = WorkflowExecutions::new(client, auth);
923/// // You can configure optional parameters by calling the respective setters at will, and
924/// // execute the final call using `doit()`.
925/// // Values shown here are possibly random and not representative !
926/// let result = hub.projects().locations_workflows_executions_callbacks_list("parent")
927///              .page_token("voluptua.")
928///              .page_size(-27)
929///              .doit().await;
930/// # }
931/// ```
932pub struct ProjectLocationWorkflowExecutionCallbackListCall<'a, C>
933where
934    C: 'a,
935{
936    hub: &'a WorkflowExecutions<C>,
937    _parent: String,
938    _page_token: Option<String>,
939    _page_size: Option<i32>,
940    _delegate: Option<&'a mut dyn common::Delegate>,
941    _additional_params: HashMap<String, String>,
942    _scopes: BTreeSet<String>,
943}
944
945impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {}
946
947impl<'a, C> ProjectLocationWorkflowExecutionCallbackListCall<'a, C>
948where
949    C: common::Connector,
950{
951    /// Perform the operation you have build so far.
952    pub async fn doit(mut self) -> common::Result<(common::Response, ListCallbacksResponse)> {
953        use std::borrow::Cow;
954        use std::io::{Read, Seek};
955
956        use common::{url::Params, ToParts};
957        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
958
959        let mut dd = common::DefaultDelegate;
960        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
961        dlg.begin(common::MethodInfo {
962            id: "workflowexecutions.projects.locations.workflows.executions.callbacks.list",
963            http_method: hyper::Method::GET,
964        });
965
966        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
967            if self._additional_params.contains_key(field) {
968                dlg.finished(false);
969                return Err(common::Error::FieldClash(field));
970            }
971        }
972
973        let mut params = Params::with_capacity(5 + self._additional_params.len());
974        params.push("parent", self._parent);
975        if let Some(value) = self._page_token.as_ref() {
976            params.push("pageToken", value);
977        }
978        if let Some(value) = self._page_size.as_ref() {
979            params.push("pageSize", value.to_string());
980        }
981
982        params.extend(self._additional_params.iter());
983
984        params.push("alt", "json");
985        let mut url = self.hub._base_url.clone() + "v1/{+parent}/callbacks";
986        if self._scopes.is_empty() {
987            self._scopes
988                .insert(Scope::CloudPlatform.as_ref().to_string());
989        }
990
991        #[allow(clippy::single_element_loop)]
992        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
993            url = params.uri_replacement(url, param_name, find_this, true);
994        }
995        {
996            let to_remove = ["parent"];
997            params.remove_params(&to_remove);
998        }
999
1000        let url = params.parse_with_url(&url);
1001
1002        loop {
1003            let token = match self
1004                .hub
1005                .auth
1006                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1007                .await
1008            {
1009                Ok(token) => token,
1010                Err(e) => match dlg.token(e) {
1011                    Ok(token) => token,
1012                    Err(e) => {
1013                        dlg.finished(false);
1014                        return Err(common::Error::MissingToken(e));
1015                    }
1016                },
1017            };
1018            let mut req_result = {
1019                let client = &self.hub.client;
1020                dlg.pre_request();
1021                let mut req_builder = hyper::Request::builder()
1022                    .method(hyper::Method::GET)
1023                    .uri(url.as_str())
1024                    .header(USER_AGENT, self.hub._user_agent.clone());
1025
1026                if let Some(token) = token.as_ref() {
1027                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1028                }
1029
1030                let request = req_builder
1031                    .header(CONTENT_LENGTH, 0_u64)
1032                    .body(common::to_body::<String>(None));
1033
1034                client.request(request.unwrap()).await
1035            };
1036
1037            match req_result {
1038                Err(err) => {
1039                    if let common::Retry::After(d) = dlg.http_error(&err) {
1040                        sleep(d).await;
1041                        continue;
1042                    }
1043                    dlg.finished(false);
1044                    return Err(common::Error::HttpError(err));
1045                }
1046                Ok(res) => {
1047                    let (mut parts, body) = res.into_parts();
1048                    let mut body = common::Body::new(body);
1049                    if !parts.status.is_success() {
1050                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1051                        let error = serde_json::from_str(&common::to_string(&bytes));
1052                        let response = common::to_response(parts, bytes.into());
1053
1054                        if let common::Retry::After(d) =
1055                            dlg.http_failure(&response, error.as_ref().ok())
1056                        {
1057                            sleep(d).await;
1058                            continue;
1059                        }
1060
1061                        dlg.finished(false);
1062
1063                        return Err(match error {
1064                            Ok(value) => common::Error::BadRequest(value),
1065                            _ => common::Error::Failure(response),
1066                        });
1067                    }
1068                    let response = {
1069                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1070                        let encoded = common::to_string(&bytes);
1071                        match serde_json::from_str(&encoded) {
1072                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1073                            Err(error) => {
1074                                dlg.response_json_decode_error(&encoded, &error);
1075                                return Err(common::Error::JsonDecodeError(
1076                                    encoded.to_string(),
1077                                    error,
1078                                ));
1079                            }
1080                        }
1081                    };
1082
1083                    dlg.finished(true);
1084                    return Ok(response);
1085                }
1086            }
1087        }
1088    }
1089
1090    /// Required. Name of the execution for which the callbacks should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
1091    ///
1092    /// Sets the *parent* path property to the given value.
1093    ///
1094    /// Even though the property as already been set when instantiating this call,
1095    /// we provide this method for API completeness.
1096    pub fn parent(
1097        mut self,
1098        new_value: &str,
1099    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
1100        self._parent = new_value.to_string();
1101        self
1102    }
1103    /// A page token, received from a previous `ListCallbacks` call. Provide this to retrieve the subsequent page. Note that pagination is applied to dynamic data. The list of callbacks returned can change between page requests if callbacks are created or deleted.
1104    ///
1105    /// Sets the *page token* query property to the given value.
1106    pub fn page_token(
1107        mut self,
1108        new_value: &str,
1109    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
1110        self._page_token = Some(new_value.to_string());
1111        self
1112    }
1113    /// Maximum number of callbacks to return per call. The default value is 100 and is also the maximum value.
1114    ///
1115    /// Sets the *page size* query property to the given value.
1116    pub fn page_size(
1117        mut self,
1118        new_value: i32,
1119    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
1120        self._page_size = Some(new_value);
1121        self
1122    }
1123    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1124    /// while executing the actual API request.
1125    ///
1126    /// ````text
1127    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1128    /// ````
1129    ///
1130    /// Sets the *delegate* property to the given value.
1131    pub fn delegate(
1132        mut self,
1133        new_value: &'a mut dyn common::Delegate,
1134    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
1135        self._delegate = Some(new_value);
1136        self
1137    }
1138
1139    /// Set any additional parameter of the query string used in the request.
1140    /// It should be used to set parameters which are not yet available through their own
1141    /// setters.
1142    ///
1143    /// Please note that this method must not be used to set any of the known parameters
1144    /// which have their own setter method. If done anyway, the request will fail.
1145    ///
1146    /// # Additional Parameters
1147    ///
1148    /// * *$.xgafv* (query-string) - V1 error format.
1149    /// * *access_token* (query-string) - OAuth access token.
1150    /// * *alt* (query-string) - Data format for response.
1151    /// * *callback* (query-string) - JSONP
1152    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1153    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1154    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1155    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1156    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1157    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1158    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1159    pub fn param<T>(
1160        mut self,
1161        name: T,
1162        value: T,
1163    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C>
1164    where
1165        T: AsRef<str>,
1166    {
1167        self._additional_params
1168            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1169        self
1170    }
1171
1172    /// Identifies the authorization scope for the method you are building.
1173    ///
1174    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1175    /// [`Scope::CloudPlatform`].
1176    ///
1177    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1178    /// tokens for more than one scope.
1179    ///
1180    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1181    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1182    /// sufficient, a read-write scope will do as well.
1183    pub fn add_scope<St>(
1184        mut self,
1185        scope: St,
1186    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C>
1187    where
1188        St: AsRef<str>,
1189    {
1190        self._scopes.insert(String::from(scope.as_ref()));
1191        self
1192    }
1193    /// Identifies the authorization scope(s) for the method you are building.
1194    ///
1195    /// See [`Self::add_scope()`] for details.
1196    pub fn add_scopes<I, St>(
1197        mut self,
1198        scopes: I,
1199    ) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C>
1200    where
1201        I: IntoIterator<Item = St>,
1202        St: AsRef<str>,
1203    {
1204        self._scopes
1205            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1206        self
1207    }
1208
1209    /// Removes all scopes, and no default scope will be used either.
1210    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1211    /// for details).
1212    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionCallbackListCall<'a, C> {
1213        self._scopes.clear();
1214        self
1215    }
1216}
1217
1218/// Gets a step entry.
1219///
1220/// A builder for the *locations.workflows.executions.stepEntries.get* method supported by a *project* resource.
1221/// It is not used directly, but through a [`ProjectMethods`] instance.
1222///
1223/// # Example
1224///
1225/// Instantiate a resource method builder
1226///
1227/// ```test_harness,no_run
1228/// # extern crate hyper;
1229/// # extern crate hyper_rustls;
1230/// # extern crate google_workflowexecutions1 as workflowexecutions1;
1231/// # async fn dox() {
1232/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1233///
1234/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1235/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1236/// #     secret,
1237/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1238/// # ).build().await.unwrap();
1239///
1240/// # let client = hyper_util::client::legacy::Client::builder(
1241/// #     hyper_util::rt::TokioExecutor::new()
1242/// # )
1243/// # .build(
1244/// #     hyper_rustls::HttpsConnectorBuilder::new()
1245/// #         .with_native_roots()
1246/// #         .unwrap()
1247/// #         .https_or_http()
1248/// #         .enable_http1()
1249/// #         .build()
1250/// # );
1251/// # let mut hub = WorkflowExecutions::new(client, auth);
1252/// // You can configure optional parameters by calling the respective setters at will, and
1253/// // execute the final call using `doit()`.
1254/// // Values shown here are possibly random and not representative !
1255/// let result = hub.projects().locations_workflows_executions_step_entries_get("name")
1256///              .doit().await;
1257/// # }
1258/// ```
1259pub struct ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C>
1260where
1261    C: 'a,
1262{
1263    hub: &'a WorkflowExecutions<C>,
1264    _name: String,
1265    _delegate: Option<&'a mut dyn common::Delegate>,
1266    _additional_params: HashMap<String, String>,
1267    _scopes: BTreeSet<String>,
1268}
1269
1270impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C> {}
1271
1272impl<'a, C> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C>
1273where
1274    C: common::Connector,
1275{
1276    /// Perform the operation you have build so far.
1277    pub async fn doit(mut self) -> common::Result<(common::Response, StepEntry)> {
1278        use std::borrow::Cow;
1279        use std::io::{Read, Seek};
1280
1281        use common::{url::Params, ToParts};
1282        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1283
1284        let mut dd = common::DefaultDelegate;
1285        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1286        dlg.begin(common::MethodInfo {
1287            id: "workflowexecutions.projects.locations.workflows.executions.stepEntries.get",
1288            http_method: hyper::Method::GET,
1289        });
1290
1291        for &field in ["alt", "name"].iter() {
1292            if self._additional_params.contains_key(field) {
1293                dlg.finished(false);
1294                return Err(common::Error::FieldClash(field));
1295            }
1296        }
1297
1298        let mut params = Params::with_capacity(3 + self._additional_params.len());
1299        params.push("name", self._name);
1300
1301        params.extend(self._additional_params.iter());
1302
1303        params.push("alt", "json");
1304        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1305        if self._scopes.is_empty() {
1306            self._scopes
1307                .insert(Scope::CloudPlatform.as_ref().to_string());
1308        }
1309
1310        #[allow(clippy::single_element_loop)]
1311        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1312            url = params.uri_replacement(url, param_name, find_this, true);
1313        }
1314        {
1315            let to_remove = ["name"];
1316            params.remove_params(&to_remove);
1317        }
1318
1319        let url = params.parse_with_url(&url);
1320
1321        loop {
1322            let token = match self
1323                .hub
1324                .auth
1325                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1326                .await
1327            {
1328                Ok(token) => token,
1329                Err(e) => match dlg.token(e) {
1330                    Ok(token) => token,
1331                    Err(e) => {
1332                        dlg.finished(false);
1333                        return Err(common::Error::MissingToken(e));
1334                    }
1335                },
1336            };
1337            let mut req_result = {
1338                let client = &self.hub.client;
1339                dlg.pre_request();
1340                let mut req_builder = hyper::Request::builder()
1341                    .method(hyper::Method::GET)
1342                    .uri(url.as_str())
1343                    .header(USER_AGENT, self.hub._user_agent.clone());
1344
1345                if let Some(token) = token.as_ref() {
1346                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1347                }
1348
1349                let request = req_builder
1350                    .header(CONTENT_LENGTH, 0_u64)
1351                    .body(common::to_body::<String>(None));
1352
1353                client.request(request.unwrap()).await
1354            };
1355
1356            match req_result {
1357                Err(err) => {
1358                    if let common::Retry::After(d) = dlg.http_error(&err) {
1359                        sleep(d).await;
1360                        continue;
1361                    }
1362                    dlg.finished(false);
1363                    return Err(common::Error::HttpError(err));
1364                }
1365                Ok(res) => {
1366                    let (mut parts, body) = res.into_parts();
1367                    let mut body = common::Body::new(body);
1368                    if !parts.status.is_success() {
1369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1370                        let error = serde_json::from_str(&common::to_string(&bytes));
1371                        let response = common::to_response(parts, bytes.into());
1372
1373                        if let common::Retry::After(d) =
1374                            dlg.http_failure(&response, error.as_ref().ok())
1375                        {
1376                            sleep(d).await;
1377                            continue;
1378                        }
1379
1380                        dlg.finished(false);
1381
1382                        return Err(match error {
1383                            Ok(value) => common::Error::BadRequest(value),
1384                            _ => common::Error::Failure(response),
1385                        });
1386                    }
1387                    let response = {
1388                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1389                        let encoded = common::to_string(&bytes);
1390                        match serde_json::from_str(&encoded) {
1391                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1392                            Err(error) => {
1393                                dlg.response_json_decode_error(&encoded, &error);
1394                                return Err(common::Error::JsonDecodeError(
1395                                    encoded.to_string(),
1396                                    error,
1397                                ));
1398                            }
1399                        }
1400                    };
1401
1402                    dlg.finished(true);
1403                    return Ok(response);
1404                }
1405            }
1406        }
1407    }
1408
1409    /// Required. The name of the step entry to retrieve. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/stepEntries/{step_entry}
1410    ///
1411    /// Sets the *name* path property to the given value.
1412    ///
1413    /// Even though the property as already been set when instantiating this call,
1414    /// we provide this method for API completeness.
1415    pub fn name(
1416        mut self,
1417        new_value: &str,
1418    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C> {
1419        self._name = new_value.to_string();
1420        self
1421    }
1422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1423    /// while executing the actual API request.
1424    ///
1425    /// ````text
1426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1427    /// ````
1428    ///
1429    /// Sets the *delegate* property to the given value.
1430    pub fn delegate(
1431        mut self,
1432        new_value: &'a mut dyn common::Delegate,
1433    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C> {
1434        self._delegate = Some(new_value);
1435        self
1436    }
1437
1438    /// Set any additional parameter of the query string used in the request.
1439    /// It should be used to set parameters which are not yet available through their own
1440    /// setters.
1441    ///
1442    /// Please note that this method must not be used to set any of the known parameters
1443    /// which have their own setter method. If done anyway, the request will fail.
1444    ///
1445    /// # Additional Parameters
1446    ///
1447    /// * *$.xgafv* (query-string) - V1 error format.
1448    /// * *access_token* (query-string) - OAuth access token.
1449    /// * *alt* (query-string) - Data format for response.
1450    /// * *callback* (query-string) - JSONP
1451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1452    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1455    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1458    pub fn param<T>(
1459        mut self,
1460        name: T,
1461        value: T,
1462    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C>
1463    where
1464        T: AsRef<str>,
1465    {
1466        self._additional_params
1467            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1468        self
1469    }
1470
1471    /// Identifies the authorization scope for the method you are building.
1472    ///
1473    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1474    /// [`Scope::CloudPlatform`].
1475    ///
1476    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1477    /// tokens for more than one scope.
1478    ///
1479    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1480    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1481    /// sufficient, a read-write scope will do as well.
1482    pub fn add_scope<St>(
1483        mut self,
1484        scope: St,
1485    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C>
1486    where
1487        St: AsRef<str>,
1488    {
1489        self._scopes.insert(String::from(scope.as_ref()));
1490        self
1491    }
1492    /// Identifies the authorization scope(s) for the method you are building.
1493    ///
1494    /// See [`Self::add_scope()`] for details.
1495    pub fn add_scopes<I, St>(
1496        mut self,
1497        scopes: I,
1498    ) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C>
1499    where
1500        I: IntoIterator<Item = St>,
1501        St: AsRef<str>,
1502    {
1503        self._scopes
1504            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1505        self
1506    }
1507
1508    /// Removes all scopes, and no default scope will be used either.
1509    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1510    /// for details).
1511    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionStepEntryGetCall<'a, C> {
1512        self._scopes.clear();
1513        self
1514    }
1515}
1516
1517/// Lists step entries for the corresponding workflow execution. Returned entries are ordered by their create_time.
1518///
1519/// A builder for the *locations.workflows.executions.stepEntries.list* method supported by a *project* resource.
1520/// It is not used directly, but through a [`ProjectMethods`] instance.
1521///
1522/// # Example
1523///
1524/// Instantiate a resource method builder
1525///
1526/// ```test_harness,no_run
1527/// # extern crate hyper;
1528/// # extern crate hyper_rustls;
1529/// # extern crate google_workflowexecutions1 as workflowexecutions1;
1530/// # async fn dox() {
1531/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1532///
1533/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1534/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1535/// #     secret,
1536/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1537/// # ).build().await.unwrap();
1538///
1539/// # let client = hyper_util::client::legacy::Client::builder(
1540/// #     hyper_util::rt::TokioExecutor::new()
1541/// # )
1542/// # .build(
1543/// #     hyper_rustls::HttpsConnectorBuilder::new()
1544/// #         .with_native_roots()
1545/// #         .unwrap()
1546/// #         .https_or_http()
1547/// #         .enable_http1()
1548/// #         .build()
1549/// # );
1550/// # let mut hub = WorkflowExecutions::new(client, auth);
1551/// // You can configure optional parameters by calling the respective setters at will, and
1552/// // execute the final call using `doit()`.
1553/// // Values shown here are possibly random and not representative !
1554/// let result = hub.projects().locations_workflows_executions_step_entries_list("parent")
1555///              .skip(-2)
1556///              .page_token("takimata")
1557///              .page_size(-52)
1558///              .order_by("duo")
1559///              .filter("ipsum")
1560///              .doit().await;
1561/// # }
1562/// ```
1563pub struct ProjectLocationWorkflowExecutionStepEntryListCall<'a, C>
1564where
1565    C: 'a,
1566{
1567    hub: &'a WorkflowExecutions<C>,
1568    _parent: String,
1569    _skip: Option<i32>,
1570    _page_token: Option<String>,
1571    _page_size: Option<i32>,
1572    _order_by: Option<String>,
1573    _filter: Option<String>,
1574    _delegate: Option<&'a mut dyn common::Delegate>,
1575    _additional_params: HashMap<String, String>,
1576    _scopes: BTreeSet<String>,
1577}
1578
1579impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {}
1580
1581impl<'a, C> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C>
1582where
1583    C: common::Connector,
1584{
1585    /// Perform the operation you have build so far.
1586    pub async fn doit(mut self) -> common::Result<(common::Response, ListStepEntriesResponse)> {
1587        use std::borrow::Cow;
1588        use std::io::{Read, Seek};
1589
1590        use common::{url::Params, ToParts};
1591        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1592
1593        let mut dd = common::DefaultDelegate;
1594        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1595        dlg.begin(common::MethodInfo {
1596            id: "workflowexecutions.projects.locations.workflows.executions.stepEntries.list",
1597            http_method: hyper::Method::GET,
1598        });
1599
1600        for &field in [
1601            "alt",
1602            "parent",
1603            "skip",
1604            "pageToken",
1605            "pageSize",
1606            "orderBy",
1607            "filter",
1608        ]
1609        .iter()
1610        {
1611            if self._additional_params.contains_key(field) {
1612                dlg.finished(false);
1613                return Err(common::Error::FieldClash(field));
1614            }
1615        }
1616
1617        let mut params = Params::with_capacity(8 + self._additional_params.len());
1618        params.push("parent", self._parent);
1619        if let Some(value) = self._skip.as_ref() {
1620            params.push("skip", value.to_string());
1621        }
1622        if let Some(value) = self._page_token.as_ref() {
1623            params.push("pageToken", value);
1624        }
1625        if let Some(value) = self._page_size.as_ref() {
1626            params.push("pageSize", value.to_string());
1627        }
1628        if let Some(value) = self._order_by.as_ref() {
1629            params.push("orderBy", value);
1630        }
1631        if let Some(value) = self._filter.as_ref() {
1632            params.push("filter", value);
1633        }
1634
1635        params.extend(self._additional_params.iter());
1636
1637        params.push("alt", "json");
1638        let mut url = self.hub._base_url.clone() + "v1/{+parent}/stepEntries";
1639        if self._scopes.is_empty() {
1640            self._scopes
1641                .insert(Scope::CloudPlatform.as_ref().to_string());
1642        }
1643
1644        #[allow(clippy::single_element_loop)]
1645        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1646            url = params.uri_replacement(url, param_name, find_this, true);
1647        }
1648        {
1649            let to_remove = ["parent"];
1650            params.remove_params(&to_remove);
1651        }
1652
1653        let url = params.parse_with_url(&url);
1654
1655        loop {
1656            let token = match self
1657                .hub
1658                .auth
1659                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1660                .await
1661            {
1662                Ok(token) => token,
1663                Err(e) => match dlg.token(e) {
1664                    Ok(token) => token,
1665                    Err(e) => {
1666                        dlg.finished(false);
1667                        return Err(common::Error::MissingToken(e));
1668                    }
1669                },
1670            };
1671            let mut req_result = {
1672                let client = &self.hub.client;
1673                dlg.pre_request();
1674                let mut req_builder = hyper::Request::builder()
1675                    .method(hyper::Method::GET)
1676                    .uri(url.as_str())
1677                    .header(USER_AGENT, self.hub._user_agent.clone());
1678
1679                if let Some(token) = token.as_ref() {
1680                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1681                }
1682
1683                let request = req_builder
1684                    .header(CONTENT_LENGTH, 0_u64)
1685                    .body(common::to_body::<String>(None));
1686
1687                client.request(request.unwrap()).await
1688            };
1689
1690            match req_result {
1691                Err(err) => {
1692                    if let common::Retry::After(d) = dlg.http_error(&err) {
1693                        sleep(d).await;
1694                        continue;
1695                    }
1696                    dlg.finished(false);
1697                    return Err(common::Error::HttpError(err));
1698                }
1699                Ok(res) => {
1700                    let (mut parts, body) = res.into_parts();
1701                    let mut body = common::Body::new(body);
1702                    if !parts.status.is_success() {
1703                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1704                        let error = serde_json::from_str(&common::to_string(&bytes));
1705                        let response = common::to_response(parts, bytes.into());
1706
1707                        if let common::Retry::After(d) =
1708                            dlg.http_failure(&response, error.as_ref().ok())
1709                        {
1710                            sleep(d).await;
1711                            continue;
1712                        }
1713
1714                        dlg.finished(false);
1715
1716                        return Err(match error {
1717                            Ok(value) => common::Error::BadRequest(value),
1718                            _ => common::Error::Failure(response),
1719                        });
1720                    }
1721                    let response = {
1722                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1723                        let encoded = common::to_string(&bytes);
1724                        match serde_json::from_str(&encoded) {
1725                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1726                            Err(error) => {
1727                                dlg.response_json_decode_error(&encoded, &error);
1728                                return Err(common::Error::JsonDecodeError(
1729                                    encoded.to_string(),
1730                                    error,
1731                                ));
1732                            }
1733                        }
1734                    };
1735
1736                    dlg.finished(true);
1737                    return Ok(response);
1738                }
1739            }
1740        }
1741    }
1742
1743    /// Required. Name of the workflow execution to list entries for. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}/stepEntries/
1744    ///
1745    /// Sets the *parent* path property to the given value.
1746    ///
1747    /// Even though the property as already been set when instantiating this call,
1748    /// we provide this method for API completeness.
1749    pub fn parent(
1750        mut self,
1751        new_value: &str,
1752    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1753        self._parent = new_value.to_string();
1754        self
1755    }
1756    /// Optional. The number of step entries to skip. It can be used with or without a pageToken. If used with a pageToken, then it indicates the number of step entries to skip starting from the requested page.
1757    ///
1758    /// Sets the *skip* query property to the given value.
1759    pub fn skip(
1760        mut self,
1761        new_value: i32,
1762    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1763        self._skip = Some(new_value);
1764        self
1765    }
1766    /// Optional. A page token, received from a previous `ListStepEntries` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListStepEntries` must match the call that provided the page token.
1767    ///
1768    /// Sets the *page token* query property to the given value.
1769    pub fn page_token(
1770        mut self,
1771        new_value: &str,
1772    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1773        self._page_token = Some(new_value.to_string());
1774        self
1775    }
1776    /// Optional. Number of step entries to return per call. The default max is 1000.
1777    ///
1778    /// Sets the *page size* query property to the given value.
1779    pub fn page_size(
1780        mut self,
1781        new_value: i32,
1782    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1783        self._page_size = Some(new_value);
1784        self
1785    }
1786    /// Optional. Comma-separated list of fields that specify the ordering applied to the `[StepEntries.ListStepEntries]` results. By default the ordering is based on ascending `entryId`. The following fields are supported for ordering: `entryId`, `createTime`, `updateTime`, `routine`, `step`, `stepType`, `state`. For details, see AIP-132.
1787    ///
1788    /// Sets the *order by* query property to the given value.
1789    pub fn order_by(
1790        mut self,
1791        new_value: &str,
1792    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1793        self._order_by = Some(new_value.to_string());
1794        self
1795    }
1796    /// Optional. Filters applied to the `[StepEntries.ListStepEntries]` results. The following fields are supported for filtering: `entryId`, `createTime`, `updateTime`, `routine`, `step`, `stepType`, `state`. For details, see AIP-160. For example, if you are using the Google APIs Explorer: `state="SUCCEEDED"` or `createTime>"2023-08-01" AND state="FAILED"`
1797    ///
1798    /// Sets the *filter* query property to the given value.
1799    pub fn filter(
1800        mut self,
1801        new_value: &str,
1802    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1803        self._filter = Some(new_value.to_string());
1804        self
1805    }
1806    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1807    /// while executing the actual API request.
1808    ///
1809    /// ````text
1810    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1811    /// ````
1812    ///
1813    /// Sets the *delegate* property to the given value.
1814    pub fn delegate(
1815        mut self,
1816        new_value: &'a mut dyn common::Delegate,
1817    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1818        self._delegate = Some(new_value);
1819        self
1820    }
1821
1822    /// Set any additional parameter of the query string used in the request.
1823    /// It should be used to set parameters which are not yet available through their own
1824    /// setters.
1825    ///
1826    /// Please note that this method must not be used to set any of the known parameters
1827    /// which have their own setter method. If done anyway, the request will fail.
1828    ///
1829    /// # Additional Parameters
1830    ///
1831    /// * *$.xgafv* (query-string) - V1 error format.
1832    /// * *access_token* (query-string) - OAuth access token.
1833    /// * *alt* (query-string) - Data format for response.
1834    /// * *callback* (query-string) - JSONP
1835    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1836    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1837    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1838    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1839    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1840    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1841    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1842    pub fn param<T>(
1843        mut self,
1844        name: T,
1845        value: T,
1846    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C>
1847    where
1848        T: AsRef<str>,
1849    {
1850        self._additional_params
1851            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1852        self
1853    }
1854
1855    /// Identifies the authorization scope for the method you are building.
1856    ///
1857    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1858    /// [`Scope::CloudPlatform`].
1859    ///
1860    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1861    /// tokens for more than one scope.
1862    ///
1863    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1864    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1865    /// sufficient, a read-write scope will do as well.
1866    pub fn add_scope<St>(
1867        mut self,
1868        scope: St,
1869    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C>
1870    where
1871        St: AsRef<str>,
1872    {
1873        self._scopes.insert(String::from(scope.as_ref()));
1874        self
1875    }
1876    /// Identifies the authorization scope(s) for the method you are building.
1877    ///
1878    /// See [`Self::add_scope()`] for details.
1879    pub fn add_scopes<I, St>(
1880        mut self,
1881        scopes: I,
1882    ) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C>
1883    where
1884        I: IntoIterator<Item = St>,
1885        St: AsRef<str>,
1886    {
1887        self._scopes
1888            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1889        self
1890    }
1891
1892    /// Removes all scopes, and no default scope will be used either.
1893    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1894    /// for details).
1895    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionStepEntryListCall<'a, C> {
1896        self._scopes.clear();
1897        self
1898    }
1899}
1900
1901/// Cancels an execution of the given name.
1902///
1903/// A builder for the *locations.workflows.executions.cancel* method supported by a *project* resource.
1904/// It is not used directly, but through a [`ProjectMethods`] instance.
1905///
1906/// # Example
1907///
1908/// Instantiate a resource method builder
1909///
1910/// ```test_harness,no_run
1911/// # extern crate hyper;
1912/// # extern crate hyper_rustls;
1913/// # extern crate google_workflowexecutions1 as workflowexecutions1;
1914/// use workflowexecutions1::api::CancelExecutionRequest;
1915/// # async fn dox() {
1916/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1917///
1918/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1919/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1920/// #     secret,
1921/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1922/// # ).build().await.unwrap();
1923///
1924/// # let client = hyper_util::client::legacy::Client::builder(
1925/// #     hyper_util::rt::TokioExecutor::new()
1926/// # )
1927/// # .build(
1928/// #     hyper_rustls::HttpsConnectorBuilder::new()
1929/// #         .with_native_roots()
1930/// #         .unwrap()
1931/// #         .https_or_http()
1932/// #         .enable_http1()
1933/// #         .build()
1934/// # );
1935/// # let mut hub = WorkflowExecutions::new(client, auth);
1936/// // As the method needs a request, you would usually fill it with the desired information
1937/// // into the respective structure. Some of the parts shown here might not be applicable !
1938/// // Values shown here are possibly random and not representative !
1939/// let mut req = CancelExecutionRequest::default();
1940///
1941/// // You can configure optional parameters by calling the respective setters at will, and
1942/// // execute the final call using `doit()`.
1943/// // Values shown here are possibly random and not representative !
1944/// let result = hub.projects().locations_workflows_executions_cancel(req, "name")
1945///              .doit().await;
1946/// # }
1947/// ```
1948pub struct ProjectLocationWorkflowExecutionCancelCall<'a, C>
1949where
1950    C: 'a,
1951{
1952    hub: &'a WorkflowExecutions<C>,
1953    _request: CancelExecutionRequest,
1954    _name: String,
1955    _delegate: Option<&'a mut dyn common::Delegate>,
1956    _additional_params: HashMap<String, String>,
1957    _scopes: BTreeSet<String>,
1958}
1959
1960impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionCancelCall<'a, C> {}
1961
1962impl<'a, C> ProjectLocationWorkflowExecutionCancelCall<'a, C>
1963where
1964    C: common::Connector,
1965{
1966    /// Perform the operation you have build so far.
1967    pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
1968        use std::borrow::Cow;
1969        use std::io::{Read, Seek};
1970
1971        use common::{url::Params, ToParts};
1972        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1973
1974        let mut dd = common::DefaultDelegate;
1975        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1976        dlg.begin(common::MethodInfo {
1977            id: "workflowexecutions.projects.locations.workflows.executions.cancel",
1978            http_method: hyper::Method::POST,
1979        });
1980
1981        for &field in ["alt", "name"].iter() {
1982            if self._additional_params.contains_key(field) {
1983                dlg.finished(false);
1984                return Err(common::Error::FieldClash(field));
1985            }
1986        }
1987
1988        let mut params = Params::with_capacity(4 + self._additional_params.len());
1989        params.push("name", self._name);
1990
1991        params.extend(self._additional_params.iter());
1992
1993        params.push("alt", "json");
1994        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
1995        if self._scopes.is_empty() {
1996            self._scopes
1997                .insert(Scope::CloudPlatform.as_ref().to_string());
1998        }
1999
2000        #[allow(clippy::single_element_loop)]
2001        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2002            url = params.uri_replacement(url, param_name, find_this, true);
2003        }
2004        {
2005            let to_remove = ["name"];
2006            params.remove_params(&to_remove);
2007        }
2008
2009        let url = params.parse_with_url(&url);
2010
2011        let mut json_mime_type = mime::APPLICATION_JSON;
2012        let mut request_value_reader = {
2013            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2014            common::remove_json_null_values(&mut value);
2015            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2016            serde_json::to_writer(&mut dst, &value).unwrap();
2017            dst
2018        };
2019        let request_size = request_value_reader
2020            .seek(std::io::SeekFrom::End(0))
2021            .unwrap();
2022        request_value_reader
2023            .seek(std::io::SeekFrom::Start(0))
2024            .unwrap();
2025
2026        loop {
2027            let token = match self
2028                .hub
2029                .auth
2030                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2031                .await
2032            {
2033                Ok(token) => token,
2034                Err(e) => match dlg.token(e) {
2035                    Ok(token) => token,
2036                    Err(e) => {
2037                        dlg.finished(false);
2038                        return Err(common::Error::MissingToken(e));
2039                    }
2040                },
2041            };
2042            request_value_reader
2043                .seek(std::io::SeekFrom::Start(0))
2044                .unwrap();
2045            let mut req_result = {
2046                let client = &self.hub.client;
2047                dlg.pre_request();
2048                let mut req_builder = hyper::Request::builder()
2049                    .method(hyper::Method::POST)
2050                    .uri(url.as_str())
2051                    .header(USER_AGENT, self.hub._user_agent.clone());
2052
2053                if let Some(token) = token.as_ref() {
2054                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2055                }
2056
2057                let request = req_builder
2058                    .header(CONTENT_TYPE, json_mime_type.to_string())
2059                    .header(CONTENT_LENGTH, request_size as u64)
2060                    .body(common::to_body(
2061                        request_value_reader.get_ref().clone().into(),
2062                    ));
2063
2064                client.request(request.unwrap()).await
2065            };
2066
2067            match req_result {
2068                Err(err) => {
2069                    if let common::Retry::After(d) = dlg.http_error(&err) {
2070                        sleep(d).await;
2071                        continue;
2072                    }
2073                    dlg.finished(false);
2074                    return Err(common::Error::HttpError(err));
2075                }
2076                Ok(res) => {
2077                    let (mut parts, body) = res.into_parts();
2078                    let mut body = common::Body::new(body);
2079                    if !parts.status.is_success() {
2080                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2081                        let error = serde_json::from_str(&common::to_string(&bytes));
2082                        let response = common::to_response(parts, bytes.into());
2083
2084                        if let common::Retry::After(d) =
2085                            dlg.http_failure(&response, error.as_ref().ok())
2086                        {
2087                            sleep(d).await;
2088                            continue;
2089                        }
2090
2091                        dlg.finished(false);
2092
2093                        return Err(match error {
2094                            Ok(value) => common::Error::BadRequest(value),
2095                            _ => common::Error::Failure(response),
2096                        });
2097                    }
2098                    let response = {
2099                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2100                        let encoded = common::to_string(&bytes);
2101                        match serde_json::from_str(&encoded) {
2102                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2103                            Err(error) => {
2104                                dlg.response_json_decode_error(&encoded, &error);
2105                                return Err(common::Error::JsonDecodeError(
2106                                    encoded.to_string(),
2107                                    error,
2108                                ));
2109                            }
2110                        }
2111                    };
2112
2113                    dlg.finished(true);
2114                    return Ok(response);
2115                }
2116            }
2117        }
2118    }
2119
2120    ///
2121    /// Sets the *request* property to the given value.
2122    ///
2123    /// Even though the property as already been set when instantiating this call,
2124    /// we provide this method for API completeness.
2125    pub fn request(
2126        mut self,
2127        new_value: CancelExecutionRequest,
2128    ) -> ProjectLocationWorkflowExecutionCancelCall<'a, C> {
2129        self._request = new_value;
2130        self
2131    }
2132    /// Required. Name of the execution to be cancelled. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
2133    ///
2134    /// Sets the *name* path property to the given value.
2135    ///
2136    /// Even though the property as already been set when instantiating this call,
2137    /// we provide this method for API completeness.
2138    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionCancelCall<'a, C> {
2139        self._name = new_value.to_string();
2140        self
2141    }
2142    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2143    /// while executing the actual API request.
2144    ///
2145    /// ````text
2146    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2147    /// ````
2148    ///
2149    /// Sets the *delegate* property to the given value.
2150    pub fn delegate(
2151        mut self,
2152        new_value: &'a mut dyn common::Delegate,
2153    ) -> ProjectLocationWorkflowExecutionCancelCall<'a, C> {
2154        self._delegate = Some(new_value);
2155        self
2156    }
2157
2158    /// Set any additional parameter of the query string used in the request.
2159    /// It should be used to set parameters which are not yet available through their own
2160    /// setters.
2161    ///
2162    /// Please note that this method must not be used to set any of the known parameters
2163    /// which have their own setter method. If done anyway, the request will fail.
2164    ///
2165    /// # Additional Parameters
2166    ///
2167    /// * *$.xgafv* (query-string) - V1 error format.
2168    /// * *access_token* (query-string) - OAuth access token.
2169    /// * *alt* (query-string) - Data format for response.
2170    /// * *callback* (query-string) - JSONP
2171    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2172    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2173    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2174    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2175    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2176    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2177    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2178    pub fn param<T>(
2179        mut self,
2180        name: T,
2181        value: T,
2182    ) -> ProjectLocationWorkflowExecutionCancelCall<'a, C>
2183    where
2184        T: AsRef<str>,
2185    {
2186        self._additional_params
2187            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2188        self
2189    }
2190
2191    /// Identifies the authorization scope for the method you are building.
2192    ///
2193    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2194    /// [`Scope::CloudPlatform`].
2195    ///
2196    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2197    /// tokens for more than one scope.
2198    ///
2199    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2200    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2201    /// sufficient, a read-write scope will do as well.
2202    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowExecutionCancelCall<'a, C>
2203    where
2204        St: AsRef<str>,
2205    {
2206        self._scopes.insert(String::from(scope.as_ref()));
2207        self
2208    }
2209    /// Identifies the authorization scope(s) for the method you are building.
2210    ///
2211    /// See [`Self::add_scope()`] for details.
2212    pub fn add_scopes<I, St>(
2213        mut self,
2214        scopes: I,
2215    ) -> ProjectLocationWorkflowExecutionCancelCall<'a, C>
2216    where
2217        I: IntoIterator<Item = St>,
2218        St: AsRef<str>,
2219    {
2220        self._scopes
2221            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2222        self
2223    }
2224
2225    /// Removes all scopes, and no default scope will be used either.
2226    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2227    /// for details).
2228    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionCancelCall<'a, C> {
2229        self._scopes.clear();
2230        self
2231    }
2232}
2233
2234/// Creates a new execution using the latest revision of the given workflow. For more information, see Execute a workflow.
2235///
2236/// A builder for the *locations.workflows.executions.create* method supported by a *project* resource.
2237/// It is not used directly, but through a [`ProjectMethods`] instance.
2238///
2239/// # Example
2240///
2241/// Instantiate a resource method builder
2242///
2243/// ```test_harness,no_run
2244/// # extern crate hyper;
2245/// # extern crate hyper_rustls;
2246/// # extern crate google_workflowexecutions1 as workflowexecutions1;
2247/// use workflowexecutions1::api::Execution;
2248/// # async fn dox() {
2249/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2250///
2251/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2253/// #     secret,
2254/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2255/// # ).build().await.unwrap();
2256///
2257/// # let client = hyper_util::client::legacy::Client::builder(
2258/// #     hyper_util::rt::TokioExecutor::new()
2259/// # )
2260/// # .build(
2261/// #     hyper_rustls::HttpsConnectorBuilder::new()
2262/// #         .with_native_roots()
2263/// #         .unwrap()
2264/// #         .https_or_http()
2265/// #         .enable_http1()
2266/// #         .build()
2267/// # );
2268/// # let mut hub = WorkflowExecutions::new(client, auth);
2269/// // As the method needs a request, you would usually fill it with the desired information
2270/// // into the respective structure. Some of the parts shown here might not be applicable !
2271/// // Values shown here are possibly random and not representative !
2272/// let mut req = Execution::default();
2273///
2274/// // You can configure optional parameters by calling the respective setters at will, and
2275/// // execute the final call using `doit()`.
2276/// // Values shown here are possibly random and not representative !
2277/// let result = hub.projects().locations_workflows_executions_create(req, "parent")
2278///              .doit().await;
2279/// # }
2280/// ```
2281pub struct ProjectLocationWorkflowExecutionCreateCall<'a, C>
2282where
2283    C: 'a,
2284{
2285    hub: &'a WorkflowExecutions<C>,
2286    _request: Execution,
2287    _parent: String,
2288    _delegate: Option<&'a mut dyn common::Delegate>,
2289    _additional_params: HashMap<String, String>,
2290    _scopes: BTreeSet<String>,
2291}
2292
2293impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionCreateCall<'a, C> {}
2294
2295impl<'a, C> ProjectLocationWorkflowExecutionCreateCall<'a, C>
2296where
2297    C: common::Connector,
2298{
2299    /// Perform the operation you have build so far.
2300    pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
2301        use std::borrow::Cow;
2302        use std::io::{Read, Seek};
2303
2304        use common::{url::Params, ToParts};
2305        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2306
2307        let mut dd = common::DefaultDelegate;
2308        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2309        dlg.begin(common::MethodInfo {
2310            id: "workflowexecutions.projects.locations.workflows.executions.create",
2311            http_method: hyper::Method::POST,
2312        });
2313
2314        for &field in ["alt", "parent"].iter() {
2315            if self._additional_params.contains_key(field) {
2316                dlg.finished(false);
2317                return Err(common::Error::FieldClash(field));
2318            }
2319        }
2320
2321        let mut params = Params::with_capacity(4 + self._additional_params.len());
2322        params.push("parent", self._parent);
2323
2324        params.extend(self._additional_params.iter());
2325
2326        params.push("alt", "json");
2327        let mut url = self.hub._base_url.clone() + "v1/{+parent}/executions";
2328        if self._scopes.is_empty() {
2329            self._scopes
2330                .insert(Scope::CloudPlatform.as_ref().to_string());
2331        }
2332
2333        #[allow(clippy::single_element_loop)]
2334        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2335            url = params.uri_replacement(url, param_name, find_this, true);
2336        }
2337        {
2338            let to_remove = ["parent"];
2339            params.remove_params(&to_remove);
2340        }
2341
2342        let url = params.parse_with_url(&url);
2343
2344        let mut json_mime_type = mime::APPLICATION_JSON;
2345        let mut request_value_reader = {
2346            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2347            common::remove_json_null_values(&mut value);
2348            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2349            serde_json::to_writer(&mut dst, &value).unwrap();
2350            dst
2351        };
2352        let request_size = request_value_reader
2353            .seek(std::io::SeekFrom::End(0))
2354            .unwrap();
2355        request_value_reader
2356            .seek(std::io::SeekFrom::Start(0))
2357            .unwrap();
2358
2359        loop {
2360            let token = match self
2361                .hub
2362                .auth
2363                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2364                .await
2365            {
2366                Ok(token) => token,
2367                Err(e) => match dlg.token(e) {
2368                    Ok(token) => token,
2369                    Err(e) => {
2370                        dlg.finished(false);
2371                        return Err(common::Error::MissingToken(e));
2372                    }
2373                },
2374            };
2375            request_value_reader
2376                .seek(std::io::SeekFrom::Start(0))
2377                .unwrap();
2378            let mut req_result = {
2379                let client = &self.hub.client;
2380                dlg.pre_request();
2381                let mut req_builder = hyper::Request::builder()
2382                    .method(hyper::Method::POST)
2383                    .uri(url.as_str())
2384                    .header(USER_AGENT, self.hub._user_agent.clone());
2385
2386                if let Some(token) = token.as_ref() {
2387                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2388                }
2389
2390                let request = req_builder
2391                    .header(CONTENT_TYPE, json_mime_type.to_string())
2392                    .header(CONTENT_LENGTH, request_size as u64)
2393                    .body(common::to_body(
2394                        request_value_reader.get_ref().clone().into(),
2395                    ));
2396
2397                client.request(request.unwrap()).await
2398            };
2399
2400            match req_result {
2401                Err(err) => {
2402                    if let common::Retry::After(d) = dlg.http_error(&err) {
2403                        sleep(d).await;
2404                        continue;
2405                    }
2406                    dlg.finished(false);
2407                    return Err(common::Error::HttpError(err));
2408                }
2409                Ok(res) => {
2410                    let (mut parts, body) = res.into_parts();
2411                    let mut body = common::Body::new(body);
2412                    if !parts.status.is_success() {
2413                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2414                        let error = serde_json::from_str(&common::to_string(&bytes));
2415                        let response = common::to_response(parts, bytes.into());
2416
2417                        if let common::Retry::After(d) =
2418                            dlg.http_failure(&response, error.as_ref().ok())
2419                        {
2420                            sleep(d).await;
2421                            continue;
2422                        }
2423
2424                        dlg.finished(false);
2425
2426                        return Err(match error {
2427                            Ok(value) => common::Error::BadRequest(value),
2428                            _ => common::Error::Failure(response),
2429                        });
2430                    }
2431                    let response = {
2432                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2433                        let encoded = common::to_string(&bytes);
2434                        match serde_json::from_str(&encoded) {
2435                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2436                            Err(error) => {
2437                                dlg.response_json_decode_error(&encoded, &error);
2438                                return Err(common::Error::JsonDecodeError(
2439                                    encoded.to_string(),
2440                                    error,
2441                                ));
2442                            }
2443                        }
2444                    };
2445
2446                    dlg.finished(true);
2447                    return Ok(response);
2448                }
2449            }
2450        }
2451    }
2452
2453    ///
2454    /// Sets the *request* property to the given value.
2455    ///
2456    /// Even though the property as already been set when instantiating this call,
2457    /// we provide this method for API completeness.
2458    pub fn request(
2459        mut self,
2460        new_value: Execution,
2461    ) -> ProjectLocationWorkflowExecutionCreateCall<'a, C> {
2462        self._request = new_value;
2463        self
2464    }
2465    /// Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the workflow will be used.
2466    ///
2467    /// Sets the *parent* path property to the given value.
2468    ///
2469    /// Even though the property as already been set when instantiating this call,
2470    /// we provide this method for API completeness.
2471    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionCreateCall<'a, C> {
2472        self._parent = new_value.to_string();
2473        self
2474    }
2475    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2476    /// while executing the actual API request.
2477    ///
2478    /// ````text
2479    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2480    /// ````
2481    ///
2482    /// Sets the *delegate* property to the given value.
2483    pub fn delegate(
2484        mut self,
2485        new_value: &'a mut dyn common::Delegate,
2486    ) -> ProjectLocationWorkflowExecutionCreateCall<'a, C> {
2487        self._delegate = Some(new_value);
2488        self
2489    }
2490
2491    /// Set any additional parameter of the query string used in the request.
2492    /// It should be used to set parameters which are not yet available through their own
2493    /// setters.
2494    ///
2495    /// Please note that this method must not be used to set any of the known parameters
2496    /// which have their own setter method. If done anyway, the request will fail.
2497    ///
2498    /// # Additional Parameters
2499    ///
2500    /// * *$.xgafv* (query-string) - V1 error format.
2501    /// * *access_token* (query-string) - OAuth access token.
2502    /// * *alt* (query-string) - Data format for response.
2503    /// * *callback* (query-string) - JSONP
2504    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2505    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2506    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2507    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2508    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2509    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2510    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2511    pub fn param<T>(
2512        mut self,
2513        name: T,
2514        value: T,
2515    ) -> ProjectLocationWorkflowExecutionCreateCall<'a, C>
2516    where
2517        T: AsRef<str>,
2518    {
2519        self._additional_params
2520            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2521        self
2522    }
2523
2524    /// Identifies the authorization scope for the method you are building.
2525    ///
2526    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2527    /// [`Scope::CloudPlatform`].
2528    ///
2529    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2530    /// tokens for more than one scope.
2531    ///
2532    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2533    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2534    /// sufficient, a read-write scope will do as well.
2535    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowExecutionCreateCall<'a, C>
2536    where
2537        St: AsRef<str>,
2538    {
2539        self._scopes.insert(String::from(scope.as_ref()));
2540        self
2541    }
2542    /// Identifies the authorization scope(s) for the method you are building.
2543    ///
2544    /// See [`Self::add_scope()`] for details.
2545    pub fn add_scopes<I, St>(
2546        mut self,
2547        scopes: I,
2548    ) -> ProjectLocationWorkflowExecutionCreateCall<'a, C>
2549    where
2550        I: IntoIterator<Item = St>,
2551        St: AsRef<str>,
2552    {
2553        self._scopes
2554            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2555        self
2556    }
2557
2558    /// Removes all scopes, and no default scope will be used either.
2559    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2560    /// for details).
2561    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionCreateCall<'a, C> {
2562        self._scopes.clear();
2563        self
2564    }
2565}
2566
2567/// Returns all metadata stored about an execution, excluding most data that is already accessible using other API methods.
2568///
2569/// A builder for the *locations.workflows.executions.exportData* method supported by a *project* resource.
2570/// It is not used directly, but through a [`ProjectMethods`] instance.
2571///
2572/// # Example
2573///
2574/// Instantiate a resource method builder
2575///
2576/// ```test_harness,no_run
2577/// # extern crate hyper;
2578/// # extern crate hyper_rustls;
2579/// # extern crate google_workflowexecutions1 as workflowexecutions1;
2580/// # async fn dox() {
2581/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2582///
2583/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2584/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2585/// #     secret,
2586/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2587/// # ).build().await.unwrap();
2588///
2589/// # let client = hyper_util::client::legacy::Client::builder(
2590/// #     hyper_util::rt::TokioExecutor::new()
2591/// # )
2592/// # .build(
2593/// #     hyper_rustls::HttpsConnectorBuilder::new()
2594/// #         .with_native_roots()
2595/// #         .unwrap()
2596/// #         .https_or_http()
2597/// #         .enable_http1()
2598/// #         .build()
2599/// # );
2600/// # let mut hub = WorkflowExecutions::new(client, auth);
2601/// // You can configure optional parameters by calling the respective setters at will, and
2602/// // execute the final call using `doit()`.
2603/// // Values shown here are possibly random and not representative !
2604/// let result = hub.projects().locations_workflows_executions_export_data("name")
2605///              .doit().await;
2606/// # }
2607/// ```
2608pub struct ProjectLocationWorkflowExecutionExportDataCall<'a, C>
2609where
2610    C: 'a,
2611{
2612    hub: &'a WorkflowExecutions<C>,
2613    _name: String,
2614    _delegate: Option<&'a mut dyn common::Delegate>,
2615    _additional_params: HashMap<String, String>,
2616    _scopes: BTreeSet<String>,
2617}
2618
2619impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionExportDataCall<'a, C> {}
2620
2621impl<'a, C> ProjectLocationWorkflowExecutionExportDataCall<'a, C>
2622where
2623    C: common::Connector,
2624{
2625    /// Perform the operation you have build so far.
2626    pub async fn doit(mut self) -> common::Result<(common::Response, ExportDataResponse)> {
2627        use std::borrow::Cow;
2628        use std::io::{Read, Seek};
2629
2630        use common::{url::Params, ToParts};
2631        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2632
2633        let mut dd = common::DefaultDelegate;
2634        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2635        dlg.begin(common::MethodInfo {
2636            id: "workflowexecutions.projects.locations.workflows.executions.exportData",
2637            http_method: hyper::Method::GET,
2638        });
2639
2640        for &field in ["alt", "name"].iter() {
2641            if self._additional_params.contains_key(field) {
2642                dlg.finished(false);
2643                return Err(common::Error::FieldClash(field));
2644            }
2645        }
2646
2647        let mut params = Params::with_capacity(3 + self._additional_params.len());
2648        params.push("name", self._name);
2649
2650        params.extend(self._additional_params.iter());
2651
2652        params.push("alt", "json");
2653        let mut url = self.hub._base_url.clone() + "v1/{+name}:exportData";
2654        if self._scopes.is_empty() {
2655            self._scopes
2656                .insert(Scope::CloudPlatform.as_ref().to_string());
2657        }
2658
2659        #[allow(clippy::single_element_loop)]
2660        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2661            url = params.uri_replacement(url, param_name, find_this, true);
2662        }
2663        {
2664            let to_remove = ["name"];
2665            params.remove_params(&to_remove);
2666        }
2667
2668        let url = params.parse_with_url(&url);
2669
2670        loop {
2671            let token = match self
2672                .hub
2673                .auth
2674                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2675                .await
2676            {
2677                Ok(token) => token,
2678                Err(e) => match dlg.token(e) {
2679                    Ok(token) => token,
2680                    Err(e) => {
2681                        dlg.finished(false);
2682                        return Err(common::Error::MissingToken(e));
2683                    }
2684                },
2685            };
2686            let mut req_result = {
2687                let client = &self.hub.client;
2688                dlg.pre_request();
2689                let mut req_builder = hyper::Request::builder()
2690                    .method(hyper::Method::GET)
2691                    .uri(url.as_str())
2692                    .header(USER_AGENT, self.hub._user_agent.clone());
2693
2694                if let Some(token) = token.as_ref() {
2695                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2696                }
2697
2698                let request = req_builder
2699                    .header(CONTENT_LENGTH, 0_u64)
2700                    .body(common::to_body::<String>(None));
2701
2702                client.request(request.unwrap()).await
2703            };
2704
2705            match req_result {
2706                Err(err) => {
2707                    if let common::Retry::After(d) = dlg.http_error(&err) {
2708                        sleep(d).await;
2709                        continue;
2710                    }
2711                    dlg.finished(false);
2712                    return Err(common::Error::HttpError(err));
2713                }
2714                Ok(res) => {
2715                    let (mut parts, body) = res.into_parts();
2716                    let mut body = common::Body::new(body);
2717                    if !parts.status.is_success() {
2718                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2719                        let error = serde_json::from_str(&common::to_string(&bytes));
2720                        let response = common::to_response(parts, bytes.into());
2721
2722                        if let common::Retry::After(d) =
2723                            dlg.http_failure(&response, error.as_ref().ok())
2724                        {
2725                            sleep(d).await;
2726                            continue;
2727                        }
2728
2729                        dlg.finished(false);
2730
2731                        return Err(match error {
2732                            Ok(value) => common::Error::BadRequest(value),
2733                            _ => common::Error::Failure(response),
2734                        });
2735                    }
2736                    let response = {
2737                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2738                        let encoded = common::to_string(&bytes);
2739                        match serde_json::from_str(&encoded) {
2740                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2741                            Err(error) => {
2742                                dlg.response_json_decode_error(&encoded, &error);
2743                                return Err(common::Error::JsonDecodeError(
2744                                    encoded.to_string(),
2745                                    error,
2746                                ));
2747                            }
2748                        }
2749                    };
2750
2751                    dlg.finished(true);
2752                    return Ok(response);
2753                }
2754            }
2755        }
2756    }
2757
2758    /// Required. Name of the execution for which data is to be exported. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
2759    ///
2760    /// Sets the *name* path property to the given value.
2761    ///
2762    /// Even though the property as already been set when instantiating this call,
2763    /// we provide this method for API completeness.
2764    pub fn name(
2765        mut self,
2766        new_value: &str,
2767    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C> {
2768        self._name = new_value.to_string();
2769        self
2770    }
2771    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2772    /// while executing the actual API request.
2773    ///
2774    /// ````text
2775    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2776    /// ````
2777    ///
2778    /// Sets the *delegate* property to the given value.
2779    pub fn delegate(
2780        mut self,
2781        new_value: &'a mut dyn common::Delegate,
2782    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C> {
2783        self._delegate = Some(new_value);
2784        self
2785    }
2786
2787    /// Set any additional parameter of the query string used in the request.
2788    /// It should be used to set parameters which are not yet available through their own
2789    /// setters.
2790    ///
2791    /// Please note that this method must not be used to set any of the known parameters
2792    /// which have their own setter method. If done anyway, the request will fail.
2793    ///
2794    /// # Additional Parameters
2795    ///
2796    /// * *$.xgafv* (query-string) - V1 error format.
2797    /// * *access_token* (query-string) - OAuth access token.
2798    /// * *alt* (query-string) - Data format for response.
2799    /// * *callback* (query-string) - JSONP
2800    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2801    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2802    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2803    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2804    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2805    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2806    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2807    pub fn param<T>(
2808        mut self,
2809        name: T,
2810        value: T,
2811    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C>
2812    where
2813        T: AsRef<str>,
2814    {
2815        self._additional_params
2816            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2817        self
2818    }
2819
2820    /// Identifies the authorization scope for the method you are building.
2821    ///
2822    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2823    /// [`Scope::CloudPlatform`].
2824    ///
2825    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2826    /// tokens for more than one scope.
2827    ///
2828    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2829    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2830    /// sufficient, a read-write scope will do as well.
2831    pub fn add_scope<St>(
2832        mut self,
2833        scope: St,
2834    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C>
2835    where
2836        St: AsRef<str>,
2837    {
2838        self._scopes.insert(String::from(scope.as_ref()));
2839        self
2840    }
2841    /// Identifies the authorization scope(s) for the method you are building.
2842    ///
2843    /// See [`Self::add_scope()`] for details.
2844    pub fn add_scopes<I, St>(
2845        mut self,
2846        scopes: I,
2847    ) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C>
2848    where
2849        I: IntoIterator<Item = St>,
2850        St: AsRef<str>,
2851    {
2852        self._scopes
2853            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2854        self
2855    }
2856
2857    /// Removes all scopes, and no default scope will be used either.
2858    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2859    /// for details).
2860    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionExportDataCall<'a, C> {
2861        self._scopes.clear();
2862        self
2863    }
2864}
2865
2866/// Returns an execution of the given name.
2867///
2868/// A builder for the *locations.workflows.executions.get* method supported by a *project* resource.
2869/// It is not used directly, but through a [`ProjectMethods`] instance.
2870///
2871/// # Example
2872///
2873/// Instantiate a resource method builder
2874///
2875/// ```test_harness,no_run
2876/// # extern crate hyper;
2877/// # extern crate hyper_rustls;
2878/// # extern crate google_workflowexecutions1 as workflowexecutions1;
2879/// # async fn dox() {
2880/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2881///
2882/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2883/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2884/// #     secret,
2885/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2886/// # ).build().await.unwrap();
2887///
2888/// # let client = hyper_util::client::legacy::Client::builder(
2889/// #     hyper_util::rt::TokioExecutor::new()
2890/// # )
2891/// # .build(
2892/// #     hyper_rustls::HttpsConnectorBuilder::new()
2893/// #         .with_native_roots()
2894/// #         .unwrap()
2895/// #         .https_or_http()
2896/// #         .enable_http1()
2897/// #         .build()
2898/// # );
2899/// # let mut hub = WorkflowExecutions::new(client, auth);
2900/// // You can configure optional parameters by calling the respective setters at will, and
2901/// // execute the final call using `doit()`.
2902/// // Values shown here are possibly random and not representative !
2903/// let result = hub.projects().locations_workflows_executions_get("name")
2904///              .view("dolor")
2905///              .doit().await;
2906/// # }
2907/// ```
2908pub struct ProjectLocationWorkflowExecutionGetCall<'a, C>
2909where
2910    C: 'a,
2911{
2912    hub: &'a WorkflowExecutions<C>,
2913    _name: String,
2914    _view: Option<String>,
2915    _delegate: Option<&'a mut dyn common::Delegate>,
2916    _additional_params: HashMap<String, String>,
2917    _scopes: BTreeSet<String>,
2918}
2919
2920impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionGetCall<'a, C> {}
2921
2922impl<'a, C> ProjectLocationWorkflowExecutionGetCall<'a, C>
2923where
2924    C: common::Connector,
2925{
2926    /// Perform the operation you have build so far.
2927    pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
2928        use std::borrow::Cow;
2929        use std::io::{Read, Seek};
2930
2931        use common::{url::Params, ToParts};
2932        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2933
2934        let mut dd = common::DefaultDelegate;
2935        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2936        dlg.begin(common::MethodInfo {
2937            id: "workflowexecutions.projects.locations.workflows.executions.get",
2938            http_method: hyper::Method::GET,
2939        });
2940
2941        for &field in ["alt", "name", "view"].iter() {
2942            if self._additional_params.contains_key(field) {
2943                dlg.finished(false);
2944                return Err(common::Error::FieldClash(field));
2945            }
2946        }
2947
2948        let mut params = Params::with_capacity(4 + self._additional_params.len());
2949        params.push("name", self._name);
2950        if let Some(value) = self._view.as_ref() {
2951            params.push("view", value);
2952        }
2953
2954        params.extend(self._additional_params.iter());
2955
2956        params.push("alt", "json");
2957        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2958        if self._scopes.is_empty() {
2959            self._scopes
2960                .insert(Scope::CloudPlatform.as_ref().to_string());
2961        }
2962
2963        #[allow(clippy::single_element_loop)]
2964        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2965            url = params.uri_replacement(url, param_name, find_this, true);
2966        }
2967        {
2968            let to_remove = ["name"];
2969            params.remove_params(&to_remove);
2970        }
2971
2972        let url = params.parse_with_url(&url);
2973
2974        loop {
2975            let token = match self
2976                .hub
2977                .auth
2978                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2979                .await
2980            {
2981                Ok(token) => token,
2982                Err(e) => match dlg.token(e) {
2983                    Ok(token) => token,
2984                    Err(e) => {
2985                        dlg.finished(false);
2986                        return Err(common::Error::MissingToken(e));
2987                    }
2988                },
2989            };
2990            let mut req_result = {
2991                let client = &self.hub.client;
2992                dlg.pre_request();
2993                let mut req_builder = hyper::Request::builder()
2994                    .method(hyper::Method::GET)
2995                    .uri(url.as_str())
2996                    .header(USER_AGENT, self.hub._user_agent.clone());
2997
2998                if let Some(token) = token.as_ref() {
2999                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3000                }
3001
3002                let request = req_builder
3003                    .header(CONTENT_LENGTH, 0_u64)
3004                    .body(common::to_body::<String>(None));
3005
3006                client.request(request.unwrap()).await
3007            };
3008
3009            match req_result {
3010                Err(err) => {
3011                    if let common::Retry::After(d) = dlg.http_error(&err) {
3012                        sleep(d).await;
3013                        continue;
3014                    }
3015                    dlg.finished(false);
3016                    return Err(common::Error::HttpError(err));
3017                }
3018                Ok(res) => {
3019                    let (mut parts, body) = res.into_parts();
3020                    let mut body = common::Body::new(body);
3021                    if !parts.status.is_success() {
3022                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3023                        let error = serde_json::from_str(&common::to_string(&bytes));
3024                        let response = common::to_response(parts, bytes.into());
3025
3026                        if let common::Retry::After(d) =
3027                            dlg.http_failure(&response, error.as_ref().ok())
3028                        {
3029                            sleep(d).await;
3030                            continue;
3031                        }
3032
3033                        dlg.finished(false);
3034
3035                        return Err(match error {
3036                            Ok(value) => common::Error::BadRequest(value),
3037                            _ => common::Error::Failure(response),
3038                        });
3039                    }
3040                    let response = {
3041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3042                        let encoded = common::to_string(&bytes);
3043                        match serde_json::from_str(&encoded) {
3044                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3045                            Err(error) => {
3046                                dlg.response_json_decode_error(&encoded, &error);
3047                                return Err(common::Error::JsonDecodeError(
3048                                    encoded.to_string(),
3049                                    error,
3050                                ));
3051                            }
3052                        }
3053                    };
3054
3055                    dlg.finished(true);
3056                    return Ok(response);
3057                }
3058            }
3059        }
3060    }
3061
3062    /// Required. Name of the execution to be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
3063    ///
3064    /// Sets the *name* path property to the given value.
3065    ///
3066    /// Even though the property as already been set when instantiating this call,
3067    /// we provide this method for API completeness.
3068    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionGetCall<'a, C> {
3069        self._name = new_value.to_string();
3070        self
3071    }
3072    /// Optional. A view defining which fields should be filled in the returned execution. The API will default to the FULL view.
3073    ///
3074    /// Sets the *view* query property to the given value.
3075    pub fn view(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionGetCall<'a, C> {
3076        self._view = Some(new_value.to_string());
3077        self
3078    }
3079    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3080    /// while executing the actual API request.
3081    ///
3082    /// ````text
3083    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3084    /// ````
3085    ///
3086    /// Sets the *delegate* property to the given value.
3087    pub fn delegate(
3088        mut self,
3089        new_value: &'a mut dyn common::Delegate,
3090    ) -> ProjectLocationWorkflowExecutionGetCall<'a, C> {
3091        self._delegate = Some(new_value);
3092        self
3093    }
3094
3095    /// Set any additional parameter of the query string used in the request.
3096    /// It should be used to set parameters which are not yet available through their own
3097    /// setters.
3098    ///
3099    /// Please note that this method must not be used to set any of the known parameters
3100    /// which have their own setter method. If done anyway, the request will fail.
3101    ///
3102    /// # Additional Parameters
3103    ///
3104    /// * *$.xgafv* (query-string) - V1 error format.
3105    /// * *access_token* (query-string) - OAuth access token.
3106    /// * *alt* (query-string) - Data format for response.
3107    /// * *callback* (query-string) - JSONP
3108    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3109    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3110    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3111    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3112    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3113    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3114    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3115    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowExecutionGetCall<'a, C>
3116    where
3117        T: AsRef<str>,
3118    {
3119        self._additional_params
3120            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3121        self
3122    }
3123
3124    /// Identifies the authorization scope for the method you are building.
3125    ///
3126    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3127    /// [`Scope::CloudPlatform`].
3128    ///
3129    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3130    /// tokens for more than one scope.
3131    ///
3132    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3133    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3134    /// sufficient, a read-write scope will do as well.
3135    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowExecutionGetCall<'a, C>
3136    where
3137        St: AsRef<str>,
3138    {
3139        self._scopes.insert(String::from(scope.as_ref()));
3140        self
3141    }
3142    /// Identifies the authorization scope(s) for the method you are building.
3143    ///
3144    /// See [`Self::add_scope()`] for details.
3145    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowExecutionGetCall<'a, C>
3146    where
3147        I: IntoIterator<Item = St>,
3148        St: AsRef<str>,
3149    {
3150        self._scopes
3151            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3152        self
3153    }
3154
3155    /// Removes all scopes, and no default scope will be used either.
3156    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3157    /// for details).
3158    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionGetCall<'a, C> {
3159        self._scopes.clear();
3160        self
3161    }
3162}
3163
3164/// Returns a list of executions which belong to the workflow with the given name. The method returns executions of all workflow revisions. Returned executions are ordered by their start time (newest first).
3165///
3166/// A builder for the *locations.workflows.executions.list* method supported by a *project* resource.
3167/// It is not used directly, but through a [`ProjectMethods`] instance.
3168///
3169/// # Example
3170///
3171/// Instantiate a resource method builder
3172///
3173/// ```test_harness,no_run
3174/// # extern crate hyper;
3175/// # extern crate hyper_rustls;
3176/// # extern crate google_workflowexecutions1 as workflowexecutions1;
3177/// # async fn dox() {
3178/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3179///
3180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3181/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3182/// #     secret,
3183/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3184/// # ).build().await.unwrap();
3185///
3186/// # let client = hyper_util::client::legacy::Client::builder(
3187/// #     hyper_util::rt::TokioExecutor::new()
3188/// # )
3189/// # .build(
3190/// #     hyper_rustls::HttpsConnectorBuilder::new()
3191/// #         .with_native_roots()
3192/// #         .unwrap()
3193/// #         .https_or_http()
3194/// #         .enable_http1()
3195/// #         .build()
3196/// # );
3197/// # let mut hub = WorkflowExecutions::new(client, auth);
3198/// // You can configure optional parameters by calling the respective setters at will, and
3199/// // execute the final call using `doit()`.
3200/// // Values shown here are possibly random and not representative !
3201/// let result = hub.projects().locations_workflows_executions_list("parent")
3202///              .view("ipsum")
3203///              .page_token("invidunt")
3204///              .page_size(-47)
3205///              .order_by("duo")
3206///              .filter("ipsum")
3207///              .doit().await;
3208/// # }
3209/// ```
3210pub struct ProjectLocationWorkflowExecutionListCall<'a, C>
3211where
3212    C: 'a,
3213{
3214    hub: &'a WorkflowExecutions<C>,
3215    _parent: String,
3216    _view: Option<String>,
3217    _page_token: Option<String>,
3218    _page_size: Option<i32>,
3219    _order_by: Option<String>,
3220    _filter: Option<String>,
3221    _delegate: Option<&'a mut dyn common::Delegate>,
3222    _additional_params: HashMap<String, String>,
3223    _scopes: BTreeSet<String>,
3224}
3225
3226impl<'a, C> common::CallBuilder for ProjectLocationWorkflowExecutionListCall<'a, C> {}
3227
3228impl<'a, C> ProjectLocationWorkflowExecutionListCall<'a, C>
3229where
3230    C: common::Connector,
3231{
3232    /// Perform the operation you have build so far.
3233    pub async fn doit(mut self) -> common::Result<(common::Response, ListExecutionsResponse)> {
3234        use std::borrow::Cow;
3235        use std::io::{Read, Seek};
3236
3237        use common::{url::Params, ToParts};
3238        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3239
3240        let mut dd = common::DefaultDelegate;
3241        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3242        dlg.begin(common::MethodInfo {
3243            id: "workflowexecutions.projects.locations.workflows.executions.list",
3244            http_method: hyper::Method::GET,
3245        });
3246
3247        for &field in [
3248            "alt",
3249            "parent",
3250            "view",
3251            "pageToken",
3252            "pageSize",
3253            "orderBy",
3254            "filter",
3255        ]
3256        .iter()
3257        {
3258            if self._additional_params.contains_key(field) {
3259                dlg.finished(false);
3260                return Err(common::Error::FieldClash(field));
3261            }
3262        }
3263
3264        let mut params = Params::with_capacity(8 + self._additional_params.len());
3265        params.push("parent", self._parent);
3266        if let Some(value) = self._view.as_ref() {
3267            params.push("view", value);
3268        }
3269        if let Some(value) = self._page_token.as_ref() {
3270            params.push("pageToken", value);
3271        }
3272        if let Some(value) = self._page_size.as_ref() {
3273            params.push("pageSize", value.to_string());
3274        }
3275        if let Some(value) = self._order_by.as_ref() {
3276            params.push("orderBy", value);
3277        }
3278        if let Some(value) = self._filter.as_ref() {
3279            params.push("filter", value);
3280        }
3281
3282        params.extend(self._additional_params.iter());
3283
3284        params.push("alt", "json");
3285        let mut url = self.hub._base_url.clone() + "v1/{+parent}/executions";
3286        if self._scopes.is_empty() {
3287            self._scopes
3288                .insert(Scope::CloudPlatform.as_ref().to_string());
3289        }
3290
3291        #[allow(clippy::single_element_loop)]
3292        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3293            url = params.uri_replacement(url, param_name, find_this, true);
3294        }
3295        {
3296            let to_remove = ["parent"];
3297            params.remove_params(&to_remove);
3298        }
3299
3300        let url = params.parse_with_url(&url);
3301
3302        loop {
3303            let token = match self
3304                .hub
3305                .auth
3306                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3307                .await
3308            {
3309                Ok(token) => token,
3310                Err(e) => match dlg.token(e) {
3311                    Ok(token) => token,
3312                    Err(e) => {
3313                        dlg.finished(false);
3314                        return Err(common::Error::MissingToken(e));
3315                    }
3316                },
3317            };
3318            let mut req_result = {
3319                let client = &self.hub.client;
3320                dlg.pre_request();
3321                let mut req_builder = hyper::Request::builder()
3322                    .method(hyper::Method::GET)
3323                    .uri(url.as_str())
3324                    .header(USER_AGENT, self.hub._user_agent.clone());
3325
3326                if let Some(token) = token.as_ref() {
3327                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3328                }
3329
3330                let request = req_builder
3331                    .header(CONTENT_LENGTH, 0_u64)
3332                    .body(common::to_body::<String>(None));
3333
3334                client.request(request.unwrap()).await
3335            };
3336
3337            match req_result {
3338                Err(err) => {
3339                    if let common::Retry::After(d) = dlg.http_error(&err) {
3340                        sleep(d).await;
3341                        continue;
3342                    }
3343                    dlg.finished(false);
3344                    return Err(common::Error::HttpError(err));
3345                }
3346                Ok(res) => {
3347                    let (mut parts, body) = res.into_parts();
3348                    let mut body = common::Body::new(body);
3349                    if !parts.status.is_success() {
3350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3351                        let error = serde_json::from_str(&common::to_string(&bytes));
3352                        let response = common::to_response(parts, bytes.into());
3353
3354                        if let common::Retry::After(d) =
3355                            dlg.http_failure(&response, error.as_ref().ok())
3356                        {
3357                            sleep(d).await;
3358                            continue;
3359                        }
3360
3361                        dlg.finished(false);
3362
3363                        return Err(match error {
3364                            Ok(value) => common::Error::BadRequest(value),
3365                            _ => common::Error::Failure(response),
3366                        });
3367                    }
3368                    let response = {
3369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3370                        let encoded = common::to_string(&bytes);
3371                        match serde_json::from_str(&encoded) {
3372                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3373                            Err(error) => {
3374                                dlg.response_json_decode_error(&encoded, &error);
3375                                return Err(common::Error::JsonDecodeError(
3376                                    encoded.to_string(),
3377                                    error,
3378                                ));
3379                            }
3380                        }
3381                    };
3382
3383                    dlg.finished(true);
3384                    return Ok(response);
3385                }
3386            }
3387        }
3388    }
3389
3390    /// Required. Name of the workflow for which the executions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow}
3391    ///
3392    /// Sets the *parent* path property to the given value.
3393    ///
3394    /// Even though the property as already been set when instantiating this call,
3395    /// we provide this method for API completeness.
3396    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3397        self._parent = new_value.to_string();
3398        self
3399    }
3400    /// Optional. A view defining which fields should be filled in the returned executions. The API will default to the BASIC view.
3401    ///
3402    /// Sets the *view* query property to the given value.
3403    pub fn view(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3404        self._view = Some(new_value.to_string());
3405        self
3406    }
3407    /// A page token, received from a previous `ListExecutions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListExecutions` must match the call that provided the page token. Note that pagination is applied to dynamic data. The list of executions returned can change between page requests.
3408    ///
3409    /// Sets the *page token* query property to the given value.
3410    pub fn page_token(
3411        mut self,
3412        new_value: &str,
3413    ) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3414        self._page_token = Some(new_value.to_string());
3415        self
3416    }
3417    /// Maximum number of executions to return per call. Max supported value depends on the selected Execution view: it's 1000 for BASIC and 100 for FULL. The default value used if the field is not specified is 100, regardless of the selected view. Values greater than the max value will be coerced down to it.
3418    ///
3419    /// Sets the *page size* query property to the given value.
3420    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3421        self._page_size = Some(new_value);
3422        self
3423    }
3424    /// Optional. Comma-separated list of fields that specify the ordering applied to the `[Executions.ListExecutions]` results. By default the ordering is based on descending `createTime`. The following fields are supported for ordering: `executionId`, `state`, `createTime`, `startTime`, `endTime`, `duration`, and `workflowRevisionId`. For details, see AIP-132.
3425    ///
3426    /// Sets the *order by* query property to the given value.
3427    pub fn order_by(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3428        self._order_by = Some(new_value.to_string());
3429        self
3430    }
3431    /// Optional. Filters applied to the `[Executions.ListExecutions]` results. The following fields are supported for filtering: `executionId`, `state`, `createTime`, `startTime`, `endTime`, `duration`, `workflowRevisionId`, `stepName`, and `label`. For details, see AIP-160. For more information, see Filter executions. For example, if you are using the Google APIs Explorer: `state="SUCCEEDED"` or `startTime>"2023-08-01" AND state="FAILED"`
3432    ///
3433    /// Sets the *filter* query property to the given value.
3434    pub fn filter(mut self, new_value: &str) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3435        self._filter = Some(new_value.to_string());
3436        self
3437    }
3438    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3439    /// while executing the actual API request.
3440    ///
3441    /// ````text
3442    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3443    /// ````
3444    ///
3445    /// Sets the *delegate* property to the given value.
3446    pub fn delegate(
3447        mut self,
3448        new_value: &'a mut dyn common::Delegate,
3449    ) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3450        self._delegate = Some(new_value);
3451        self
3452    }
3453
3454    /// Set any additional parameter of the query string used in the request.
3455    /// It should be used to set parameters which are not yet available through their own
3456    /// setters.
3457    ///
3458    /// Please note that this method must not be used to set any of the known parameters
3459    /// which have their own setter method. If done anyway, the request will fail.
3460    ///
3461    /// # Additional Parameters
3462    ///
3463    /// * *$.xgafv* (query-string) - V1 error format.
3464    /// * *access_token* (query-string) - OAuth access token.
3465    /// * *alt* (query-string) - Data format for response.
3466    /// * *callback* (query-string) - JSONP
3467    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3468    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3469    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3470    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3471    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3472    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3473    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3474    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowExecutionListCall<'a, C>
3475    where
3476        T: AsRef<str>,
3477    {
3478        self._additional_params
3479            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3480        self
3481    }
3482
3483    /// Identifies the authorization scope for the method you are building.
3484    ///
3485    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3486    /// [`Scope::CloudPlatform`].
3487    ///
3488    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3489    /// tokens for more than one scope.
3490    ///
3491    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3492    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3493    /// sufficient, a read-write scope will do as well.
3494    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowExecutionListCall<'a, C>
3495    where
3496        St: AsRef<str>,
3497    {
3498        self._scopes.insert(String::from(scope.as_ref()));
3499        self
3500    }
3501    /// Identifies the authorization scope(s) for the method you are building.
3502    ///
3503    /// See [`Self::add_scope()`] for details.
3504    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowExecutionListCall<'a, C>
3505    where
3506        I: IntoIterator<Item = St>,
3507        St: AsRef<str>,
3508    {
3509        self._scopes
3510            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3511        self
3512    }
3513
3514    /// Removes all scopes, and no default scope will be used either.
3515    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3516    /// for details).
3517    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowExecutionListCall<'a, C> {
3518        self._scopes.clear();
3519        self
3520    }
3521}
3522
3523/// Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.
3524///
3525/// A builder for the *locations.workflows.triggerPubsubExecution* method supported by a *project* resource.
3526/// It is not used directly, but through a [`ProjectMethods`] instance.
3527///
3528/// # Example
3529///
3530/// Instantiate a resource method builder
3531///
3532/// ```test_harness,no_run
3533/// # extern crate hyper;
3534/// # extern crate hyper_rustls;
3535/// # extern crate google_workflowexecutions1 as workflowexecutions1;
3536/// use workflowexecutions1::api::TriggerPubsubExecutionRequest;
3537/// # async fn dox() {
3538/// # use workflowexecutions1::{WorkflowExecutions, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3539///
3540/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3541/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3542/// #     secret,
3543/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3544/// # ).build().await.unwrap();
3545///
3546/// # let client = hyper_util::client::legacy::Client::builder(
3547/// #     hyper_util::rt::TokioExecutor::new()
3548/// # )
3549/// # .build(
3550/// #     hyper_rustls::HttpsConnectorBuilder::new()
3551/// #         .with_native_roots()
3552/// #         .unwrap()
3553/// #         .https_or_http()
3554/// #         .enable_http1()
3555/// #         .build()
3556/// # );
3557/// # let mut hub = WorkflowExecutions::new(client, auth);
3558/// // As the method needs a request, you would usually fill it with the desired information
3559/// // into the respective structure. Some of the parts shown here might not be applicable !
3560/// // Values shown here are possibly random and not representative !
3561/// let mut req = TriggerPubsubExecutionRequest::default();
3562///
3563/// // You can configure optional parameters by calling the respective setters at will, and
3564/// // execute the final call using `doit()`.
3565/// // Values shown here are possibly random and not representative !
3566/// let result = hub.projects().locations_workflows_trigger_pubsub_execution(req, "workflow")
3567///              .doit().await;
3568/// # }
3569/// ```
3570pub struct ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C>
3571where
3572    C: 'a,
3573{
3574    hub: &'a WorkflowExecutions<C>,
3575    _request: TriggerPubsubExecutionRequest,
3576    _workflow: String,
3577    _delegate: Option<&'a mut dyn common::Delegate>,
3578    _additional_params: HashMap<String, String>,
3579    _scopes: BTreeSet<String>,
3580}
3581
3582impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {}
3583
3584impl<'a, C> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C>
3585where
3586    C: common::Connector,
3587{
3588    /// Perform the operation you have build so far.
3589    pub async fn doit(mut self) -> common::Result<(common::Response, Execution)> {
3590        use std::borrow::Cow;
3591        use std::io::{Read, Seek};
3592
3593        use common::{url::Params, ToParts};
3594        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3595
3596        let mut dd = common::DefaultDelegate;
3597        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3598        dlg.begin(common::MethodInfo {
3599            id: "workflowexecutions.projects.locations.workflows.triggerPubsubExecution",
3600            http_method: hyper::Method::POST,
3601        });
3602
3603        for &field in ["alt", "workflow"].iter() {
3604            if self._additional_params.contains_key(field) {
3605                dlg.finished(false);
3606                return Err(common::Error::FieldClash(field));
3607            }
3608        }
3609
3610        let mut params = Params::with_capacity(4 + self._additional_params.len());
3611        params.push("workflow", self._workflow);
3612
3613        params.extend(self._additional_params.iter());
3614
3615        params.push("alt", "json");
3616        let mut url = self.hub._base_url.clone() + "v1/{+workflow}:triggerPubsubExecution";
3617        if self._scopes.is_empty() {
3618            self._scopes
3619                .insert(Scope::CloudPlatform.as_ref().to_string());
3620        }
3621
3622        #[allow(clippy::single_element_loop)]
3623        for &(find_this, param_name) in [("{+workflow}", "workflow")].iter() {
3624            url = params.uri_replacement(url, param_name, find_this, true);
3625        }
3626        {
3627            let to_remove = ["workflow"];
3628            params.remove_params(&to_remove);
3629        }
3630
3631        let url = params.parse_with_url(&url);
3632
3633        let mut json_mime_type = mime::APPLICATION_JSON;
3634        let mut request_value_reader = {
3635            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3636            common::remove_json_null_values(&mut value);
3637            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3638            serde_json::to_writer(&mut dst, &value).unwrap();
3639            dst
3640        };
3641        let request_size = request_value_reader
3642            .seek(std::io::SeekFrom::End(0))
3643            .unwrap();
3644        request_value_reader
3645            .seek(std::io::SeekFrom::Start(0))
3646            .unwrap();
3647
3648        loop {
3649            let token = match self
3650                .hub
3651                .auth
3652                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3653                .await
3654            {
3655                Ok(token) => token,
3656                Err(e) => match dlg.token(e) {
3657                    Ok(token) => token,
3658                    Err(e) => {
3659                        dlg.finished(false);
3660                        return Err(common::Error::MissingToken(e));
3661                    }
3662                },
3663            };
3664            request_value_reader
3665                .seek(std::io::SeekFrom::Start(0))
3666                .unwrap();
3667            let mut req_result = {
3668                let client = &self.hub.client;
3669                dlg.pre_request();
3670                let mut req_builder = hyper::Request::builder()
3671                    .method(hyper::Method::POST)
3672                    .uri(url.as_str())
3673                    .header(USER_AGENT, self.hub._user_agent.clone());
3674
3675                if let Some(token) = token.as_ref() {
3676                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3677                }
3678
3679                let request = req_builder
3680                    .header(CONTENT_TYPE, json_mime_type.to_string())
3681                    .header(CONTENT_LENGTH, request_size as u64)
3682                    .body(common::to_body(
3683                        request_value_reader.get_ref().clone().into(),
3684                    ));
3685
3686                client.request(request.unwrap()).await
3687            };
3688
3689            match req_result {
3690                Err(err) => {
3691                    if let common::Retry::After(d) = dlg.http_error(&err) {
3692                        sleep(d).await;
3693                        continue;
3694                    }
3695                    dlg.finished(false);
3696                    return Err(common::Error::HttpError(err));
3697                }
3698                Ok(res) => {
3699                    let (mut parts, body) = res.into_parts();
3700                    let mut body = common::Body::new(body);
3701                    if !parts.status.is_success() {
3702                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3703                        let error = serde_json::from_str(&common::to_string(&bytes));
3704                        let response = common::to_response(parts, bytes.into());
3705
3706                        if let common::Retry::After(d) =
3707                            dlg.http_failure(&response, error.as_ref().ok())
3708                        {
3709                            sleep(d).await;
3710                            continue;
3711                        }
3712
3713                        dlg.finished(false);
3714
3715                        return Err(match error {
3716                            Ok(value) => common::Error::BadRequest(value),
3717                            _ => common::Error::Failure(response),
3718                        });
3719                    }
3720                    let response = {
3721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3722                        let encoded = common::to_string(&bytes);
3723                        match serde_json::from_str(&encoded) {
3724                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3725                            Err(error) => {
3726                                dlg.response_json_decode_error(&encoded, &error);
3727                                return Err(common::Error::JsonDecodeError(
3728                                    encoded.to_string(),
3729                                    error,
3730                                ));
3731                            }
3732                        }
3733                    };
3734
3735                    dlg.finished(true);
3736                    return Ok(response);
3737                }
3738            }
3739        }
3740    }
3741
3742    ///
3743    /// Sets the *request* property to the given value.
3744    ///
3745    /// Even though the property as already been set when instantiating this call,
3746    /// we provide this method for API completeness.
3747    pub fn request(
3748        mut self,
3749        new_value: TriggerPubsubExecutionRequest,
3750    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {
3751        self._request = new_value;
3752        self
3753    }
3754    /// Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow}
3755    ///
3756    /// Sets the *workflow* path property to the given value.
3757    ///
3758    /// Even though the property as already been set when instantiating this call,
3759    /// we provide this method for API completeness.
3760    pub fn workflow(
3761        mut self,
3762        new_value: &str,
3763    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {
3764        self._workflow = new_value.to_string();
3765        self
3766    }
3767    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3768    /// while executing the actual API request.
3769    ///
3770    /// ````text
3771    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3772    /// ````
3773    ///
3774    /// Sets the *delegate* property to the given value.
3775    pub fn delegate(
3776        mut self,
3777        new_value: &'a mut dyn common::Delegate,
3778    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {
3779        self._delegate = Some(new_value);
3780        self
3781    }
3782
3783    /// Set any additional parameter of the query string used in the request.
3784    /// It should be used to set parameters which are not yet available through their own
3785    /// setters.
3786    ///
3787    /// Please note that this method must not be used to set any of the known parameters
3788    /// which have their own setter method. If done anyway, the request will fail.
3789    ///
3790    /// # Additional Parameters
3791    ///
3792    /// * *$.xgafv* (query-string) - V1 error format.
3793    /// * *access_token* (query-string) - OAuth access token.
3794    /// * *alt* (query-string) - Data format for response.
3795    /// * *callback* (query-string) - JSONP
3796    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3797    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3798    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3799    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3800    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3801    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3802    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3803    pub fn param<T>(
3804        mut self,
3805        name: T,
3806        value: T,
3807    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C>
3808    where
3809        T: AsRef<str>,
3810    {
3811        self._additional_params
3812            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3813        self
3814    }
3815
3816    /// Identifies the authorization scope for the method you are building.
3817    ///
3818    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3819    /// [`Scope::CloudPlatform`].
3820    ///
3821    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3822    /// tokens for more than one scope.
3823    ///
3824    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3825    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3826    /// sufficient, a read-write scope will do as well.
3827    pub fn add_scope<St>(
3828        mut self,
3829        scope: St,
3830    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C>
3831    where
3832        St: AsRef<str>,
3833    {
3834        self._scopes.insert(String::from(scope.as_ref()));
3835        self
3836    }
3837    /// Identifies the authorization scope(s) for the method you are building.
3838    ///
3839    /// See [`Self::add_scope()`] for details.
3840    pub fn add_scopes<I, St>(
3841        mut self,
3842        scopes: I,
3843    ) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C>
3844    where
3845        I: IntoIterator<Item = St>,
3846        St: AsRef<str>,
3847    {
3848        self._scopes
3849            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3850        self
3851    }
3852
3853    /// Removes all scopes, and no default scope will be used either.
3854    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3855    /// for details).
3856    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTriggerPubsubExecutionCall<'a, C> {
3857        self._scopes.clear();
3858        self
3859    }
3860}