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