google_dataproc1/
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 Dataproc 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_dataproc1 as dataproc1;
49/// use dataproc1::api::Cluster;
50/// use dataproc1::{Result, Error};
51/// # async fn dox() {
52/// use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = Dataproc::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Cluster::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().regions_clusters_patch(req, "projectId", "region", "clusterName")
88///              .update_mask(FieldMask::new::<&str>(&[]))
89///              .request_id("gubergren")
90///              .graceful_decommission_timeout(chrono::Duration::seconds(6569141))
91///              .doit().await;
92///
93/// match result {
94///     Err(e) => match e {
95///         // The Error enum provides details about what exactly happened.
96///         // You can also just use its `Debug`, `Display` or `Error` traits
97///          Error::HttpError(_)
98///         |Error::Io(_)
99///         |Error::MissingAPIKey
100///         |Error::MissingToken(_)
101///         |Error::Cancelled
102///         |Error::UploadSizeLimitExceeded(_, _)
103///         |Error::Failure(_)
104///         |Error::BadRequest(_)
105///         |Error::FieldClash(_)
106///         |Error::JsonDecodeError(_, _) => println!("{}", e),
107///     },
108///     Ok(res) => println!("Success: {:?}", res),
109/// }
110/// # }
111/// ```
112#[derive(Clone)]
113pub struct Dataproc<C> {
114    pub client: common::Client<C>,
115    pub auth: Box<dyn common::GetToken>,
116    _user_agent: String,
117    _base_url: String,
118    _root_url: String,
119}
120
121impl<C> common::Hub for Dataproc<C> {}
122
123impl<'a, C> Dataproc<C> {
124    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Dataproc<C> {
125        Dataproc {
126            client,
127            auth: Box::new(auth),
128            _user_agent: "google-api-rust-client/6.0.0".to_string(),
129            _base_url: "https://dataproc.googleapis.com/".to_string(),
130            _root_url: "https://dataproc.googleapis.com/".to_string(),
131        }
132    }
133
134    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
135        ProjectMethods { hub: self }
136    }
137
138    /// Set the user-agent header field to use in all requests to the server.
139    /// It defaults to `google-api-rust-client/6.0.0`.
140    ///
141    /// Returns the previously set user-agent.
142    pub fn user_agent(&mut self, agent_name: String) -> String {
143        std::mem::replace(&mut self._user_agent, agent_name)
144    }
145
146    /// Set the base url to use in all requests to the server.
147    /// It defaults to `https://dataproc.googleapis.com/`.
148    ///
149    /// Returns the previously set base url.
150    pub fn base_url(&mut self, new_base_url: String) -> String {
151        std::mem::replace(&mut self._base_url, new_base_url)
152    }
153
154    /// Set the root url to use in all requests to the server.
155    /// It defaults to `https://dataproc.googleapis.com/`.
156    ///
157    /// Returns the previously set root url.
158    pub fn root_url(&mut self, new_root_url: String) -> String {
159        std::mem::replace(&mut self._root_url, new_root_url)
160    }
161}
162
163// ############
164// SCHEMAS ###
165// ##########
166/// Specifies the type and number of accelerator cards attached to the instances of an instance. See GPUs on Compute Engine (https://cloud.google.com/compute/docs/gpus/).
167///
168/// This type is not used in any activity, and only used as *part* of another schema.
169///
170#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
171#[serde_with::serde_as]
172#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
173pub struct AcceleratorConfig {
174    /// The number of the accelerator cards of this type exposed to this instance.
175    #[serde(rename = "acceleratorCount")]
176    pub accelerator_count: Option<i32>,
177    /// Full URL, partial URI, or short name of the accelerator type resource to expose to this instance. See Compute Engine AcceleratorTypes (https://cloud.google.com/compute/docs/reference/v1/acceleratorTypes).Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4 projects/[project_id]/zones/[zone]/acceleratorTypes/nvidia-tesla-t4 nvidia-tesla-t4Auto Zone Exception: If you are using the Dataproc Auto Zone Placement (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) feature, you must use the short name of the accelerator type resource, for example, nvidia-tesla-t4.
178    #[serde(rename = "acceleratorTypeUri")]
179    pub accelerator_type_uri: Option<String>,
180}
181
182impl common::Part for AcceleratorConfig {}
183
184/// A request to analyze a batch workload.
185///
186/// # Activities
187///
188/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
189/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
190///
191/// * [locations batches analyze projects](ProjectLocationBatchAnalyzeCall) (request)
192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
193#[serde_with::serde_as]
194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
195pub struct AnalyzeBatchRequest {
196    /// Optional. A unique ID used to identify the request. If the service receives two AnalyzeBatchRequest (http://cloud/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.AnalyzeBatchRequest)s with the same request_id, the second request is ignored and the Operation that corresponds to the first request created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
197    #[serde(rename = "requestId")]
198    pub request_id: Option<String>,
199}
200
201impl common::RequestValue for AnalyzeBatchRequest {}
202
203/// Autoscaling Policy config associated with the cluster.
204///
205/// This type is not used in any activity, and only used as *part* of another schema.
206///
207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
208#[serde_with::serde_as]
209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
210pub struct AutoscalingConfig {
211    /// Optional. The autoscaling policy used by the cluster.Only resource names including projectid and location (region) are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id] projects/[project_id]/locations/[dataproc_region]/autoscalingPolicies/[policy_id]Note that the policy must be in the same project and Dataproc region.
212    #[serde(rename = "policyUri")]
213    pub policy_uri: Option<String>,
214}
215
216impl common::Part for AutoscalingConfig {}
217
218/// Describes an autoscaling policy for Dataproc cluster autoscaler.
219///
220/// # Activities
221///
222/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
223/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
224///
225/// * [locations autoscaling policies create projects](ProjectLocationAutoscalingPolicyCreateCall) (request|response)
226/// * [locations autoscaling policies get projects](ProjectLocationAutoscalingPolicyGetCall) (response)
227/// * [locations autoscaling policies update projects](ProjectLocationAutoscalingPolicyUpdateCall) (request|response)
228/// * [regions autoscaling policies create projects](ProjectRegionAutoscalingPolicyCreateCall) (request|response)
229/// * [regions autoscaling policies get projects](ProjectRegionAutoscalingPolicyGetCall) (response)
230/// * [regions autoscaling policies update projects](ProjectRegionAutoscalingPolicyUpdateCall) (request|response)
231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
232#[serde_with::serde_as]
233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
234pub struct AutoscalingPolicy {
235    /// no description provided
236    #[serde(rename = "basicAlgorithm")]
237    pub basic_algorithm: Option<BasicAutoscalingAlgorithm>,
238    /// Required. The policy id.The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters.
239    pub id: Option<String>,
240    /// Optional. The labels to associate with this autoscaling policy. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with an autoscaling policy.
241    pub labels: Option<HashMap<String, String>>,
242    /// Output only. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
243    pub name: Option<String>,
244    /// Optional. Describes how the autoscaler will operate for secondary workers.
245    #[serde(rename = "secondaryWorkerConfig")]
246    pub secondary_worker_config: Option<InstanceGroupAutoscalingPolicyConfig>,
247    /// Required. Describes how the autoscaler will operate for primary workers.
248    #[serde(rename = "workerConfig")]
249    pub worker_config: Option<InstanceGroupAutoscalingPolicyConfig>,
250}
251
252impl common::RequestValue for AutoscalingPolicy {}
253impl common::ResponseResult for AutoscalingPolicy {}
254
255/// Autotuning configuration of the workload.
256///
257/// This type is not used in any activity, and only used as *part* of another schema.
258///
259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
260#[serde_with::serde_as]
261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
262pub struct AutotuningConfig {
263    /// Optional. Scenarios for which tunings are applied.
264    pub scenarios: Option<Vec<String>>,
265}
266
267impl common::Part for AutotuningConfig {}
268
269/// Node group identification and configuration information.
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 AuxiliaryNodeGroup {
277    /// Required. Node group configuration.
278    #[serde(rename = "nodeGroup")]
279    pub node_group: Option<NodeGroup>,
280    /// Optional. A node group ID. Generated if not specified.The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of from 3 to 33 characters.
281    #[serde(rename = "nodeGroupId")]
282    pub node_group_id: Option<String>,
283}
284
285impl common::Part for AuxiliaryNodeGroup {}
286
287/// Auxiliary services configuration for a Cluster.
288///
289/// This type is not used in any activity, and only used as *part* of another schema.
290///
291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
292#[serde_with::serde_as]
293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
294pub struct AuxiliaryServicesConfig {
295    /// Optional. The Hive Metastore configuration for this workload.
296    #[serde(rename = "metastoreConfig")]
297    pub metastore_config: Option<MetastoreConfig>,
298    /// Optional. The Spark History Server configuration for the workload.
299    #[serde(rename = "sparkHistoryServerConfig")]
300    pub spark_history_server_config: Option<SparkHistoryServerConfig>,
301}
302
303impl common::Part for AuxiliaryServicesConfig {}
304
305/// Basic algorithm for autoscaling.
306///
307/// This type is not used in any activity, and only used as *part* of another schema.
308///
309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
310#[serde_with::serde_as]
311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
312pub struct BasicAutoscalingAlgorithm {
313    /// Optional. Duration between scaling events. A scaling period starts after the update operation from the previous event has completed.Bounds: 2m, 1d. Default: 2m.
314    #[serde(rename = "cooldownPeriod")]
315    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
316    pub cooldown_period: Option<chrono::Duration>,
317    /// Optional. Spark Standalone autoscaling configuration
318    #[serde(rename = "sparkStandaloneConfig")]
319    pub spark_standalone_config: Option<SparkStandaloneAutoscalingConfig>,
320    /// Optional. YARN autoscaling configuration.
321    #[serde(rename = "yarnConfig")]
322    pub yarn_config: Option<BasicYarnAutoscalingConfig>,
323}
324
325impl common::Part for BasicAutoscalingAlgorithm {}
326
327/// Basic autoscaling configurations for YARN.
328///
329/// This type is not used in any activity, and only used as *part* of another schema.
330///
331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
332#[serde_with::serde_as]
333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
334pub struct BasicYarnAutoscalingConfig {
335    /// Required. Timeout for YARN graceful decommissioning of Node Managers. Specifies the duration to wait for jobs to complete before forcefully removing workers (and potentially interrupting jobs). Only applicable to downscaling operations.Bounds: 0s, 1d.
336    #[serde(rename = "gracefulDecommissionTimeout")]
337    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
338    pub graceful_decommission_timeout: Option<chrono::Duration>,
339    /// Required. Fraction of average YARN pending memory in the last cooldown period for which to remove workers. A scale-down factor of 1 will result in scaling down so that there is no available memory remaining after the update (more aggressive scaling). A scale-down factor of 0 disables removing workers, which can be beneficial for autoscaling a single job. See How autoscaling works (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) for more information.Bounds: 0.0, 1.0.
340    #[serde(rename = "scaleDownFactor")]
341    pub scale_down_factor: Option<f64>,
342    /// Optional. Minimum scale-down threshold as a fraction of total cluster size before scaling occurs. For example, in a 20-worker cluster, a threshold of 0.1 means the autoscaler must recommend at least a 2 worker scale-down for the cluster to scale. A threshold of 0 means the autoscaler will scale down on any recommended change.Bounds: 0.0, 1.0. Default: 0.0.
343    #[serde(rename = "scaleDownMinWorkerFraction")]
344    pub scale_down_min_worker_fraction: Option<f64>,
345    /// Required. Fraction of average YARN pending memory in the last cooldown period for which to add workers. A scale-up factor of 1.0 will result in scaling up so that there is no pending memory remaining after the update (more aggressive scaling). A scale-up factor closer to 0 will result in a smaller magnitude of scaling up (less aggressive scaling). See How autoscaling works (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/autoscaling#how_autoscaling_works) for more information.Bounds: 0.0, 1.0.
346    #[serde(rename = "scaleUpFactor")]
347    pub scale_up_factor: Option<f64>,
348    /// Optional. Minimum scale-up threshold as a fraction of total cluster size before scaling occurs. For example, in a 20-worker cluster, a threshold of 0.1 means the autoscaler must recommend at least a 2-worker scale-up for the cluster to scale. A threshold of 0 means the autoscaler will scale up on any recommended change.Bounds: 0.0, 1.0. Default: 0.0.
349    #[serde(rename = "scaleUpMinWorkerFraction")]
350    pub scale_up_min_worker_fraction: Option<f64>,
351}
352
353impl common::Part for BasicYarnAutoscalingConfig {}
354
355/// A representation of a batch workload in the service.
356///
357/// # Activities
358///
359/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
360/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
361///
362/// * [locations batches create projects](ProjectLocationBatchCreateCall) (request)
363/// * [locations batches get projects](ProjectLocationBatchGetCall) (response)
364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
365#[serde_with::serde_as]
366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
367pub struct Batch {
368    /// Output only. The time when the batch was created.
369    #[serde(rename = "createTime")]
370    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
371    /// Output only. The email address of the user who created the batch.
372    pub creator: Option<String>,
373    /// Optional. Environment configuration for the batch execution.
374    #[serde(rename = "environmentConfig")]
375    pub environment_config: Option<EnvironmentConfig>,
376    /// Optional. The labels to associate with this batch. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a batch.
377    pub labels: Option<HashMap<String, String>>,
378    /// Output only. The resource name of the batch.
379    pub name: Option<String>,
380    /// Output only. The resource name of the operation associated with this batch.
381    pub operation: Option<String>,
382    /// Optional. PySpark batch config.
383    #[serde(rename = "pysparkBatch")]
384    pub pyspark_batch: Option<PySparkBatch>,
385    /// Optional. Runtime configuration for the batch execution.
386    #[serde(rename = "runtimeConfig")]
387    pub runtime_config: Option<RuntimeConfig>,
388    /// Output only. Runtime information about batch execution.
389    #[serde(rename = "runtimeInfo")]
390    pub runtime_info: Option<RuntimeInfo>,
391    /// Optional. Spark batch config.
392    #[serde(rename = "sparkBatch")]
393    pub spark_batch: Option<SparkBatch>,
394    /// Optional. SparkR batch config.
395    #[serde(rename = "sparkRBatch")]
396    pub spark_r_batch: Option<SparkRBatch>,
397    /// Optional. SparkSql batch config.
398    #[serde(rename = "sparkSqlBatch")]
399    pub spark_sql_batch: Option<SparkSqlBatch>,
400    /// Output only. The state of the batch.
401    pub state: Option<String>,
402    /// Output only. Historical state information for the batch.
403    #[serde(rename = "stateHistory")]
404    pub state_history: Option<Vec<StateHistory>>,
405    /// Output only. Batch state details, such as a failure description if the state is FAILED.
406    #[serde(rename = "stateMessage")]
407    pub state_message: Option<String>,
408    /// Output only. The time when the batch entered a current state.
409    #[serde(rename = "stateTime")]
410    pub state_time: Option<chrono::DateTime<chrono::offset::Utc>>,
411    /// Output only. A batch UUID (Unique Universal Identifier). The service generates this value when it creates the batch.
412    pub uuid: Option<String>,
413}
414
415impl common::RequestValue for Batch {}
416impl common::ResponseResult for Batch {}
417
418/// Associates members, or principals, with a role.
419///
420/// This type is not used in any activity, and only used as *part* of another schema.
421///
422#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
423#[serde_with::serde_as]
424#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
425pub struct Binding {
426    /// The condition that is associated with this binding.If the condition evaluates to true, then this binding applies to the current request.If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding.To learn which resources support conditions in their IAM policies, see the IAM documentation (https://cloud.google.com/iam/help/conditions/resource-policies).
427    pub condition: Option<Expr>,
428    /// Specifies the principals requesting access for a Google Cloud resource. members can have the following values: allUsers: A special identifier that represents anyone who is on the internet; with or without a Google account. allAuthenticatedUsers: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. user:{emailid}: An email address that represents a specific Google account. For example, alice@example.com . serviceAccount:{emailid}: An email address that represents a Google service account. For example, my-other-app@appspot.gserviceaccount.com. serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]: An identifier for a Kubernetes service account (https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, my-project.svc.id.goog[my-namespace/my-kubernetes-sa]. group:{emailid}: An email address that represents a Google group. For example, admins@example.com. domain:{domain}: The G Suite domain (primary) that represents all the users of that domain. For example, google.com or example.com. principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}: A single identity in a workforce identity pool. principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}: All workforce identities in a group. principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}: All workforce identities with a specific attribute value. principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*: All identities in a workforce identity pool. principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}: A single identity in a workload identity pool. principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}: A workload identity pool group. principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}: All identities in a workload identity pool with a certain attribute. principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*: All identities in a workload identity pool. deleted:user:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a user that has been recently deleted. For example, alice@example.com?uid=123456789012345678901. If the user is recovered, this value reverts to user:{emailid} and the recovered user retains the role in the binding. deleted:serviceAccount:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901. If the service account is undeleted, this value reverts to serviceAccount:{emailid} and the undeleted service account retains the role in the binding. deleted:group:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, admins@example.com?uid=123456789012345678901. If the group is recovered, this value reverts to group:{emailid} and the recovered group retains the role in the binding. deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}: Deleted single identity in a workforce identity pool. For example, deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value.
429    pub members: Option<Vec<String>>,
430    /// Role that is assigned to the list of members, or principals. For example, roles/viewer, roles/editor, or roles/owner.For an overview of the IAM roles and permissions, see the IAM documentation (https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see here (https://cloud.google.com/iam/docs/understanding-roles).
431    pub role: Option<String>,
432}
433
434impl common::Part for Binding {}
435
436/// A request to cancel a job.
437///
438/// # Activities
439///
440/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
441/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
442///
443/// * [regions jobs cancel projects](ProjectRegionJobCancelCall) (request)
444#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
445#[serde_with::serde_as]
446#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
447pub struct CancelJobRequest {
448    _never_set: Option<bool>,
449}
450
451impl common::RequestValue for CancelJobRequest {}
452
453/// Describes the identifying information, config, and status of a Dataproc cluster
454///
455/// # Activities
456///
457/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
458/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
459///
460/// * [regions clusters create projects](ProjectRegionClusterCreateCall) (request)
461/// * [regions clusters get projects](ProjectRegionClusterGetCall) (response)
462/// * [regions clusters patch projects](ProjectRegionClusterPatchCall) (request)
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct Cluster {
467    /// Required. The cluster name, which must be unique within a project. The name must start with a lowercase letter, and can contain up to 51 lowercase letters, numbers, and hyphens. It cannot end with a hyphen. The name of a deleted cluster can be reused.
468    #[serde(rename = "clusterName")]
469    pub cluster_name: Option<String>,
470    /// Output only. A cluster UUID (Unique Universal Identifier). Dataproc generates this value when it creates the cluster.
471    #[serde(rename = "clusterUuid")]
472    pub cluster_uuid: Option<String>,
473    /// Optional. The cluster config for a cluster of Compute Engine Instances. Note that Dataproc may set default values, and values may change when clusters are updated.Exactly one of ClusterConfig or VirtualClusterConfig must be specified.
474    pub config: Option<ClusterConfig>,
475    /// Optional. The labels to associate with this cluster. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a cluster.
476    pub labels: Option<HashMap<String, String>>,
477    /// Output only. Contains cluster daemon metrics such as HDFS and YARN stats.Beta Feature: This report is available for testing purposes only. It may be changed before final release.
478    pub metrics: Option<ClusterMetrics>,
479    /// Required. The Google Cloud Platform project ID that the cluster belongs to.
480    #[serde(rename = "projectId")]
481    pub project_id: Option<String>,
482    /// Output only. Cluster status.
483    pub status: Option<ClusterStatus>,
484    /// Output only. The previous cluster status.
485    #[serde(rename = "statusHistory")]
486    pub status_history: Option<Vec<ClusterStatus>>,
487    /// Optional. The virtual cluster config is used when creating a Dataproc cluster that does not directly control the underlying compute resources, for example, when creating a Dataproc-on-GKE cluster (https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview). Dataproc may set default values, and values may change when clusters are updated. Exactly one of config or virtual_cluster_config must be specified.
488    #[serde(rename = "virtualClusterConfig")]
489    pub virtual_cluster_config: Option<VirtualClusterConfig>,
490}
491
492impl common::RequestValue for Cluster {}
493impl common::ResponseResult for Cluster {}
494
495/// The cluster config.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct ClusterConfig {
503    /// Optional. Autoscaling config for the policy associated with the cluster. Cluster does not autoscale if this field is unset.
504    #[serde(rename = "autoscalingConfig")]
505    pub autoscaling_config: Option<AutoscalingConfig>,
506    /// Optional. The node group settings.
507    #[serde(rename = "auxiliaryNodeGroups")]
508    pub auxiliary_node_groups: Option<Vec<AuxiliaryNodeGroup>>,
509    /// Optional. A Cloud Storage bucket used to stage job dependencies, config files, and job driver console output. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's staging bucket according to the Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket (see Dataproc staging and temp buckets (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). This field requires a Cloud Storage bucket name, not a gs://... URI to a Cloud Storage bucket.
510    #[serde(rename = "configBucket")]
511    pub config_bucket: Option<String>,
512    /// Optional. The config for Dataproc metrics.
513    #[serde(rename = "dataprocMetricConfig")]
514    pub dataproc_metric_config: Option<DataprocMetricConfig>,
515    /// Optional. Encryption settings for the cluster.
516    #[serde(rename = "encryptionConfig")]
517    pub encryption_config: Option<EncryptionConfig>,
518    /// Optional. Port/endpoint configuration for this cluster
519    #[serde(rename = "endpointConfig")]
520    pub endpoint_config: Option<EndpointConfig>,
521    /// Optional. The shared Compute Engine config settings for all instances in a cluster.
522    #[serde(rename = "gceClusterConfig")]
523    pub gce_cluster_config: Option<GceClusterConfig>,
524    /// Optional. BETA. The Kubernetes Engine config for Dataproc clusters deployed to The Kubernetes Engine config for Dataproc clusters deployed to Kubernetes. These config settings are mutually exclusive with Compute Engine-based options, such as gce_cluster_config, master_config, worker_config, secondary_worker_config, and autoscaling_config.
525    #[serde(rename = "gkeClusterConfig")]
526    pub gke_cluster_config: Option<GkeClusterConfig>,
527    /// Optional. Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's role metadata to run an executable on a master or worker node, as shown below using curl (you can also use wget): ROLE=$(curl -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) if [[ "${ROLE}" == 'Master' ]]; then ... master specific actions ... else ... worker specific actions ... fi
528    #[serde(rename = "initializationActions")]
529    pub initialization_actions: Option<Vec<NodeInitializationAction>>,
530    /// Optional. Lifecycle setting for the cluster.
531    #[serde(rename = "lifecycleConfig")]
532    pub lifecycle_config: Option<LifecycleConfig>,
533    /// Optional. The Compute Engine config settings for the cluster's master instance.
534    #[serde(rename = "masterConfig")]
535    pub master_config: Option<InstanceGroupConfig>,
536    /// Optional. Metastore configuration.
537    #[serde(rename = "metastoreConfig")]
538    pub metastore_config: Option<MetastoreConfig>,
539    /// Optional. The Compute Engine config settings for a cluster's secondary worker instances
540    #[serde(rename = "secondaryWorkerConfig")]
541    pub secondary_worker_config: Option<InstanceGroupConfig>,
542    /// Optional. Security settings for the cluster.
543    #[serde(rename = "securityConfig")]
544    pub security_config: Option<SecurityConfig>,
545    /// Optional. The config settings for cluster software.
546    #[serde(rename = "softwareConfig")]
547    pub software_config: Option<SoftwareConfig>,
548    /// Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, such as Spark and MapReduce history files. If you do not specify a temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's temp bucket according to the Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket. The default bucket has a TTL of 90 days, but you can use any TTL (or none) if you specify a bucket (see Dataproc staging and temp buckets (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). This field requires a Cloud Storage bucket name, not a gs://... URI to a Cloud Storage bucket.
549    #[serde(rename = "tempBucket")]
550    pub temp_bucket: Option<String>,
551    /// Optional. The Compute Engine config settings for the cluster's worker instances.
552    #[serde(rename = "workerConfig")]
553    pub worker_config: Option<InstanceGroupConfig>,
554}
555
556impl common::Part for ClusterConfig {}
557
558/// Contains cluster daemon metrics, such as HDFS and YARN stats.Beta Feature: This report is available for testing purposes only. It may be changed before final release.
559///
560/// This type is not used in any activity, and only used as *part* of another schema.
561///
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct ClusterMetrics {
566    /// The HDFS metrics.
567    #[serde(rename = "hdfsMetrics")]
568    #[serde_as(as = "Option<HashMap<_, serde_with::DisplayFromStr>>")]
569    pub hdfs_metrics: Option<HashMap<String, i64>>,
570    /// YARN metrics.
571    #[serde(rename = "yarnMetrics")]
572    #[serde_as(as = "Option<HashMap<_, serde_with::DisplayFromStr>>")]
573    pub yarn_metrics: Option<HashMap<String, i64>>,
574}
575
576impl common::Part for ClusterMetrics {}
577
578/// A selector that chooses target cluster for jobs based on metadata.
579///
580/// This type is not used in any activity, and only used as *part* of another schema.
581///
582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
583#[serde_with::serde_as]
584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
585pub struct ClusterSelector {
586    /// Required. The cluster labels. Cluster must have all labels to match.
587    #[serde(rename = "clusterLabels")]
588    pub cluster_labels: Option<HashMap<String, String>>,
589    /// Optional. The zone where workflow process executes. This parameter does not affect the selection of the cluster.If unspecified, the zone of the first cluster matching the selector is used.
590    pub zone: Option<String>,
591}
592
593impl common::Part for ClusterSelector {}
594
595/// The status of a cluster and its instances.
596///
597/// This type is not used in any activity, and only used as *part* of another schema.
598///
599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
600#[serde_with::serde_as]
601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
602pub struct ClusterStatus {
603    /// Optional. Output only. Details of cluster's state.
604    pub detail: Option<String>,
605    /// Output only. The cluster's state.
606    pub state: Option<String>,
607    /// Output only. Time when this state was entered (see JSON representation of Timestamp (https://developers.google.com/protocol-buffers/docs/proto3#json)).
608    #[serde(rename = "stateStartTime")]
609    pub state_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
610    /// Output only. Additional state information that includes status reported by the agent.
611    pub substate: Option<String>,
612}
613
614impl common::Part for ClusterStatus {}
615
616/// Confidential Instance Config for clusters using Confidential VMs (https://cloud.google.com/compute/confidential-vm/docs)
617///
618/// This type is not used in any activity, and only used as *part* of another schema.
619///
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct ConfidentialInstanceConfig {
624    /// Optional. Defines whether the instance should have confidential compute enabled.
625    #[serde(rename = "enableConfidentialCompute")]
626    pub enable_confidential_compute: Option<bool>,
627}
628
629impl common::Part for ConfidentialInstanceConfig {}
630
631/// Dataproc metric config.
632///
633/// This type is not used in any activity, and only used as *part* of another schema.
634///
635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
636#[serde_with::serde_as]
637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
638pub struct DataprocMetricConfig {
639    /// Required. Metrics sources to enable.
640    pub metrics: Option<Vec<Metric>>,
641}
642
643impl common::Part for DataprocMetricConfig {}
644
645/// A request to collect cluster diagnostic information.
646///
647/// # Activities
648///
649/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
650/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
651///
652/// * [regions clusters diagnose projects](ProjectRegionClusterDiagnoseCall) (request)
653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
654#[serde_with::serde_as]
655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
656pub struct DiagnoseClusterRequest {
657    /// Optional. Time interval in which diagnosis should be carried out on the cluster.
658    #[serde(rename = "diagnosisInterval")]
659    pub diagnosis_interval: Option<Interval>,
660    /// Optional. DEPRECATED Specifies the job on which diagnosis is to be performed. Format: projects/{project}/regions/{region}/jobs/{job}
661    pub job: Option<String>,
662    /// Optional. Specifies a list of jobs on which diagnosis is to be performed. Format: projects/{project}/regions/{region}/jobs/{job}
663    pub jobs: Option<Vec<String>>,
664    /// Optional. (Optional) The access type to the diagnostic tarball. If not specified, falls back to default access of the bucket
665    #[serde(rename = "tarballAccess")]
666    pub tarball_access: Option<String>,
667    /// Optional. (Optional) The output Cloud Storage directory for the diagnostic tarball. If not specified, a task-specific directory in the cluster's staging bucket will be used.
668    #[serde(rename = "tarballGcsDir")]
669    pub tarball_gcs_dir: Option<String>,
670    /// Optional. DEPRECATED Specifies the yarn application on which diagnosis is to be performed.
671    #[serde(rename = "yarnApplicationId")]
672    pub yarn_application_id: Option<String>,
673    /// Optional. Specifies a list of yarn applications on which diagnosis is to be performed.
674    #[serde(rename = "yarnApplicationIds")]
675    pub yarn_application_ids: Option<Vec<String>>,
676}
677
678impl common::RequestValue for DiagnoseClusterRequest {}
679
680/// Specifies the config of disk options for a group of VM instances.
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 DiskConfig {
688    /// Optional. Indicates how many IOPS to provision for the disk. This sets the number of I/O operations per second that the disk can handle. Note: This field is only supported if boot_disk_type is hyperdisk-balanced.
689    #[serde(rename = "bootDiskProvisionedIops")]
690    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
691    pub boot_disk_provisioned_iops: Option<i64>,
692    /// Optional. Indicates how much throughput to provision for the disk. This sets the number of throughput mb per second that the disk can handle. Values must be greater than or equal to 1. Note: This field is only supported if boot_disk_type is hyperdisk-balanced.
693    #[serde(rename = "bootDiskProvisionedThroughput")]
694    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
695    pub boot_disk_provisioned_throughput: Option<i64>,
696    /// Optional. Size in GB of the boot disk (default is 500GB).
697    #[serde(rename = "bootDiskSizeGb")]
698    pub boot_disk_size_gb: Option<i32>,
699    /// Optional. Type of the boot disk (default is "pd-standard"). Valid values: "pd-balanced" (Persistent Disk Balanced Solid State Drive), "pd-ssd" (Persistent Disk Solid State Drive), or "pd-standard" (Persistent Disk Hard Disk Drive). See Disk types (https://cloud.google.com/compute/docs/disks#disk-types).
700    #[serde(rename = "bootDiskType")]
701    pub boot_disk_type: Option<String>,
702    /// Optional. Interface type of local SSDs (default is "scsi"). Valid values: "scsi" (Small Computer System Interface), "nvme" (Non-Volatile Memory Express). See local SSD performance (https://cloud.google.com/compute/docs/disks/local-ssd#performance).
703    #[serde(rename = "localSsdInterface")]
704    pub local_ssd_interface: Option<String>,
705    /// Optional. Number of attached SSDs, from 0 to 8 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and HDFS (https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries.Note: Local SSD options may vary by machine type and number of vCPUs selected.
706    #[serde(rename = "numLocalSsds")]
707    pub num_local_ssds: Option<i32>,
708}
709
710impl common::Part for DiskConfig {}
711
712/// Driver scheduling configuration.
713///
714/// This type is not used in any activity, and only used as *part* of another schema.
715///
716#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
717#[serde_with::serde_as]
718#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
719pub struct DriverSchedulingConfig {
720    /// Required. The amount of memory in MB the driver is requesting.
721    #[serde(rename = "memoryMb")]
722    pub memory_mb: Option<i32>,
723    /// Required. The number of vCPUs the driver is requesting.
724    pub vcores: Option<i32>,
725}
726
727impl common::Part for DriverSchedulingConfig {}
728
729/// 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); }
730///
731/// # Activities
732///
733/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
734/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
735///
736/// * [locations autoscaling policies delete projects](ProjectLocationAutoscalingPolicyDeleteCall) (response)
737/// * [locations batches delete projects](ProjectLocationBatchDeleteCall) (response)
738/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
739/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
740/// * [locations session templates delete projects](ProjectLocationSessionTemplateDeleteCall) (response)
741/// * [locations workflow templates delete projects](ProjectLocationWorkflowTemplateDeleteCall) (response)
742/// * [regions autoscaling policies delete projects](ProjectRegionAutoscalingPolicyDeleteCall) (response)
743/// * [regions jobs delete projects](ProjectRegionJobDeleteCall) (response)
744/// * [regions operations cancel projects](ProjectRegionOperationCancelCall) (response)
745/// * [regions operations delete projects](ProjectRegionOperationDeleteCall) (response)
746/// * [regions workflow templates delete projects](ProjectRegionWorkflowTemplateDeleteCall) (response)
747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
748#[serde_with::serde_as]
749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
750pub struct Empty {
751    _never_set: Option<bool>,
752}
753
754impl common::ResponseResult for Empty {}
755
756/// Encryption settings for the cluster.
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct EncryptionConfig {
764    /// Optional. The Cloud KMS key resource name to use for persistent disk encryption for all instances in the cluster. See Use CMEK with cluster data (https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data) for more information.
765    #[serde(rename = "gcePdKmsKeyName")]
766    pub gce_pd_kms_key_name: Option<String>,
767    /// Optional. The Cloud KMS key resource name to use for cluster persistent disk and job argument encryption. See Use CMEK with cluster data (https://cloud.google.com//dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_cluster_data) for more information.When this key resource name is provided, the following job arguments of the following job types submitted to the cluster are encrypted using CMEK: FlinkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob) HadoopJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob) SparkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob) SparkRJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob) PySparkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob) SparkSqlJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob) scriptVariables and queryList.queries HiveJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob) scriptVariables and queryList.queries PigJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob) scriptVariables and queryList.queries PrestoJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob) scriptVariables and queryList.queries
768    #[serde(rename = "kmsKey")]
769    pub kms_key: Option<String>,
770}
771
772impl common::Part for EncryptionConfig {}
773
774/// Endpoint config for this cluster
775///
776/// This type is not used in any activity, and only used as *part* of another schema.
777///
778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
779#[serde_with::serde_as]
780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
781pub struct EndpointConfig {
782    /// Optional. If true, enable http access to specific ports on the cluster from external sources. Defaults to false.
783    #[serde(rename = "enableHttpPortAccess")]
784    pub enable_http_port_access: Option<bool>,
785    /// Output only. The map of port descriptions to URLs. Will only be populated if enable_http_port_access is true.
786    #[serde(rename = "httpPorts")]
787    pub http_ports: Option<HashMap<String, String>>,
788}
789
790impl common::Part for EndpointConfig {}
791
792/// Environment configuration for a workload.
793///
794/// This type is not used in any activity, and only used as *part* of another schema.
795///
796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
797#[serde_with::serde_as]
798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
799pub struct EnvironmentConfig {
800    /// Optional. Execution configuration for a workload.
801    #[serde(rename = "executionConfig")]
802    pub execution_config: Option<ExecutionConfig>,
803    /// Optional. Peripherals configuration that workload has access to.
804    #[serde(rename = "peripheralsConfig")]
805    pub peripherals_config: Option<PeripheralsConfig>,
806}
807
808impl common::Part for EnvironmentConfig {}
809
810/// Execution configuration for a workload.
811///
812/// This type is not used in any activity, and only used as *part* of another schema.
813///
814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
815#[serde_with::serde_as]
816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
817pub struct ExecutionConfig {
818    /// Optional. Applies to sessions only. The duration to keep the session alive while it's idling. Exceeding this threshold causes the session to terminate. This field cannot be set on a batch workload. Minimum value is 10 minutes; maximum value is 14 days (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). Defaults to 1 hour if not set. If both ttl and idle_ttl are specified for an interactive session, the conditions are treated as OR conditions: the workload will be terminated when it has been idle for idle_ttl or when ttl has been exceeded, whichever occurs first.
819    #[serde(rename = "idleTtl")]
820    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
821    pub idle_ttl: Option<chrono::Duration>,
822    /// Optional. The Cloud KMS key to use for encryption.
823    #[serde(rename = "kmsKey")]
824    pub kms_key: Option<String>,
825    /// Optional. Tags used for network traffic control.
826    #[serde(rename = "networkTags")]
827    pub network_tags: Option<Vec<String>>,
828    /// Optional. Network URI to connect workload to.
829    #[serde(rename = "networkUri")]
830    pub network_uri: Option<String>,
831    /// Optional. Service account that used to execute workload.
832    #[serde(rename = "serviceAccount")]
833    pub service_account: Option<String>,
834    /// Optional. A Cloud Storage bucket used to stage workload dependencies, config files, and store workload output and other ephemeral data, such as Spark history files. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location according to the region where your workload is running, and then create and manage project-level, per-location staging and temporary buckets. This field requires a Cloud Storage bucket name, not a gs://... URI to a Cloud Storage bucket.
835    #[serde(rename = "stagingBucket")]
836    pub staging_bucket: Option<String>,
837    /// Optional. Subnetwork URI to connect workload to.
838    #[serde(rename = "subnetworkUri")]
839    pub subnetwork_uri: Option<String>,
840    /// Optional. The duration after which the workload will be terminated, specified as the JSON representation for Duration (https://protobuf.dev/programming-guides/proto3/#json). When the workload exceeds this duration, it will be unconditionally terminated without waiting for ongoing work to finish. If ttl is not specified for a batch workload, the workload will be allowed to run until it exits naturally (or run forever without exiting). If ttl is not specified for an interactive session, it defaults to 24 hours. If ttl is not specified for a batch that uses 2.1+ runtime version, it defaults to 4 hours. Minimum value is 10 minutes; maximum value is 14 days. If both ttl and idle_ttl are specified (for an interactive session), the conditions are treated as OR conditions: the workload will be terminated when it has been idle for idle_ttl or when ttl has been exceeded, whichever occurs first.
841    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
842    pub ttl: Option<chrono::Duration>,
843}
844
845impl common::Part for ExecutionConfig {}
846
847/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec.Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
848///
849/// This type is not used in any activity, and only used as *part* of another schema.
850///
851#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
852#[serde_with::serde_as]
853#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
854pub struct Expr {
855    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
856    pub description: Option<String>,
857    /// Textual representation of an expression in Common Expression Language syntax.
858    pub expression: Option<String>,
859    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
860    pub location: Option<String>,
861    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
862    pub title: Option<String>,
863}
864
865impl common::Part for Expr {}
866
867/// A Dataproc job for running Apache Flink applications on YARN.
868///
869/// This type is not used in any activity, and only used as *part* of another schema.
870///
871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
872#[serde_with::serde_as]
873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
874pub struct FlinkJob {
875    /// Optional. The arguments to pass to the driver. Do not include arguments, such as --conf, that can be set as job properties, since a collision might occur that causes an incorrect job submission.
876    pub args: Option<Vec<String>>,
877    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the Flink driver and tasks.
878    #[serde(rename = "jarFileUris")]
879    pub jar_file_uris: Option<Vec<String>>,
880    /// Optional. The runtime log config for job execution.
881    #[serde(rename = "loggingConfig")]
882    pub logging_config: Option<LoggingConfig>,
883    /// The name of the driver's main class. The jar file that contains the class must be in the default CLASSPATH or specified in jarFileUris.
884    #[serde(rename = "mainClass")]
885    pub main_class: Option<String>,
886    /// The HCFS URI of the jar file that contains the main class.
887    #[serde(rename = "mainJarFileUri")]
888    pub main_jar_file_uri: Option<String>,
889    /// Optional. A mapping of property names to values, used to configure Flink. Properties that conflict with values set by the Dataproc API might beoverwritten. Can include properties set in/etc/flink/conf/flink-defaults.conf and classes in user code.
890    pub properties: Option<HashMap<String, String>>,
891    /// Optional. HCFS URI of the savepoint, which contains the last saved progress for starting the current job.
892    #[serde(rename = "savepointUri")]
893    pub savepoint_uri: Option<String>,
894}
895
896impl common::Part for FlinkJob {}
897
898/// Common config settings for resources of Compute Engine cluster instances, applicable to all instances in the cluster.
899///
900/// This type is not used in any activity, and only used as *part* of another schema.
901///
902#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
903#[serde_with::serde_as]
904#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
905pub struct GceClusterConfig {
906    /// Optional. Confidential Instance Config for clusters using Confidential VMs (https://cloud.google.com/compute/confidential-vm/docs).
907    #[serde(rename = "confidentialInstanceConfig")]
908    pub confidential_instance_config: Option<ConfidentialInstanceConfig>,
909    /// Optional. This setting applies to subnetwork-enabled networks. It is set to true by default in clusters created with image versions 2.2.x.When set to true: All cluster VMs have internal IP addresses. Google Private Access (https://cloud.google.com/vpc/docs/private-google-access) must be enabled to access Dataproc and other Google Cloud APIs. Off-cluster dependencies must be configured to be accessible without external IP addresses.When set to false: Cluster VMs are not restricted to internal IP addresses. Ephemeral external IP addresses are assigned to each cluster VM.
910    #[serde(rename = "internalIpOnly")]
911    pub internal_ip_only: Option<bool>,
912    /// Optional. The Compute Engine metadata entries to add to all instances (see Project and instance metadata (https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
913    pub metadata: Option<HashMap<String, String>>,
914    /// Optional. The Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither network_uri nor subnetwork_uri is specified, the "default" network of the project is used, if it exists. Cannot be a "Custom Subnet Network" (see Using Subnetworks (https://cloud.google.com/compute/docs/subnetworks) for more information).A full URL, partial URI, or short name are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/global/networks/default projects/[project_id]/global/networks/default default
915    #[serde(rename = "networkUri")]
916    pub network_uri: Option<String>,
917    /// Optional. Node Group Affinity for sole-tenant clusters.
918    #[serde(rename = "nodeGroupAffinity")]
919    pub node_group_affinity: Option<NodeGroupAffinity>,
920    /// Optional. The type of IPv6 access for a cluster.
921    #[serde(rename = "privateIpv6GoogleAccess")]
922    pub private_ipv6_google_access: Option<String>,
923    /// Optional. Reservation Affinity for consuming Zonal reservation.
924    #[serde(rename = "reservationAffinity")]
925    pub reservation_affinity: Option<ReservationAffinity>,
926    /// Optional. The Dataproc service account (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/service-accounts#service_accounts_in_dataproc) (also see VM Data Plane identity (https://cloud.google.com/dataproc/docs/concepts/iam/dataproc-principals#vm_service_account_data_plane_identity)) used by Dataproc cluster VM instances to access Google Cloud Platform services.If not specified, the Compute Engine default service account (https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) is used.
927    #[serde(rename = "serviceAccount")]
928    pub service_account: Option<String>,
929    /// Optional. The URIs of service account scopes to be included in Compute Engine instances. The following base set of scopes is always included: https://www.googleapis.com/auth/cloud.useraccounts.readonly https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/logging.writeIf no scopes are specified, the following defaults are also provided: https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/bigtable.admin.table https://www.googleapis.com/auth/bigtable.data https://www.googleapis.com/auth/devstorage.full_control
930    #[serde(rename = "serviceAccountScopes")]
931    pub service_account_scopes: Option<Vec<String>>,
932    /// Optional. Shielded Instance Config for clusters using Compute Engine Shielded VMs (https://cloud.google.com/security/shielded-cloud/shielded-vm).
933    #[serde(rename = "shieldedInstanceConfig")]
934    pub shielded_instance_config: Option<ShieldedInstanceConfig>,
935    /// Optional. The Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri.A full URL, partial URI, or short name are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/regions/[region]/subnetworks/sub0 projects/[project_id]/regions/[region]/subnetworks/sub0 sub0
936    #[serde(rename = "subnetworkUri")]
937    pub subnetwork_uri: Option<String>,
938    /// The Compute Engine network tags to add to all instances (see Tagging instances (https://cloud.google.com/vpc/docs/add-remove-network-tags)).
939    pub tags: Option<Vec<String>>,
940    /// Optional. The Compute Engine zone where the Dataproc cluster will be located. If omitted, the service will pick a zone in the cluster's Compute Engine region. On a get request, zone will always be present.A full URL, partial URI, or short name are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone] projects/[project_id]/zones/[zone] [zone]
941    #[serde(rename = "zoneUri")]
942    pub zone_uri: Option<String>,
943}
944
945impl common::Part for GceClusterConfig {}
946
947/// Request message for GetIamPolicy method.
948///
949/// # Activities
950///
951/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
952/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
953///
954/// * [locations autoscaling policies get iam policy projects](ProjectLocationAutoscalingPolicyGetIamPolicyCall) (request)
955/// * [locations workflow templates get iam policy projects](ProjectLocationWorkflowTemplateGetIamPolicyCall) (request)
956/// * [regions autoscaling policies get iam policy projects](ProjectRegionAutoscalingPolicyGetIamPolicyCall) (request)
957/// * [regions clusters get iam policy projects](ProjectRegionClusterGetIamPolicyCall) (request)
958/// * [regions jobs get iam policy projects](ProjectRegionJobGetIamPolicyCall) (request)
959/// * [regions operations get iam policy projects](ProjectRegionOperationGetIamPolicyCall) (request)
960/// * [regions workflow templates get iam policy projects](ProjectRegionWorkflowTemplateGetIamPolicyCall) (request)
961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
962#[serde_with::serde_as]
963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
964pub struct GetIamPolicyRequest {
965    /// OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
966    pub options: Option<GetPolicyOptions>,
967}
968
969impl common::RequestValue for GetIamPolicyRequest {}
970
971/// Encapsulates settings provided to GetIamPolicy.
972///
973/// This type is not used in any activity, and only used as *part* of another schema.
974///
975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
976#[serde_with::serde_as]
977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
978pub struct GetPolicyOptions {
979    /// Optional. The maximum policy version that will be used to format the policy.Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected.Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset.The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1.To learn which resources support conditions in their IAM policies, see the IAM documentation (https://cloud.google.com/iam/help/conditions/resource-policies).
980    #[serde(rename = "requestedPolicyVersion")]
981    pub requested_policy_version: Option<i32>,
982}
983
984impl common::Part for GetPolicyOptions {}
985
986/// The cluster's GKE config.
987///
988/// This type is not used in any activity, and only used as *part* of another schema.
989///
990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
991#[serde_with::serde_as]
992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
993pub struct GkeClusterConfig {
994    /// Optional. A target GKE cluster to deploy to. It must be in the same project and region as the Dataproc cluster (the GKE cluster can be zonal or regional). Format: 'projects/{project}/locations/{location}/clusters/{cluster_id}'
995    #[serde(rename = "gkeClusterTarget")]
996    pub gke_cluster_target: Option<String>,
997    /// Optional. Deprecated. Use gkeClusterTarget. Used only for the deprecated beta. A target for the deployment.
998    #[serde(rename = "namespacedGkeDeploymentTarget")]
999    pub namespaced_gke_deployment_target: Option<NamespacedGkeDeploymentTarget>,
1000    /// Optional. GKE node pools where workloads will be scheduled. At least one node pool must be assigned the DEFAULT GkeNodePoolTarget.Role. If a GkeNodePoolTarget is not specified, Dataproc constructs a DEFAULT GkeNodePoolTarget. Each role can be given to only one GkeNodePoolTarget. All node pools must have the same location settings.
1001    #[serde(rename = "nodePoolTarget")]
1002    pub node_pool_target: Option<Vec<GkeNodePoolTarget>>,
1003}
1004
1005impl common::Part for GkeClusterConfig {}
1006
1007/// Parameters that describe cluster nodes.
1008///
1009/// This type is not used in any activity, and only used as *part* of another schema.
1010///
1011#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1012#[serde_with::serde_as]
1013#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1014pub struct GkeNodeConfig {
1015    /// Optional. A list of hardware accelerators (https://cloud.google.com/compute/docs/gpus) to attach to each node.
1016    pub accelerators: Option<Vec<GkeNodePoolAcceleratorConfig>>,
1017    /// Optional. The Customer Managed Encryption Key (CMEK) (https://cloud.google.com/kubernetes-engine/docs/how-to/using-cmek) used to encrypt the boot disk attached to each node in the node pool. Specify the key using the following format: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
1018    #[serde(rename = "bootDiskKmsKey")]
1019    pub boot_disk_kms_key: Option<String>,
1020    /// Optional. The number of local SSD disks to attach to the node, which is limited by the maximum number of disks allowable per zone (see Adding Local SSDs (https://cloud.google.com/compute/docs/disks/local-ssd)).
1021    #[serde(rename = "localSsdCount")]
1022    pub local_ssd_count: Option<i32>,
1023    /// Optional. The name of a Compute Engine machine type (https://cloud.google.com/compute/docs/machine-types).
1024    #[serde(rename = "machineType")]
1025    pub machine_type: Option<String>,
1026    /// Optional. Minimum CPU platform (https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform) to be used by this instance. The instance may be scheduled on the specified or a newer CPU platform. Specify the friendly names of CPU platforms, such as "Intel Haswell"` or Intel Sandy Bridge".
1027    #[serde(rename = "minCpuPlatform")]
1028    pub min_cpu_platform: Option<String>,
1029    /// Optional. Whether the nodes are created as legacy preemptible VM instances (https://cloud.google.com/compute/docs/instances/preemptible). Also see Spot VMs, preemptible VM instances without a maximum lifetime. Legacy and Spot preemptible nodes cannot be used in a node pool with the CONTROLLER role or in the DEFAULT node pool if the CONTROLLER role is not assigned (the DEFAULT node pool will assume the CONTROLLER role).
1030    pub preemptible: Option<bool>,
1031    /// Optional. Whether the nodes are created as Spot VM instances (https://cloud.google.com/compute/docs/instances/spot). Spot VMs are the latest update to legacy preemptible VMs. Spot VMs do not have a maximum lifetime. Legacy and Spot preemptible nodes cannot be used in a node pool with the CONTROLLER role or in the DEFAULT node pool if the CONTROLLER role is not assigned (the DEFAULT node pool will assume the CONTROLLER role).
1032    pub spot: Option<bool>,
1033}
1034
1035impl common::Part for GkeNodeConfig {}
1036
1037/// A GkeNodeConfigAcceleratorConfig represents a Hardware Accelerator request for a node pool.
1038///
1039/// This type is not used in any activity, and only used as *part* of another schema.
1040///
1041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1042#[serde_with::serde_as]
1043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1044pub struct GkeNodePoolAcceleratorConfig {
1045    /// The number of accelerator cards exposed to an instance.
1046    #[serde(rename = "acceleratorCount")]
1047    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1048    pub accelerator_count: Option<i64>,
1049    /// The accelerator type resource namename (see GPUs on Compute Engine).
1050    #[serde(rename = "acceleratorType")]
1051    pub accelerator_type: Option<String>,
1052    /// Size of partitions to create on the GPU. Valid values are described in the NVIDIA mig user guide (https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
1053    #[serde(rename = "gpuPartitionSize")]
1054    pub gpu_partition_size: Option<String>,
1055}
1056
1057impl common::Part for GkeNodePoolAcceleratorConfig {}
1058
1059/// GkeNodePoolAutoscaling contains information the cluster autoscaler needs to adjust the size of the node pool to the current cluster usage.
1060///
1061/// This type is not used in any activity, and only used as *part* of another schema.
1062///
1063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1064#[serde_with::serde_as]
1065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1066pub struct GkeNodePoolAutoscalingConfig {
1067    /// The maximum number of nodes in the node pool. Must be >= min_node_count, and must be > 0. Note: Quota must be sufficient to scale up the cluster.
1068    #[serde(rename = "maxNodeCount")]
1069    pub max_node_count: Option<i32>,
1070    /// The minimum number of nodes in the node pool. Must be >= 0 and <= max_node_count.
1071    #[serde(rename = "minNodeCount")]
1072    pub min_node_count: Option<i32>,
1073}
1074
1075impl common::Part for GkeNodePoolAutoscalingConfig {}
1076
1077/// The configuration of a GKE node pool used by a Dataproc-on-GKE cluster (https://cloud.google.com/dataproc/docs/concepts/jobs/dataproc-gke#create-a-dataproc-on-gke-cluster).
1078///
1079/// This type is not used in any activity, and only used as *part* of another schema.
1080///
1081#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1082#[serde_with::serde_as]
1083#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1084pub struct GkeNodePoolConfig {
1085    /// Optional. The autoscaler configuration for this node pool. The autoscaler is enabled only when a valid configuration is present.
1086    pub autoscaling: Option<GkeNodePoolAutoscalingConfig>,
1087    /// Optional. The node pool configuration.
1088    pub config: Option<GkeNodeConfig>,
1089    /// Optional. The list of Compute Engine zones (https://cloud.google.com/compute/docs/zones#available) where node pool nodes associated with a Dataproc on GKE virtual cluster will be located.Note: All node pools associated with a virtual cluster must be located in the same region as the virtual cluster, and they must be located in the same zone within that region.If a location is not specified during node pool creation, Dataproc on GKE will choose the zone.
1090    pub locations: Option<Vec<String>>,
1091}
1092
1093impl common::Part for GkeNodePoolConfig {}
1094
1095/// GKE node pools that Dataproc workloads run on.
1096///
1097/// This type is not used in any activity, and only used as *part* of another schema.
1098///
1099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1100#[serde_with::serde_as]
1101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1102pub struct GkeNodePoolTarget {
1103    /// Required. The target GKE node pool. Format: 'projects/{project}/locations/{location}/clusters/{cluster}/nodePools/{node_pool}'
1104    #[serde(rename = "nodePool")]
1105    pub node_pool: Option<String>,
1106    /// Input only. The configuration for the GKE node pool.If specified, Dataproc attempts to create a node pool with the specified shape. If one with the same name already exists, it is verified against all specified fields. If a field differs, the virtual cluster creation will fail.If omitted, any node pool with the specified name is used. If a node pool with the specified name does not exist, Dataproc create a node pool with default values.This is an input only field. It will not be returned by the API.
1107    #[serde(rename = "nodePoolConfig")]
1108    pub node_pool_config: Option<GkeNodePoolConfig>,
1109    /// Required. The roles associated with the GKE node pool.
1110    pub roles: Option<Vec<String>>,
1111}
1112
1113impl common::Part for GkeNodePoolTarget {}
1114
1115/// Encryption settings for encrypting workflow template job arguments.
1116///
1117/// This type is not used in any activity, and only used as *part* of another schema.
1118///
1119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1120#[serde_with::serde_as]
1121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1122pub struct GoogleCloudDataprocV1WorkflowTemplateEncryptionConfig {
1123    /// Optional. The Cloud KMS key name to use for encrypting workflow template job arguments.When this this key is provided, the following workflow template job arguments (https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows#adding_jobs_to_a_template), if present, are CMEK encrypted (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/customer-managed-encryption#use_cmek_with_workflow_template_data): FlinkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/FlinkJob) HadoopJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/HadoopJob) SparkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkJob) SparkRJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkRJob) PySparkJob args (https://cloud.google.com/dataproc/docs/reference/rest/v1/PySparkJob) SparkSqlJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/SparkSqlJob) scriptVariables and queryList.queries HiveJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/HiveJob) scriptVariables and queryList.queries PigJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/PigJob) scriptVariables and queryList.queries PrestoJob (https://cloud.google.com/dataproc/docs/reference/rest/v1/PrestoJob) scriptVariables and queryList.queries
1124    #[serde(rename = "kmsKey")]
1125    pub kms_key: Option<String>,
1126}
1127
1128impl common::Part for GoogleCloudDataprocV1WorkflowTemplateEncryptionConfig {}
1129
1130/// A Dataproc job for running Apache Hadoop MapReduce (https://hadoop.apache.org/docs/current/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html) jobs on Apache Hadoop YARN (https://hadoop.apache.org/docs/r2.7.1/hadoop-yarn/hadoop-yarn-site/YARN.html).
1131///
1132/// This type is not used in any activity, and only used as *part* of another schema.
1133///
1134#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1135#[serde_with::serde_as]
1136#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1137pub struct HadoopJob {
1138    /// Optional. HCFS URIs of archives to be extracted in the working directory of Hadoop drivers and tasks. Supported file types: .jar, .tar, .tar.gz, .tgz, or .zip.
1139    #[serde(rename = "archiveUris")]
1140    pub archive_uris: Option<Vec<String>>,
1141    /// Optional. The arguments to pass to the driver. Do not include arguments, such as -libjars or -Dfoo=bar, that can be set as job properties, since a collision might occur that causes an incorrect job submission.
1142    pub args: Option<Vec<String>>,
1143    /// Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied to the working directory of Hadoop drivers and distributed tasks. Useful for naively parallel tasks.
1144    #[serde(rename = "fileUris")]
1145    pub file_uris: Option<Vec<String>>,
1146    /// Optional. Jar file URIs to add to the CLASSPATHs of the Hadoop driver and tasks.
1147    #[serde(rename = "jarFileUris")]
1148    pub jar_file_uris: Option<Vec<String>>,
1149    /// Optional. The runtime log config for job execution.
1150    #[serde(rename = "loggingConfig")]
1151    pub logging_config: Option<LoggingConfig>,
1152    /// The name of the driver's main class. The jar file containing the class must be in the default CLASSPATH or specified in jar_file_uris.
1153    #[serde(rename = "mainClass")]
1154    pub main_class: Option<String>,
1155    /// The HCFS URI of the jar file containing the main class. Examples: 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar' 'hdfs:/tmp/test-samples/custom-wordcount.jar' 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar'
1156    #[serde(rename = "mainJarFileUri")]
1157    pub main_jar_file_uri: Option<String>,
1158    /// Optional. A mapping of property names to values, used to configure Hadoop. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/hadoop/conf/*-site and classes in user code.
1159    pub properties: Option<HashMap<String, String>>,
1160}
1161
1162impl common::Part for HadoopJob {}
1163
1164/// A Dataproc job for running Apache Hive (https://hive.apache.org/) queries on YARN.
1165///
1166/// This type is not used in any activity, and only used as *part* of another schema.
1167///
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct HiveJob {
1172    /// Optional. Whether to continue executing queries if a query fails. The default value is false. Setting to true can be useful when executing independent parallel queries.
1173    #[serde(rename = "continueOnFailure")]
1174    pub continue_on_failure: Option<bool>,
1175    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes and UDFs.
1176    #[serde(rename = "jarFileUris")]
1177    pub jar_file_uris: Option<Vec<String>>,
1178    /// Optional. A mapping of property names and values, used to configure Hive. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, /etc/hive/conf/hive-site.xml, and classes in user code.
1179    pub properties: Option<HashMap<String, String>>,
1180    /// The HCFS URI of the script that contains Hive queries.
1181    #[serde(rename = "queryFileUri")]
1182    pub query_file_uri: Option<String>,
1183    /// A list of queries.
1184    #[serde(rename = "queryList")]
1185    pub query_list: Option<QueryList>,
1186    /// Optional. Mapping of query variable names to values (equivalent to the Hive command: SET name="value";).
1187    #[serde(rename = "scriptVariables")]
1188    pub script_variables: Option<HashMap<String, String>>,
1189}
1190
1191impl common::Part for HiveJob {}
1192
1193/// Identity related configuration, including service account based secure multi-tenancy user mappings.
1194///
1195/// This type is not used in any activity, and only used as *part* of another schema.
1196///
1197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1198#[serde_with::serde_as]
1199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1200pub struct IdentityConfig {
1201    /// Required. Map of user to service account.
1202    #[serde(rename = "userServiceAccountMapping")]
1203    pub user_service_account_mapping: Option<HashMap<String, String>>,
1204}
1205
1206impl common::Part for IdentityConfig {}
1207
1208/// A request to inject credentials into a cluster.
1209///
1210/// # Activities
1211///
1212/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1213/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1214///
1215/// * [regions clusters inject credentials projects](ProjectRegionClusterInjectCredentialCall) (request)
1216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1217#[serde_with::serde_as]
1218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1219pub struct InjectCredentialsRequest {
1220    /// Required. The cluster UUID.
1221    #[serde(rename = "clusterUuid")]
1222    pub cluster_uuid: Option<String>,
1223    /// Required. The encrypted credentials being injected in to the cluster.The client is responsible for encrypting the credentials in a way that is supported by the cluster.A wrapped value is used here so that the actual contents of the encrypted credentials are not written to audit logs.
1224    #[serde(rename = "credentialsCiphertext")]
1225    pub credentials_ciphertext: Option<String>,
1226}
1227
1228impl common::RequestValue for InjectCredentialsRequest {}
1229
1230/// Instance flexibility Policy allowing a mixture of VM shapes and provisioning models.
1231///
1232/// This type is not used in any activity, and only used as *part* of another schema.
1233///
1234#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1235#[serde_with::serde_as]
1236#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1237pub struct InstanceFlexibilityPolicy {
1238    /// Optional. List of instance selection options that the group will use when creating new VMs.
1239    #[serde(rename = "instanceSelectionList")]
1240    pub instance_selection_list: Option<Vec<InstanceSelection>>,
1241    /// Output only. A list of instance selection results in the group.
1242    #[serde(rename = "instanceSelectionResults")]
1243    pub instance_selection_results: Option<Vec<InstanceSelectionResult>>,
1244}
1245
1246impl common::Part for InstanceFlexibilityPolicy {}
1247
1248/// Configuration for the size bounds of an instance group, including its proportional size to other groups.
1249///
1250/// This type is not used in any activity, and only used as *part* of another schema.
1251///
1252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1253#[serde_with::serde_as]
1254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1255pub struct InstanceGroupAutoscalingPolicyConfig {
1256    /// Required. Maximum number of instances for this group. Required for primary workers. Note that by default, clusters will not use secondary workers. Required for secondary workers if the minimum secondary instances is set.Primary workers - Bounds: [min_instances, ). Secondary workers - Bounds: [min_instances, ). Default: 0.
1257    #[serde(rename = "maxInstances")]
1258    pub max_instances: Option<i32>,
1259    /// Optional. Minimum number of instances for this group.Primary workers - Bounds: 2, max_instances. Default: 2. Secondary workers - Bounds: 0, max_instances. Default: 0.
1260    #[serde(rename = "minInstances")]
1261    pub min_instances: Option<i32>,
1262    /// Optional. Weight for the instance group, which is used to determine the fraction of total workers in the cluster from this instance group. For example, if primary workers have weight 2, and secondary workers have weight 1, the cluster will have approximately 2 primary workers for each secondary worker.The cluster may not reach the specified balance if constrained by min/max bounds or other autoscaling settings. For example, if max_instances for secondary workers is 0, then only primary workers will be added. The cluster can also be out of balance when created.If weight is not set on any instance group, the cluster will default to equal weight for all groups: the cluster will attempt to maintain an equal number of workers in each group within the configured size bounds for each group. If weight is set for one group only, the cluster will default to zero weight on the unset group. For example if weight is set only on primary workers, the cluster will use primary workers only and no secondary workers.
1263    pub weight: Option<i32>,
1264}
1265
1266impl common::Part for InstanceGroupAutoscalingPolicyConfig {}
1267
1268/// The config settings for Compute Engine resources in an instance group, such as a master or worker group.
1269///
1270/// This type is not used in any activity, and only used as *part* of another schema.
1271///
1272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1273#[serde_with::serde_as]
1274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1275pub struct InstanceGroupConfig {
1276    /// Optional. The Compute Engine accelerator configuration for these instances.
1277    pub accelerators: Option<Vec<AcceleratorConfig>>,
1278    /// Optional. Disk option config settings.
1279    #[serde(rename = "diskConfig")]
1280    pub disk_config: Option<DiskConfig>,
1281    /// Optional. The Compute Engine image resource used for cluster instances.The URI can represent an image or image family.Image examples: https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/[image-id] projects/[project_id]/global/images/[image-id] image-idImage family examples. Dataproc will use the most recent image from the family: https://www.googleapis.com/compute/v1/projects/[project_id]/global/images/family/[custom-image-family-name] projects/[project_id]/global/images/family/[custom-image-family-name]If the URI is unspecified, it will be inferred from SoftwareConfig.image_version or the system default.
1282    #[serde(rename = "imageUri")]
1283    pub image_uri: Option<String>,
1284    /// Optional. Instance flexibility Policy allowing a mixture of VM shapes and provisioning models.
1285    #[serde(rename = "instanceFlexibilityPolicy")]
1286    pub instance_flexibility_policy: Option<InstanceFlexibilityPolicy>,
1287    /// Output only. The list of instance names. Dataproc derives the names from cluster_name, num_instances, and the instance group.
1288    #[serde(rename = "instanceNames")]
1289    pub instance_names: Option<Vec<String>>,
1290    /// Output only. List of references to Compute Engine instances.
1291    #[serde(rename = "instanceReferences")]
1292    pub instance_references: Option<Vec<InstanceReference>>,
1293    /// Output only. Specifies that this instance group contains preemptible instances.
1294    #[serde(rename = "isPreemptible")]
1295    pub is_preemptible: Option<bool>,
1296    /// Optional. The Compute Engine machine type used for cluster instances.A full URL, partial URI, or short name are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2 projects/[project_id]/zones/[zone]/machineTypes/n1-standard-2 n1-standard-2Auto Zone Exception: If you are using the Dataproc Auto Zone Placement (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) feature, you must use the short name of the machine type resource, for example, n1-standard-2.
1297    #[serde(rename = "machineTypeUri")]
1298    pub machine_type_uri: Option<String>,
1299    /// Output only. The config for Compute Engine Instance Group Manager that manages this group. This is only used for preemptible instance groups.
1300    #[serde(rename = "managedGroupConfig")]
1301    pub managed_group_config: Option<ManagedGroupConfig>,
1302    /// Optional. Specifies the minimum cpu platform for the Instance Group. See Dataproc -> Minimum CPU Platform (https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu).
1303    #[serde(rename = "minCpuPlatform")]
1304    pub min_cpu_platform: Option<String>,
1305    /// Optional. The minimum number of primary worker instances to create. If min_num_instances is set, cluster creation will succeed if the number of primary workers created is at least equal to the min_num_instances number.Example: Cluster creation request with num_instances = 5 and min_num_instances = 3: If 4 VMs are created and 1 instance fails, the failed VM is deleted. The cluster is resized to 4 instances and placed in a RUNNING state. If 2 instances are created and 3 instances fail, the cluster in placed in an ERROR state. The failed VMs are not deleted.
1306    #[serde(rename = "minNumInstances")]
1307    pub min_num_instances: Option<i32>,
1308    /// Optional. The number of VM instances in the instance group. For HA cluster master_config groups, must be set to 3. For standard cluster master_config groups, must be set to 1.
1309    #[serde(rename = "numInstances")]
1310    pub num_instances: Option<i32>,
1311    /// Optional. Specifies the preemptibility of the instance group.The default value for master and worker groups is NON_PREEMPTIBLE. This default cannot be changed.The default value for secondary instances is PREEMPTIBLE.
1312    pub preemptibility: Option<String>,
1313    /// Optional. Configuration to handle the startup of instances during cluster create and update process.
1314    #[serde(rename = "startupConfig")]
1315    pub startup_config: Option<StartupConfig>,
1316}
1317
1318impl common::Part for InstanceGroupConfig {}
1319
1320/// A reference to a Compute Engine instance.
1321///
1322/// This type is not used in any activity, and only used as *part* of another schema.
1323///
1324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1325#[serde_with::serde_as]
1326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1327pub struct InstanceReference {
1328    /// The unique identifier of the Compute Engine instance.
1329    #[serde(rename = "instanceId")]
1330    pub instance_id: Option<String>,
1331    /// The user-friendly name of the Compute Engine instance.
1332    #[serde(rename = "instanceName")]
1333    pub instance_name: Option<String>,
1334    /// The public ECIES key used for sharing data with this instance.
1335    #[serde(rename = "publicEciesKey")]
1336    pub public_ecies_key: Option<String>,
1337    /// The public RSA key used for sharing data with this instance.
1338    #[serde(rename = "publicKey")]
1339    pub public_key: Option<String>,
1340}
1341
1342impl common::Part for InstanceReference {}
1343
1344/// Defines machines types and a rank to which the machines types belong.
1345///
1346/// This type is not used in any activity, and only used as *part* of another schema.
1347///
1348#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1349#[serde_with::serde_as]
1350#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1351pub struct InstanceSelection {
1352    /// Optional. Full machine-type names, e.g. "n1-standard-16".
1353    #[serde(rename = "machineTypes")]
1354    pub machine_types: Option<Vec<String>>,
1355    /// Optional. Preference of this instance selection. Lower number means higher preference. Dataproc will first try to create a VM based on the machine-type with priority rank and fallback to next rank based on availability. Machine types and instance selections with the same priority have the same preference.
1356    pub rank: Option<i32>,
1357}
1358
1359impl common::Part for InstanceSelection {}
1360
1361/// Defines a mapping from machine types to the number of VMs that are created with each machine type.
1362///
1363/// This type is not used in any activity, and only used as *part* of another schema.
1364///
1365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1366#[serde_with::serde_as]
1367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1368pub struct InstanceSelectionResult {
1369    /// Output only. Full machine-type names, e.g. "n1-standard-16".
1370    #[serde(rename = "machineType")]
1371    pub machine_type: Option<String>,
1372    /// Output only. Number of VM provisioned with the machine_type.
1373    #[serde(rename = "vmCount")]
1374    pub vm_count: Option<i32>,
1375}
1376
1377impl common::Part for InstanceSelectionResult {}
1378
1379/// A request to instantiate a workflow template.
1380///
1381/// # Activities
1382///
1383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1385///
1386/// * [locations workflow templates instantiate projects](ProjectLocationWorkflowTemplateInstantiateCall) (request)
1387/// * [regions workflow templates instantiate projects](ProjectRegionWorkflowTemplateInstantiateCall) (request)
1388#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1389#[serde_with::serde_as]
1390#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1391pub struct InstantiateWorkflowTemplateRequest {
1392    /// Optional. Map from parameter names to values that should be used for those parameters. Values may not exceed 1000 characters.
1393    pub parameters: Option<HashMap<String, String>>,
1394    /// Optional. A tag that prevents multiple concurrent workflow instances with the same tag from running. This mitigates risk of concurrent instances started due to retries.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The tag must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
1395    #[serde(rename = "requestId")]
1396    pub request_id: Option<String>,
1397    /// Optional. The version of workflow template to instantiate. If specified, the workflow will be instantiated only if the current version of the workflow template has the supplied version.This option cannot be used to instantiate a previous version of workflow template.
1398    pub version: Option<i32>,
1399}
1400
1401impl common::RequestValue for InstantiateWorkflowTemplateRequest {}
1402
1403/// Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive).The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.
1404///
1405/// This type is not used in any activity, and only used as *part* of another schema.
1406///
1407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1408#[serde_with::serde_as]
1409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1410pub struct Interval {
1411    /// Optional. Exclusive end of the interval.If specified, a Timestamp matching this interval will have to be before the end.
1412    #[serde(rename = "endTime")]
1413    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1414    /// Optional. Inclusive start of the interval.If specified, a Timestamp matching this interval will have to be the same or after the start.
1415    #[serde(rename = "startTime")]
1416    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1417}
1418
1419impl common::Part for Interval {}
1420
1421/// A Dataproc job resource.
1422///
1423/// # Activities
1424///
1425/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1426/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1427///
1428/// * [regions jobs cancel projects](ProjectRegionJobCancelCall) (response)
1429/// * [regions jobs get projects](ProjectRegionJobGetCall) (response)
1430/// * [regions jobs patch projects](ProjectRegionJobPatchCall) (request|response)
1431/// * [regions jobs submit projects](ProjectRegionJobSubmitCall) (response)
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct Job {
1436    /// Output only. Indicates whether the job is completed. If the value is false, the job is still in progress. If true, the job is completed, and status.state field will indicate if it was successful, failed, or cancelled.
1437    pub done: Option<bool>,
1438    /// Output only. If present, the location of miscellaneous control files which can be used as part of job setup and handling. If not present, control files might be placed in the same location as driver_output_uri.
1439    #[serde(rename = "driverControlFilesUri")]
1440    pub driver_control_files_uri: Option<String>,
1441    /// Output only. A URI pointing to the location of the stdout of the job's driver program.
1442    #[serde(rename = "driverOutputResourceUri")]
1443    pub driver_output_resource_uri: Option<String>,
1444    /// Optional. Driver scheduling configuration.
1445    #[serde(rename = "driverSchedulingConfig")]
1446    pub driver_scheduling_config: Option<DriverSchedulingConfig>,
1447    /// Optional. Job is a Flink job.
1448    #[serde(rename = "flinkJob")]
1449    pub flink_job: Option<FlinkJob>,
1450    /// Optional. Job is a Hadoop job.
1451    #[serde(rename = "hadoopJob")]
1452    pub hadoop_job: Option<HadoopJob>,
1453    /// Optional. Job is a Hive job.
1454    #[serde(rename = "hiveJob")]
1455    pub hive_job: Option<HiveJob>,
1456    /// Output only. A UUID that uniquely identifies a job within the project over time. This is in contrast to a user-settable reference.job_id that might be reused over time.
1457    #[serde(rename = "jobUuid")]
1458    pub job_uuid: Option<String>,
1459    /// Optional. The labels to associate with this job. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values can be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a job.
1460    pub labels: Option<HashMap<String, String>>,
1461    /// Optional. Job is a Pig job.
1462    #[serde(rename = "pigJob")]
1463    pub pig_job: Option<PigJob>,
1464    /// Required. Job information, including how, when, and where to run the job.
1465    pub placement: Option<JobPlacement>,
1466    /// Optional. Job is a Presto job.
1467    #[serde(rename = "prestoJob")]
1468    pub presto_job: Option<PrestoJob>,
1469    /// Optional. Job is a PySpark job.
1470    #[serde(rename = "pysparkJob")]
1471    pub pyspark_job: Option<PySparkJob>,
1472    /// Optional. The fully qualified reference to the job, which can be used to obtain the equivalent REST path of the job resource. If this property is not specified when a job is created, the server generates a job_id.
1473    pub reference: Option<JobReference>,
1474    /// Optional. Job scheduling configuration.
1475    pub scheduling: Option<JobScheduling>,
1476    /// Optional. Job is a Spark job.
1477    #[serde(rename = "sparkJob")]
1478    pub spark_job: Option<SparkJob>,
1479    /// Optional. Job is a SparkR job.
1480    #[serde(rename = "sparkRJob")]
1481    pub spark_r_job: Option<SparkRJob>,
1482    /// Optional. Job is a SparkSql job.
1483    #[serde(rename = "sparkSqlJob")]
1484    pub spark_sql_job: Option<SparkSqlJob>,
1485    /// Output only. The job status. Additional application-specific status information might be contained in the type_job and yarn_applications fields.
1486    pub status: Option<JobStatus>,
1487    /// Output only. The previous job status.
1488    #[serde(rename = "statusHistory")]
1489    pub status_history: Option<Vec<JobStatus>>,
1490    /// Optional. Job is a Trino job.
1491    #[serde(rename = "trinoJob")]
1492    pub trino_job: Option<TrinoJob>,
1493    /// Output only. The collection of YARN applications spun up by this job.Beta Feature: This report is available for testing purposes only. It might be changed before final release.
1494    #[serde(rename = "yarnApplications")]
1495    pub yarn_applications: Option<Vec<YarnApplication>>,
1496}
1497
1498impl common::RequestValue for Job {}
1499impl common::ResponseResult for Job {}
1500
1501/// Dataproc job config.
1502///
1503/// This type is not used in any activity, and only used as *part* of another schema.
1504///
1505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1506#[serde_with::serde_as]
1507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1508pub struct JobPlacement {
1509    /// Optional. Cluster labels to identify a cluster where the job will be submitted.
1510    #[serde(rename = "clusterLabels")]
1511    pub cluster_labels: Option<HashMap<String, String>>,
1512    /// Required. The name of the cluster where the job will be submitted.
1513    #[serde(rename = "clusterName")]
1514    pub cluster_name: Option<String>,
1515    /// Output only. A cluster UUID generated by the Dataproc service when the job is submitted.
1516    #[serde(rename = "clusterUuid")]
1517    pub cluster_uuid: Option<String>,
1518}
1519
1520impl common::Part for JobPlacement {}
1521
1522/// Encapsulates the full scoping used to reference a job.
1523///
1524/// This type is not used in any activity, and only used as *part* of another schema.
1525///
1526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1527#[serde_with::serde_as]
1528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1529pub struct JobReference {
1530    /// Optional. The job ID, which must be unique within the project.The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or hyphens (-). The maximum length is 100 characters.If not specified by the caller, the job ID will be provided by the server.
1531    #[serde(rename = "jobId")]
1532    pub job_id: Option<String>,
1533    /// Optional. The ID of the Google Cloud Platform project that the job belongs to. If specified, must match the request project ID.
1534    #[serde(rename = "projectId")]
1535    pub project_id: Option<String>,
1536}
1537
1538impl common::Part for JobReference {}
1539
1540/// Job scheduling options.
1541///
1542/// This type is not used in any activity, and only used as *part* of another schema.
1543///
1544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1545#[serde_with::serde_as]
1546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1547pub struct JobScheduling {
1548    /// Optional. Maximum number of times per hour a driver can be restarted as a result of driver exiting with non-zero code before job is reported failed.A job might be reported as thrashing if the driver exits with a non-zero code four times within a 10-minute window.Maximum value is 10.Note: This restartable job option is not supported in Dataproc workflow templates (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
1549    #[serde(rename = "maxFailuresPerHour")]
1550    pub max_failures_per_hour: Option<i32>,
1551    /// Optional. Maximum total number of times a driver can be restarted as a result of the driver exiting with a non-zero code. After the maximum number is reached, the job will be reported as failed.Maximum value is 240.Note: Currently, this restartable job option is not supported in Dataproc workflow templates (https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows#adding_jobs_to_a_template).
1552    #[serde(rename = "maxFailuresTotal")]
1553    pub max_failures_total: Option<i32>,
1554}
1555
1556impl common::Part for JobScheduling {}
1557
1558/// Dataproc job status.
1559///
1560/// This type is not used in any activity, and only used as *part* of another schema.
1561///
1562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1563#[serde_with::serde_as]
1564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1565pub struct JobStatus {
1566    /// Optional. Output only. Job state details, such as an error description if the state is ERROR.
1567    pub details: Option<String>,
1568    /// Output only. A state message specifying the overall job state.
1569    pub state: Option<String>,
1570    /// Output only. The time when this state was entered.
1571    #[serde(rename = "stateStartTime")]
1572    pub state_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1573    /// Output only. Additional state information, which includes status reported by the agent.
1574    pub substate: Option<String>,
1575}
1576
1577impl common::Part for JobStatus {}
1578
1579/// Jupyter configuration for an interactive session.
1580///
1581/// This type is not used in any activity, and only used as *part* of another schema.
1582///
1583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1584#[serde_with::serde_as]
1585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1586pub struct JupyterConfig {
1587    /// Optional. Display name, shown in the Jupyter kernelspec card.
1588    #[serde(rename = "displayName")]
1589    pub display_name: Option<String>,
1590    /// Optional. Kernel
1591    pub kernel: Option<String>,
1592}
1593
1594impl common::Part for JupyterConfig {}
1595
1596/// Specifies Kerberos related configuration.
1597///
1598/// This type is not used in any activity, and only used as *part* of another schema.
1599///
1600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1601#[serde_with::serde_as]
1602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1603pub struct KerberosConfig {
1604    /// Optional. The admin server (IP or hostname) for the remote trusted realm in a cross realm trust relationship.
1605    #[serde(rename = "crossRealmTrustAdminServer")]
1606    pub cross_realm_trust_admin_server: Option<String>,
1607    /// Optional. The KDC (IP or hostname) for the remote trusted realm in a cross realm trust relationship.
1608    #[serde(rename = "crossRealmTrustKdc")]
1609    pub cross_realm_trust_kdc: Option<String>,
1610    /// Optional. The remote realm the Dataproc on-cluster KDC will trust, should the user enable cross realm trust.
1611    #[serde(rename = "crossRealmTrustRealm")]
1612    pub cross_realm_trust_realm: Option<String>,
1613    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the shared password between the on-cluster Kerberos realm and the remote trusted realm, in a cross realm trust relationship.
1614    #[serde(rename = "crossRealmTrustSharedPasswordUri")]
1615    pub cross_realm_trust_shared_password_uri: Option<String>,
1616    /// Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set this field to true to enable Kerberos on a cluster.
1617    #[serde(rename = "enableKerberos")]
1618    pub enable_kerberos: Option<bool>,
1619    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the master key of the KDC database.
1620    #[serde(rename = "kdcDbKeyUri")]
1621    pub kdc_db_key_uri: Option<String>,
1622    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided key. For the self-signed certificate, this password is generated by Dataproc.
1623    #[serde(rename = "keyPasswordUri")]
1624    pub key_password_uri: Option<String>,
1625    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided keystore. For the self-signed certificate, this password is generated by Dataproc.
1626    #[serde(rename = "keystorePasswordUri")]
1627    pub keystore_password_uri: Option<String>,
1628    /// Optional. The Cloud Storage URI of the keystore file used for SSL encryption. If not provided, Dataproc will provide a self-signed certificate.
1629    #[serde(rename = "keystoreUri")]
1630    pub keystore_uri: Option<String>,
1631    /// Optional. The URI of the KMS key used to encrypt sensitive files.
1632    #[serde(rename = "kmsKeyUri")]
1633    pub kms_key_uri: Option<String>,
1634    /// Optional. The name of the on-cluster Kerberos realm. If not specified, the uppercased domain of hostnames will be the realm.
1635    pub realm: Option<String>,
1636    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the root principal password.
1637    #[serde(rename = "rootPrincipalPasswordUri")]
1638    pub root_principal_password_uri: Option<String>,
1639    /// Optional. The lifetime of the ticket granting ticket, in hours. If not specified, or user specifies 0, then default value 10 will be used.
1640    #[serde(rename = "tgtLifetimeHours")]
1641    pub tgt_lifetime_hours: Option<i32>,
1642    /// Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided truststore. For the self-signed certificate, this password is generated by Dataproc.
1643    #[serde(rename = "truststorePasswordUri")]
1644    pub truststore_password_uri: Option<String>,
1645    /// Optional. The Cloud Storage URI of the truststore file used for SSL encryption. If not provided, Dataproc will provide a self-signed certificate.
1646    #[serde(rename = "truststoreUri")]
1647    pub truststore_uri: Option<String>,
1648}
1649
1650impl common::Part for KerberosConfig {}
1651
1652/// The configuration for running the Dataproc cluster on Kubernetes.
1653///
1654/// This type is not used in any activity, and only used as *part* of another schema.
1655///
1656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1657#[serde_with::serde_as]
1658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1659pub struct KubernetesClusterConfig {
1660    /// Required. The configuration for running the Dataproc cluster on GKE.
1661    #[serde(rename = "gkeClusterConfig")]
1662    pub gke_cluster_config: Option<GkeClusterConfig>,
1663    /// Optional. A namespace within the Kubernetes cluster to deploy into. If this namespace does not exist, it is created. If it exists, Dataproc verifies that another Dataproc VirtualCluster is not installed into it. If not specified, the name of the Dataproc Cluster is used.
1664    #[serde(rename = "kubernetesNamespace")]
1665    pub kubernetes_namespace: Option<String>,
1666    /// Optional. The software configuration for this Dataproc cluster running on Kubernetes.
1667    #[serde(rename = "kubernetesSoftwareConfig")]
1668    pub kubernetes_software_config: Option<KubernetesSoftwareConfig>,
1669}
1670
1671impl common::Part for KubernetesClusterConfig {}
1672
1673/// The software configuration for this Dataproc cluster running on Kubernetes.
1674///
1675/// This type is not used in any activity, and only used as *part* of another schema.
1676///
1677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1678#[serde_with::serde_as]
1679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1680pub struct KubernetesSoftwareConfig {
1681    /// The components that should be installed in this Dataproc cluster. The key must be a string from the KubernetesComponent enumeration. The value is the version of the software to be installed. At least one entry must be specified.
1682    #[serde(rename = "componentVersion")]
1683    pub component_version: Option<HashMap<String, String>>,
1684    /// The properties to set on daemon config files.Property keys are specified in prefix:property format, for example spark:spark.kubernetes.container.image. The following are supported prefixes and their mappings: spark: spark-defaults.confFor more information, see Cluster properties (https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
1685    pub properties: Option<HashMap<String, String>>,
1686}
1687
1688impl common::Part for KubernetesSoftwareConfig {}
1689
1690/// Specifies the cluster auto-delete schedule configuration.
1691///
1692/// This type is not used in any activity, and only used as *part* of another schema.
1693///
1694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1695#[serde_with::serde_as]
1696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1697pub struct LifecycleConfig {
1698    /// Optional. The time when cluster will be auto-deleted (see JSON representation of Timestamp (https://developers.google.com/protocol-buffers/docs/proto3#json)).
1699    #[serde(rename = "autoDeleteTime")]
1700    pub auto_delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1701    /// Optional. The lifetime duration of cluster. The cluster will be auto-deleted at the end of this period. Minimum value is 10 minutes; maximum value is 14 days (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).
1702    #[serde(rename = "autoDeleteTtl")]
1703    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1704    pub auto_delete_ttl: Option<chrono::Duration>,
1705    /// Optional. The duration to keep the cluster alive while idling (when no jobs are running). Passing this threshold will cause the cluster to be deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).
1706    #[serde(rename = "idleDeleteTtl")]
1707    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1708    pub idle_delete_ttl: Option<chrono::Duration>,
1709    /// Output only. The time when cluster became idle (most recent job finished) and became eligible for deletion due to idleness (see JSON representation of Timestamp (https://developers.google.com/protocol-buffers/docs/proto3#json)).
1710    #[serde(rename = "idleStartTime")]
1711    pub idle_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1712}
1713
1714impl common::Part for LifecycleConfig {}
1715
1716/// A response to a request to list autoscaling policies in a project.
1717///
1718/// # Activities
1719///
1720/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1721/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1722///
1723/// * [locations autoscaling policies list projects](ProjectLocationAutoscalingPolicyListCall) (response)
1724/// * [regions autoscaling policies list projects](ProjectRegionAutoscalingPolicyListCall) (response)
1725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1726#[serde_with::serde_as]
1727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1728pub struct ListAutoscalingPoliciesResponse {
1729    /// Output only. This token is included in the response if there are more results to fetch.
1730    #[serde(rename = "nextPageToken")]
1731    pub next_page_token: Option<String>,
1732    /// Output only. Autoscaling policies list.
1733    pub policies: Option<Vec<AutoscalingPolicy>>,
1734}
1735
1736impl common::ResponseResult for ListAutoscalingPoliciesResponse {}
1737
1738/// A list of batch workloads.
1739///
1740/// # Activities
1741///
1742/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1743/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1744///
1745/// * [locations batches list projects](ProjectLocationBatchListCall) (response)
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct ListBatchesResponse {
1750    /// Output only. The batches from the specified collection.
1751    pub batches: Option<Vec<Batch>>,
1752    /// A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
1753    #[serde(rename = "nextPageToken")]
1754    pub next_page_token: Option<String>,
1755    /// Output only. List of Batches that could not be included in the response. Attempting to get one of these resources may indicate why it was not included in the list response.
1756    pub unreachable: Option<Vec<String>>,
1757}
1758
1759impl common::ResponseResult for ListBatchesResponse {}
1760
1761/// The list of all clusters in a project.
1762///
1763/// # Activities
1764///
1765/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1766/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1767///
1768/// * [regions clusters list projects](ProjectRegionClusterListCall) (response)
1769#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1770#[serde_with::serde_as]
1771#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1772pub struct ListClustersResponse {
1773    /// Output only. The clusters in the project.
1774    pub clusters: Option<Vec<Cluster>>,
1775    /// Output only. This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the page_token in a subsequent ListClustersRequest.
1776    #[serde(rename = "nextPageToken")]
1777    pub next_page_token: Option<String>,
1778}
1779
1780impl common::ResponseResult for ListClustersResponse {}
1781
1782/// A list of jobs in a project.
1783///
1784/// # Activities
1785///
1786/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1787/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1788///
1789/// * [regions jobs list projects](ProjectRegionJobListCall) (response)
1790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1791#[serde_with::serde_as]
1792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1793pub struct ListJobsResponse {
1794    /// Output only. Jobs list.
1795    pub jobs: Option<Vec<Job>>,
1796    /// Optional. This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the page_token in a subsequent ListJobsRequest.
1797    #[serde(rename = "nextPageToken")]
1798    pub next_page_token: Option<String>,
1799    /// Output only. List of jobs with kms_key-encrypted parameters that could not be decrypted. A response to a jobs.get request may indicate the reason for the decryption failure for a specific job.
1800    pub unreachable: Option<Vec<String>>,
1801}
1802
1803impl common::ResponseResult for ListJobsResponse {}
1804
1805/// The response message for Operations.ListOperations.
1806///
1807/// # Activities
1808///
1809/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1810/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1811///
1812/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1813/// * [regions operations list projects](ProjectRegionOperationListCall) (response)
1814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1815#[serde_with::serde_as]
1816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1817pub struct ListOperationsResponse {
1818    /// The standard List next-page token.
1819    #[serde(rename = "nextPageToken")]
1820    pub next_page_token: Option<String>,
1821    /// A list of operations that matches the specified filter in the request.
1822    pub operations: Option<Vec<Operation>>,
1823}
1824
1825impl common::ResponseResult for ListOperationsResponse {}
1826
1827/// A list of session templates.
1828///
1829/// # Activities
1830///
1831/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1832/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1833///
1834/// * [locations session templates list projects](ProjectLocationSessionTemplateListCall) (response)
1835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1836#[serde_with::serde_as]
1837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1838pub struct ListSessionTemplatesResponse {
1839    /// A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
1840    #[serde(rename = "nextPageToken")]
1841    pub next_page_token: Option<String>,
1842    /// Output only. Session template list
1843    #[serde(rename = "sessionTemplates")]
1844    pub session_templates: Option<Vec<SessionTemplate>>,
1845}
1846
1847impl common::ResponseResult for ListSessionTemplatesResponse {}
1848
1849/// A list of interactive sessions.
1850///
1851/// # Activities
1852///
1853/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1854/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1855///
1856/// * [locations sessions list projects](ProjectLocationSessionListCall) (response)
1857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1858#[serde_with::serde_as]
1859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1860pub struct ListSessionsResponse {
1861    /// A token, which can be sent as page_token, to retrieve the next page. If this field is omitted, there are no subsequent pages.
1862    #[serde(rename = "nextPageToken")]
1863    pub next_page_token: Option<String>,
1864    /// Output only. The sessions from the specified collection.
1865    pub sessions: Option<Vec<Session>>,
1866}
1867
1868impl common::ResponseResult for ListSessionsResponse {}
1869
1870/// A response to a request to list workflow templates in a project.
1871///
1872/// # Activities
1873///
1874/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1875/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1876///
1877/// * [locations workflow templates list projects](ProjectLocationWorkflowTemplateListCall) (response)
1878/// * [regions workflow templates list projects](ProjectRegionWorkflowTemplateListCall) (response)
1879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1880#[serde_with::serde_as]
1881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1882pub struct ListWorkflowTemplatesResponse {
1883    /// Output only. This token is included in the response if there are more results to fetch. To fetch additional results, provide this value as the page_token in a subsequent ListWorkflowTemplatesRequest.
1884    #[serde(rename = "nextPageToken")]
1885    pub next_page_token: Option<String>,
1886    /// Output only. WorkflowTemplates list.
1887    pub templates: Option<Vec<WorkflowTemplate>>,
1888    /// Output only. List of workflow templates that could not be included in the response. Attempting to get one of these resources may indicate why it was not included in the list response.
1889    pub unreachable: Option<Vec<String>>,
1890}
1891
1892impl common::ResponseResult for ListWorkflowTemplatesResponse {}
1893
1894/// The runtime logging config of the job.
1895///
1896/// This type is not used in any activity, and only used as *part* of another schema.
1897///
1898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1899#[serde_with::serde_as]
1900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1901pub struct LoggingConfig {
1902    /// The per-package log levels for the driver. This can include "root" package name to configure rootLogger. Examples: - 'com.google = FATAL' - 'root = INFO' - 'org.apache = DEBUG'
1903    #[serde(rename = "driverLogLevels")]
1904    pub driver_log_levels: Option<HashMap<String, String>>,
1905}
1906
1907impl common::Part for LoggingConfig {}
1908
1909/// Cluster that is managed by the workflow.
1910///
1911/// This type is not used in any activity, and only used as *part* of another schema.
1912///
1913#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1914#[serde_with::serde_as]
1915#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1916pub struct ManagedCluster {
1917    /// Required. The cluster name prefix. A unique cluster name will be formed by appending a random suffix.The name must contain only lower-case letters (a-z), numbers (0-9), and hyphens (-). Must begin with a letter. Cannot begin or end with hyphen. Must consist of between 2 and 35 characters.
1918    #[serde(rename = "clusterName")]
1919    pub cluster_name: Option<String>,
1920    /// Required. The cluster configuration.
1921    pub config: Option<ClusterConfig>,
1922    /// Optional. The labels to associate with this cluster.Label keys must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62}Label values must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}\p{N}_-{0,63}No more than 32 labels can be associated with a given cluster.
1923    pub labels: Option<HashMap<String, String>>,
1924}
1925
1926impl common::Part for ManagedCluster {}
1927
1928/// Specifies the resources used to actively manage an instance group.
1929///
1930/// This type is not used in any activity, and only used as *part* of another schema.
1931///
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct ManagedGroupConfig {
1936    /// Output only. The name of the Instance Group Manager for this group.
1937    #[serde(rename = "instanceGroupManagerName")]
1938    pub instance_group_manager_name: Option<String>,
1939    /// Output only. The partial URI to the instance group manager for this group. E.g. projects/my-project/regions/us-central1/instanceGroupManagers/my-igm.
1940    #[serde(rename = "instanceGroupManagerUri")]
1941    pub instance_group_manager_uri: Option<String>,
1942    /// Output only. The name of the Instance Template used for the Managed Instance Group.
1943    #[serde(rename = "instanceTemplateName")]
1944    pub instance_template_name: Option<String>,
1945}
1946
1947impl common::Part for ManagedGroupConfig {}
1948
1949/// Specifies a Metastore configuration.
1950///
1951/// This type is not used in any activity, and only used as *part* of another schema.
1952///
1953#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1954#[serde_with::serde_as]
1955#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1956pub struct MetastoreConfig {
1957    /// Required. Resource name of an existing Dataproc Metastore service.Example: projects/[project_id]/locations/[dataproc_region]/services/[service-name]
1958    #[serde(rename = "dataprocMetastoreService")]
1959    pub dataproc_metastore_service: Option<String>,
1960}
1961
1962impl common::Part for MetastoreConfig {}
1963
1964/// A Dataproc custom metric.
1965///
1966/// This type is not used in any activity, and only used as *part* of another schema.
1967///
1968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1969#[serde_with::serde_as]
1970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1971pub struct Metric {
1972    /// Optional. Specify one or more Custom metrics (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) to collect for the metric course (for the SPARK metric source (any Spark metric (https://spark.apache.org/docs/latest/monitoring.html#metrics) can be specified).Provide metrics in the following format: METRIC_SOURCE: INSTANCE:GROUP:METRIC Use camelcase as appropriate.Examples: yarn:ResourceManager:QueueMetrics:AppsCompleted spark:driver:DAGScheduler:job.allJobs sparkHistoryServer:JVM:Memory:NonHeapMemoryUsage.committed hiveserver2:JVM:Memory:NonHeapMemoryUsage.used Notes: Only the specified overridden metrics are collected for the metric source. For example, if one or more spark:executive metrics are listed as metric overrides, other SPARK metrics are not collected. The collection of the metrics for other enabled custom metric sources is unaffected. For example, if both SPARK andd YARN metric sources are enabled, and overrides are provided for Spark metrics only, all YARN metrics are collected.
1973    #[serde(rename = "metricOverrides")]
1974    pub metric_overrides: Option<Vec<String>>,
1975    /// Required. A standard set of metrics is collected unless metricOverrides are specified for the metric source (see Custom metrics (https://cloud.google.com/dataproc/docs/guides/dataproc-metrics#custom_metrics) for more information).
1976    #[serde(rename = "metricSource")]
1977    pub metric_source: Option<String>,
1978}
1979
1980impl common::Part for Metric {}
1981
1982/// Deprecated. Used only for the deprecated beta. A full, namespace-isolated deployment target for an existing GKE cluster.
1983///
1984/// This type is not used in any activity, and only used as *part* of another schema.
1985///
1986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1987#[serde_with::serde_as]
1988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1989pub struct NamespacedGkeDeploymentTarget {
1990    /// Optional. A namespace within the GKE cluster to deploy into.
1991    #[serde(rename = "clusterNamespace")]
1992    pub cluster_namespace: Option<String>,
1993    /// Optional. The target GKE cluster to deploy to. Format: 'projects/{project}/locations/{location}/clusters/{cluster_id}'
1994    #[serde(rename = "targetGkeCluster")]
1995    pub target_gke_cluster: Option<String>,
1996}
1997
1998impl common::Part for NamespacedGkeDeploymentTarget {}
1999
2000/// Dataproc Node Group. The Dataproc NodeGroup resource is not related to the Dataproc NodeGroupAffinity resource.
2001///
2002/// # Activities
2003///
2004/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2005/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2006///
2007/// * [regions clusters node groups create projects](ProjectRegionClusterNodeGroupCreateCall) (request)
2008/// * [regions clusters node groups get projects](ProjectRegionClusterNodeGroupGetCall) (response)
2009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2010#[serde_with::serde_as]
2011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2012pub struct NodeGroup {
2013    /// Optional. Node group labels. Label keys must consist of from 1 to 63 characters and conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values can be empty. If specified, they must consist of from 1 to 63 characters and conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). The node group must have no more than 32 labelsn.
2014    pub labels: Option<HashMap<String, String>>,
2015    /// The Node group resource name (https://aip.dev/122).
2016    pub name: Option<String>,
2017    /// Optional. The node group instance group configuration.
2018    #[serde(rename = "nodeGroupConfig")]
2019    pub node_group_config: Option<InstanceGroupConfig>,
2020    /// Required. Node group roles.
2021    pub roles: Option<Vec<String>>,
2022}
2023
2024impl common::RequestValue for NodeGroup {}
2025impl common::ResponseResult for NodeGroup {}
2026
2027/// Node Group Affinity for clusters using sole-tenant node groups. The Dataproc NodeGroupAffinity resource is not related to the Dataproc NodeGroup resource.
2028///
2029/// This type is not used in any activity, and only used as *part* of another schema.
2030///
2031#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2032#[serde_with::serde_as]
2033#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2034pub struct NodeGroupAffinity {
2035    /// Required. The URI of a sole-tenant node group resource (https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups) that the cluster will be created on.A full URL, partial URI, or node group name are valid. Examples: https://www.googleapis.com/compute/v1/projects/[project_id]/zones/[zone]/nodeGroups/node-group-1 projects/[project_id]/zones/[zone]/nodeGroups/node-group-1 node-group-1
2036    #[serde(rename = "nodeGroupUri")]
2037    pub node_group_uri: Option<String>,
2038}
2039
2040impl common::Part for NodeGroupAffinity {}
2041
2042/// Specifies an executable to run on a fully configured node and a timeout period for executable completion.
2043///
2044/// This type is not used in any activity, and only used as *part* of another schema.
2045///
2046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2047#[serde_with::serde_as]
2048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2049pub struct NodeInitializationAction {
2050    /// Required. Cloud Storage URI of executable file.
2051    #[serde(rename = "executableFile")]
2052    pub executable_file: Option<String>,
2053    /// Optional. Amount of time executable has to complete. Default is 10 minutes (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).Cluster creation fails with an explanatory error message (the name of the executable that caused the error and the exceeded timeout period) if the executable is not completed at end of the timeout period.
2054    #[serde(rename = "executionTimeout")]
2055    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2056    pub execution_timeout: Option<chrono::Duration>,
2057}
2058
2059impl common::Part for NodeInitializationAction {}
2060
2061/// indicating a list of workers of same type
2062///
2063/// This type is not used in any activity, and only used as *part* of another schema.
2064///
2065#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2066#[serde_with::serde_as]
2067#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2068pub struct NodePool {
2069    /// Required. A unique id of the node pool. Primary and Secondary workers can be specified using special reserved ids PRIMARY_WORKER_POOL and SECONDARY_WORKER_POOL respectively. Aux node pools can be referenced using corresponding pool id.
2070    pub id: Option<String>,
2071    /// Name of instances to be repaired. These instances must belong to specified node pool.
2072    #[serde(rename = "instanceNames")]
2073    pub instance_names: Option<Vec<String>>,
2074    /// Required. Repair action to take on specified resources of the node pool.
2075    #[serde(rename = "repairAction")]
2076    pub repair_action: Option<String>,
2077}
2078
2079impl common::Part for NodePool {}
2080
2081/// This resource represents a long-running operation that is the result of a network API call.
2082///
2083/// # Activities
2084///
2085/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2086/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2087///
2088/// * [locations batches analyze projects](ProjectLocationBatchAnalyzeCall) (response)
2089/// * [locations batches create projects](ProjectLocationBatchCreateCall) (response)
2090/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2091/// * [locations sessions create projects](ProjectLocationSessionCreateCall) (response)
2092/// * [locations sessions delete projects](ProjectLocationSessionDeleteCall) (response)
2093/// * [locations sessions terminate projects](ProjectLocationSessionTerminateCall) (response)
2094/// * [locations workflow templates instantiate projects](ProjectLocationWorkflowTemplateInstantiateCall) (response)
2095/// * [locations workflow templates instantiate inline projects](ProjectLocationWorkflowTemplateInstantiateInlineCall) (response)
2096/// * [regions clusters node groups create projects](ProjectRegionClusterNodeGroupCreateCall) (response)
2097/// * [regions clusters node groups repair projects](ProjectRegionClusterNodeGroupRepairCall) (response)
2098/// * [regions clusters node groups resize projects](ProjectRegionClusterNodeGroupResizeCall) (response)
2099/// * [regions clusters create projects](ProjectRegionClusterCreateCall) (response)
2100/// * [regions clusters delete projects](ProjectRegionClusterDeleteCall) (response)
2101/// * [regions clusters diagnose projects](ProjectRegionClusterDiagnoseCall) (response)
2102/// * [regions clusters inject credentials projects](ProjectRegionClusterInjectCredentialCall) (response)
2103/// * [regions clusters patch projects](ProjectRegionClusterPatchCall) (response)
2104/// * [regions clusters repair projects](ProjectRegionClusterRepairCall) (response)
2105/// * [regions clusters start projects](ProjectRegionClusterStartCall) (response)
2106/// * [regions clusters stop projects](ProjectRegionClusterStopCall) (response)
2107/// * [regions jobs submit as operation projects](ProjectRegionJobSubmitAsOperationCall) (response)
2108/// * [regions operations get projects](ProjectRegionOperationGetCall) (response)
2109/// * [regions workflow templates instantiate projects](ProjectRegionWorkflowTemplateInstantiateCall) (response)
2110/// * [regions workflow templates instantiate inline projects](ProjectRegionWorkflowTemplateInstantiateInlineCall) (response)
2111#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2112#[serde_with::serde_as]
2113#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2114pub struct Operation {
2115    /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
2116    pub done: Option<bool>,
2117    /// The error result of the operation in case of failure or cancellation.
2118    pub error: Option<Status>,
2119    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
2120    pub metadata: Option<HashMap<String, serde_json::Value>>,
2121    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should be a resource name ending with operations/{unique_id}.
2122    pub name: Option<String>,
2123    /// The normal, successful response of the operation. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.
2124    pub response: Option<HashMap<String, serde_json::Value>>,
2125}
2126
2127impl common::ResponseResult for Operation {}
2128
2129/// A job executed by the workflow.
2130///
2131/// This type is not used in any activity, and only used as *part* of another schema.
2132///
2133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2134#[serde_with::serde_as]
2135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2136pub struct OrderedJob {
2137    /// Optional. Job is a Flink job.
2138    #[serde(rename = "flinkJob")]
2139    pub flink_job: Option<FlinkJob>,
2140    /// Optional. Job is a Hadoop job.
2141    #[serde(rename = "hadoopJob")]
2142    pub hadoop_job: Option<HadoopJob>,
2143    /// Optional. Job is a Hive job.
2144    #[serde(rename = "hiveJob")]
2145    pub hive_job: Option<HiveJob>,
2146    /// Optional. The labels to associate with this job.Label keys must be between 1 and 63 characters long, and must conform to the following regular expression: \p{Ll}\p{Lo}{0,62}Label values must be between 1 and 63 characters long, and must conform to the following regular expression: \p{Ll}\p{Lo}\p{N}_-{0,63}No more than 32 labels can be associated with a given job.
2147    pub labels: Option<HashMap<String, String>>,
2148    /// Optional. Job is a Pig job.
2149    #[serde(rename = "pigJob")]
2150    pub pig_job: Option<PigJob>,
2151    /// Optional. The optional list of prerequisite job step_ids. If not specified, the job will start at the beginning of workflow.
2152    #[serde(rename = "prerequisiteStepIds")]
2153    pub prerequisite_step_ids: Option<Vec<String>>,
2154    /// Optional. Job is a Presto job.
2155    #[serde(rename = "prestoJob")]
2156    pub presto_job: Option<PrestoJob>,
2157    /// Optional. Job is a PySpark job.
2158    #[serde(rename = "pysparkJob")]
2159    pub pyspark_job: Option<PySparkJob>,
2160    /// Optional. Job scheduling configuration.
2161    pub scheduling: Option<JobScheduling>,
2162    /// Optional. Job is a Spark job.
2163    #[serde(rename = "sparkJob")]
2164    pub spark_job: Option<SparkJob>,
2165    /// Optional. Job is a SparkR job.
2166    #[serde(rename = "sparkRJob")]
2167    pub spark_r_job: Option<SparkRJob>,
2168    /// Optional. Job is a SparkSql job.
2169    #[serde(rename = "sparkSqlJob")]
2170    pub spark_sql_job: Option<SparkSqlJob>,
2171    /// Required. The step id. The id must be unique among all jobs within the template.The step id is used as prefix for job id, as job goog-dataproc-workflow-step-id label, and in prerequisiteStepIds field from other steps.The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters.
2172    #[serde(rename = "stepId")]
2173    pub step_id: Option<String>,
2174    /// Optional. Job is a Trino job.
2175    #[serde(rename = "trinoJob")]
2176    pub trino_job: Option<TrinoJob>,
2177}
2178
2179impl common::Part for OrderedJob {}
2180
2181/// Configuration for parameter validation.
2182///
2183/// This type is not used in any activity, and only used as *part* of another schema.
2184///
2185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2186#[serde_with::serde_as]
2187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2188pub struct ParameterValidation {
2189    /// Validation based on regular expressions.
2190    pub regex: Option<RegexValidation>,
2191    /// Validation based on a list of allowed values.
2192    pub values: Option<ValueValidation>,
2193}
2194
2195impl common::Part for ParameterValidation {}
2196
2197/// Auxiliary services configuration for a workload.
2198///
2199/// This type is not used in any activity, and only used as *part* of another schema.
2200///
2201#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2202#[serde_with::serde_as]
2203#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2204pub struct PeripheralsConfig {
2205    /// Optional. Resource name of an existing Dataproc Metastore service.Example: projects/[project_id]/locations/[region]/services/[service_id]
2206    #[serde(rename = "metastoreService")]
2207    pub metastore_service: Option<String>,
2208    /// Optional. The Spark History Server configuration for the workload.
2209    #[serde(rename = "sparkHistoryServerConfig")]
2210    pub spark_history_server_config: Option<SparkHistoryServerConfig>,
2211}
2212
2213impl common::Part for PeripheralsConfig {}
2214
2215/// A Dataproc job for running Apache Pig (https://pig.apache.org/) queries on YARN.
2216///
2217/// This type is not used in any activity, and only used as *part* of another schema.
2218///
2219#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2220#[serde_with::serde_as]
2221#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2222pub struct PigJob {
2223    /// Optional. Whether to continue executing queries if a query fails. The default value is false. Setting to true can be useful when executing independent parallel queries.
2224    #[serde(rename = "continueOnFailure")]
2225    pub continue_on_failure: Option<bool>,
2226    /// Optional. HCFS URIs of jar files to add to the CLASSPATH of the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs.
2227    #[serde(rename = "jarFileUris")]
2228    pub jar_file_uris: Option<Vec<String>>,
2229    /// Optional. The runtime log config for job execution.
2230    #[serde(rename = "loggingConfig")]
2231    pub logging_config: Option<LoggingConfig>,
2232    /// Optional. A mapping of property names to values, used to configure Pig. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, /etc/pig/conf/pig.properties, and classes in user code.
2233    pub properties: Option<HashMap<String, String>>,
2234    /// The HCFS URI of the script that contains the Pig queries.
2235    #[serde(rename = "queryFileUri")]
2236    pub query_file_uri: Option<String>,
2237    /// A list of queries.
2238    #[serde(rename = "queryList")]
2239    pub query_list: Option<QueryList>,
2240    /// Optional. Mapping of query variable names to values (equivalent to the Pig command: name=[value]).
2241    #[serde(rename = "scriptVariables")]
2242    pub script_variables: Option<HashMap<String, String>>,
2243}
2244
2245impl common::Part for PigJob {}
2246
2247/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources.A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role.For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the IAM documentation (https://cloud.google.com/iam/help/conditions/resource-policies).JSON example: { “bindings”: \[ { “role”: “roles/resourcemanager.organizationAdmin”, “members”: \[ “user:mike@example.com”, “group:admins@example.com”, “domain:google.com”, “serviceAccount:my-project-id@appspot.gserviceaccount.com” \] }, { “role”: “roles/resourcemanager.organizationViewer”, “members”: \[ “user:eve@example.com” \], “condition”: { “title”: “expirable access”, “description”: “Does not grant access after Sep 2020”, “expression”: “request.time \< timestamp(‘2020-10-01T00:00:00.000Z’)”, } } \], “etag”: “BwWWja0YfJA=”, “version”: 3 } YAML example: bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time \< timestamp(‘2020-10-01T00:00:00.000Z’) etag: BwWWja0YfJA= version: 3 For a description of IAM and its features, see the IAM documentation (https://cloud.google.com/iam/docs/).
2248///
2249/// # Activities
2250///
2251/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2252/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2253///
2254/// * [locations autoscaling policies get iam policy projects](ProjectLocationAutoscalingPolicyGetIamPolicyCall) (response)
2255/// * [locations autoscaling policies set iam policy projects](ProjectLocationAutoscalingPolicySetIamPolicyCall) (response)
2256/// * [locations workflow templates get iam policy projects](ProjectLocationWorkflowTemplateGetIamPolicyCall) (response)
2257/// * [locations workflow templates set iam policy projects](ProjectLocationWorkflowTemplateSetIamPolicyCall) (response)
2258/// * [regions autoscaling policies get iam policy projects](ProjectRegionAutoscalingPolicyGetIamPolicyCall) (response)
2259/// * [regions autoscaling policies set iam policy projects](ProjectRegionAutoscalingPolicySetIamPolicyCall) (response)
2260/// * [regions clusters get iam policy projects](ProjectRegionClusterGetIamPolicyCall) (response)
2261/// * [regions clusters set iam policy projects](ProjectRegionClusterSetIamPolicyCall) (response)
2262/// * [regions jobs get iam policy projects](ProjectRegionJobGetIamPolicyCall) (response)
2263/// * [regions jobs set iam policy projects](ProjectRegionJobSetIamPolicyCall) (response)
2264/// * [regions operations get iam policy projects](ProjectRegionOperationGetIamPolicyCall) (response)
2265/// * [regions operations set iam policy projects](ProjectRegionOperationSetIamPolicyCall) (response)
2266/// * [regions workflow templates get iam policy projects](ProjectRegionWorkflowTemplateGetIamPolicyCall) (response)
2267/// * [regions workflow templates set iam policy projects](ProjectRegionWorkflowTemplateSetIamPolicyCall) (response)
2268#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2269#[serde_with::serde_as]
2270#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2271pub struct Policy {
2272    /// Associates a list of members, or principals, with a role. Optionally, may specify a condition that determines how and when the bindings are applied. Each of the bindings must contain at least one principal.The bindings in a Policy can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the bindings grant 50 different roles to user:alice@example.com, and not to any other principal, then you can add another 1,450 principals to the bindings in the Policy.
2273    pub bindings: Option<Vec<Binding>>,
2274    /// etag is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the etag in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An etag is returned in the response to getIamPolicy, and systems are expected to put that etag in the request to setIamPolicy to ensure that their change will be applied to the same version of the policy.Important: If you use IAM Conditions, you must include the etag field whenever you call setIamPolicy. If you omit this field, then IAM allows you to overwrite a version 3 policy with a version 1 policy, and all of the conditions in the version 3 policy are lost.
2275    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2276    pub etag: Option<Vec<u8>>,
2277    /// Specifies the format of the policy.Valid values are 0, 1, and 3. Requests that specify an invalid value are rejected.Any operation that affects conditional role bindings must specify version 3. This requirement applies to the following operations: Getting a policy that includes a conditional role binding Adding a conditional role binding to a policy Changing a conditional role binding in a policy Removing any role binding, with or without a condition, from a policy that includes conditionsImportant: If you use IAM Conditions, you must include the etag field whenever you call setIamPolicy. If you omit this field, then IAM allows you to overwrite a version 3 policy with a version 1 policy, and all of the conditions in the version 3 policy are lost.If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset.To learn which resources support conditions in their IAM policies, see the IAM documentation (https://cloud.google.com/iam/help/conditions/resource-policies).
2278    pub version: Option<i32>,
2279}
2280
2281impl common::ResponseResult for Policy {}
2282
2283/// A Dataproc job for running Presto (https://prestosql.io/) queries. IMPORTANT: The Dataproc Presto Optional Component (https://cloud.google.com/dataproc/docs/concepts/components/presto) must be enabled when the cluster is created to submit a Presto job to the cluster.
2284///
2285/// This type is not used in any activity, and only used as *part* of another schema.
2286///
2287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2288#[serde_with::serde_as]
2289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2290pub struct PrestoJob {
2291    /// Optional. Presto client tags to attach to this query
2292    #[serde(rename = "clientTags")]
2293    pub client_tags: Option<Vec<String>>,
2294    /// Optional. Whether to continue executing queries if a query fails. The default value is false. Setting to true can be useful when executing independent parallel queries.
2295    #[serde(rename = "continueOnFailure")]
2296    pub continue_on_failure: Option<bool>,
2297    /// Optional. The runtime log config for job execution.
2298    #[serde(rename = "loggingConfig")]
2299    pub logging_config: Option<LoggingConfig>,
2300    /// Optional. The format in which query output will be displayed. See the Presto documentation for supported output formats
2301    #[serde(rename = "outputFormat")]
2302    pub output_format: Option<String>,
2303    /// Optional. A mapping of property names to values. Used to set Presto session properties (https://prestodb.io/docs/current/sql/set-session.html) Equivalent to using the --session flag in the Presto CLI
2304    pub properties: Option<HashMap<String, String>>,
2305    /// The HCFS URI of the script that contains SQL queries.
2306    #[serde(rename = "queryFileUri")]
2307    pub query_file_uri: Option<String>,
2308    /// A list of queries.
2309    #[serde(rename = "queryList")]
2310    pub query_list: Option<QueryList>,
2311}
2312
2313impl common::Part for PrestoJob {}
2314
2315/// Configuration for PyPi repository
2316///
2317/// This type is not used in any activity, and only used as *part* of another schema.
2318///
2319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2320#[serde_with::serde_as]
2321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2322pub struct PyPiRepositoryConfig {
2323    /// Optional. PyPi repository address
2324    #[serde(rename = "pypiRepository")]
2325    pub pypi_repository: Option<String>,
2326}
2327
2328impl common::Part for PyPiRepositoryConfig {}
2329
2330/// A configuration for running an Apache PySpark (https://spark.apache.org/docs/latest/api/python/getting_started/quickstart.html) batch workload.
2331///
2332/// This type is not used in any activity, and only used as *part* of another schema.
2333///
2334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2335#[serde_with::serde_as]
2336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2337pub struct PySparkBatch {
2338    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2339    #[serde(rename = "archiveUris")]
2340    pub archive_uris: Option<Vec<String>>,
2341    /// Optional. The arguments to pass to the driver. Do not include arguments that can be set as batch properties, such as --conf, since a collision can occur that causes an incorrect batch submission.
2342    pub args: Option<Vec<String>>,
2343    /// Optional. HCFS URIs of files to be placed in the working directory of each executor.
2344    #[serde(rename = "fileUris")]
2345    pub file_uris: Option<Vec<String>>,
2346    /// Optional. HCFS URIs of jar files to add to the classpath of the Spark driver and tasks.
2347    #[serde(rename = "jarFileUris")]
2348    pub jar_file_uris: Option<Vec<String>>,
2349    /// Required. The HCFS URI of the main Python file to use as the Spark driver. Must be a .py file.
2350    #[serde(rename = "mainPythonFileUri")]
2351    pub main_python_file_uri: Option<String>,
2352    /// Optional. HCFS file URIs of Python files to pass to the PySpark framework. Supported file types: .py, .egg, and .zip.
2353    #[serde(rename = "pythonFileUris")]
2354    pub python_file_uris: Option<Vec<String>>,
2355}
2356
2357impl common::Part for PySparkBatch {}
2358
2359/// A Dataproc job for running Apache PySpark (https://spark.apache.org/docs/0.9.0/python-programming-guide.html) applications on YARN.
2360///
2361/// This type is not used in any activity, and only used as *part* of another schema.
2362///
2363#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2364#[serde_with::serde_as]
2365#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2366pub struct PySparkJob {
2367    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2368    #[serde(rename = "archiveUris")]
2369    pub archive_uris: Option<Vec<String>>,
2370    /// Optional. The arguments to pass to the driver. Do not include arguments, such as --conf, that can be set as job properties, since a collision may occur that causes an incorrect job submission.
2371    pub args: Option<Vec<String>>,
2372    /// Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks.
2373    #[serde(rename = "fileUris")]
2374    pub file_uris: Option<Vec<String>>,
2375    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the Python driver and tasks.
2376    #[serde(rename = "jarFileUris")]
2377    pub jar_file_uris: Option<Vec<String>>,
2378    /// Optional. The runtime log config for job execution.
2379    #[serde(rename = "loggingConfig")]
2380    pub logging_config: Option<LoggingConfig>,
2381    /// Required. The HCFS URI of the main Python file to use as the driver. Must be a .py file.
2382    #[serde(rename = "mainPythonFileUri")]
2383    pub main_python_file_uri: Option<String>,
2384    /// Optional. A mapping of property names to values, used to configure PySpark. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code.
2385    pub properties: Option<HashMap<String, String>>,
2386    /// Optional. HCFS file URIs of Python files to pass to the PySpark framework. Supported file types: .py, .egg, and .zip.
2387    #[serde(rename = "pythonFileUris")]
2388    pub python_file_uris: Option<Vec<String>>,
2389}
2390
2391impl common::Part for PySparkJob {}
2392
2393/// A list of queries to run on a cluster.
2394///
2395/// This type is not used in any activity, and only used as *part* of another schema.
2396///
2397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2398#[serde_with::serde_as]
2399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2400pub struct QueryList {
2401    /// Required. The queries to execute. You do not need to end a query expression with a semicolon. Multiple queries can be specified in one string by separating each with a semicolon. Here is an example of a Dataproc API snippet that uses a QueryList to specify a HiveJob: "hiveJob": { "queryList": { "queries": [ "query1", "query2", "query3;query4", ] } }
2402    pub queries: Option<Vec<String>>,
2403}
2404
2405impl common::Part for QueryList {}
2406
2407/// Validation based on regular expressions.
2408///
2409/// This type is not used in any activity, and only used as *part* of another schema.
2410///
2411#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2412#[serde_with::serde_as]
2413#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2414pub struct RegexValidation {
2415    /// Required. RE2 regular expressions used to validate the parameter's value. The value must match the regex in its entirety (substring matches are not sufficient).
2416    pub regexes: Option<Vec<String>>,
2417}
2418
2419impl common::Part for RegexValidation {}
2420
2421/// A request to repair a cluster.
2422///
2423/// # Activities
2424///
2425/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2426/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2427///
2428/// * [regions clusters repair projects](ProjectRegionClusterRepairCall) (request)
2429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2430#[serde_with::serde_as]
2431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2432pub struct RepairClusterRequest {
2433    /// Optional. Specifying the cluster_uuid means the RPC will fail (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
2434    #[serde(rename = "clusterUuid")]
2435    pub cluster_uuid: Option<String>,
2436    /// Optional. Timeout for graceful YARN decommissioning. Graceful decommissioning facilitates the removal of cluster nodes without interrupting jobs in progress. The timeout specifies the amount of time to wait for jobs finish before forcefully removing nodes. The default timeout is 0 for forceful decommissioning, and the maximum timeout period is 1 day. (see JSON Mapping—Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).graceful_decommission_timeout is supported in Dataproc image versions 1.2+.
2437    #[serde(rename = "gracefulDecommissionTimeout")]
2438    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2439    pub graceful_decommission_timeout: Option<chrono::Duration>,
2440    /// Optional. Node pools and corresponding repair action to be taken. All node pools should be unique in this request. i.e. Multiple entries for the same node pool id are not allowed.
2441    #[serde(rename = "nodePools")]
2442    pub node_pools: Option<Vec<NodePool>>,
2443    /// Optional. operation id of the parent operation sending the repair request
2444    #[serde(rename = "parentOperationId")]
2445    pub parent_operation_id: Option<String>,
2446    /// Optional. A unique ID used to identify the request. If the server receives two RepairClusterRequests with the same ID, the second request is ignored, and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
2447    #[serde(rename = "requestId")]
2448    pub request_id: Option<String>,
2449}
2450
2451impl common::RequestValue for RepairClusterRequest {}
2452
2453/// There is no detailed description.
2454///
2455/// # Activities
2456///
2457/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2458/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2459///
2460/// * [regions clusters node groups repair projects](ProjectRegionClusterNodeGroupRepairCall) (request)
2461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2462#[serde_with::serde_as]
2463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2464pub struct RepairNodeGroupRequest {
2465    /// Required. Name of instances to be repaired. These instances must belong to specified node pool.
2466    #[serde(rename = "instanceNames")]
2467    pub instance_names: Option<Vec<String>>,
2468    /// Required. Repair action to take on specified resources of the node pool.
2469    #[serde(rename = "repairAction")]
2470    pub repair_action: Option<String>,
2471    /// Optional. A unique ID used to identify the request. If the server receives two RepairNodeGroupRequest with the same ID, the second request is ignored and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
2472    #[serde(rename = "requestId")]
2473    pub request_id: Option<String>,
2474}
2475
2476impl common::RequestValue for RepairNodeGroupRequest {}
2477
2478/// Configuration for dependency repositories
2479///
2480/// This type is not used in any activity, and only used as *part* of another schema.
2481///
2482#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2483#[serde_with::serde_as]
2484#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2485pub struct RepositoryConfig {
2486    /// Optional. Configuration for PyPi repository.
2487    #[serde(rename = "pypiRepositoryConfig")]
2488    pub pypi_repository_config: Option<PyPiRepositoryConfig>,
2489}
2490
2491impl common::Part for RepositoryConfig {}
2492
2493/// Reservation Affinity for consuming Zonal reservation.
2494///
2495/// This type is not used in any activity, and only used as *part* of another schema.
2496///
2497#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2498#[serde_with::serde_as]
2499#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2500pub struct ReservationAffinity {
2501    /// Optional. Type of reservation to consume
2502    #[serde(rename = "consumeReservationType")]
2503    pub consume_reservation_type: Option<String>,
2504    /// Optional. Corresponds to the label key of reservation resource.
2505    pub key: Option<String>,
2506    /// Optional. Corresponds to the label values of reservation resource.
2507    pub values: Option<Vec<String>>,
2508}
2509
2510impl common::Part for ReservationAffinity {}
2511
2512/// A request to resize a node group.
2513///
2514/// # Activities
2515///
2516/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2517/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2518///
2519/// * [regions clusters node groups resize projects](ProjectRegionClusterNodeGroupResizeCall) (request)
2520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2521#[serde_with::serde_as]
2522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2523pub struct ResizeNodeGroupRequest {
2524    /// Optional. Timeout for graceful YARN decommissioning. Graceful decommissioning (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning) allows the removal of nodes from the Compute Engine node group without interrupting jobs in progress. This timeout specifies how long to wait for jobs in progress to finish before forcefully removing nodes (and potentially interrupting jobs). Default timeout is 0 (for forceful decommission), and the maximum allowed timeout is 1 day. (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).Only supported on Dataproc image versions 1.2 and higher.
2525    #[serde(rename = "gracefulDecommissionTimeout")]
2526    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2527    pub graceful_decommission_timeout: Option<chrono::Duration>,
2528    /// Optional. operation id of the parent operation sending the resize request
2529    #[serde(rename = "parentOperationId")]
2530    pub parent_operation_id: Option<String>,
2531    /// Optional. A unique ID used to identify the request. If the server receives two ResizeNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests) with the same ID, the second request is ignored and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
2532    #[serde(rename = "requestId")]
2533    pub request_id: Option<String>,
2534    /// Required. The number of running instances for the node group to maintain. The group adds or removes instances to maintain the number of instances specified by this parameter.
2535    pub size: Option<i32>,
2536}
2537
2538impl common::RequestValue for ResizeNodeGroupRequest {}
2539
2540/// Runtime configuration for a workload.
2541///
2542/// This type is not used in any activity, and only used as *part* of another schema.
2543///
2544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2545#[serde_with::serde_as]
2546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2547pub struct RuntimeConfig {
2548    /// Optional. Autotuning configuration of the workload.
2549    #[serde(rename = "autotuningConfig")]
2550    pub autotuning_config: Option<AutotuningConfig>,
2551    /// Optional. Cohort identifier. Identifies families of the workloads having the same shape, e.g. daily ETL jobs.
2552    pub cohort: Option<String>,
2553    /// Optional. Optional custom container image for the job runtime environment. If not specified, a default container image will be used.
2554    #[serde(rename = "containerImage")]
2555    pub container_image: Option<String>,
2556    /// Optional. A mapping of property names to values, which are used to configure workload execution.
2557    pub properties: Option<HashMap<String, String>>,
2558    /// Optional. Dependency repository configuration.
2559    #[serde(rename = "repositoryConfig")]
2560    pub repository_config: Option<RepositoryConfig>,
2561    /// Optional. Version of the batch runtime.
2562    pub version: Option<String>,
2563}
2564
2565impl common::Part for RuntimeConfig {}
2566
2567/// Runtime information about workload execution.
2568///
2569/// This type is not used in any activity, and only used as *part* of another schema.
2570///
2571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2572#[serde_with::serde_as]
2573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2574pub struct RuntimeInfo {
2575    /// Output only. Approximate workload resource usage, calculated when the workload completes (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).Note: This metric calculation may change in the future, for example, to capture cumulative workload resource consumption during workload execution (see the Dataproc Serverless release notes (https://cloud.google.com/dataproc-serverless/docs/release-notes) for announcements, changes, fixes and other Dataproc developments).
2576    #[serde(rename = "approximateUsage")]
2577    pub approximate_usage: Option<UsageMetrics>,
2578    /// Output only. Snapshot of current workload resource usage.
2579    #[serde(rename = "currentUsage")]
2580    pub current_usage: Option<UsageSnapshot>,
2581    /// Output only. A URI pointing to the location of the diagnostics tarball.
2582    #[serde(rename = "diagnosticOutputUri")]
2583    pub diagnostic_output_uri: Option<String>,
2584    /// Output only. Map of remote access endpoints (such as web interfaces and APIs) to their URIs.
2585    pub endpoints: Option<HashMap<String, String>>,
2586    /// Output only. A URI pointing to the location of the stdout and stderr of the workload.
2587    #[serde(rename = "outputUri")]
2588    pub output_uri: Option<String>,
2589}
2590
2591impl common::Part for RuntimeInfo {}
2592
2593/// Security related configuration, including encryption, Kerberos, etc.
2594///
2595/// This type is not used in any activity, and only used as *part* of another schema.
2596///
2597#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2598#[serde_with::serde_as]
2599#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2600pub struct SecurityConfig {
2601    /// Optional. Identity related configuration, including service account based secure multi-tenancy user mappings.
2602    #[serde(rename = "identityConfig")]
2603    pub identity_config: Option<IdentityConfig>,
2604    /// Optional. Kerberos related configuration.
2605    #[serde(rename = "kerberosConfig")]
2606    pub kerberos_config: Option<KerberosConfig>,
2607}
2608
2609impl common::Part for SecurityConfig {}
2610
2611/// A representation of a session.
2612///
2613/// # Activities
2614///
2615/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2616/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2617///
2618/// * [locations sessions create projects](ProjectLocationSessionCreateCall) (request)
2619/// * [locations sessions get projects](ProjectLocationSessionGetCall) (response)
2620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2621#[serde_with::serde_as]
2622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2623pub struct Session {
2624    /// Output only. The time when the session was created.
2625    #[serde(rename = "createTime")]
2626    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2627    /// Output only. The email address of the user who created the session.
2628    pub creator: Option<String>,
2629    /// Optional. Environment configuration for the session execution.
2630    #[serde(rename = "environmentConfig")]
2631    pub environment_config: Option<EnvironmentConfig>,
2632    /// Optional. Jupyter session config.
2633    #[serde(rename = "jupyterSession")]
2634    pub jupyter_session: Option<JupyterConfig>,
2635    /// Optional. The labels to associate with the session. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a session.
2636    pub labels: Option<HashMap<String, String>>,
2637    /// Required. The resource name of the session.
2638    pub name: Option<String>,
2639    /// Optional. Runtime configuration for the session execution.
2640    #[serde(rename = "runtimeConfig")]
2641    pub runtime_config: Option<RuntimeConfig>,
2642    /// Output only. Runtime information about session execution.
2643    #[serde(rename = "runtimeInfo")]
2644    pub runtime_info: Option<RuntimeInfo>,
2645    /// Optional. The session template used by the session.Only resource names, including project ID and location, are valid.Example: * https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id] * projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]The template must be in the same project and Dataproc region as the session.
2646    #[serde(rename = "sessionTemplate")]
2647    pub session_template: Option<String>,
2648    /// Output only. A state of the session.
2649    pub state: Option<String>,
2650    /// Output only. Historical state information for the session.
2651    #[serde(rename = "stateHistory")]
2652    pub state_history: Option<Vec<SessionStateHistory>>,
2653    /// Output only. Session state details, such as the failure description if the state is FAILED.
2654    #[serde(rename = "stateMessage")]
2655    pub state_message: Option<String>,
2656    /// Output only. The time when the session entered the current state.
2657    #[serde(rename = "stateTime")]
2658    pub state_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2659    /// Optional. The email address of the user who owns the session.
2660    pub user: Option<String>,
2661    /// Output only. A session UUID (Unique Universal Identifier). The service generates this value when it creates the session.
2662    pub uuid: Option<String>,
2663}
2664
2665impl common::RequestValue for Session {}
2666impl common::ResponseResult for Session {}
2667
2668/// Historical state information.
2669///
2670/// This type is not used in any activity, and only used as *part* of another schema.
2671///
2672#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2673#[serde_with::serde_as]
2674#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2675pub struct SessionStateHistory {
2676    /// Output only. The state of the session at this point in the session history.
2677    pub state: Option<String>,
2678    /// Output only. Details about the state at this point in the session history.
2679    #[serde(rename = "stateMessage")]
2680    pub state_message: Option<String>,
2681    /// Output only. The time when the session entered the historical state.
2682    #[serde(rename = "stateStartTime")]
2683    pub state_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2684}
2685
2686impl common::Part for SessionStateHistory {}
2687
2688/// A representation of a session template.
2689///
2690/// # Activities
2691///
2692/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2693/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2694///
2695/// * [locations session templates create projects](ProjectLocationSessionTemplateCreateCall) (request|response)
2696/// * [locations session templates get projects](ProjectLocationSessionTemplateGetCall) (response)
2697/// * [locations session templates patch projects](ProjectLocationSessionTemplatePatchCall) (request|response)
2698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2699#[serde_with::serde_as]
2700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2701pub struct SessionTemplate {
2702    /// Output only. The time when the template was created.
2703    #[serde(rename = "createTime")]
2704    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2705    /// Output only. The email address of the user who created the template.
2706    pub creator: Option<String>,
2707    /// Optional. Brief description of the template.
2708    pub description: Option<String>,
2709    /// Optional. Environment configuration for session execution.
2710    #[serde(rename = "environmentConfig")]
2711    pub environment_config: Option<EnvironmentConfig>,
2712    /// Optional. Jupyter session config.
2713    #[serde(rename = "jupyterSession")]
2714    pub jupyter_session: Option<JupyterConfig>,
2715    /// Optional. Labels to associate with sessions created using this template. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values can be empty, but, if present, must contain 1 to 63 characters and conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a session.
2716    pub labels: Option<HashMap<String, String>>,
2717    /// Required. The resource name of the session template.
2718    pub name: Option<String>,
2719    /// Optional. Runtime configuration for session execution.
2720    #[serde(rename = "runtimeConfig")]
2721    pub runtime_config: Option<RuntimeConfig>,
2722    /// Output only. The time the template was last updated.
2723    #[serde(rename = "updateTime")]
2724    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2725    /// Output only. A session template UUID (Unique Universal Identifier). The service generates this value when it creates the session template.
2726    pub uuid: Option<String>,
2727}
2728
2729impl common::RequestValue for SessionTemplate {}
2730impl common::ResponseResult for SessionTemplate {}
2731
2732/// Request message for SetIamPolicy method.
2733///
2734/// # Activities
2735///
2736/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2737/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2738///
2739/// * [locations autoscaling policies set iam policy projects](ProjectLocationAutoscalingPolicySetIamPolicyCall) (request)
2740/// * [locations workflow templates set iam policy projects](ProjectLocationWorkflowTemplateSetIamPolicyCall) (request)
2741/// * [regions autoscaling policies set iam policy projects](ProjectRegionAutoscalingPolicySetIamPolicyCall) (request)
2742/// * [regions clusters set iam policy projects](ProjectRegionClusterSetIamPolicyCall) (request)
2743/// * [regions jobs set iam policy projects](ProjectRegionJobSetIamPolicyCall) (request)
2744/// * [regions operations set iam policy projects](ProjectRegionOperationSetIamPolicyCall) (request)
2745/// * [regions workflow templates set iam policy projects](ProjectRegionWorkflowTemplateSetIamPolicyCall) (request)
2746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2747#[serde_with::serde_as]
2748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2749pub struct SetIamPolicyRequest {
2750    /// REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
2751    pub policy: Option<Policy>,
2752}
2753
2754impl common::RequestValue for SetIamPolicyRequest {}
2755
2756/// Shielded Instance Config for clusters using Compute Engine Shielded VMs (https://cloud.google.com/security/shielded-cloud/shielded-vm).
2757///
2758/// This type is not used in any activity, and only used as *part* of another schema.
2759///
2760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2761#[serde_with::serde_as]
2762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2763pub struct ShieldedInstanceConfig {
2764    /// Optional. Defines whether instances have integrity monitoring enabled.
2765    #[serde(rename = "enableIntegrityMonitoring")]
2766    pub enable_integrity_monitoring: Option<bool>,
2767    /// Optional. Defines whether instances have Secure Boot enabled.
2768    #[serde(rename = "enableSecureBoot")]
2769    pub enable_secure_boot: Option<bool>,
2770    /// Optional. Defines whether instances have the vTPM enabled.
2771    #[serde(rename = "enableVtpm")]
2772    pub enable_vtpm: Option<bool>,
2773}
2774
2775impl common::Part for ShieldedInstanceConfig {}
2776
2777/// Specifies the selection and config of software inside the cluster.
2778///
2779/// This type is not used in any activity, and only used as *part* of another schema.
2780///
2781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2782#[serde_with::serde_as]
2783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2784pub struct SoftwareConfig {
2785    /// Optional. The version of software inside the cluster. It must be one of the supported Dataproc Versions (https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#supported_dataproc_versions), such as "1.2" (including a subminor version, such as "1.2.29"), or the "preview" version (https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions). If unspecified, it defaults to the latest Debian version.
2786    #[serde(rename = "imageVersion")]
2787    pub image_version: Option<String>,
2788    /// Optional. The set of components to activate on the cluster.
2789    #[serde(rename = "optionalComponents")]
2790    pub optional_components: Option<Vec<String>>,
2791    /// Optional. The properties to set on daemon config files.Property keys are specified in prefix:property format, for example core:hadoop.tmp.dir. The following are supported prefixes and their mappings: capacity-scheduler: capacity-scheduler.xml core: core-site.xml distcp: distcp-default.xml hdfs: hdfs-site.xml hive: hive-site.xml mapred: mapred-site.xml pig: pig.properties spark: spark-defaults.conf yarn: yarn-site.xmlFor more information, see Cluster properties (https://cloud.google.com/dataproc/docs/concepts/cluster-properties).
2792    pub properties: Option<HashMap<String, String>>,
2793}
2794
2795impl common::Part for SoftwareConfig {}
2796
2797/// A configuration for running an Apache Spark (https://spark.apache.org/) batch workload.
2798///
2799/// This type is not used in any activity, and only used as *part* of another schema.
2800///
2801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2802#[serde_with::serde_as]
2803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2804pub struct SparkBatch {
2805    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2806    #[serde(rename = "archiveUris")]
2807    pub archive_uris: Option<Vec<String>>,
2808    /// Optional. The arguments to pass to the driver. Do not include arguments that can be set as batch properties, such as --conf, since a collision can occur that causes an incorrect batch submission.
2809    pub args: Option<Vec<String>>,
2810    /// Optional. HCFS URIs of files to be placed in the working directory of each executor.
2811    #[serde(rename = "fileUris")]
2812    pub file_uris: Option<Vec<String>>,
2813    /// Optional. HCFS URIs of jar files to add to the classpath of the Spark driver and tasks.
2814    #[serde(rename = "jarFileUris")]
2815    pub jar_file_uris: Option<Vec<String>>,
2816    /// Optional. The name of the driver main class. The jar file that contains the class must be in the classpath or specified in jar_file_uris.
2817    #[serde(rename = "mainClass")]
2818    pub main_class: Option<String>,
2819    /// Optional. The HCFS URI of the jar file that contains the main class.
2820    #[serde(rename = "mainJarFileUri")]
2821    pub main_jar_file_uri: Option<String>,
2822}
2823
2824impl common::Part for SparkBatch {}
2825
2826/// Spark History Server configuration for the workload.
2827///
2828/// This type is not used in any activity, and only used as *part* of another schema.
2829///
2830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2831#[serde_with::serde_as]
2832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2833pub struct SparkHistoryServerConfig {
2834    /// Optional. Resource name of an existing Dataproc Cluster to act as a Spark History Server for the workload.Example: projects/[project_id]/regions/[region]/clusters/[cluster_name]
2835    #[serde(rename = "dataprocCluster")]
2836    pub dataproc_cluster: Option<String>,
2837}
2838
2839impl common::Part for SparkHistoryServerConfig {}
2840
2841/// A Dataproc job for running Apache Spark (https://spark.apache.org/) applications on YARN.
2842///
2843/// This type is not used in any activity, and only used as *part* of another schema.
2844///
2845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2846#[serde_with::serde_as]
2847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2848pub struct SparkJob {
2849    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2850    #[serde(rename = "archiveUris")]
2851    pub archive_uris: Option<Vec<String>>,
2852    /// Optional. The arguments to pass to the driver. Do not include arguments, such as --conf, that can be set as job properties, since a collision may occur that causes an incorrect job submission.
2853    pub args: Option<Vec<String>>,
2854    /// Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks.
2855    #[serde(rename = "fileUris")]
2856    pub file_uris: Option<Vec<String>>,
2857    /// Optional. HCFS URIs of jar files to add to the CLASSPATHs of the Spark driver and tasks.
2858    #[serde(rename = "jarFileUris")]
2859    pub jar_file_uris: Option<Vec<String>>,
2860    /// Optional. The runtime log config for job execution.
2861    #[serde(rename = "loggingConfig")]
2862    pub logging_config: Option<LoggingConfig>,
2863    /// The name of the driver's main class. The jar file that contains the class must be in the default CLASSPATH or specified in SparkJob.jar_file_uris.
2864    #[serde(rename = "mainClass")]
2865    pub main_class: Option<String>,
2866    /// The HCFS URI of the jar file that contains the main class.
2867    #[serde(rename = "mainJarFileUri")]
2868    pub main_jar_file_uri: Option<String>,
2869    /// Optional. A mapping of property names to values, used to configure Spark. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code.
2870    pub properties: Option<HashMap<String, String>>,
2871}
2872
2873impl common::Part for SparkJob {}
2874
2875/// A configuration for running an Apache SparkR (https://spark.apache.org/docs/latest/sparkr.html) batch workload.
2876///
2877/// This type is not used in any activity, and only used as *part* of another schema.
2878///
2879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2880#[serde_with::serde_as]
2881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2882pub struct SparkRBatch {
2883    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2884    #[serde(rename = "archiveUris")]
2885    pub archive_uris: Option<Vec<String>>,
2886    /// Optional. The arguments to pass to the Spark driver. Do not include arguments that can be set as batch properties, such as --conf, since a collision can occur that causes an incorrect batch submission.
2887    pub args: Option<Vec<String>>,
2888    /// Optional. HCFS URIs of files to be placed in the working directory of each executor.
2889    #[serde(rename = "fileUris")]
2890    pub file_uris: Option<Vec<String>>,
2891    /// Required. The HCFS URI of the main R file to use as the driver. Must be a .R or .r file.
2892    #[serde(rename = "mainRFileUri")]
2893    pub main_r_file_uri: Option<String>,
2894}
2895
2896impl common::Part for SparkRBatch {}
2897
2898/// A Dataproc job for running Apache SparkR (https://spark.apache.org/docs/latest/sparkr.html) applications on YARN.
2899///
2900/// This type is not used in any activity, and only used as *part* of another schema.
2901///
2902#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2903#[serde_with::serde_as]
2904#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2905pub struct SparkRJob {
2906    /// Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip.
2907    #[serde(rename = "archiveUris")]
2908    pub archive_uris: Option<Vec<String>>,
2909    /// Optional. The arguments to pass to the driver. Do not include arguments, such as --conf, that can be set as job properties, since a collision may occur that causes an incorrect job submission.
2910    pub args: Option<Vec<String>>,
2911    /// Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks.
2912    #[serde(rename = "fileUris")]
2913    pub file_uris: Option<Vec<String>>,
2914    /// Optional. The runtime log config for job execution.
2915    #[serde(rename = "loggingConfig")]
2916    pub logging_config: Option<LoggingConfig>,
2917    /// Required. The HCFS URI of the main R file to use as the driver. Must be a .R file.
2918    #[serde(rename = "mainRFileUri")]
2919    pub main_r_file_uri: Option<String>,
2920    /// Optional. A mapping of property names to values, used to configure SparkR. Properties that conflict with values set by the Dataproc API might be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code.
2921    pub properties: Option<HashMap<String, String>>,
2922}
2923
2924impl common::Part for SparkRJob {}
2925
2926/// A configuration for running Apache Spark SQL (https://spark.apache.org/sql/) queries as a batch workload.
2927///
2928/// This type is not used in any activity, and only used as *part* of another schema.
2929///
2930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2931#[serde_with::serde_as]
2932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2933pub struct SparkSqlBatch {
2934    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2935    #[serde(rename = "jarFileUris")]
2936    pub jar_file_uris: Option<Vec<String>>,
2937    /// Required. The HCFS URI of the script that contains Spark SQL queries to execute.
2938    #[serde(rename = "queryFileUri")]
2939    pub query_file_uri: Option<String>,
2940    /// Optional. Mapping of query variable names to values (equivalent to the Spark SQL command: SET name="value";).
2941    #[serde(rename = "queryVariables")]
2942    pub query_variables: Option<HashMap<String, String>>,
2943}
2944
2945impl common::Part for SparkSqlBatch {}
2946
2947/// A Dataproc job for running Apache Spark SQL (https://spark.apache.org/sql/) queries.
2948///
2949/// This type is not used in any activity, and only used as *part* of another schema.
2950///
2951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2952#[serde_with::serde_as]
2953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2954pub struct SparkSqlJob {
2955    /// Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH.
2956    #[serde(rename = "jarFileUris")]
2957    pub jar_file_uris: Option<Vec<String>>,
2958    /// Optional. The runtime log config for job execution.
2959    #[serde(rename = "loggingConfig")]
2960    pub logging_config: Option<LoggingConfig>,
2961    /// Optional. A mapping of property names to values, used to configure Spark SQL's SparkConf. Properties that conflict with values set by the Dataproc API might be overwritten.
2962    pub properties: Option<HashMap<String, String>>,
2963    /// The HCFS URI of the script that contains SQL queries.
2964    #[serde(rename = "queryFileUri")]
2965    pub query_file_uri: Option<String>,
2966    /// A list of queries.
2967    #[serde(rename = "queryList")]
2968    pub query_list: Option<QueryList>,
2969    /// Optional. Mapping of query variable names to values (equivalent to the Spark SQL command: SET name="value";).
2970    #[serde(rename = "scriptVariables")]
2971    pub script_variables: Option<HashMap<String, String>>,
2972}
2973
2974impl common::Part for SparkSqlJob {}
2975
2976/// Basic autoscaling configurations for Spark Standalone.
2977///
2978/// This type is not used in any activity, and only used as *part* of another schema.
2979///
2980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2981#[serde_with::serde_as]
2982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2983pub struct SparkStandaloneAutoscalingConfig {
2984    /// Required. Timeout for Spark graceful decommissioning of spark workers. Specifies the duration to wait for spark worker to complete spark decommissioning tasks before forcefully removing workers. Only applicable to downscaling operations.Bounds: 0s, 1d.
2985    #[serde(rename = "gracefulDecommissionTimeout")]
2986    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2987    pub graceful_decommission_timeout: Option<chrono::Duration>,
2988    /// Optional. Remove only idle workers when scaling down cluster
2989    #[serde(rename = "removeOnlyIdleWorkers")]
2990    pub remove_only_idle_workers: Option<bool>,
2991    /// Required. Fraction of required executors to remove from Spark Serverless clusters. A scale-down factor of 1.0 will result in scaling down so that there are no more executors for the Spark Job.(more aggressive scaling). A scale-down factor closer to 0 will result in a smaller magnitude of scaling donw (less aggressive scaling).Bounds: 0.0, 1.0.
2992    #[serde(rename = "scaleDownFactor")]
2993    pub scale_down_factor: Option<f64>,
2994    /// Optional. Minimum scale-down threshold as a fraction of total cluster size before scaling occurs. For example, in a 20-worker cluster, a threshold of 0.1 means the autoscaler must recommend at least a 2 worker scale-down for the cluster to scale. A threshold of 0 means the autoscaler will scale down on any recommended change.Bounds: 0.0, 1.0. Default: 0.0.
2995    #[serde(rename = "scaleDownMinWorkerFraction")]
2996    pub scale_down_min_worker_fraction: Option<f64>,
2997    /// Required. Fraction of required workers to add to Spark Standalone clusters. A scale-up factor of 1.0 will result in scaling up so that there are no more required workers for the Spark Job (more aggressive scaling). A scale-up factor closer to 0 will result in a smaller magnitude of scaling up (less aggressive scaling).Bounds: 0.0, 1.0.
2998    #[serde(rename = "scaleUpFactor")]
2999    pub scale_up_factor: Option<f64>,
3000    /// Optional. Minimum scale-up threshold as a fraction of total cluster size before scaling occurs. For example, in a 20-worker cluster, a threshold of 0.1 means the autoscaler must recommend at least a 2-worker scale-up for the cluster to scale. A threshold of 0 means the autoscaler will scale up on any recommended change.Bounds: 0.0, 1.0. Default: 0.0.
3001    #[serde(rename = "scaleUpMinWorkerFraction")]
3002    pub scale_up_min_worker_fraction: Option<f64>,
3003}
3004
3005impl common::Part for SparkStandaloneAutoscalingConfig {}
3006
3007/// A request to start a cluster.
3008///
3009/// # Activities
3010///
3011/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3012/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3013///
3014/// * [regions clusters start projects](ProjectRegionClusterStartCall) (request)
3015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3016#[serde_with::serde_as]
3017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3018pub struct StartClusterRequest {
3019    /// Optional. Specifying the cluster_uuid means the RPC will fail (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
3020    #[serde(rename = "clusterUuid")]
3021    pub cluster_uuid: Option<String>,
3022    /// Optional. A unique ID used to identify the request. If the server receives two StartClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
3023    #[serde(rename = "requestId")]
3024    pub request_id: Option<String>,
3025}
3026
3027impl common::RequestValue for StartClusterRequest {}
3028
3029/// Configuration to handle the startup of instances during cluster create and update process.
3030///
3031/// This type is not used in any activity, and only used as *part* of another schema.
3032///
3033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3034#[serde_with::serde_as]
3035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3036pub struct StartupConfig {
3037    /// Optional. The config setting to enable cluster creation/ updation to be successful only after required_registration_fraction of instances are up and running. This configuration is applicable to only secondary workers for now. The cluster will fail if required_registration_fraction of instances are not available. This will include instance creation, agent registration, and service registration (if enabled).
3038    #[serde(rename = "requiredRegistrationFraction")]
3039    pub required_registration_fraction: Option<f64>,
3040}
3041
3042impl common::Part for StartupConfig {}
3043
3044/// Historical state information.
3045///
3046/// This type is not used in any activity, and only used as *part* of another schema.
3047///
3048#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3049#[serde_with::serde_as]
3050#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3051pub struct StateHistory {
3052    /// Output only. The state of the batch at this point in history.
3053    pub state: Option<String>,
3054    /// Output only. Details about the state at this point in history.
3055    #[serde(rename = "stateMessage")]
3056    pub state_message: Option<String>,
3057    /// Output only. The time when the batch entered the historical state.
3058    #[serde(rename = "stateStartTime")]
3059    pub state_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3060}
3061
3062impl common::Part for StateHistory {}
3063
3064/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). Each Status message contains three pieces of data: error code, error message, and error details.You can find out more about this error model and how to work with it in the API Design Guide (https://cloud.google.com/apis/design/errors).
3065///
3066/// This type is not used in any activity, and only used as *part* of another schema.
3067///
3068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3069#[serde_with::serde_as]
3070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3071pub struct Status {
3072    /// The status code, which should be an enum value of google.rpc.Code.
3073    pub code: Option<i32>,
3074    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3075    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3076    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
3077    pub message: Option<String>,
3078}
3079
3080impl common::Part for Status {}
3081
3082/// A request to stop a cluster.
3083///
3084/// # Activities
3085///
3086/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3087/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3088///
3089/// * [regions clusters stop projects](ProjectRegionClusterStopCall) (request)
3090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3091#[serde_with::serde_as]
3092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3093pub struct StopClusterRequest {
3094    /// Optional. Specifying the cluster_uuid means the RPC will fail (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
3095    #[serde(rename = "clusterUuid")]
3096    pub cluster_uuid: Option<String>,
3097    /// Optional. A unique ID used to identify the request. If the server receives two StopClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
3098    #[serde(rename = "requestId")]
3099    pub request_id: Option<String>,
3100}
3101
3102impl common::RequestValue for StopClusterRequest {}
3103
3104/// A request to submit a job.
3105///
3106/// # Activities
3107///
3108/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3109/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3110///
3111/// * [regions jobs submit projects](ProjectRegionJobSubmitCall) (request)
3112/// * [regions jobs submit as operation projects](ProjectRegionJobSubmitAsOperationCall) (request)
3113#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3114#[serde_with::serde_as]
3115#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3116pub struct SubmitJobRequest {
3117    /// Required. The job resource.
3118    pub job: Option<Job>,
3119    /// Optional. A unique id used to identify the request. If the server receives two SubmitJobRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s with the same id, then the second request will be ignored and the first Job created and stored in the backend is returned.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
3120    #[serde(rename = "requestId")]
3121    pub request_id: Option<String>,
3122}
3123
3124impl common::RequestValue for SubmitJobRequest {}
3125
3126/// A configurable parameter that replaces one or more fields in the template. Parameterizable fields: - Labels - File uris - Job properties - Job arguments - Script variables - Main class (in HadoopJob and SparkJob) - Zone (in ClusterSelector)
3127///
3128/// This type is not used in any activity, and only used as *part* of another schema.
3129///
3130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3131#[serde_with::serde_as]
3132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3133pub struct TemplateParameter {
3134    /// Optional. Brief description of the parameter. Must not exceed 1024 characters.
3135    pub description: Option<String>,
3136    /// Required. Paths to all fields that the parameter replaces. A field is allowed to appear in at most one parameter's list of field paths.A field path is similar in syntax to a google.protobuf.FieldMask. For example, a field path that references the zone field of a workflow template's cluster selector would be specified as placement.clusterSelector.zone.Also, field paths can reference fields using the following syntax: Values in maps can be referenced by key: labels'key' placement.clusterSelector.clusterLabels'key' placement.managedCluster.labels'key' placement.clusterSelector.clusterLabels'key' jobs'step-id'.labels'key' Jobs in the jobs list can be referenced by step-id: jobs'step-id'.hadoopJob.mainJarFileUri jobs'step-id'.hiveJob.queryFileUri jobs'step-id'.pySparkJob.mainPythonFileUri jobs'step-id'.hadoopJob.jarFileUris0 jobs'step-id'.hadoopJob.archiveUris0 jobs'step-id'.hadoopJob.fileUris0 jobs'step-id'.pySparkJob.pythonFileUris0 Items in repeated fields can be referenced by a zero-based index: jobs'step-id'.sparkJob.args0 Other examples: jobs'step-id'.hadoopJob.properties'key' jobs'step-id'.hadoopJob.args0 jobs'step-id'.hiveJob.scriptVariables'key' jobs'step-id'.hadoopJob.mainJarFileUri placement.clusterSelector.zoneIt may not be possible to parameterize maps and repeated fields in their entirety since only individual map values and individual items in repeated fields can be referenced. For example, the following field paths are invalid: placement.clusterSelector.clusterLabels jobs'step-id'.sparkJob.args
3137    pub fields: Option<Vec<String>>,
3138    /// Required. Parameter name. The parameter name is used as the key, and paired with the parameter value, which are passed to the template when the template is instantiated. The name must contain only capital letters (A-Z), numbers (0-9), and underscores (_), and must not start with a number. The maximum length is 40 characters.
3139    pub name: Option<String>,
3140    /// Optional. Validation rules to be applied to this parameter's value.
3141    pub validation: Option<ParameterValidation>,
3142}
3143
3144impl common::Part for TemplateParameter {}
3145
3146/// A request to terminate an interactive session.
3147///
3148/// # Activities
3149///
3150/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3151/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3152///
3153/// * [locations sessions terminate projects](ProjectLocationSessionTerminateCall) (request)
3154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3155#[serde_with::serde_as]
3156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3157pub struct TerminateSessionRequest {
3158    /// Optional. A unique ID used to identify the request. If the service receives two TerminateSessionRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.TerminateSessionRequest)s with the same ID, the second request is ignored.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
3159    #[serde(rename = "requestId")]
3160    pub request_id: Option<String>,
3161}
3162
3163impl common::RequestValue for TerminateSessionRequest {}
3164
3165/// Request message for TestIamPermissions method.
3166///
3167/// # Activities
3168///
3169/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3170/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3171///
3172/// * [locations autoscaling policies test iam permissions projects](ProjectLocationAutoscalingPolicyTestIamPermissionCall) (request)
3173/// * [locations workflow templates test iam permissions projects](ProjectLocationWorkflowTemplateTestIamPermissionCall) (request)
3174/// * [regions autoscaling policies test iam permissions projects](ProjectRegionAutoscalingPolicyTestIamPermissionCall) (request)
3175/// * [regions clusters test iam permissions projects](ProjectRegionClusterTestIamPermissionCall) (request)
3176/// * [regions jobs test iam permissions projects](ProjectRegionJobTestIamPermissionCall) (request)
3177/// * [regions operations test iam permissions projects](ProjectRegionOperationTestIamPermissionCall) (request)
3178/// * [regions workflow templates test iam permissions projects](ProjectRegionWorkflowTemplateTestIamPermissionCall) (request)
3179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3180#[serde_with::serde_as]
3181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3182pub struct TestIamPermissionsRequest {
3183    /// The set of permissions to check for the resource. Permissions with wildcards (such as * or storage.*) are not allowed. For more information see IAM Overview (https://cloud.google.com/iam/docs/overview#permissions).
3184    pub permissions: Option<Vec<String>>,
3185}
3186
3187impl common::RequestValue for TestIamPermissionsRequest {}
3188
3189/// Response message for TestIamPermissions method.
3190///
3191/// # Activities
3192///
3193/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3194/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3195///
3196/// * [locations autoscaling policies test iam permissions projects](ProjectLocationAutoscalingPolicyTestIamPermissionCall) (response)
3197/// * [locations workflow templates test iam permissions projects](ProjectLocationWorkflowTemplateTestIamPermissionCall) (response)
3198/// * [regions autoscaling policies test iam permissions projects](ProjectRegionAutoscalingPolicyTestIamPermissionCall) (response)
3199/// * [regions clusters test iam permissions projects](ProjectRegionClusterTestIamPermissionCall) (response)
3200/// * [regions jobs test iam permissions projects](ProjectRegionJobTestIamPermissionCall) (response)
3201/// * [regions operations test iam permissions projects](ProjectRegionOperationTestIamPermissionCall) (response)
3202/// * [regions workflow templates test iam permissions projects](ProjectRegionWorkflowTemplateTestIamPermissionCall) (response)
3203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3204#[serde_with::serde_as]
3205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3206pub struct TestIamPermissionsResponse {
3207    /// A subset of TestPermissionsRequest.permissions that the caller is allowed.
3208    pub permissions: Option<Vec<String>>,
3209}
3210
3211impl common::ResponseResult for TestIamPermissionsResponse {}
3212
3213/// A Dataproc job for running Trino (https://trino.io/) queries. IMPORTANT: The Dataproc Trino Optional Component (https://cloud.google.com/dataproc/docs/concepts/components/trino) must be enabled when the cluster is created to submit a Trino job to the cluster.
3214///
3215/// This type is not used in any activity, and only used as *part* of another schema.
3216///
3217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3218#[serde_with::serde_as]
3219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3220pub struct TrinoJob {
3221    /// Optional. Trino client tags to attach to this query
3222    #[serde(rename = "clientTags")]
3223    pub client_tags: Option<Vec<String>>,
3224    /// Optional. Whether to continue executing queries if a query fails. The default value is false. Setting to true can be useful when executing independent parallel queries.
3225    #[serde(rename = "continueOnFailure")]
3226    pub continue_on_failure: Option<bool>,
3227    /// Optional. The runtime log config for job execution.
3228    #[serde(rename = "loggingConfig")]
3229    pub logging_config: Option<LoggingConfig>,
3230    /// Optional. The format in which query output will be displayed. See the Trino documentation for supported output formats
3231    #[serde(rename = "outputFormat")]
3232    pub output_format: Option<String>,
3233    /// Optional. A mapping of property names to values. Used to set Trino session properties (https://trino.io/docs/current/sql/set-session.html) Equivalent to using the --session flag in the Trino CLI
3234    pub properties: Option<HashMap<String, String>>,
3235    /// The HCFS URI of the script that contains SQL queries.
3236    #[serde(rename = "queryFileUri")]
3237    pub query_file_uri: Option<String>,
3238    /// A list of queries.
3239    #[serde(rename = "queryList")]
3240    pub query_list: Option<QueryList>,
3241}
3242
3243impl common::Part for TrinoJob {}
3244
3245/// Usage metrics represent approximate total resources consumed by a workload.
3246///
3247/// This type is not used in any activity, and only used as *part* of another schema.
3248///
3249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3250#[serde_with::serde_as]
3251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3252pub struct UsageMetrics {
3253    /// Optional. Accelerator type being used, if any
3254    #[serde(rename = "acceleratorType")]
3255    pub accelerator_type: Option<String>,
3256    /// Optional. Accelerator usage in (milliAccelerator x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).
3257    #[serde(rename = "milliAcceleratorSeconds")]
3258    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3259    pub milli_accelerator_seconds: Option<i64>,
3260    /// Optional. DCU (Dataproc Compute Units) usage in (milliDCU x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).
3261    #[serde(rename = "milliDcuSeconds")]
3262    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3263    pub milli_dcu_seconds: Option<i64>,
3264    /// Optional. Shuffle storage usage in (GB x seconds) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).
3265    #[serde(rename = "shuffleStorageGbSeconds")]
3266    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3267    pub shuffle_storage_gb_seconds: Option<i64>,
3268}
3269
3270impl common::Part for UsageMetrics {}
3271
3272/// The usage snapshot represents the resources consumed by a workload at a specified time.
3273///
3274/// This type is not used in any activity, and only used as *part* of another schema.
3275///
3276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3277#[serde_with::serde_as]
3278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3279pub struct UsageSnapshot {
3280    /// Optional. Accelerator type being used, if any
3281    #[serde(rename = "acceleratorType")]
3282    pub accelerator_type: Option<String>,
3283    /// Optional. Milli (one-thousandth) accelerator. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))
3284    #[serde(rename = "milliAccelerator")]
3285    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3286    pub milli_accelerator: Option<i64>,
3287    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).
3288    #[serde(rename = "milliDcu")]
3289    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3290    pub milli_dcu: Option<i64>,
3291    /// Optional. Milli (one-thousandth) Dataproc Compute Units (DCUs) charged at premium tier (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing)).
3292    #[serde(rename = "milliDcuPremium")]
3293    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3294    pub milli_dcu_premium: Option<i64>,
3295    /// Optional. Shuffle Storage in gigabytes (GB). (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))
3296    #[serde(rename = "shuffleStorageGb")]
3297    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3298    pub shuffle_storage_gb: Option<i64>,
3299    /// Optional. Shuffle Storage in gigabytes (GB) charged at premium tier. (see Dataproc Serverless pricing (https://cloud.google.com/dataproc-serverless/pricing))
3300    #[serde(rename = "shuffleStorageGbPremium")]
3301    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3302    pub shuffle_storage_gb_premium: Option<i64>,
3303    /// Optional. The timestamp of the usage snapshot.
3304    #[serde(rename = "snapshotTime")]
3305    pub snapshot_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3306}
3307
3308impl common::Part for UsageSnapshot {}
3309
3310/// Validation based on a list of allowed values.
3311///
3312/// This type is not used in any activity, and only used as *part* of another schema.
3313///
3314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3315#[serde_with::serde_as]
3316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3317pub struct ValueValidation {
3318    /// Required. List of allowed values for the parameter.
3319    pub values: Option<Vec<String>>,
3320}
3321
3322impl common::Part for ValueValidation {}
3323
3324/// The Dataproc cluster config for a cluster that does not directly control the underlying compute resources, such as a Dataproc-on-GKE cluster (https://cloud.google.com/dataproc/docs/guides/dpgke/dataproc-gke-overview).
3325///
3326/// This type is not used in any activity, and only used as *part* of another schema.
3327///
3328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3329#[serde_with::serde_as]
3330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3331pub struct VirtualClusterConfig {
3332    /// Optional. Configuration of auxiliary services used by this cluster.
3333    #[serde(rename = "auxiliaryServicesConfig")]
3334    pub auxiliary_services_config: Option<AuxiliaryServicesConfig>,
3335    /// Required. The configuration for running the Dataproc cluster on Kubernetes.
3336    #[serde(rename = "kubernetesClusterConfig")]
3337    pub kubernetes_cluster_config: Option<KubernetesClusterConfig>,
3338    /// Optional. A Cloud Storage bucket used to stage job dependencies, config files, and job driver console output. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's staging bucket according to the Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket (see Dataproc staging and temp buckets (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). This field requires a Cloud Storage bucket name, not a gs://... URI to a Cloud Storage bucket.
3339    #[serde(rename = "stagingBucket")]
3340    pub staging_bucket: Option<String>,
3341}
3342
3343impl common::Part for VirtualClusterConfig {}
3344
3345/// A Dataproc workflow template resource.
3346///
3347/// # Activities
3348///
3349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3351///
3352/// * [locations workflow templates create projects](ProjectLocationWorkflowTemplateCreateCall) (request|response)
3353/// * [locations workflow templates get projects](ProjectLocationWorkflowTemplateGetCall) (response)
3354/// * [locations workflow templates instantiate inline projects](ProjectLocationWorkflowTemplateInstantiateInlineCall) (request)
3355/// * [locations workflow templates update projects](ProjectLocationWorkflowTemplateUpdateCall) (request|response)
3356/// * [regions workflow templates create projects](ProjectRegionWorkflowTemplateCreateCall) (request|response)
3357/// * [regions workflow templates get projects](ProjectRegionWorkflowTemplateGetCall) (response)
3358/// * [regions workflow templates instantiate inline projects](ProjectRegionWorkflowTemplateInstantiateInlineCall) (request)
3359/// * [regions workflow templates update projects](ProjectRegionWorkflowTemplateUpdateCall) (request|response)
3360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3361#[serde_with::serde_as]
3362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3363pub struct WorkflowTemplate {
3364    /// Output only. The time template was created.
3365    #[serde(rename = "createTime")]
3366    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3367    /// Optional. Timeout duration for the DAG of jobs, expressed in seconds (see JSON representation of duration (https://developers.google.com/protocol-buffers/docs/proto3#json)). The timeout duration must be from 10 minutes ("600s") to 24 hours ("86400s"). The timer begins when the first job is submitted. If the workflow is running at the end of the timeout period, any remaining jobs are cancelled, the workflow is ended, and if the workflow was running on a managed cluster, the cluster is deleted.
3368    #[serde(rename = "dagTimeout")]
3369    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3370    pub dag_timeout: Option<chrono::Duration>,
3371    /// Optional. Encryption settings for encrypting workflow template job arguments.
3372    #[serde(rename = "encryptionConfig")]
3373    pub encryption_config: Option<GoogleCloudDataprocV1WorkflowTemplateEncryptionConfig>,
3374    /// no description provided
3375    pub id: Option<String>,
3376    /// Required. The Directed Acyclic Graph of Jobs to submit.
3377    pub jobs: Option<Vec<OrderedJob>>,
3378    /// Optional. The labels to associate with this template. These labels will be propagated to all jobs and clusters created by the workflow instance.Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt).Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt).No more than 32 labels can be associated with a template.
3379    pub labels: Option<HashMap<String, String>>,
3380    /// Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
3381    pub name: Option<String>,
3382    /// Optional. Template parameters whose values are substituted into the template. Values for parameters must be provided when the template is instantiated.
3383    pub parameters: Option<Vec<TemplateParameter>>,
3384    /// Required. WorkflowTemplate scheduling information.
3385    pub placement: Option<WorkflowTemplatePlacement>,
3386    /// Output only. The time template was last updated.
3387    #[serde(rename = "updateTime")]
3388    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3389    /// Optional. Used to perform a consistent read-modify-write.This field should be left blank for a CreateWorkflowTemplate request. It is required for an UpdateWorkflowTemplate request, and must match the current server version. A typical update template flow would fetch the current template with a GetWorkflowTemplate request, which will return the current template with the version field filled in with the current server version. The user updates other fields in the template, then returns it as part of the UpdateWorkflowTemplate request.
3390    pub version: Option<i32>,
3391}
3392
3393impl common::RequestValue for WorkflowTemplate {}
3394impl common::ResponseResult for WorkflowTemplate {}
3395
3396/// Specifies workflow execution target.Either managed_cluster or cluster_selector is required.
3397///
3398/// This type is not used in any activity, and only used as *part* of another schema.
3399///
3400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3401#[serde_with::serde_as]
3402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3403pub struct WorkflowTemplatePlacement {
3404    /// Optional. A selector that chooses target cluster for jobs based on metadata.The selector is evaluated at the time each job is submitted.
3405    #[serde(rename = "clusterSelector")]
3406    pub cluster_selector: Option<ClusterSelector>,
3407    /// A cluster that is managed by the workflow.
3408    #[serde(rename = "managedCluster")]
3409    pub managed_cluster: Option<ManagedCluster>,
3410}
3411
3412impl common::Part for WorkflowTemplatePlacement {}
3413
3414/// A YARN application created by a job. Application information is a subset of org.apache.hadoop.yarn.proto.YarnProtos.ApplicationReportProto.Beta Feature: This report is available for testing purposes only. It may be changed before final release.
3415///
3416/// This type is not used in any activity, and only used as *part* of another schema.
3417///
3418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3419#[serde_with::serde_as]
3420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3421pub struct YarnApplication {
3422    /// Required. The application name.
3423    pub name: Option<String>,
3424    /// Required. The numerical progress of the application, from 1 to 100.
3425    pub progress: Option<f32>,
3426    /// Required. The application state.
3427    pub state: Option<String>,
3428    /// Optional. The HTTP URL of the ApplicationMaster, HistoryServer, or TimelineServer that provides application-specific information. The URL uses the internal hostname, and requires a proxy server for resolution and, possibly, access.
3429    #[serde(rename = "trackingUrl")]
3430    pub tracking_url: Option<String>,
3431}
3432
3433impl common::Part for YarnApplication {}
3434
3435// ###################
3436// MethodBuilders ###
3437// #################
3438
3439/// A builder providing access to all methods supported on *project* resources.
3440/// It is not used directly, but through the [`Dataproc`] hub.
3441///
3442/// # Example
3443///
3444/// Instantiate a resource builder
3445///
3446/// ```test_harness,no_run
3447/// extern crate hyper;
3448/// extern crate hyper_rustls;
3449/// extern crate google_dataproc1 as dataproc1;
3450///
3451/// # async fn dox() {
3452/// use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3453///
3454/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3455/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3456///     secret,
3457///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3458/// ).build().await.unwrap();
3459///
3460/// let client = hyper_util::client::legacy::Client::builder(
3461///     hyper_util::rt::TokioExecutor::new()
3462/// )
3463/// .build(
3464///     hyper_rustls::HttpsConnectorBuilder::new()
3465///         .with_native_roots()
3466///         .unwrap()
3467///         .https_or_http()
3468///         .enable_http1()
3469///         .build()
3470/// );
3471/// let mut hub = Dataproc::new(client, auth);
3472/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3473/// // like `locations_autoscaling_policies_create(...)`, `locations_autoscaling_policies_delete(...)`, `locations_autoscaling_policies_get(...)`, `locations_autoscaling_policies_get_iam_policy(...)`, `locations_autoscaling_policies_list(...)`, `locations_autoscaling_policies_set_iam_policy(...)`, `locations_autoscaling_policies_test_iam_permissions(...)`, `locations_autoscaling_policies_update(...)`, `locations_batches_analyze(...)`, `locations_batches_create(...)`, `locations_batches_delete(...)`, `locations_batches_get(...)`, `locations_batches_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_session_templates_create(...)`, `locations_session_templates_delete(...)`, `locations_session_templates_get(...)`, `locations_session_templates_list(...)`, `locations_session_templates_patch(...)`, `locations_sessions_create(...)`, `locations_sessions_delete(...)`, `locations_sessions_get(...)`, `locations_sessions_list(...)`, `locations_sessions_terminate(...)`, `locations_workflow_templates_create(...)`, `locations_workflow_templates_delete(...)`, `locations_workflow_templates_get(...)`, `locations_workflow_templates_get_iam_policy(...)`, `locations_workflow_templates_instantiate(...)`, `locations_workflow_templates_instantiate_inline(...)`, `locations_workflow_templates_list(...)`, `locations_workflow_templates_set_iam_policy(...)`, `locations_workflow_templates_test_iam_permissions(...)`, `locations_workflow_templates_update(...)`, `regions_autoscaling_policies_create(...)`, `regions_autoscaling_policies_delete(...)`, `regions_autoscaling_policies_get(...)`, `regions_autoscaling_policies_get_iam_policy(...)`, `regions_autoscaling_policies_list(...)`, `regions_autoscaling_policies_set_iam_policy(...)`, `regions_autoscaling_policies_test_iam_permissions(...)`, `regions_autoscaling_policies_update(...)`, `regions_clusters_create(...)`, `regions_clusters_delete(...)`, `regions_clusters_diagnose(...)`, `regions_clusters_get(...)`, `regions_clusters_get_iam_policy(...)`, `regions_clusters_inject_credentials(...)`, `regions_clusters_list(...)`, `regions_clusters_node_groups_create(...)`, `regions_clusters_node_groups_get(...)`, `regions_clusters_node_groups_repair(...)`, `regions_clusters_node_groups_resize(...)`, `regions_clusters_patch(...)`, `regions_clusters_repair(...)`, `regions_clusters_set_iam_policy(...)`, `regions_clusters_start(...)`, `regions_clusters_stop(...)`, `regions_clusters_test_iam_permissions(...)`, `regions_jobs_cancel(...)`, `regions_jobs_delete(...)`, `regions_jobs_get(...)`, `regions_jobs_get_iam_policy(...)`, `regions_jobs_list(...)`, `regions_jobs_patch(...)`, `regions_jobs_set_iam_policy(...)`, `regions_jobs_submit(...)`, `regions_jobs_submit_as_operation(...)`, `regions_jobs_test_iam_permissions(...)`, `regions_operations_cancel(...)`, `regions_operations_delete(...)`, `regions_operations_get(...)`, `regions_operations_get_iam_policy(...)`, `regions_operations_list(...)`, `regions_operations_set_iam_policy(...)`, `regions_operations_test_iam_permissions(...)`, `regions_workflow_templates_create(...)`, `regions_workflow_templates_delete(...)`, `regions_workflow_templates_get(...)`, `regions_workflow_templates_get_iam_policy(...)`, `regions_workflow_templates_instantiate(...)`, `regions_workflow_templates_instantiate_inline(...)`, `regions_workflow_templates_list(...)`, `regions_workflow_templates_set_iam_policy(...)`, `regions_workflow_templates_test_iam_permissions(...)` and `regions_workflow_templates_update(...)`
3474/// // to build up your call.
3475/// let rb = hub.projects();
3476/// # }
3477/// ```
3478pub struct ProjectMethods<'a, C>
3479where
3480    C: 'a,
3481{
3482    hub: &'a Dataproc<C>,
3483}
3484
3485impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3486
3487impl<'a, C> ProjectMethods<'a, C> {
3488    /// Create a builder to help you perform the following task:
3489    ///
3490    /// Creates new autoscaling policy.
3491    ///
3492    /// # Arguments
3493    ///
3494    /// * `request` - No description provided.
3495    /// * `parent` - Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
3496    pub fn locations_autoscaling_policies_create(
3497        &self,
3498        request: AutoscalingPolicy,
3499        parent: &str,
3500    ) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C> {
3501        ProjectLocationAutoscalingPolicyCreateCall {
3502            hub: self.hub,
3503            _request: request,
3504            _parent: parent.to_string(),
3505            _delegate: Default::default(),
3506            _additional_params: Default::default(),
3507            _scopes: Default::default(),
3508        }
3509    }
3510
3511    /// Create a builder to help you perform the following task:
3512    ///
3513    /// Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.
3514    ///
3515    /// # Arguments
3516    ///
3517    /// * `name` - Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
3518    pub fn locations_autoscaling_policies_delete(
3519        &self,
3520        name: &str,
3521    ) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C> {
3522        ProjectLocationAutoscalingPolicyDeleteCall {
3523            hub: self.hub,
3524            _name: name.to_string(),
3525            _delegate: Default::default(),
3526            _additional_params: Default::default(),
3527            _scopes: Default::default(),
3528        }
3529    }
3530
3531    /// Create a builder to help you perform the following task:
3532    ///
3533    /// Retrieves autoscaling policy.
3534    ///
3535    /// # Arguments
3536    ///
3537    /// * `name` - Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
3538    pub fn locations_autoscaling_policies_get(
3539        &self,
3540        name: &str,
3541    ) -> ProjectLocationAutoscalingPolicyGetCall<'a, C> {
3542        ProjectLocationAutoscalingPolicyGetCall {
3543            hub: self.hub,
3544            _name: name.to_string(),
3545            _delegate: Default::default(),
3546            _additional_params: Default::default(),
3547            _scopes: Default::default(),
3548        }
3549    }
3550
3551    /// Create a builder to help you perform the following task:
3552    ///
3553    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3554    ///
3555    /// # Arguments
3556    ///
3557    /// * `request` - No description provided.
3558    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3559    pub fn locations_autoscaling_policies_get_iam_policy(
3560        &self,
3561        request: GetIamPolicyRequest,
3562        resource: &str,
3563    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {
3564        ProjectLocationAutoscalingPolicyGetIamPolicyCall {
3565            hub: self.hub,
3566            _request: request,
3567            _resource: resource.to_string(),
3568            _delegate: Default::default(),
3569            _additional_params: Default::default(),
3570            _scopes: Default::default(),
3571        }
3572    }
3573
3574    /// Create a builder to help you perform the following task:
3575    ///
3576    /// Lists autoscaling policies in the project.
3577    ///
3578    /// # Arguments
3579    ///
3580    /// * `parent` - Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
3581    pub fn locations_autoscaling_policies_list(
3582        &self,
3583        parent: &str,
3584    ) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
3585        ProjectLocationAutoscalingPolicyListCall {
3586            hub: self.hub,
3587            _parent: parent.to_string(),
3588            _page_token: Default::default(),
3589            _page_size: Default::default(),
3590            _delegate: Default::default(),
3591            _additional_params: Default::default(),
3592            _scopes: Default::default(),
3593        }
3594    }
3595
3596    /// Create a builder to help you perform the following task:
3597    ///
3598    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
3599    ///
3600    /// # Arguments
3601    ///
3602    /// * `request` - No description provided.
3603    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3604    pub fn locations_autoscaling_policies_set_iam_policy(
3605        &self,
3606        request: SetIamPolicyRequest,
3607        resource: &str,
3608    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {
3609        ProjectLocationAutoscalingPolicySetIamPolicyCall {
3610            hub: self.hub,
3611            _request: request,
3612            _resource: resource.to_string(),
3613            _delegate: Default::default(),
3614            _additional_params: Default::default(),
3615            _scopes: Default::default(),
3616        }
3617    }
3618
3619    /// Create a builder to help you perform the following task:
3620    ///
3621    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
3622    ///
3623    /// # Arguments
3624    ///
3625    /// * `request` - No description provided.
3626    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3627    pub fn locations_autoscaling_policies_test_iam_permissions(
3628        &self,
3629        request: TestIamPermissionsRequest,
3630        resource: &str,
3631    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {
3632        ProjectLocationAutoscalingPolicyTestIamPermissionCall {
3633            hub: self.hub,
3634            _request: request,
3635            _resource: resource.to_string(),
3636            _delegate: Default::default(),
3637            _additional_params: Default::default(),
3638            _scopes: Default::default(),
3639        }
3640    }
3641
3642    /// Create a builder to help you perform the following task:
3643    ///
3644    /// Updates (replaces) autoscaling policy.Disabled check for update_mask, because all updates will be full replacements.
3645    ///
3646    /// # Arguments
3647    ///
3648    /// * `request` - No description provided.
3649    /// * `name` - Output only. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
3650    pub fn locations_autoscaling_policies_update(
3651        &self,
3652        request: AutoscalingPolicy,
3653        name: &str,
3654    ) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {
3655        ProjectLocationAutoscalingPolicyUpdateCall {
3656            hub: self.hub,
3657            _request: request,
3658            _name: name.to_string(),
3659            _delegate: Default::default(),
3660            _additional_params: Default::default(),
3661            _scopes: Default::default(),
3662        }
3663    }
3664
3665    /// Create a builder to help you perform the following task:
3666    ///
3667    /// Analyze a Batch for possible recommendations and insights.
3668    ///
3669    /// # Arguments
3670    ///
3671    /// * `request` - No description provided.
3672    /// * `name` - Required. The fully qualified name of the batch to analyze in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
3673    pub fn locations_batches_analyze(
3674        &self,
3675        request: AnalyzeBatchRequest,
3676        name: &str,
3677    ) -> ProjectLocationBatchAnalyzeCall<'a, C> {
3678        ProjectLocationBatchAnalyzeCall {
3679            hub: self.hub,
3680            _request: request,
3681            _name: name.to_string(),
3682            _delegate: Default::default(),
3683            _additional_params: Default::default(),
3684            _scopes: Default::default(),
3685        }
3686    }
3687
3688    /// Create a builder to help you perform the following task:
3689    ///
3690    /// Creates a batch workload that executes asynchronously.
3691    ///
3692    /// # Arguments
3693    ///
3694    /// * `request` - No description provided.
3695    /// * `parent` - Required. The parent resource where this batch will be created.
3696    pub fn locations_batches_create(
3697        &self,
3698        request: Batch,
3699        parent: &str,
3700    ) -> ProjectLocationBatchCreateCall<'a, C> {
3701        ProjectLocationBatchCreateCall {
3702            hub: self.hub,
3703            _request: request,
3704            _parent: parent.to_string(),
3705            _request_id: Default::default(),
3706            _batch_id: Default::default(),
3707            _delegate: Default::default(),
3708            _additional_params: Default::default(),
3709            _scopes: Default::default(),
3710        }
3711    }
3712
3713    /// Create a builder to help you perform the following task:
3714    ///
3715    /// Deletes the batch workload resource. If the batch is not in a CANCELLED, SUCCEEDED or FAILED State, the delete operation fails and the response returns FAILED_PRECONDITION.
3716    ///
3717    /// # Arguments
3718    ///
3719    /// * `name` - Required. The fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
3720    pub fn locations_batches_delete(&self, name: &str) -> ProjectLocationBatchDeleteCall<'a, C> {
3721        ProjectLocationBatchDeleteCall {
3722            hub: self.hub,
3723            _name: name.to_string(),
3724            _delegate: Default::default(),
3725            _additional_params: Default::default(),
3726            _scopes: Default::default(),
3727        }
3728    }
3729
3730    /// Create a builder to help you perform the following task:
3731    ///
3732    /// Gets the batch workload resource representation.
3733    ///
3734    /// # Arguments
3735    ///
3736    /// * `name` - Required. The fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
3737    pub fn locations_batches_get(&self, name: &str) -> ProjectLocationBatchGetCall<'a, C> {
3738        ProjectLocationBatchGetCall {
3739            hub: self.hub,
3740            _name: name.to_string(),
3741            _delegate: Default::default(),
3742            _additional_params: Default::default(),
3743            _scopes: Default::default(),
3744        }
3745    }
3746
3747    /// Create a builder to help you perform the following task:
3748    ///
3749    /// Lists batch workloads.
3750    ///
3751    /// # Arguments
3752    ///
3753    /// * `parent` - Required. The parent, which owns this collection of batches.
3754    pub fn locations_batches_list(&self, parent: &str) -> ProjectLocationBatchListCall<'a, C> {
3755        ProjectLocationBatchListCall {
3756            hub: self.hub,
3757            _parent: parent.to_string(),
3758            _page_token: Default::default(),
3759            _page_size: Default::default(),
3760            _order_by: Default::default(),
3761            _filter: Default::default(),
3762            _delegate: Default::default(),
3763            _additional_params: Default::default(),
3764            _scopes: Default::default(),
3765        }
3766    }
3767
3768    /// Create a builder to help you perform the following task:
3769    ///
3770    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
3771    ///
3772    /// # Arguments
3773    ///
3774    /// * `name` - The name of the operation resource to be cancelled.
3775    pub fn locations_operations_cancel(
3776        &self,
3777        name: &str,
3778    ) -> ProjectLocationOperationCancelCall<'a, C> {
3779        ProjectLocationOperationCancelCall {
3780            hub: self.hub,
3781            _name: name.to_string(),
3782            _delegate: Default::default(),
3783            _additional_params: Default::default(),
3784            _scopes: Default::default(),
3785        }
3786    }
3787
3788    /// Create a builder to help you perform the following task:
3789    ///
3790    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
3791    ///
3792    /// # Arguments
3793    ///
3794    /// * `name` - The name of the operation resource to be deleted.
3795    pub fn locations_operations_delete(
3796        &self,
3797        name: &str,
3798    ) -> ProjectLocationOperationDeleteCall<'a, C> {
3799        ProjectLocationOperationDeleteCall {
3800            hub: self.hub,
3801            _name: name.to_string(),
3802            _delegate: Default::default(),
3803            _additional_params: Default::default(),
3804            _scopes: Default::default(),
3805        }
3806    }
3807
3808    /// Create a builder to help you perform the following task:
3809    ///
3810    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3811    ///
3812    /// # Arguments
3813    ///
3814    /// * `name` - The name of the operation resource.
3815    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
3816        ProjectLocationOperationGetCall {
3817            hub: self.hub,
3818            _name: name.to_string(),
3819            _delegate: Default::default(),
3820            _additional_params: Default::default(),
3821            _scopes: Default::default(),
3822        }
3823    }
3824
3825    /// Create a builder to help you perform the following task:
3826    ///
3827    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
3828    ///
3829    /// # Arguments
3830    ///
3831    /// * `name` - The name of the operation's parent resource.
3832    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
3833        ProjectLocationOperationListCall {
3834            hub: self.hub,
3835            _name: name.to_string(),
3836            _page_token: Default::default(),
3837            _page_size: Default::default(),
3838            _filter: Default::default(),
3839            _delegate: Default::default(),
3840            _additional_params: Default::default(),
3841            _scopes: Default::default(),
3842        }
3843    }
3844
3845    /// Create a builder to help you perform the following task:
3846    ///
3847    /// Create a session template synchronously.
3848    ///
3849    /// # Arguments
3850    ///
3851    /// * `request` - No description provided.
3852    /// * `parent` - Required. The parent resource where this session template will be created.
3853    pub fn locations_session_templates_create(
3854        &self,
3855        request: SessionTemplate,
3856        parent: &str,
3857    ) -> ProjectLocationSessionTemplateCreateCall<'a, C> {
3858        ProjectLocationSessionTemplateCreateCall {
3859            hub: self.hub,
3860            _request: request,
3861            _parent: parent.to_string(),
3862            _delegate: Default::default(),
3863            _additional_params: Default::default(),
3864            _scopes: Default::default(),
3865        }
3866    }
3867
3868    /// Create a builder to help you perform the following task:
3869    ///
3870    /// Deletes a session template.
3871    ///
3872    /// # Arguments
3873    ///
3874    /// * `name` - Required. The name of the session template resource to delete.
3875    pub fn locations_session_templates_delete(
3876        &self,
3877        name: &str,
3878    ) -> ProjectLocationSessionTemplateDeleteCall<'a, C> {
3879        ProjectLocationSessionTemplateDeleteCall {
3880            hub: self.hub,
3881            _name: name.to_string(),
3882            _delegate: Default::default(),
3883            _additional_params: Default::default(),
3884            _scopes: Default::default(),
3885        }
3886    }
3887
3888    /// Create a builder to help you perform the following task:
3889    ///
3890    /// Gets the resource representation for a session template.
3891    ///
3892    /// # Arguments
3893    ///
3894    /// * `name` - Required. The name of the session template to retrieve.
3895    pub fn locations_session_templates_get(
3896        &self,
3897        name: &str,
3898    ) -> ProjectLocationSessionTemplateGetCall<'a, C> {
3899        ProjectLocationSessionTemplateGetCall {
3900            hub: self.hub,
3901            _name: name.to_string(),
3902            _delegate: Default::default(),
3903            _additional_params: Default::default(),
3904            _scopes: Default::default(),
3905        }
3906    }
3907
3908    /// Create a builder to help you perform the following task:
3909    ///
3910    /// Lists session templates.
3911    ///
3912    /// # Arguments
3913    ///
3914    /// * `parent` - Required. The parent that owns this collection of session templates.
3915    pub fn locations_session_templates_list(
3916        &self,
3917        parent: &str,
3918    ) -> ProjectLocationSessionTemplateListCall<'a, C> {
3919        ProjectLocationSessionTemplateListCall {
3920            hub: self.hub,
3921            _parent: parent.to_string(),
3922            _page_token: Default::default(),
3923            _page_size: Default::default(),
3924            _filter: Default::default(),
3925            _delegate: Default::default(),
3926            _additional_params: Default::default(),
3927            _scopes: Default::default(),
3928        }
3929    }
3930
3931    /// Create a builder to help you perform the following task:
3932    ///
3933    /// Updates the session template synchronously.
3934    ///
3935    /// # Arguments
3936    ///
3937    /// * `request` - No description provided.
3938    /// * `name` - Required. The resource name of the session template.
3939    pub fn locations_session_templates_patch(
3940        &self,
3941        request: SessionTemplate,
3942        name: &str,
3943    ) -> ProjectLocationSessionTemplatePatchCall<'a, C> {
3944        ProjectLocationSessionTemplatePatchCall {
3945            hub: self.hub,
3946            _request: request,
3947            _name: name.to_string(),
3948            _delegate: Default::default(),
3949            _additional_params: Default::default(),
3950            _scopes: Default::default(),
3951        }
3952    }
3953
3954    /// Create a builder to help you perform the following task:
3955    ///
3956    /// Create an interactive session asynchronously.
3957    ///
3958    /// # Arguments
3959    ///
3960    /// * `request` - No description provided.
3961    /// * `parent` - Required. The parent resource where this session will be created.
3962    pub fn locations_sessions_create(
3963        &self,
3964        request: Session,
3965        parent: &str,
3966    ) -> ProjectLocationSessionCreateCall<'a, C> {
3967        ProjectLocationSessionCreateCall {
3968            hub: self.hub,
3969            _request: request,
3970            _parent: parent.to_string(),
3971            _session_id: Default::default(),
3972            _request_id: Default::default(),
3973            _delegate: Default::default(),
3974            _additional_params: Default::default(),
3975            _scopes: Default::default(),
3976        }
3977    }
3978
3979    /// Create a builder to help you perform the following task:
3980    ///
3981    /// Deletes the interactive session resource. If the session is not in terminal state, it is terminated, and then deleted.
3982    ///
3983    /// # Arguments
3984    ///
3985    /// * `name` - Required. The name of the session resource to delete.
3986    pub fn locations_sessions_delete(&self, name: &str) -> ProjectLocationSessionDeleteCall<'a, C> {
3987        ProjectLocationSessionDeleteCall {
3988            hub: self.hub,
3989            _name: name.to_string(),
3990            _request_id: Default::default(),
3991            _delegate: Default::default(),
3992            _additional_params: Default::default(),
3993            _scopes: Default::default(),
3994        }
3995    }
3996
3997    /// Create a builder to help you perform the following task:
3998    ///
3999    /// Gets the resource representation for an interactive session.
4000    ///
4001    /// # Arguments
4002    ///
4003    /// * `name` - Required. The name of the session to retrieve.
4004    pub fn locations_sessions_get(&self, name: &str) -> ProjectLocationSessionGetCall<'a, C> {
4005        ProjectLocationSessionGetCall {
4006            hub: self.hub,
4007            _name: name.to_string(),
4008            _delegate: Default::default(),
4009            _additional_params: Default::default(),
4010            _scopes: Default::default(),
4011        }
4012    }
4013
4014    /// Create a builder to help you perform the following task:
4015    ///
4016    /// Lists interactive sessions.
4017    ///
4018    /// # Arguments
4019    ///
4020    /// * `parent` - Required. The parent, which owns this collection of sessions.
4021    pub fn locations_sessions_list(&self, parent: &str) -> ProjectLocationSessionListCall<'a, C> {
4022        ProjectLocationSessionListCall {
4023            hub: self.hub,
4024            _parent: parent.to_string(),
4025            _page_token: Default::default(),
4026            _page_size: Default::default(),
4027            _filter: Default::default(),
4028            _delegate: Default::default(),
4029            _additional_params: Default::default(),
4030            _scopes: Default::default(),
4031        }
4032    }
4033
4034    /// Create a builder to help you perform the following task:
4035    ///
4036    /// Terminates the interactive session.
4037    ///
4038    /// # Arguments
4039    ///
4040    /// * `request` - No description provided.
4041    /// * `name` - Required. The name of the session resource to terminate.
4042    pub fn locations_sessions_terminate(
4043        &self,
4044        request: TerminateSessionRequest,
4045        name: &str,
4046    ) -> ProjectLocationSessionTerminateCall<'a, C> {
4047        ProjectLocationSessionTerminateCall {
4048            hub: self.hub,
4049            _request: request,
4050            _name: name.to_string(),
4051            _delegate: Default::default(),
4052            _additional_params: Default::default(),
4053            _scopes: Default::default(),
4054        }
4055    }
4056
4057    /// Create a builder to help you perform the following task:
4058    ///
4059    /// Creates new workflow template.
4060    ///
4061    /// # Arguments
4062    ///
4063    /// * `request` - No description provided.
4064    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
4065    pub fn locations_workflow_templates_create(
4066        &self,
4067        request: WorkflowTemplate,
4068        parent: &str,
4069    ) -> ProjectLocationWorkflowTemplateCreateCall<'a, C> {
4070        ProjectLocationWorkflowTemplateCreateCall {
4071            hub: self.hub,
4072            _request: request,
4073            _parent: parent.to_string(),
4074            _delegate: Default::default(),
4075            _additional_params: Default::default(),
4076            _scopes: Default::default(),
4077        }
4078    }
4079
4080    /// Create a builder to help you perform the following task:
4081    ///
4082    /// Deletes a workflow template. It does not cancel in-progress workflows.
4083    ///
4084    /// # Arguments
4085    ///
4086    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
4087    pub fn locations_workflow_templates_delete(
4088        &self,
4089        name: &str,
4090    ) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C> {
4091        ProjectLocationWorkflowTemplateDeleteCall {
4092            hub: self.hub,
4093            _name: name.to_string(),
4094            _version: Default::default(),
4095            _delegate: Default::default(),
4096            _additional_params: Default::default(),
4097            _scopes: Default::default(),
4098        }
4099    }
4100
4101    /// Create a builder to help you perform the following task:
4102    ///
4103    /// Retrieves the latest workflow template.Can retrieve previously instantiated template by specifying optional version parameter.
4104    ///
4105    /// # Arguments
4106    ///
4107    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
4108    pub fn locations_workflow_templates_get(
4109        &self,
4110        name: &str,
4111    ) -> ProjectLocationWorkflowTemplateGetCall<'a, C> {
4112        ProjectLocationWorkflowTemplateGetCall {
4113            hub: self.hub,
4114            _name: name.to_string(),
4115            _version: Default::default(),
4116            _delegate: Default::default(),
4117            _additional_params: Default::default(),
4118            _scopes: Default::default(),
4119        }
4120    }
4121
4122    /// Create a builder to help you perform the following task:
4123    ///
4124    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4125    ///
4126    /// # Arguments
4127    ///
4128    /// * `request` - No description provided.
4129    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4130    pub fn locations_workflow_templates_get_iam_policy(
4131        &self,
4132        request: GetIamPolicyRequest,
4133        resource: &str,
4134    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {
4135        ProjectLocationWorkflowTemplateGetIamPolicyCall {
4136            hub: self.hub,
4137            _request: request,
4138            _resource: resource.to_string(),
4139            _delegate: Default::default(),
4140            _additional_params: Default::default(),
4141            _scopes: Default::default(),
4142        }
4143    }
4144
4145    /// Create a builder to help you perform the following task:
4146    ///
4147    /// Instantiates a template and begins execution.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
4148    ///
4149    /// # Arguments
4150    ///
4151    /// * `request` - No description provided.
4152    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
4153    pub fn locations_workflow_templates_instantiate(
4154        &self,
4155        request: InstantiateWorkflowTemplateRequest,
4156        name: &str,
4157    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {
4158        ProjectLocationWorkflowTemplateInstantiateCall {
4159            hub: self.hub,
4160            _request: request,
4161            _name: name.to_string(),
4162            _delegate: Default::default(),
4163            _additional_params: Default::default(),
4164            _scopes: Default::default(),
4165        }
4166    }
4167
4168    /// Create a builder to help you perform the following task:
4169    ///
4170    /// Instantiates a template and begins execution.This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
4171    ///
4172    /// # Arguments
4173    ///
4174    /// * `request` - No description provided.
4175    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}
4176    pub fn locations_workflow_templates_instantiate_inline(
4177        &self,
4178        request: WorkflowTemplate,
4179        parent: &str,
4180    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
4181        ProjectLocationWorkflowTemplateInstantiateInlineCall {
4182            hub: self.hub,
4183            _request: request,
4184            _parent: parent.to_string(),
4185            _request_id: Default::default(),
4186            _delegate: Default::default(),
4187            _additional_params: Default::default(),
4188            _scopes: Default::default(),
4189        }
4190    }
4191
4192    /// Create a builder to help you perform the following task:
4193    ///
4194    /// Lists workflows that match the specified filter in the request.
4195    ///
4196    /// # Arguments
4197    ///
4198    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
4199    pub fn locations_workflow_templates_list(
4200        &self,
4201        parent: &str,
4202    ) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
4203        ProjectLocationWorkflowTemplateListCall {
4204            hub: self.hub,
4205            _parent: parent.to_string(),
4206            _page_token: Default::default(),
4207            _page_size: Default::default(),
4208            _delegate: Default::default(),
4209            _additional_params: Default::default(),
4210            _scopes: Default::default(),
4211        }
4212    }
4213
4214    /// Create a builder to help you perform the following task:
4215    ///
4216    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
4217    ///
4218    /// # Arguments
4219    ///
4220    /// * `request` - No description provided.
4221    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4222    pub fn locations_workflow_templates_set_iam_policy(
4223        &self,
4224        request: SetIamPolicyRequest,
4225        resource: &str,
4226    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {
4227        ProjectLocationWorkflowTemplateSetIamPolicyCall {
4228            hub: self.hub,
4229            _request: request,
4230            _resource: resource.to_string(),
4231            _delegate: Default::default(),
4232            _additional_params: Default::default(),
4233            _scopes: Default::default(),
4234        }
4235    }
4236
4237    /// Create a builder to help you perform the following task:
4238    ///
4239    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4240    ///
4241    /// # Arguments
4242    ///
4243    /// * `request` - No description provided.
4244    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4245    pub fn locations_workflow_templates_test_iam_permissions(
4246        &self,
4247        request: TestIamPermissionsRequest,
4248        resource: &str,
4249    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {
4250        ProjectLocationWorkflowTemplateTestIamPermissionCall {
4251            hub: self.hub,
4252            _request: request,
4253            _resource: resource.to_string(),
4254            _delegate: Default::default(),
4255            _additional_params: Default::default(),
4256            _scopes: Default::default(),
4257        }
4258    }
4259
4260    /// Create a builder to help you perform the following task:
4261    ///
4262    /// Updates (replaces) workflow template. The updated template must contain version that matches the current server version.
4263    ///
4264    /// # Arguments
4265    ///
4266    /// * `request` - No description provided.
4267    /// * `name` - Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
4268    pub fn locations_workflow_templates_update(
4269        &self,
4270        request: WorkflowTemplate,
4271        name: &str,
4272    ) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C> {
4273        ProjectLocationWorkflowTemplateUpdateCall {
4274            hub: self.hub,
4275            _request: request,
4276            _name: name.to_string(),
4277            _delegate: Default::default(),
4278            _additional_params: Default::default(),
4279            _scopes: Default::default(),
4280        }
4281    }
4282
4283    /// Create a builder to help you perform the following task:
4284    ///
4285    /// Creates new autoscaling policy.
4286    ///
4287    /// # Arguments
4288    ///
4289    /// * `request` - No description provided.
4290    /// * `parent` - Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
4291    pub fn regions_autoscaling_policies_create(
4292        &self,
4293        request: AutoscalingPolicy,
4294        parent: &str,
4295    ) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C> {
4296        ProjectRegionAutoscalingPolicyCreateCall {
4297            hub: self.hub,
4298            _request: request,
4299            _parent: parent.to_string(),
4300            _delegate: Default::default(),
4301            _additional_params: Default::default(),
4302            _scopes: Default::default(),
4303        }
4304    }
4305
4306    /// Create a builder to help you perform the following task:
4307    ///
4308    /// Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.
4309    ///
4310    /// # Arguments
4311    ///
4312    /// * `name` - Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
4313    pub fn regions_autoscaling_policies_delete(
4314        &self,
4315        name: &str,
4316    ) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C> {
4317        ProjectRegionAutoscalingPolicyDeleteCall {
4318            hub: self.hub,
4319            _name: name.to_string(),
4320            _delegate: Default::default(),
4321            _additional_params: Default::default(),
4322            _scopes: Default::default(),
4323        }
4324    }
4325
4326    /// Create a builder to help you perform the following task:
4327    ///
4328    /// Retrieves autoscaling policy.
4329    ///
4330    /// # Arguments
4331    ///
4332    /// * `name` - Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
4333    pub fn regions_autoscaling_policies_get(
4334        &self,
4335        name: &str,
4336    ) -> ProjectRegionAutoscalingPolicyGetCall<'a, C> {
4337        ProjectRegionAutoscalingPolicyGetCall {
4338            hub: self.hub,
4339            _name: name.to_string(),
4340            _delegate: Default::default(),
4341            _additional_params: Default::default(),
4342            _scopes: Default::default(),
4343        }
4344    }
4345
4346    /// Create a builder to help you perform the following task:
4347    ///
4348    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4349    ///
4350    /// # Arguments
4351    ///
4352    /// * `request` - No description provided.
4353    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4354    pub fn regions_autoscaling_policies_get_iam_policy(
4355        &self,
4356        request: GetIamPolicyRequest,
4357        resource: &str,
4358    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {
4359        ProjectRegionAutoscalingPolicyGetIamPolicyCall {
4360            hub: self.hub,
4361            _request: request,
4362            _resource: resource.to_string(),
4363            _delegate: Default::default(),
4364            _additional_params: Default::default(),
4365            _scopes: Default::default(),
4366        }
4367    }
4368
4369    /// Create a builder to help you perform the following task:
4370    ///
4371    /// Lists autoscaling policies in the project.
4372    ///
4373    /// # Arguments
4374    ///
4375    /// * `parent` - Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
4376    pub fn regions_autoscaling_policies_list(
4377        &self,
4378        parent: &str,
4379    ) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
4380        ProjectRegionAutoscalingPolicyListCall {
4381            hub: self.hub,
4382            _parent: parent.to_string(),
4383            _page_token: Default::default(),
4384            _page_size: Default::default(),
4385            _delegate: Default::default(),
4386            _additional_params: Default::default(),
4387            _scopes: Default::default(),
4388        }
4389    }
4390
4391    /// Create a builder to help you perform the following task:
4392    ///
4393    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
4394    ///
4395    /// # Arguments
4396    ///
4397    /// * `request` - No description provided.
4398    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4399    pub fn regions_autoscaling_policies_set_iam_policy(
4400        &self,
4401        request: SetIamPolicyRequest,
4402        resource: &str,
4403    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {
4404        ProjectRegionAutoscalingPolicySetIamPolicyCall {
4405            hub: self.hub,
4406            _request: request,
4407            _resource: resource.to_string(),
4408            _delegate: Default::default(),
4409            _additional_params: Default::default(),
4410            _scopes: Default::default(),
4411        }
4412    }
4413
4414    /// Create a builder to help you perform the following task:
4415    ///
4416    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4417    ///
4418    /// # Arguments
4419    ///
4420    /// * `request` - No description provided.
4421    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4422    pub fn regions_autoscaling_policies_test_iam_permissions(
4423        &self,
4424        request: TestIamPermissionsRequest,
4425        resource: &str,
4426    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {
4427        ProjectRegionAutoscalingPolicyTestIamPermissionCall {
4428            hub: self.hub,
4429            _request: request,
4430            _resource: resource.to_string(),
4431            _delegate: Default::default(),
4432            _additional_params: Default::default(),
4433            _scopes: Default::default(),
4434        }
4435    }
4436
4437    /// Create a builder to help you perform the following task:
4438    ///
4439    /// Updates (replaces) autoscaling policy.Disabled check for update_mask, because all updates will be full replacements.
4440    ///
4441    /// # Arguments
4442    ///
4443    /// * `request` - No description provided.
4444    /// * `name` - Output only. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
4445    pub fn regions_autoscaling_policies_update(
4446        &self,
4447        request: AutoscalingPolicy,
4448        name: &str,
4449    ) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {
4450        ProjectRegionAutoscalingPolicyUpdateCall {
4451            hub: self.hub,
4452            _request: request,
4453            _name: name.to_string(),
4454            _delegate: Default::default(),
4455            _additional_params: Default::default(),
4456            _scopes: Default::default(),
4457        }
4458    }
4459
4460    /// Create a builder to help you perform the following task:
4461    ///
4462    /// Creates a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
4463    ///
4464    /// # Arguments
4465    ///
4466    /// * `request` - No description provided.
4467    /// * `parent` - Required. The parent resource where this node group will be created. Format: projects/{project}/regions/{region}/clusters/{cluster}
4468    pub fn regions_clusters_node_groups_create(
4469        &self,
4470        request: NodeGroup,
4471        parent: &str,
4472    ) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
4473        ProjectRegionClusterNodeGroupCreateCall {
4474            hub: self.hub,
4475            _request: request,
4476            _parent: parent.to_string(),
4477            _request_id: Default::default(),
4478            _parent_operation_id: Default::default(),
4479            _node_group_id: Default::default(),
4480            _delegate: Default::default(),
4481            _additional_params: Default::default(),
4482            _scopes: Default::default(),
4483        }
4484    }
4485
4486    /// Create a builder to help you perform the following task:
4487    ///
4488    /// Gets the resource representation for a node group in a cluster.
4489    ///
4490    /// # Arguments
4491    ///
4492    /// * `name` - Required. The name of the node group to retrieve. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
4493    pub fn regions_clusters_node_groups_get(
4494        &self,
4495        name: &str,
4496    ) -> ProjectRegionClusterNodeGroupGetCall<'a, C> {
4497        ProjectRegionClusterNodeGroupGetCall {
4498            hub: self.hub,
4499            _name: name.to_string(),
4500            _delegate: Default::default(),
4501            _additional_params: Default::default(),
4502            _scopes: Default::default(),
4503        }
4504    }
4505
4506    /// Create a builder to help you perform the following task:
4507    ///
4508    /// Repair nodes in a node group.
4509    ///
4510    /// # Arguments
4511    ///
4512    /// * `request` - No description provided.
4513    /// * `name` - Required. The name of the node group to resize. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
4514    pub fn regions_clusters_node_groups_repair(
4515        &self,
4516        request: RepairNodeGroupRequest,
4517        name: &str,
4518    ) -> ProjectRegionClusterNodeGroupRepairCall<'a, C> {
4519        ProjectRegionClusterNodeGroupRepairCall {
4520            hub: self.hub,
4521            _request: request,
4522            _name: name.to_string(),
4523            _delegate: Default::default(),
4524            _additional_params: Default::default(),
4525            _scopes: Default::default(),
4526        }
4527    }
4528
4529    /// Create a builder to help you perform the following task:
4530    ///
4531    /// Resizes a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
4532    ///
4533    /// # Arguments
4534    ///
4535    /// * `request` - No description provided.
4536    /// * `name` - Required. The name of the node group to resize. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
4537    pub fn regions_clusters_node_groups_resize(
4538        &self,
4539        request: ResizeNodeGroupRequest,
4540        name: &str,
4541    ) -> ProjectRegionClusterNodeGroupResizeCall<'a, C> {
4542        ProjectRegionClusterNodeGroupResizeCall {
4543            hub: self.hub,
4544            _request: request,
4545            _name: name.to_string(),
4546            _delegate: Default::default(),
4547            _additional_params: Default::default(),
4548            _scopes: Default::default(),
4549        }
4550    }
4551
4552    /// Create a builder to help you perform the following task:
4553    ///
4554    /// Creates a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
4555    ///
4556    /// # Arguments
4557    ///
4558    /// * `request` - No description provided.
4559    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the cluster belongs to.
4560    /// * `region` - Required. The Dataproc region in which to handle the request.
4561    pub fn regions_clusters_create(
4562        &self,
4563        request: Cluster,
4564        project_id: &str,
4565        region: &str,
4566    ) -> ProjectRegionClusterCreateCall<'a, C> {
4567        ProjectRegionClusterCreateCall {
4568            hub: self.hub,
4569            _request: request,
4570            _project_id: project_id.to_string(),
4571            _region: region.to_string(),
4572            _request_id: Default::default(),
4573            _action_on_failed_primary_workers: Default::default(),
4574            _delegate: Default::default(),
4575            _additional_params: Default::default(),
4576            _scopes: Default::default(),
4577        }
4578    }
4579
4580    /// Create a builder to help you perform the following task:
4581    ///
4582    /// Deletes a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
4583    ///
4584    /// # Arguments
4585    ///
4586    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the cluster belongs to.
4587    /// * `region` - Required. The Dataproc region in which to handle the request.
4588    /// * `clusterName` - Required. The cluster name.
4589    pub fn regions_clusters_delete(
4590        &self,
4591        project_id: &str,
4592        region: &str,
4593        cluster_name: &str,
4594    ) -> ProjectRegionClusterDeleteCall<'a, C> {
4595        ProjectRegionClusterDeleteCall {
4596            hub: self.hub,
4597            _project_id: project_id.to_string(),
4598            _region: region.to_string(),
4599            _cluster_name: cluster_name.to_string(),
4600            _request_id: Default::default(),
4601            _graceful_termination_timeout: Default::default(),
4602            _cluster_uuid: Default::default(),
4603            _delegate: Default::default(),
4604            _additional_params: Default::default(),
4605            _scopes: Default::default(),
4606        }
4607    }
4608
4609    /// Create a builder to help you perform the following task:
4610    ///
4611    /// Gets cluster diagnostic information. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, Operation.response contains DiagnoseClusterResults (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
4612    ///
4613    /// # Arguments
4614    ///
4615    /// * `request` - No description provided.
4616    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the cluster belongs to.
4617    /// * `region` - Required. The Dataproc region in which to handle the request.
4618    /// * `clusterName` - Required. The cluster name.
4619    pub fn regions_clusters_diagnose(
4620        &self,
4621        request: DiagnoseClusterRequest,
4622        project_id: &str,
4623        region: &str,
4624        cluster_name: &str,
4625    ) -> ProjectRegionClusterDiagnoseCall<'a, C> {
4626        ProjectRegionClusterDiagnoseCall {
4627            hub: self.hub,
4628            _request: request,
4629            _project_id: project_id.to_string(),
4630            _region: region.to_string(),
4631            _cluster_name: cluster_name.to_string(),
4632            _delegate: Default::default(),
4633            _additional_params: Default::default(),
4634            _scopes: Default::default(),
4635        }
4636    }
4637
4638    /// Create a builder to help you perform the following task:
4639    ///
4640    /// Gets the resource representation for a cluster in a project.
4641    ///
4642    /// # Arguments
4643    ///
4644    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the cluster belongs to.
4645    /// * `region` - Required. The Dataproc region in which to handle the request.
4646    /// * `clusterName` - Required. The cluster name.
4647    pub fn regions_clusters_get(
4648        &self,
4649        project_id: &str,
4650        region: &str,
4651        cluster_name: &str,
4652    ) -> ProjectRegionClusterGetCall<'a, C> {
4653        ProjectRegionClusterGetCall {
4654            hub: self.hub,
4655            _project_id: project_id.to_string(),
4656            _region: region.to_string(),
4657            _cluster_name: cluster_name.to_string(),
4658            _delegate: Default::default(),
4659            _additional_params: Default::default(),
4660            _scopes: Default::default(),
4661        }
4662    }
4663
4664    /// Create a builder to help you perform the following task:
4665    ///
4666    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4667    ///
4668    /// # Arguments
4669    ///
4670    /// * `request` - No description provided.
4671    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4672    pub fn regions_clusters_get_iam_policy(
4673        &self,
4674        request: GetIamPolicyRequest,
4675        resource: &str,
4676    ) -> ProjectRegionClusterGetIamPolicyCall<'a, C> {
4677        ProjectRegionClusterGetIamPolicyCall {
4678            hub: self.hub,
4679            _request: request,
4680            _resource: resource.to_string(),
4681            _delegate: Default::default(),
4682            _additional_params: Default::default(),
4683            _scopes: Default::default(),
4684        }
4685    }
4686
4687    /// Create a builder to help you perform the following task:
4688    ///
4689    /// Inject encrypted credentials into all of the VMs in a cluster.The target cluster must be a personal auth cluster assigned to the user who is issuing the RPC.
4690    ///
4691    /// # Arguments
4692    ///
4693    /// * `request` - No description provided.
4694    /// * `project` - Required. The ID of the Google Cloud Platform project the cluster belongs to, of the form projects/.
4695    /// * `region` - Required. The region containing the cluster, of the form regions/.
4696    /// * `cluster` - Required. The cluster, in the form clusters/.
4697    pub fn regions_clusters_inject_credentials(
4698        &self,
4699        request: InjectCredentialsRequest,
4700        project: &str,
4701        region: &str,
4702        cluster: &str,
4703    ) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
4704        ProjectRegionClusterInjectCredentialCall {
4705            hub: self.hub,
4706            _request: request,
4707            _project: project.to_string(),
4708            _region: region.to_string(),
4709            _cluster: cluster.to_string(),
4710            _delegate: Default::default(),
4711            _additional_params: Default::default(),
4712            _scopes: Default::default(),
4713        }
4714    }
4715
4716    /// Create a builder to help you perform the following task:
4717    ///
4718    /// Lists all regions/{region}/clusters in a project alphabetically.
4719    ///
4720    /// # Arguments
4721    ///
4722    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the cluster belongs to.
4723    /// * `region` - Required. The Dataproc region in which to handle the request.
4724    pub fn regions_clusters_list(
4725        &self,
4726        project_id: &str,
4727        region: &str,
4728    ) -> ProjectRegionClusterListCall<'a, C> {
4729        ProjectRegionClusterListCall {
4730            hub: self.hub,
4731            _project_id: project_id.to_string(),
4732            _region: region.to_string(),
4733            _page_token: Default::default(),
4734            _page_size: Default::default(),
4735            _filter: Default::default(),
4736            _delegate: Default::default(),
4737            _additional_params: Default::default(),
4738            _scopes: Default::default(),
4739        }
4740    }
4741
4742    /// Create a builder to help you perform the following task:
4743    ///
4744    /// Updates a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a RUNNING state or an error is returned.
4745    ///
4746    /// # Arguments
4747    ///
4748    /// * `request` - No description provided.
4749    /// * `projectId` - Required. The ID of the Google Cloud Platform project the cluster belongs to.
4750    /// * `region` - Required. The Dataproc region in which to handle the request.
4751    /// * `clusterName` - Required. The cluster name.
4752    pub fn regions_clusters_patch(
4753        &self,
4754        request: Cluster,
4755        project_id: &str,
4756        region: &str,
4757        cluster_name: &str,
4758    ) -> ProjectRegionClusterPatchCall<'a, C> {
4759        ProjectRegionClusterPatchCall {
4760            hub: self.hub,
4761            _request: request,
4762            _project_id: project_id.to_string(),
4763            _region: region.to_string(),
4764            _cluster_name: cluster_name.to_string(),
4765            _update_mask: Default::default(),
4766            _request_id: Default::default(),
4767            _graceful_decommission_timeout: Default::default(),
4768            _delegate: Default::default(),
4769            _additional_params: Default::default(),
4770            _scopes: Default::default(),
4771        }
4772    }
4773
4774    /// Create a builder to help you perform the following task:
4775    ///
4776    /// Repairs a cluster.
4777    ///
4778    /// # Arguments
4779    ///
4780    /// * `request` - No description provided.
4781    /// * `projectId` - Required. The ID of the Google Cloud Platform project the cluster belongs to.
4782    /// * `region` - Required. The Dataproc region in which to handle the request.
4783    /// * `clusterName` - Required. The cluster name.
4784    pub fn regions_clusters_repair(
4785        &self,
4786        request: RepairClusterRequest,
4787        project_id: &str,
4788        region: &str,
4789        cluster_name: &str,
4790    ) -> ProjectRegionClusterRepairCall<'a, C> {
4791        ProjectRegionClusterRepairCall {
4792            hub: self.hub,
4793            _request: request,
4794            _project_id: project_id.to_string(),
4795            _region: region.to_string(),
4796            _cluster_name: cluster_name.to_string(),
4797            _delegate: Default::default(),
4798            _additional_params: Default::default(),
4799            _scopes: Default::default(),
4800        }
4801    }
4802
4803    /// Create a builder to help you perform the following task:
4804    ///
4805    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
4806    ///
4807    /// # Arguments
4808    ///
4809    /// * `request` - No description provided.
4810    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4811    pub fn regions_clusters_set_iam_policy(
4812        &self,
4813        request: SetIamPolicyRequest,
4814        resource: &str,
4815    ) -> ProjectRegionClusterSetIamPolicyCall<'a, C> {
4816        ProjectRegionClusterSetIamPolicyCall {
4817            hub: self.hub,
4818            _request: request,
4819            _resource: resource.to_string(),
4820            _delegate: Default::default(),
4821            _additional_params: Default::default(),
4822            _scopes: Default::default(),
4823        }
4824    }
4825
4826    /// Create a builder to help you perform the following task:
4827    ///
4828    /// Starts a cluster in a project.
4829    ///
4830    /// # Arguments
4831    ///
4832    /// * `request` - No description provided.
4833    /// * `projectId` - Required. The ID of the Google Cloud Platform project the cluster belongs to.
4834    /// * `region` - Required. The Dataproc region in which to handle the request.
4835    /// * `clusterName` - Required. The cluster name.
4836    pub fn regions_clusters_start(
4837        &self,
4838        request: StartClusterRequest,
4839        project_id: &str,
4840        region: &str,
4841        cluster_name: &str,
4842    ) -> ProjectRegionClusterStartCall<'a, C> {
4843        ProjectRegionClusterStartCall {
4844            hub: self.hub,
4845            _request: request,
4846            _project_id: project_id.to_string(),
4847            _region: region.to_string(),
4848            _cluster_name: cluster_name.to_string(),
4849            _delegate: Default::default(),
4850            _additional_params: Default::default(),
4851            _scopes: Default::default(),
4852        }
4853    }
4854
4855    /// Create a builder to help you perform the following task:
4856    ///
4857    /// Stops a cluster in a project.
4858    ///
4859    /// # Arguments
4860    ///
4861    /// * `request` - No description provided.
4862    /// * `projectId` - Required. The ID of the Google Cloud Platform project the cluster belongs to.
4863    /// * `region` - Required. The Dataproc region in which to handle the request.
4864    /// * `clusterName` - Required. The cluster name.
4865    pub fn regions_clusters_stop(
4866        &self,
4867        request: StopClusterRequest,
4868        project_id: &str,
4869        region: &str,
4870        cluster_name: &str,
4871    ) -> ProjectRegionClusterStopCall<'a, C> {
4872        ProjectRegionClusterStopCall {
4873            hub: self.hub,
4874            _request: request,
4875            _project_id: project_id.to_string(),
4876            _region: region.to_string(),
4877            _cluster_name: cluster_name.to_string(),
4878            _delegate: Default::default(),
4879            _additional_params: Default::default(),
4880            _scopes: Default::default(),
4881        }
4882    }
4883
4884    /// Create a builder to help you perform the following task:
4885    ///
4886    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4887    ///
4888    /// # Arguments
4889    ///
4890    /// * `request` - No description provided.
4891    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4892    pub fn regions_clusters_test_iam_permissions(
4893        &self,
4894        request: TestIamPermissionsRequest,
4895        resource: &str,
4896    ) -> ProjectRegionClusterTestIamPermissionCall<'a, C> {
4897        ProjectRegionClusterTestIamPermissionCall {
4898            hub: self.hub,
4899            _request: request,
4900            _resource: resource.to_string(),
4901            _delegate: Default::default(),
4902            _additional_params: Default::default(),
4903            _scopes: Default::default(),
4904        }
4905    }
4906
4907    /// Create a builder to help you perform the following task:
4908    ///
4909    /// Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or regions/{region}/jobs.get (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).
4910    ///
4911    /// # Arguments
4912    ///
4913    /// * `request` - No description provided.
4914    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
4915    /// * `region` - Required. The Dataproc region in which to handle the request.
4916    /// * `jobId` - Required. The job ID.
4917    pub fn regions_jobs_cancel(
4918        &self,
4919        request: CancelJobRequest,
4920        project_id: &str,
4921        region: &str,
4922        job_id: &str,
4923    ) -> ProjectRegionJobCancelCall<'a, C> {
4924        ProjectRegionJobCancelCall {
4925            hub: self.hub,
4926            _request: request,
4927            _project_id: project_id.to_string(),
4928            _region: region.to_string(),
4929            _job_id: job_id.to_string(),
4930            _delegate: Default::default(),
4931            _additional_params: Default::default(),
4932            _scopes: Default::default(),
4933        }
4934    }
4935
4936    /// Create a builder to help you perform the following task:
4937    ///
4938    /// Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.
4939    ///
4940    /// # Arguments
4941    ///
4942    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
4943    /// * `region` - Required. The Dataproc region in which to handle the request.
4944    /// * `jobId` - Required. The job ID.
4945    pub fn regions_jobs_delete(
4946        &self,
4947        project_id: &str,
4948        region: &str,
4949        job_id: &str,
4950    ) -> ProjectRegionJobDeleteCall<'a, C> {
4951        ProjectRegionJobDeleteCall {
4952            hub: self.hub,
4953            _project_id: project_id.to_string(),
4954            _region: region.to_string(),
4955            _job_id: job_id.to_string(),
4956            _delegate: Default::default(),
4957            _additional_params: Default::default(),
4958            _scopes: Default::default(),
4959        }
4960    }
4961
4962    /// Create a builder to help you perform the following task:
4963    ///
4964    /// Gets the resource representation for a job in a project.
4965    ///
4966    /// # Arguments
4967    ///
4968    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
4969    /// * `region` - Required. The Dataproc region in which to handle the request.
4970    /// * `jobId` - Required. The job ID.
4971    pub fn regions_jobs_get(
4972        &self,
4973        project_id: &str,
4974        region: &str,
4975        job_id: &str,
4976    ) -> ProjectRegionJobGetCall<'a, C> {
4977        ProjectRegionJobGetCall {
4978            hub: self.hub,
4979            _project_id: project_id.to_string(),
4980            _region: region.to_string(),
4981            _job_id: job_id.to_string(),
4982            _delegate: Default::default(),
4983            _additional_params: Default::default(),
4984            _scopes: Default::default(),
4985        }
4986    }
4987
4988    /// Create a builder to help you perform the following task:
4989    ///
4990    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4991    ///
4992    /// # Arguments
4993    ///
4994    /// * `request` - No description provided.
4995    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4996    pub fn regions_jobs_get_iam_policy(
4997        &self,
4998        request: GetIamPolicyRequest,
4999        resource: &str,
5000    ) -> ProjectRegionJobGetIamPolicyCall<'a, C> {
5001        ProjectRegionJobGetIamPolicyCall {
5002            hub: self.hub,
5003            _request: request,
5004            _resource: resource.to_string(),
5005            _delegate: Default::default(),
5006            _additional_params: Default::default(),
5007            _scopes: Default::default(),
5008        }
5009    }
5010
5011    /// Create a builder to help you perform the following task:
5012    ///
5013    /// Lists regions/{region}/jobs in a project.
5014    ///
5015    /// # Arguments
5016    ///
5017    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
5018    /// * `region` - Required. The Dataproc region in which to handle the request.
5019    pub fn regions_jobs_list(
5020        &self,
5021        project_id: &str,
5022        region: &str,
5023    ) -> ProjectRegionJobListCall<'a, C> {
5024        ProjectRegionJobListCall {
5025            hub: self.hub,
5026            _project_id: project_id.to_string(),
5027            _region: region.to_string(),
5028            _page_token: Default::default(),
5029            _page_size: Default::default(),
5030            _job_state_matcher: Default::default(),
5031            _filter: Default::default(),
5032            _cluster_name: Default::default(),
5033            _delegate: Default::default(),
5034            _additional_params: Default::default(),
5035            _scopes: Default::default(),
5036        }
5037    }
5038
5039    /// Create a builder to help you perform the following task:
5040    ///
5041    /// Updates a job in a project.
5042    ///
5043    /// # Arguments
5044    ///
5045    /// * `request` - No description provided.
5046    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
5047    /// * `region` - Required. The Dataproc region in which to handle the request.
5048    /// * `jobId` - Required. The job ID.
5049    pub fn regions_jobs_patch(
5050        &self,
5051        request: Job,
5052        project_id: &str,
5053        region: &str,
5054        job_id: &str,
5055    ) -> ProjectRegionJobPatchCall<'a, C> {
5056        ProjectRegionJobPatchCall {
5057            hub: self.hub,
5058            _request: request,
5059            _project_id: project_id.to_string(),
5060            _region: region.to_string(),
5061            _job_id: job_id.to_string(),
5062            _update_mask: Default::default(),
5063            _delegate: Default::default(),
5064            _additional_params: Default::default(),
5065            _scopes: Default::default(),
5066        }
5067    }
5068
5069    /// Create a builder to help you perform the following task:
5070    ///
5071    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
5072    ///
5073    /// # Arguments
5074    ///
5075    /// * `request` - No description provided.
5076    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5077    pub fn regions_jobs_set_iam_policy(
5078        &self,
5079        request: SetIamPolicyRequest,
5080        resource: &str,
5081    ) -> ProjectRegionJobSetIamPolicyCall<'a, C> {
5082        ProjectRegionJobSetIamPolicyCall {
5083            hub: self.hub,
5084            _request: request,
5085            _resource: resource.to_string(),
5086            _delegate: Default::default(),
5087            _additional_params: Default::default(),
5088            _scopes: Default::default(),
5089        }
5090    }
5091
5092    /// Create a builder to help you perform the following task:
5093    ///
5094    /// Submits a job to a cluster.
5095    ///
5096    /// # Arguments
5097    ///
5098    /// * `request` - No description provided.
5099    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
5100    /// * `region` - Required. The Dataproc region in which to handle the request.
5101    pub fn regions_jobs_submit(
5102        &self,
5103        request: SubmitJobRequest,
5104        project_id: &str,
5105        region: &str,
5106    ) -> ProjectRegionJobSubmitCall<'a, C> {
5107        ProjectRegionJobSubmitCall {
5108            hub: self.hub,
5109            _request: request,
5110            _project_id: project_id.to_string(),
5111            _region: region.to_string(),
5112            _delegate: Default::default(),
5113            _additional_params: Default::default(),
5114            _scopes: Default::default(),
5115        }
5116    }
5117
5118    /// Create a builder to help you perform the following task:
5119    ///
5120    /// Submits job to a cluster.
5121    ///
5122    /// # Arguments
5123    ///
5124    /// * `request` - No description provided.
5125    /// * `projectId` - Required. The ID of the Google Cloud Platform project that the job belongs to.
5126    /// * `region` - Required. The Dataproc region in which to handle the request.
5127    pub fn regions_jobs_submit_as_operation(
5128        &self,
5129        request: SubmitJobRequest,
5130        project_id: &str,
5131        region: &str,
5132    ) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
5133        ProjectRegionJobSubmitAsOperationCall {
5134            hub: self.hub,
5135            _request: request,
5136            _project_id: project_id.to_string(),
5137            _region: region.to_string(),
5138            _delegate: Default::default(),
5139            _additional_params: Default::default(),
5140            _scopes: Default::default(),
5141        }
5142    }
5143
5144    /// Create a builder to help you perform the following task:
5145    ///
5146    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5147    ///
5148    /// # Arguments
5149    ///
5150    /// * `request` - No description provided.
5151    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5152    pub fn regions_jobs_test_iam_permissions(
5153        &self,
5154        request: TestIamPermissionsRequest,
5155        resource: &str,
5156    ) -> ProjectRegionJobTestIamPermissionCall<'a, C> {
5157        ProjectRegionJobTestIamPermissionCall {
5158            hub: self.hub,
5159            _request: request,
5160            _resource: resource.to_string(),
5161            _delegate: Default::default(),
5162            _additional_params: Default::default(),
5163            _scopes: Default::default(),
5164        }
5165    }
5166
5167    /// Create a builder to help you perform the following task:
5168    ///
5169    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
5170    ///
5171    /// # Arguments
5172    ///
5173    /// * `name` - The name of the operation resource to be cancelled.
5174    pub fn regions_operations_cancel(&self, name: &str) -> ProjectRegionOperationCancelCall<'a, C> {
5175        ProjectRegionOperationCancelCall {
5176            hub: self.hub,
5177            _name: name.to_string(),
5178            _delegate: Default::default(),
5179            _additional_params: Default::default(),
5180            _scopes: Default::default(),
5181        }
5182    }
5183
5184    /// Create a builder to help you perform the following task:
5185    ///
5186    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
5187    ///
5188    /// # Arguments
5189    ///
5190    /// * `name` - The name of the operation resource to be deleted.
5191    pub fn regions_operations_delete(&self, name: &str) -> ProjectRegionOperationDeleteCall<'a, C> {
5192        ProjectRegionOperationDeleteCall {
5193            hub: self.hub,
5194            _name: name.to_string(),
5195            _delegate: Default::default(),
5196            _additional_params: Default::default(),
5197            _scopes: Default::default(),
5198        }
5199    }
5200
5201    /// Create a builder to help you perform the following task:
5202    ///
5203    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
5204    ///
5205    /// # Arguments
5206    ///
5207    /// * `name` - The name of the operation resource.
5208    pub fn regions_operations_get(&self, name: &str) -> ProjectRegionOperationGetCall<'a, C> {
5209        ProjectRegionOperationGetCall {
5210            hub: self.hub,
5211            _name: name.to_string(),
5212            _delegate: Default::default(),
5213            _additional_params: Default::default(),
5214            _scopes: Default::default(),
5215        }
5216    }
5217
5218    /// Create a builder to help you perform the following task:
5219    ///
5220    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5221    ///
5222    /// # Arguments
5223    ///
5224    /// * `request` - No description provided.
5225    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5226    pub fn regions_operations_get_iam_policy(
5227        &self,
5228        request: GetIamPolicyRequest,
5229        resource: &str,
5230    ) -> ProjectRegionOperationGetIamPolicyCall<'a, C> {
5231        ProjectRegionOperationGetIamPolicyCall {
5232            hub: self.hub,
5233            _request: request,
5234            _resource: resource.to_string(),
5235            _delegate: Default::default(),
5236            _additional_params: Default::default(),
5237            _scopes: Default::default(),
5238        }
5239    }
5240
5241    /// Create a builder to help you perform the following task:
5242    ///
5243    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
5244    ///
5245    /// # Arguments
5246    ///
5247    /// * `name` - The name of the operation's parent resource.
5248    pub fn regions_operations_list(&self, name: &str) -> ProjectRegionOperationListCall<'a, C> {
5249        ProjectRegionOperationListCall {
5250            hub: self.hub,
5251            _name: name.to_string(),
5252            _page_token: Default::default(),
5253            _page_size: Default::default(),
5254            _filter: Default::default(),
5255            _delegate: Default::default(),
5256            _additional_params: Default::default(),
5257            _scopes: Default::default(),
5258        }
5259    }
5260
5261    /// Create a builder to help you perform the following task:
5262    ///
5263    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
5264    ///
5265    /// # Arguments
5266    ///
5267    /// * `request` - No description provided.
5268    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5269    pub fn regions_operations_set_iam_policy(
5270        &self,
5271        request: SetIamPolicyRequest,
5272        resource: &str,
5273    ) -> ProjectRegionOperationSetIamPolicyCall<'a, C> {
5274        ProjectRegionOperationSetIamPolicyCall {
5275            hub: self.hub,
5276            _request: request,
5277            _resource: resource.to_string(),
5278            _delegate: Default::default(),
5279            _additional_params: Default::default(),
5280            _scopes: Default::default(),
5281        }
5282    }
5283
5284    /// Create a builder to help you perform the following task:
5285    ///
5286    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5287    ///
5288    /// # Arguments
5289    ///
5290    /// * `request` - No description provided.
5291    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5292    pub fn regions_operations_test_iam_permissions(
5293        &self,
5294        request: TestIamPermissionsRequest,
5295        resource: &str,
5296    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C> {
5297        ProjectRegionOperationTestIamPermissionCall {
5298            hub: self.hub,
5299            _request: request,
5300            _resource: resource.to_string(),
5301            _delegate: Default::default(),
5302            _additional_params: Default::default(),
5303            _scopes: Default::default(),
5304        }
5305    }
5306
5307    /// Create a builder to help you perform the following task:
5308    ///
5309    /// Creates new workflow template.
5310    ///
5311    /// # Arguments
5312    ///
5313    /// * `request` - No description provided.
5314    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
5315    pub fn regions_workflow_templates_create(
5316        &self,
5317        request: WorkflowTemplate,
5318        parent: &str,
5319    ) -> ProjectRegionWorkflowTemplateCreateCall<'a, C> {
5320        ProjectRegionWorkflowTemplateCreateCall {
5321            hub: self.hub,
5322            _request: request,
5323            _parent: parent.to_string(),
5324            _delegate: Default::default(),
5325            _additional_params: Default::default(),
5326            _scopes: Default::default(),
5327        }
5328    }
5329
5330    /// Create a builder to help you perform the following task:
5331    ///
5332    /// Deletes a workflow template. It does not cancel in-progress workflows.
5333    ///
5334    /// # Arguments
5335    ///
5336    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
5337    pub fn regions_workflow_templates_delete(
5338        &self,
5339        name: &str,
5340    ) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C> {
5341        ProjectRegionWorkflowTemplateDeleteCall {
5342            hub: self.hub,
5343            _name: name.to_string(),
5344            _version: Default::default(),
5345            _delegate: Default::default(),
5346            _additional_params: Default::default(),
5347            _scopes: Default::default(),
5348        }
5349    }
5350
5351    /// Create a builder to help you perform the following task:
5352    ///
5353    /// Retrieves the latest workflow template.Can retrieve previously instantiated template by specifying optional version parameter.
5354    ///
5355    /// # Arguments
5356    ///
5357    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
5358    pub fn regions_workflow_templates_get(
5359        &self,
5360        name: &str,
5361    ) -> ProjectRegionWorkflowTemplateGetCall<'a, C> {
5362        ProjectRegionWorkflowTemplateGetCall {
5363            hub: self.hub,
5364            _name: name.to_string(),
5365            _version: Default::default(),
5366            _delegate: Default::default(),
5367            _additional_params: Default::default(),
5368            _scopes: Default::default(),
5369        }
5370    }
5371
5372    /// Create a builder to help you perform the following task:
5373    ///
5374    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5375    ///
5376    /// # Arguments
5377    ///
5378    /// * `request` - No description provided.
5379    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5380    pub fn regions_workflow_templates_get_iam_policy(
5381        &self,
5382        request: GetIamPolicyRequest,
5383        resource: &str,
5384    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {
5385        ProjectRegionWorkflowTemplateGetIamPolicyCall {
5386            hub: self.hub,
5387            _request: request,
5388            _resource: resource.to_string(),
5389            _delegate: Default::default(),
5390            _additional_params: Default::default(),
5391            _scopes: Default::default(),
5392        }
5393    }
5394
5395    /// Create a builder to help you perform the following task:
5396    ///
5397    /// Instantiates a template and begins execution.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
5398    ///
5399    /// # Arguments
5400    ///
5401    /// * `request` - No description provided.
5402    /// * `name` - Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
5403    pub fn regions_workflow_templates_instantiate(
5404        &self,
5405        request: InstantiateWorkflowTemplateRequest,
5406        name: &str,
5407    ) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {
5408        ProjectRegionWorkflowTemplateInstantiateCall {
5409            hub: self.hub,
5410            _request: request,
5411            _name: name.to_string(),
5412            _delegate: Default::default(),
5413            _additional_params: Default::default(),
5414            _scopes: Default::default(),
5415        }
5416    }
5417
5418    /// Create a builder to help you perform the following task:
5419    ///
5420    /// Instantiates a template and begins execution.This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
5421    ///
5422    /// # Arguments
5423    ///
5424    /// * `request` - No description provided.
5425    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}
5426    pub fn regions_workflow_templates_instantiate_inline(
5427        &self,
5428        request: WorkflowTemplate,
5429        parent: &str,
5430    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
5431        ProjectRegionWorkflowTemplateInstantiateInlineCall {
5432            hub: self.hub,
5433            _request: request,
5434            _parent: parent.to_string(),
5435            _request_id: Default::default(),
5436            _delegate: Default::default(),
5437            _additional_params: Default::default(),
5438            _scopes: Default::default(),
5439        }
5440    }
5441
5442    /// Create a builder to help you perform the following task:
5443    ///
5444    /// Lists workflows that match the specified filter in the request.
5445    ///
5446    /// # Arguments
5447    ///
5448    /// * `parent` - Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
5449    pub fn regions_workflow_templates_list(
5450        &self,
5451        parent: &str,
5452    ) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
5453        ProjectRegionWorkflowTemplateListCall {
5454            hub: self.hub,
5455            _parent: parent.to_string(),
5456            _page_token: Default::default(),
5457            _page_size: Default::default(),
5458            _delegate: Default::default(),
5459            _additional_params: Default::default(),
5460            _scopes: Default::default(),
5461        }
5462    }
5463
5464    /// Create a builder to help you perform the following task:
5465    ///
5466    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
5467    ///
5468    /// # Arguments
5469    ///
5470    /// * `request` - No description provided.
5471    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5472    pub fn regions_workflow_templates_set_iam_policy(
5473        &self,
5474        request: SetIamPolicyRequest,
5475        resource: &str,
5476    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {
5477        ProjectRegionWorkflowTemplateSetIamPolicyCall {
5478            hub: self.hub,
5479            _request: request,
5480            _resource: resource.to_string(),
5481            _delegate: Default::default(),
5482            _additional_params: Default::default(),
5483            _scopes: Default::default(),
5484        }
5485    }
5486
5487    /// Create a builder to help you perform the following task:
5488    ///
5489    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
5490    ///
5491    /// # Arguments
5492    ///
5493    /// * `request` - No description provided.
5494    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5495    pub fn regions_workflow_templates_test_iam_permissions(
5496        &self,
5497        request: TestIamPermissionsRequest,
5498        resource: &str,
5499    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {
5500        ProjectRegionWorkflowTemplateTestIamPermissionCall {
5501            hub: self.hub,
5502            _request: request,
5503            _resource: resource.to_string(),
5504            _delegate: Default::default(),
5505            _additional_params: Default::default(),
5506            _scopes: Default::default(),
5507        }
5508    }
5509
5510    /// Create a builder to help you perform the following task:
5511    ///
5512    /// Updates (replaces) workflow template. The updated template must contain version that matches the current server version.
5513    ///
5514    /// # Arguments
5515    ///
5516    /// * `request` - No description provided.
5517    /// * `name` - Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
5518    pub fn regions_workflow_templates_update(
5519        &self,
5520        request: WorkflowTemplate,
5521        name: &str,
5522    ) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C> {
5523        ProjectRegionWorkflowTemplateUpdateCall {
5524            hub: self.hub,
5525            _request: request,
5526            _name: name.to_string(),
5527            _delegate: Default::default(),
5528            _additional_params: Default::default(),
5529            _scopes: Default::default(),
5530        }
5531    }
5532}
5533
5534// ###################
5535// CallBuilders   ###
5536// #################
5537
5538/// Creates new autoscaling policy.
5539///
5540/// A builder for the *locations.autoscalingPolicies.create* method supported by a *project* resource.
5541/// It is not used directly, but through a [`ProjectMethods`] instance.
5542///
5543/// # Example
5544///
5545/// Instantiate a resource method builder
5546///
5547/// ```test_harness,no_run
5548/// # extern crate hyper;
5549/// # extern crate hyper_rustls;
5550/// # extern crate google_dataproc1 as dataproc1;
5551/// use dataproc1::api::AutoscalingPolicy;
5552/// # async fn dox() {
5553/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5554///
5555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5556/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5557/// #     secret,
5558/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5559/// # ).build().await.unwrap();
5560///
5561/// # let client = hyper_util::client::legacy::Client::builder(
5562/// #     hyper_util::rt::TokioExecutor::new()
5563/// # )
5564/// # .build(
5565/// #     hyper_rustls::HttpsConnectorBuilder::new()
5566/// #         .with_native_roots()
5567/// #         .unwrap()
5568/// #         .https_or_http()
5569/// #         .enable_http1()
5570/// #         .build()
5571/// # );
5572/// # let mut hub = Dataproc::new(client, auth);
5573/// // As the method needs a request, you would usually fill it with the desired information
5574/// // into the respective structure. Some of the parts shown here might not be applicable !
5575/// // Values shown here are possibly random and not representative !
5576/// let mut req = AutoscalingPolicy::default();
5577///
5578/// // You can configure optional parameters by calling the respective setters at will, and
5579/// // execute the final call using `doit()`.
5580/// // Values shown here are possibly random and not representative !
5581/// let result = hub.projects().locations_autoscaling_policies_create(req, "parent")
5582///              .doit().await;
5583/// # }
5584/// ```
5585pub struct ProjectLocationAutoscalingPolicyCreateCall<'a, C>
5586where
5587    C: 'a,
5588{
5589    hub: &'a Dataproc<C>,
5590    _request: AutoscalingPolicy,
5591    _parent: String,
5592    _delegate: Option<&'a mut dyn common::Delegate>,
5593    _additional_params: HashMap<String, String>,
5594    _scopes: BTreeSet<String>,
5595}
5596
5597impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyCreateCall<'a, C> {}
5598
5599impl<'a, C> ProjectLocationAutoscalingPolicyCreateCall<'a, C>
5600where
5601    C: common::Connector,
5602{
5603    /// Perform the operation you have build so far.
5604    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
5605        use std::borrow::Cow;
5606        use std::io::{Read, Seek};
5607
5608        use common::{url::Params, ToParts};
5609        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5610
5611        let mut dd = common::DefaultDelegate;
5612        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5613        dlg.begin(common::MethodInfo {
5614            id: "dataproc.projects.locations.autoscalingPolicies.create",
5615            http_method: hyper::Method::POST,
5616        });
5617
5618        for &field in ["alt", "parent"].iter() {
5619            if self._additional_params.contains_key(field) {
5620                dlg.finished(false);
5621                return Err(common::Error::FieldClash(field));
5622            }
5623        }
5624
5625        let mut params = Params::with_capacity(4 + self._additional_params.len());
5626        params.push("parent", self._parent);
5627
5628        params.extend(self._additional_params.iter());
5629
5630        params.push("alt", "json");
5631        let mut url = self.hub._base_url.clone() + "v1/{+parent}/autoscalingPolicies";
5632        if self._scopes.is_empty() {
5633            self._scopes
5634                .insert(Scope::CloudPlatform.as_ref().to_string());
5635        }
5636
5637        #[allow(clippy::single_element_loop)]
5638        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5639            url = params.uri_replacement(url, param_name, find_this, true);
5640        }
5641        {
5642            let to_remove = ["parent"];
5643            params.remove_params(&to_remove);
5644        }
5645
5646        let url = params.parse_with_url(&url);
5647
5648        let mut json_mime_type = mime::APPLICATION_JSON;
5649        let mut request_value_reader = {
5650            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5651            common::remove_json_null_values(&mut value);
5652            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5653            serde_json::to_writer(&mut dst, &value).unwrap();
5654            dst
5655        };
5656        let request_size = request_value_reader
5657            .seek(std::io::SeekFrom::End(0))
5658            .unwrap();
5659        request_value_reader
5660            .seek(std::io::SeekFrom::Start(0))
5661            .unwrap();
5662
5663        loop {
5664            let token = match self
5665                .hub
5666                .auth
5667                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5668                .await
5669            {
5670                Ok(token) => token,
5671                Err(e) => match dlg.token(e) {
5672                    Ok(token) => token,
5673                    Err(e) => {
5674                        dlg.finished(false);
5675                        return Err(common::Error::MissingToken(e));
5676                    }
5677                },
5678            };
5679            request_value_reader
5680                .seek(std::io::SeekFrom::Start(0))
5681                .unwrap();
5682            let mut req_result = {
5683                let client = &self.hub.client;
5684                dlg.pre_request();
5685                let mut req_builder = hyper::Request::builder()
5686                    .method(hyper::Method::POST)
5687                    .uri(url.as_str())
5688                    .header(USER_AGENT, self.hub._user_agent.clone());
5689
5690                if let Some(token) = token.as_ref() {
5691                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5692                }
5693
5694                let request = req_builder
5695                    .header(CONTENT_TYPE, json_mime_type.to_string())
5696                    .header(CONTENT_LENGTH, request_size as u64)
5697                    .body(common::to_body(
5698                        request_value_reader.get_ref().clone().into(),
5699                    ));
5700
5701                client.request(request.unwrap()).await
5702            };
5703
5704            match req_result {
5705                Err(err) => {
5706                    if let common::Retry::After(d) = dlg.http_error(&err) {
5707                        sleep(d).await;
5708                        continue;
5709                    }
5710                    dlg.finished(false);
5711                    return Err(common::Error::HttpError(err));
5712                }
5713                Ok(res) => {
5714                    let (mut parts, body) = res.into_parts();
5715                    let mut body = common::Body::new(body);
5716                    if !parts.status.is_success() {
5717                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5718                        let error = serde_json::from_str(&common::to_string(&bytes));
5719                        let response = common::to_response(parts, bytes.into());
5720
5721                        if let common::Retry::After(d) =
5722                            dlg.http_failure(&response, error.as_ref().ok())
5723                        {
5724                            sleep(d).await;
5725                            continue;
5726                        }
5727
5728                        dlg.finished(false);
5729
5730                        return Err(match error {
5731                            Ok(value) => common::Error::BadRequest(value),
5732                            _ => common::Error::Failure(response),
5733                        });
5734                    }
5735                    let response = {
5736                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5737                        let encoded = common::to_string(&bytes);
5738                        match serde_json::from_str(&encoded) {
5739                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5740                            Err(error) => {
5741                                dlg.response_json_decode_error(&encoded, &error);
5742                                return Err(common::Error::JsonDecodeError(
5743                                    encoded.to_string(),
5744                                    error,
5745                                ));
5746                            }
5747                        }
5748                    };
5749
5750                    dlg.finished(true);
5751                    return Ok(response);
5752                }
5753            }
5754        }
5755    }
5756
5757    ///
5758    /// Sets the *request* property to the given value.
5759    ///
5760    /// Even though the property as already been set when instantiating this call,
5761    /// we provide this method for API completeness.
5762    pub fn request(
5763        mut self,
5764        new_value: AutoscalingPolicy,
5765    ) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C> {
5766        self._request = new_value;
5767        self
5768    }
5769    /// Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
5770    ///
5771    /// Sets the *parent* path property to the given value.
5772    ///
5773    /// Even though the property as already been set when instantiating this call,
5774    /// we provide this method for API completeness.
5775    pub fn parent(mut self, new_value: &str) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C> {
5776        self._parent = new_value.to_string();
5777        self
5778    }
5779    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5780    /// while executing the actual API request.
5781    ///
5782    /// ````text
5783    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5784    /// ````
5785    ///
5786    /// Sets the *delegate* property to the given value.
5787    pub fn delegate(
5788        mut self,
5789        new_value: &'a mut dyn common::Delegate,
5790    ) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C> {
5791        self._delegate = Some(new_value);
5792        self
5793    }
5794
5795    /// Set any additional parameter of the query string used in the request.
5796    /// It should be used to set parameters which are not yet available through their own
5797    /// setters.
5798    ///
5799    /// Please note that this method must not be used to set any of the known parameters
5800    /// which have their own setter method. If done anyway, the request will fail.
5801    ///
5802    /// # Additional Parameters
5803    ///
5804    /// * *$.xgafv* (query-string) - V1 error format.
5805    /// * *access_token* (query-string) - OAuth access token.
5806    /// * *alt* (query-string) - Data format for response.
5807    /// * *callback* (query-string) - JSONP
5808    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5809    /// * *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.
5810    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5811    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5812    /// * *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.
5813    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5814    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5815    pub fn param<T>(
5816        mut self,
5817        name: T,
5818        value: T,
5819    ) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C>
5820    where
5821        T: AsRef<str>,
5822    {
5823        self._additional_params
5824            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5825        self
5826    }
5827
5828    /// Identifies the authorization scope for the method you are building.
5829    ///
5830    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5831    /// [`Scope::CloudPlatform`].
5832    ///
5833    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5834    /// tokens for more than one scope.
5835    ///
5836    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5837    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5838    /// sufficient, a read-write scope will do as well.
5839    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C>
5840    where
5841        St: AsRef<str>,
5842    {
5843        self._scopes.insert(String::from(scope.as_ref()));
5844        self
5845    }
5846    /// Identifies the authorization scope(s) for the method you are building.
5847    ///
5848    /// See [`Self::add_scope()`] for details.
5849    pub fn add_scopes<I, St>(
5850        mut self,
5851        scopes: I,
5852    ) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C>
5853    where
5854        I: IntoIterator<Item = St>,
5855        St: AsRef<str>,
5856    {
5857        self._scopes
5858            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5859        self
5860    }
5861
5862    /// Removes all scopes, and no default scope will be used either.
5863    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5864    /// for details).
5865    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyCreateCall<'a, C> {
5866        self._scopes.clear();
5867        self
5868    }
5869}
5870
5871/// Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.
5872///
5873/// A builder for the *locations.autoscalingPolicies.delete* method supported by a *project* resource.
5874/// It is not used directly, but through a [`ProjectMethods`] instance.
5875///
5876/// # Example
5877///
5878/// Instantiate a resource method builder
5879///
5880/// ```test_harness,no_run
5881/// # extern crate hyper;
5882/// # extern crate hyper_rustls;
5883/// # extern crate google_dataproc1 as dataproc1;
5884/// # async fn dox() {
5885/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5886///
5887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5888/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5889/// #     secret,
5890/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5891/// # ).build().await.unwrap();
5892///
5893/// # let client = hyper_util::client::legacy::Client::builder(
5894/// #     hyper_util::rt::TokioExecutor::new()
5895/// # )
5896/// # .build(
5897/// #     hyper_rustls::HttpsConnectorBuilder::new()
5898/// #         .with_native_roots()
5899/// #         .unwrap()
5900/// #         .https_or_http()
5901/// #         .enable_http1()
5902/// #         .build()
5903/// # );
5904/// # let mut hub = Dataproc::new(client, auth);
5905/// // You can configure optional parameters by calling the respective setters at will, and
5906/// // execute the final call using `doit()`.
5907/// // Values shown here are possibly random and not representative !
5908/// let result = hub.projects().locations_autoscaling_policies_delete("name")
5909///              .doit().await;
5910/// # }
5911/// ```
5912pub struct ProjectLocationAutoscalingPolicyDeleteCall<'a, C>
5913where
5914    C: 'a,
5915{
5916    hub: &'a Dataproc<C>,
5917    _name: String,
5918    _delegate: Option<&'a mut dyn common::Delegate>,
5919    _additional_params: HashMap<String, String>,
5920    _scopes: BTreeSet<String>,
5921}
5922
5923impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyDeleteCall<'a, C> {}
5924
5925impl<'a, C> ProjectLocationAutoscalingPolicyDeleteCall<'a, C>
5926where
5927    C: common::Connector,
5928{
5929    /// Perform the operation you have build so far.
5930    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5931        use std::borrow::Cow;
5932        use std::io::{Read, Seek};
5933
5934        use common::{url::Params, ToParts};
5935        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5936
5937        let mut dd = common::DefaultDelegate;
5938        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5939        dlg.begin(common::MethodInfo {
5940            id: "dataproc.projects.locations.autoscalingPolicies.delete",
5941            http_method: hyper::Method::DELETE,
5942        });
5943
5944        for &field in ["alt", "name"].iter() {
5945            if self._additional_params.contains_key(field) {
5946                dlg.finished(false);
5947                return Err(common::Error::FieldClash(field));
5948            }
5949        }
5950
5951        let mut params = Params::with_capacity(3 + self._additional_params.len());
5952        params.push("name", self._name);
5953
5954        params.extend(self._additional_params.iter());
5955
5956        params.push("alt", "json");
5957        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5958        if self._scopes.is_empty() {
5959            self._scopes
5960                .insert(Scope::CloudPlatform.as_ref().to_string());
5961        }
5962
5963        #[allow(clippy::single_element_loop)]
5964        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5965            url = params.uri_replacement(url, param_name, find_this, true);
5966        }
5967        {
5968            let to_remove = ["name"];
5969            params.remove_params(&to_remove);
5970        }
5971
5972        let url = params.parse_with_url(&url);
5973
5974        loop {
5975            let token = match self
5976                .hub
5977                .auth
5978                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5979                .await
5980            {
5981                Ok(token) => token,
5982                Err(e) => match dlg.token(e) {
5983                    Ok(token) => token,
5984                    Err(e) => {
5985                        dlg.finished(false);
5986                        return Err(common::Error::MissingToken(e));
5987                    }
5988                },
5989            };
5990            let mut req_result = {
5991                let client = &self.hub.client;
5992                dlg.pre_request();
5993                let mut req_builder = hyper::Request::builder()
5994                    .method(hyper::Method::DELETE)
5995                    .uri(url.as_str())
5996                    .header(USER_AGENT, self.hub._user_agent.clone());
5997
5998                if let Some(token) = token.as_ref() {
5999                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6000                }
6001
6002                let request = req_builder
6003                    .header(CONTENT_LENGTH, 0_u64)
6004                    .body(common::to_body::<String>(None));
6005
6006                client.request(request.unwrap()).await
6007            };
6008
6009            match req_result {
6010                Err(err) => {
6011                    if let common::Retry::After(d) = dlg.http_error(&err) {
6012                        sleep(d).await;
6013                        continue;
6014                    }
6015                    dlg.finished(false);
6016                    return Err(common::Error::HttpError(err));
6017                }
6018                Ok(res) => {
6019                    let (mut parts, body) = res.into_parts();
6020                    let mut body = common::Body::new(body);
6021                    if !parts.status.is_success() {
6022                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6023                        let error = serde_json::from_str(&common::to_string(&bytes));
6024                        let response = common::to_response(parts, bytes.into());
6025
6026                        if let common::Retry::After(d) =
6027                            dlg.http_failure(&response, error.as_ref().ok())
6028                        {
6029                            sleep(d).await;
6030                            continue;
6031                        }
6032
6033                        dlg.finished(false);
6034
6035                        return Err(match error {
6036                            Ok(value) => common::Error::BadRequest(value),
6037                            _ => common::Error::Failure(response),
6038                        });
6039                    }
6040                    let response = {
6041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6042                        let encoded = common::to_string(&bytes);
6043                        match serde_json::from_str(&encoded) {
6044                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6045                            Err(error) => {
6046                                dlg.response_json_decode_error(&encoded, &error);
6047                                return Err(common::Error::JsonDecodeError(
6048                                    encoded.to_string(),
6049                                    error,
6050                                ));
6051                            }
6052                        }
6053                    };
6054
6055                    dlg.finished(true);
6056                    return Ok(response);
6057                }
6058            }
6059        }
6060    }
6061
6062    /// Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
6063    ///
6064    /// Sets the *name* path property to the given value.
6065    ///
6066    /// Even though the property as already been set when instantiating this call,
6067    /// we provide this method for API completeness.
6068    pub fn name(mut self, new_value: &str) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C> {
6069        self._name = new_value.to_string();
6070        self
6071    }
6072    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6073    /// while executing the actual API request.
6074    ///
6075    /// ````text
6076    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6077    /// ````
6078    ///
6079    /// Sets the *delegate* property to the given value.
6080    pub fn delegate(
6081        mut self,
6082        new_value: &'a mut dyn common::Delegate,
6083    ) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C> {
6084        self._delegate = Some(new_value);
6085        self
6086    }
6087
6088    /// Set any additional parameter of the query string used in the request.
6089    /// It should be used to set parameters which are not yet available through their own
6090    /// setters.
6091    ///
6092    /// Please note that this method must not be used to set any of the known parameters
6093    /// which have their own setter method. If done anyway, the request will fail.
6094    ///
6095    /// # Additional Parameters
6096    ///
6097    /// * *$.xgafv* (query-string) - V1 error format.
6098    /// * *access_token* (query-string) - OAuth access token.
6099    /// * *alt* (query-string) - Data format for response.
6100    /// * *callback* (query-string) - JSONP
6101    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6102    /// * *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.
6103    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6104    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6105    /// * *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.
6106    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6107    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6108    pub fn param<T>(
6109        mut self,
6110        name: T,
6111        value: T,
6112    ) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C>
6113    where
6114        T: AsRef<str>,
6115    {
6116        self._additional_params
6117            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6118        self
6119    }
6120
6121    /// Identifies the authorization scope for the method you are building.
6122    ///
6123    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6124    /// [`Scope::CloudPlatform`].
6125    ///
6126    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6127    /// tokens for more than one scope.
6128    ///
6129    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6130    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6131    /// sufficient, a read-write scope will do as well.
6132    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C>
6133    where
6134        St: AsRef<str>,
6135    {
6136        self._scopes.insert(String::from(scope.as_ref()));
6137        self
6138    }
6139    /// Identifies the authorization scope(s) for the method you are building.
6140    ///
6141    /// See [`Self::add_scope()`] for details.
6142    pub fn add_scopes<I, St>(
6143        mut self,
6144        scopes: I,
6145    ) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C>
6146    where
6147        I: IntoIterator<Item = St>,
6148        St: AsRef<str>,
6149    {
6150        self._scopes
6151            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6152        self
6153    }
6154
6155    /// Removes all scopes, and no default scope will be used either.
6156    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6157    /// for details).
6158    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyDeleteCall<'a, C> {
6159        self._scopes.clear();
6160        self
6161    }
6162}
6163
6164/// Retrieves autoscaling policy.
6165///
6166/// A builder for the *locations.autoscalingPolicies.get* method supported by a *project* resource.
6167/// It is not used directly, but through a [`ProjectMethods`] instance.
6168///
6169/// # Example
6170///
6171/// Instantiate a resource method builder
6172///
6173/// ```test_harness,no_run
6174/// # extern crate hyper;
6175/// # extern crate hyper_rustls;
6176/// # extern crate google_dataproc1 as dataproc1;
6177/// # async fn dox() {
6178/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6179///
6180/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6181/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6182/// #     secret,
6183/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6184/// # ).build().await.unwrap();
6185///
6186/// # let client = hyper_util::client::legacy::Client::builder(
6187/// #     hyper_util::rt::TokioExecutor::new()
6188/// # )
6189/// # .build(
6190/// #     hyper_rustls::HttpsConnectorBuilder::new()
6191/// #         .with_native_roots()
6192/// #         .unwrap()
6193/// #         .https_or_http()
6194/// #         .enable_http1()
6195/// #         .build()
6196/// # );
6197/// # let mut hub = Dataproc::new(client, auth);
6198/// // You can configure optional parameters by calling the respective setters at will, and
6199/// // execute the final call using `doit()`.
6200/// // Values shown here are possibly random and not representative !
6201/// let result = hub.projects().locations_autoscaling_policies_get("name")
6202///              .doit().await;
6203/// # }
6204/// ```
6205pub struct ProjectLocationAutoscalingPolicyGetCall<'a, C>
6206where
6207    C: 'a,
6208{
6209    hub: &'a Dataproc<C>,
6210    _name: String,
6211    _delegate: Option<&'a mut dyn common::Delegate>,
6212    _additional_params: HashMap<String, String>,
6213    _scopes: BTreeSet<String>,
6214}
6215
6216impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyGetCall<'a, C> {}
6217
6218impl<'a, C> ProjectLocationAutoscalingPolicyGetCall<'a, C>
6219where
6220    C: common::Connector,
6221{
6222    /// Perform the operation you have build so far.
6223    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
6224        use std::borrow::Cow;
6225        use std::io::{Read, Seek};
6226
6227        use common::{url::Params, ToParts};
6228        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6229
6230        let mut dd = common::DefaultDelegate;
6231        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6232        dlg.begin(common::MethodInfo {
6233            id: "dataproc.projects.locations.autoscalingPolicies.get",
6234            http_method: hyper::Method::GET,
6235        });
6236
6237        for &field in ["alt", "name"].iter() {
6238            if self._additional_params.contains_key(field) {
6239                dlg.finished(false);
6240                return Err(common::Error::FieldClash(field));
6241            }
6242        }
6243
6244        let mut params = Params::with_capacity(3 + self._additional_params.len());
6245        params.push("name", self._name);
6246
6247        params.extend(self._additional_params.iter());
6248
6249        params.push("alt", "json");
6250        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6251        if self._scopes.is_empty() {
6252            self._scopes
6253                .insert(Scope::CloudPlatform.as_ref().to_string());
6254        }
6255
6256        #[allow(clippy::single_element_loop)]
6257        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6258            url = params.uri_replacement(url, param_name, find_this, true);
6259        }
6260        {
6261            let to_remove = ["name"];
6262            params.remove_params(&to_remove);
6263        }
6264
6265        let url = params.parse_with_url(&url);
6266
6267        loop {
6268            let token = match self
6269                .hub
6270                .auth
6271                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6272                .await
6273            {
6274                Ok(token) => token,
6275                Err(e) => match dlg.token(e) {
6276                    Ok(token) => token,
6277                    Err(e) => {
6278                        dlg.finished(false);
6279                        return Err(common::Error::MissingToken(e));
6280                    }
6281                },
6282            };
6283            let mut req_result = {
6284                let client = &self.hub.client;
6285                dlg.pre_request();
6286                let mut req_builder = hyper::Request::builder()
6287                    .method(hyper::Method::GET)
6288                    .uri(url.as_str())
6289                    .header(USER_AGENT, self.hub._user_agent.clone());
6290
6291                if let Some(token) = token.as_ref() {
6292                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6293                }
6294
6295                let request = req_builder
6296                    .header(CONTENT_LENGTH, 0_u64)
6297                    .body(common::to_body::<String>(None));
6298
6299                client.request(request.unwrap()).await
6300            };
6301
6302            match req_result {
6303                Err(err) => {
6304                    if let common::Retry::After(d) = dlg.http_error(&err) {
6305                        sleep(d).await;
6306                        continue;
6307                    }
6308                    dlg.finished(false);
6309                    return Err(common::Error::HttpError(err));
6310                }
6311                Ok(res) => {
6312                    let (mut parts, body) = res.into_parts();
6313                    let mut body = common::Body::new(body);
6314                    if !parts.status.is_success() {
6315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6316                        let error = serde_json::from_str(&common::to_string(&bytes));
6317                        let response = common::to_response(parts, bytes.into());
6318
6319                        if let common::Retry::After(d) =
6320                            dlg.http_failure(&response, error.as_ref().ok())
6321                        {
6322                            sleep(d).await;
6323                            continue;
6324                        }
6325
6326                        dlg.finished(false);
6327
6328                        return Err(match error {
6329                            Ok(value) => common::Error::BadRequest(value),
6330                            _ => common::Error::Failure(response),
6331                        });
6332                    }
6333                    let response = {
6334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6335                        let encoded = common::to_string(&bytes);
6336                        match serde_json::from_str(&encoded) {
6337                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6338                            Err(error) => {
6339                                dlg.response_json_decode_error(&encoded, &error);
6340                                return Err(common::Error::JsonDecodeError(
6341                                    encoded.to_string(),
6342                                    error,
6343                                ));
6344                            }
6345                        }
6346                    };
6347
6348                    dlg.finished(true);
6349                    return Ok(response);
6350                }
6351            }
6352        }
6353    }
6354
6355    /// Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
6356    ///
6357    /// Sets the *name* path property to the given value.
6358    ///
6359    /// Even though the property as already been set when instantiating this call,
6360    /// we provide this method for API completeness.
6361    pub fn name(mut self, new_value: &str) -> ProjectLocationAutoscalingPolicyGetCall<'a, C> {
6362        self._name = new_value.to_string();
6363        self
6364    }
6365    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6366    /// while executing the actual API request.
6367    ///
6368    /// ````text
6369    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6370    /// ````
6371    ///
6372    /// Sets the *delegate* property to the given value.
6373    pub fn delegate(
6374        mut self,
6375        new_value: &'a mut dyn common::Delegate,
6376    ) -> ProjectLocationAutoscalingPolicyGetCall<'a, C> {
6377        self._delegate = Some(new_value);
6378        self
6379    }
6380
6381    /// Set any additional parameter of the query string used in the request.
6382    /// It should be used to set parameters which are not yet available through their own
6383    /// setters.
6384    ///
6385    /// Please note that this method must not be used to set any of the known parameters
6386    /// which have their own setter method. If done anyway, the request will fail.
6387    ///
6388    /// # Additional Parameters
6389    ///
6390    /// * *$.xgafv* (query-string) - V1 error format.
6391    /// * *access_token* (query-string) - OAuth access token.
6392    /// * *alt* (query-string) - Data format for response.
6393    /// * *callback* (query-string) - JSONP
6394    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6395    /// * *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.
6396    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6397    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6398    /// * *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.
6399    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6400    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6401    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationAutoscalingPolicyGetCall<'a, C>
6402    where
6403        T: AsRef<str>,
6404    {
6405        self._additional_params
6406            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6407        self
6408    }
6409
6410    /// Identifies the authorization scope for the method you are building.
6411    ///
6412    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6413    /// [`Scope::CloudPlatform`].
6414    ///
6415    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6416    /// tokens for more than one scope.
6417    ///
6418    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6419    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6420    /// sufficient, a read-write scope will do as well.
6421    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAutoscalingPolicyGetCall<'a, C>
6422    where
6423        St: AsRef<str>,
6424    {
6425        self._scopes.insert(String::from(scope.as_ref()));
6426        self
6427    }
6428    /// Identifies the authorization scope(s) for the method you are building.
6429    ///
6430    /// See [`Self::add_scope()`] for details.
6431    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationAutoscalingPolicyGetCall<'a, C>
6432    where
6433        I: IntoIterator<Item = St>,
6434        St: AsRef<str>,
6435    {
6436        self._scopes
6437            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6438        self
6439    }
6440
6441    /// Removes all scopes, and no default scope will be used either.
6442    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6443    /// for details).
6444    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyGetCall<'a, C> {
6445        self._scopes.clear();
6446        self
6447    }
6448}
6449
6450/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6451///
6452/// A builder for the *locations.autoscalingPolicies.getIamPolicy* method supported by a *project* resource.
6453/// It is not used directly, but through a [`ProjectMethods`] instance.
6454///
6455/// # Example
6456///
6457/// Instantiate a resource method builder
6458///
6459/// ```test_harness,no_run
6460/// # extern crate hyper;
6461/// # extern crate hyper_rustls;
6462/// # extern crate google_dataproc1 as dataproc1;
6463/// use dataproc1::api::GetIamPolicyRequest;
6464/// # async fn dox() {
6465/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6466///
6467/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6469/// #     secret,
6470/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6471/// # ).build().await.unwrap();
6472///
6473/// # let client = hyper_util::client::legacy::Client::builder(
6474/// #     hyper_util::rt::TokioExecutor::new()
6475/// # )
6476/// # .build(
6477/// #     hyper_rustls::HttpsConnectorBuilder::new()
6478/// #         .with_native_roots()
6479/// #         .unwrap()
6480/// #         .https_or_http()
6481/// #         .enable_http1()
6482/// #         .build()
6483/// # );
6484/// # let mut hub = Dataproc::new(client, auth);
6485/// // As the method needs a request, you would usually fill it with the desired information
6486/// // into the respective structure. Some of the parts shown here might not be applicable !
6487/// // Values shown here are possibly random and not representative !
6488/// let mut req = GetIamPolicyRequest::default();
6489///
6490/// // You can configure optional parameters by calling the respective setters at will, and
6491/// // execute the final call using `doit()`.
6492/// // Values shown here are possibly random and not representative !
6493/// let result = hub.projects().locations_autoscaling_policies_get_iam_policy(req, "resource")
6494///              .doit().await;
6495/// # }
6496/// ```
6497pub struct ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C>
6498where
6499    C: 'a,
6500{
6501    hub: &'a Dataproc<C>,
6502    _request: GetIamPolicyRequest,
6503    _resource: String,
6504    _delegate: Option<&'a mut dyn common::Delegate>,
6505    _additional_params: HashMap<String, String>,
6506    _scopes: BTreeSet<String>,
6507}
6508
6509impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {}
6510
6511impl<'a, C> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C>
6512where
6513    C: common::Connector,
6514{
6515    /// Perform the operation you have build so far.
6516    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6517        use std::borrow::Cow;
6518        use std::io::{Read, Seek};
6519
6520        use common::{url::Params, ToParts};
6521        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6522
6523        let mut dd = common::DefaultDelegate;
6524        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6525        dlg.begin(common::MethodInfo {
6526            id: "dataproc.projects.locations.autoscalingPolicies.getIamPolicy",
6527            http_method: hyper::Method::POST,
6528        });
6529
6530        for &field in ["alt", "resource"].iter() {
6531            if self._additional_params.contains_key(field) {
6532                dlg.finished(false);
6533                return Err(common::Error::FieldClash(field));
6534            }
6535        }
6536
6537        let mut params = Params::with_capacity(4 + self._additional_params.len());
6538        params.push("resource", self._resource);
6539
6540        params.extend(self._additional_params.iter());
6541
6542        params.push("alt", "json");
6543        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
6544        if self._scopes.is_empty() {
6545            self._scopes
6546                .insert(Scope::CloudPlatform.as_ref().to_string());
6547        }
6548
6549        #[allow(clippy::single_element_loop)]
6550        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6551            url = params.uri_replacement(url, param_name, find_this, true);
6552        }
6553        {
6554            let to_remove = ["resource"];
6555            params.remove_params(&to_remove);
6556        }
6557
6558        let url = params.parse_with_url(&url);
6559
6560        let mut json_mime_type = mime::APPLICATION_JSON;
6561        let mut request_value_reader = {
6562            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6563            common::remove_json_null_values(&mut value);
6564            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6565            serde_json::to_writer(&mut dst, &value).unwrap();
6566            dst
6567        };
6568        let request_size = request_value_reader
6569            .seek(std::io::SeekFrom::End(0))
6570            .unwrap();
6571        request_value_reader
6572            .seek(std::io::SeekFrom::Start(0))
6573            .unwrap();
6574
6575        loop {
6576            let token = match self
6577                .hub
6578                .auth
6579                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6580                .await
6581            {
6582                Ok(token) => token,
6583                Err(e) => match dlg.token(e) {
6584                    Ok(token) => token,
6585                    Err(e) => {
6586                        dlg.finished(false);
6587                        return Err(common::Error::MissingToken(e));
6588                    }
6589                },
6590            };
6591            request_value_reader
6592                .seek(std::io::SeekFrom::Start(0))
6593                .unwrap();
6594            let mut req_result = {
6595                let client = &self.hub.client;
6596                dlg.pre_request();
6597                let mut req_builder = hyper::Request::builder()
6598                    .method(hyper::Method::POST)
6599                    .uri(url.as_str())
6600                    .header(USER_AGENT, self.hub._user_agent.clone());
6601
6602                if let Some(token) = token.as_ref() {
6603                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6604                }
6605
6606                let request = req_builder
6607                    .header(CONTENT_TYPE, json_mime_type.to_string())
6608                    .header(CONTENT_LENGTH, request_size as u64)
6609                    .body(common::to_body(
6610                        request_value_reader.get_ref().clone().into(),
6611                    ));
6612
6613                client.request(request.unwrap()).await
6614            };
6615
6616            match req_result {
6617                Err(err) => {
6618                    if let common::Retry::After(d) = dlg.http_error(&err) {
6619                        sleep(d).await;
6620                        continue;
6621                    }
6622                    dlg.finished(false);
6623                    return Err(common::Error::HttpError(err));
6624                }
6625                Ok(res) => {
6626                    let (mut parts, body) = res.into_parts();
6627                    let mut body = common::Body::new(body);
6628                    if !parts.status.is_success() {
6629                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6630                        let error = serde_json::from_str(&common::to_string(&bytes));
6631                        let response = common::to_response(parts, bytes.into());
6632
6633                        if let common::Retry::After(d) =
6634                            dlg.http_failure(&response, error.as_ref().ok())
6635                        {
6636                            sleep(d).await;
6637                            continue;
6638                        }
6639
6640                        dlg.finished(false);
6641
6642                        return Err(match error {
6643                            Ok(value) => common::Error::BadRequest(value),
6644                            _ => common::Error::Failure(response),
6645                        });
6646                    }
6647                    let response = {
6648                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6649                        let encoded = common::to_string(&bytes);
6650                        match serde_json::from_str(&encoded) {
6651                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6652                            Err(error) => {
6653                                dlg.response_json_decode_error(&encoded, &error);
6654                                return Err(common::Error::JsonDecodeError(
6655                                    encoded.to_string(),
6656                                    error,
6657                                ));
6658                            }
6659                        }
6660                    };
6661
6662                    dlg.finished(true);
6663                    return Ok(response);
6664                }
6665            }
6666        }
6667    }
6668
6669    ///
6670    /// Sets the *request* property to the given value.
6671    ///
6672    /// Even though the property as already been set when instantiating this call,
6673    /// we provide this method for API completeness.
6674    pub fn request(
6675        mut self,
6676        new_value: GetIamPolicyRequest,
6677    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {
6678        self._request = new_value;
6679        self
6680    }
6681    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6682    ///
6683    /// Sets the *resource* path property to the given value.
6684    ///
6685    /// Even though the property as already been set when instantiating this call,
6686    /// we provide this method for API completeness.
6687    pub fn resource(
6688        mut self,
6689        new_value: &str,
6690    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {
6691        self._resource = new_value.to_string();
6692        self
6693    }
6694    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6695    /// while executing the actual API request.
6696    ///
6697    /// ````text
6698    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6699    /// ````
6700    ///
6701    /// Sets the *delegate* property to the given value.
6702    pub fn delegate(
6703        mut self,
6704        new_value: &'a mut dyn common::Delegate,
6705    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {
6706        self._delegate = Some(new_value);
6707        self
6708    }
6709
6710    /// Set any additional parameter of the query string used in the request.
6711    /// It should be used to set parameters which are not yet available through their own
6712    /// setters.
6713    ///
6714    /// Please note that this method must not be used to set any of the known parameters
6715    /// which have their own setter method. If done anyway, the request will fail.
6716    ///
6717    /// # Additional Parameters
6718    ///
6719    /// * *$.xgafv* (query-string) - V1 error format.
6720    /// * *access_token* (query-string) - OAuth access token.
6721    /// * *alt* (query-string) - Data format for response.
6722    /// * *callback* (query-string) - JSONP
6723    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6724    /// * *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.
6725    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6726    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6727    /// * *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.
6728    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6729    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6730    pub fn param<T>(
6731        mut self,
6732        name: T,
6733        value: T,
6734    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C>
6735    where
6736        T: AsRef<str>,
6737    {
6738        self._additional_params
6739            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6740        self
6741    }
6742
6743    /// Identifies the authorization scope for the method you are building.
6744    ///
6745    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6746    /// [`Scope::CloudPlatform`].
6747    ///
6748    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6749    /// tokens for more than one scope.
6750    ///
6751    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6752    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6753    /// sufficient, a read-write scope will do as well.
6754    pub fn add_scope<St>(
6755        mut self,
6756        scope: St,
6757    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C>
6758    where
6759        St: AsRef<str>,
6760    {
6761        self._scopes.insert(String::from(scope.as_ref()));
6762        self
6763    }
6764    /// Identifies the authorization scope(s) for the method you are building.
6765    ///
6766    /// See [`Self::add_scope()`] for details.
6767    pub fn add_scopes<I, St>(
6768        mut self,
6769        scopes: I,
6770    ) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C>
6771    where
6772        I: IntoIterator<Item = St>,
6773        St: AsRef<str>,
6774    {
6775        self._scopes
6776            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6777        self
6778    }
6779
6780    /// Removes all scopes, and no default scope will be used either.
6781    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6782    /// for details).
6783    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyGetIamPolicyCall<'a, C> {
6784        self._scopes.clear();
6785        self
6786    }
6787}
6788
6789/// Lists autoscaling policies in the project.
6790///
6791/// A builder for the *locations.autoscalingPolicies.list* method supported by a *project* resource.
6792/// It is not used directly, but through a [`ProjectMethods`] instance.
6793///
6794/// # Example
6795///
6796/// Instantiate a resource method builder
6797///
6798/// ```test_harness,no_run
6799/// # extern crate hyper;
6800/// # extern crate hyper_rustls;
6801/// # extern crate google_dataproc1 as dataproc1;
6802/// # async fn dox() {
6803/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6804///
6805/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6806/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6807/// #     secret,
6808/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6809/// # ).build().await.unwrap();
6810///
6811/// # let client = hyper_util::client::legacy::Client::builder(
6812/// #     hyper_util::rt::TokioExecutor::new()
6813/// # )
6814/// # .build(
6815/// #     hyper_rustls::HttpsConnectorBuilder::new()
6816/// #         .with_native_roots()
6817/// #         .unwrap()
6818/// #         .https_or_http()
6819/// #         .enable_http1()
6820/// #         .build()
6821/// # );
6822/// # let mut hub = Dataproc::new(client, auth);
6823/// // You can configure optional parameters by calling the respective setters at will, and
6824/// // execute the final call using `doit()`.
6825/// // Values shown here are possibly random and not representative !
6826/// let result = hub.projects().locations_autoscaling_policies_list("parent")
6827///              .page_token("invidunt")
6828///              .page_size(-47)
6829///              .doit().await;
6830/// # }
6831/// ```
6832pub struct ProjectLocationAutoscalingPolicyListCall<'a, C>
6833where
6834    C: 'a,
6835{
6836    hub: &'a Dataproc<C>,
6837    _parent: String,
6838    _page_token: Option<String>,
6839    _page_size: Option<i32>,
6840    _delegate: Option<&'a mut dyn common::Delegate>,
6841    _additional_params: HashMap<String, String>,
6842    _scopes: BTreeSet<String>,
6843}
6844
6845impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyListCall<'a, C> {}
6846
6847impl<'a, C> ProjectLocationAutoscalingPolicyListCall<'a, C>
6848where
6849    C: common::Connector,
6850{
6851    /// Perform the operation you have build so far.
6852    pub async fn doit(
6853        mut self,
6854    ) -> common::Result<(common::Response, ListAutoscalingPoliciesResponse)> {
6855        use std::borrow::Cow;
6856        use std::io::{Read, Seek};
6857
6858        use common::{url::Params, ToParts};
6859        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6860
6861        let mut dd = common::DefaultDelegate;
6862        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6863        dlg.begin(common::MethodInfo {
6864            id: "dataproc.projects.locations.autoscalingPolicies.list",
6865            http_method: hyper::Method::GET,
6866        });
6867
6868        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6869            if self._additional_params.contains_key(field) {
6870                dlg.finished(false);
6871                return Err(common::Error::FieldClash(field));
6872            }
6873        }
6874
6875        let mut params = Params::with_capacity(5 + self._additional_params.len());
6876        params.push("parent", self._parent);
6877        if let Some(value) = self._page_token.as_ref() {
6878            params.push("pageToken", value);
6879        }
6880        if let Some(value) = self._page_size.as_ref() {
6881            params.push("pageSize", value.to_string());
6882        }
6883
6884        params.extend(self._additional_params.iter());
6885
6886        params.push("alt", "json");
6887        let mut url = self.hub._base_url.clone() + "v1/{+parent}/autoscalingPolicies";
6888        if self._scopes.is_empty() {
6889            self._scopes
6890                .insert(Scope::CloudPlatform.as_ref().to_string());
6891        }
6892
6893        #[allow(clippy::single_element_loop)]
6894        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6895            url = params.uri_replacement(url, param_name, find_this, true);
6896        }
6897        {
6898            let to_remove = ["parent"];
6899            params.remove_params(&to_remove);
6900        }
6901
6902        let url = params.parse_with_url(&url);
6903
6904        loop {
6905            let token = match self
6906                .hub
6907                .auth
6908                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6909                .await
6910            {
6911                Ok(token) => token,
6912                Err(e) => match dlg.token(e) {
6913                    Ok(token) => token,
6914                    Err(e) => {
6915                        dlg.finished(false);
6916                        return Err(common::Error::MissingToken(e));
6917                    }
6918                },
6919            };
6920            let mut req_result = {
6921                let client = &self.hub.client;
6922                dlg.pre_request();
6923                let mut req_builder = hyper::Request::builder()
6924                    .method(hyper::Method::GET)
6925                    .uri(url.as_str())
6926                    .header(USER_AGENT, self.hub._user_agent.clone());
6927
6928                if let Some(token) = token.as_ref() {
6929                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6930                }
6931
6932                let request = req_builder
6933                    .header(CONTENT_LENGTH, 0_u64)
6934                    .body(common::to_body::<String>(None));
6935
6936                client.request(request.unwrap()).await
6937            };
6938
6939            match req_result {
6940                Err(err) => {
6941                    if let common::Retry::After(d) = dlg.http_error(&err) {
6942                        sleep(d).await;
6943                        continue;
6944                    }
6945                    dlg.finished(false);
6946                    return Err(common::Error::HttpError(err));
6947                }
6948                Ok(res) => {
6949                    let (mut parts, body) = res.into_parts();
6950                    let mut body = common::Body::new(body);
6951                    if !parts.status.is_success() {
6952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6953                        let error = serde_json::from_str(&common::to_string(&bytes));
6954                        let response = common::to_response(parts, bytes.into());
6955
6956                        if let common::Retry::After(d) =
6957                            dlg.http_failure(&response, error.as_ref().ok())
6958                        {
6959                            sleep(d).await;
6960                            continue;
6961                        }
6962
6963                        dlg.finished(false);
6964
6965                        return Err(match error {
6966                            Ok(value) => common::Error::BadRequest(value),
6967                            _ => common::Error::Failure(response),
6968                        });
6969                    }
6970                    let response = {
6971                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6972                        let encoded = common::to_string(&bytes);
6973                        match serde_json::from_str(&encoded) {
6974                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6975                            Err(error) => {
6976                                dlg.response_json_decode_error(&encoded, &error);
6977                                return Err(common::Error::JsonDecodeError(
6978                                    encoded.to_string(),
6979                                    error,
6980                                ));
6981                            }
6982                        }
6983                    };
6984
6985                    dlg.finished(true);
6986                    return Ok(response);
6987                }
6988            }
6989        }
6990    }
6991
6992    /// Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
6993    ///
6994    /// Sets the *parent* path property to the given value.
6995    ///
6996    /// Even though the property as already been set when instantiating this call,
6997    /// we provide this method for API completeness.
6998    pub fn parent(mut self, new_value: &str) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
6999        self._parent = new_value.to_string();
7000        self
7001    }
7002    /// Optional. The page token, returned by a previous call, to request the next page of results.
7003    ///
7004    /// Sets the *page token* query property to the given value.
7005    pub fn page_token(
7006        mut self,
7007        new_value: &str,
7008    ) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
7009        self._page_token = Some(new_value.to_string());
7010        self
7011    }
7012    /// Optional. The maximum number of results to return in each response. Must be less than or equal to 1000. Defaults to 100.
7013    ///
7014    /// Sets the *page size* query property to the given value.
7015    pub fn page_size(mut self, new_value: i32) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
7016        self._page_size = Some(new_value);
7017        self
7018    }
7019    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7020    /// while executing the actual API request.
7021    ///
7022    /// ````text
7023    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7024    /// ````
7025    ///
7026    /// Sets the *delegate* property to the given value.
7027    pub fn delegate(
7028        mut self,
7029        new_value: &'a mut dyn common::Delegate,
7030    ) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
7031        self._delegate = Some(new_value);
7032        self
7033    }
7034
7035    /// Set any additional parameter of the query string used in the request.
7036    /// It should be used to set parameters which are not yet available through their own
7037    /// setters.
7038    ///
7039    /// Please note that this method must not be used to set any of the known parameters
7040    /// which have their own setter method. If done anyway, the request will fail.
7041    ///
7042    /// # Additional Parameters
7043    ///
7044    /// * *$.xgafv* (query-string) - V1 error format.
7045    /// * *access_token* (query-string) - OAuth access token.
7046    /// * *alt* (query-string) - Data format for response.
7047    /// * *callback* (query-string) - JSONP
7048    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7049    /// * *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.
7050    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7051    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7052    /// * *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.
7053    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7054    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7055    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationAutoscalingPolicyListCall<'a, C>
7056    where
7057        T: AsRef<str>,
7058    {
7059        self._additional_params
7060            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7061        self
7062    }
7063
7064    /// Identifies the authorization scope for the method you are building.
7065    ///
7066    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7067    /// [`Scope::CloudPlatform`].
7068    ///
7069    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7070    /// tokens for more than one scope.
7071    ///
7072    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7073    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7074    /// sufficient, a read-write scope will do as well.
7075    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAutoscalingPolicyListCall<'a, C>
7076    where
7077        St: AsRef<str>,
7078    {
7079        self._scopes.insert(String::from(scope.as_ref()));
7080        self
7081    }
7082    /// Identifies the authorization scope(s) for the method you are building.
7083    ///
7084    /// See [`Self::add_scope()`] for details.
7085    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationAutoscalingPolicyListCall<'a, C>
7086    where
7087        I: IntoIterator<Item = St>,
7088        St: AsRef<str>,
7089    {
7090        self._scopes
7091            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7092        self
7093    }
7094
7095    /// Removes all scopes, and no default scope will be used either.
7096    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7097    /// for details).
7098    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyListCall<'a, C> {
7099        self._scopes.clear();
7100        self
7101    }
7102}
7103
7104/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
7105///
7106/// A builder for the *locations.autoscalingPolicies.setIamPolicy* method supported by a *project* resource.
7107/// It is not used directly, but through a [`ProjectMethods`] instance.
7108///
7109/// # Example
7110///
7111/// Instantiate a resource method builder
7112///
7113/// ```test_harness,no_run
7114/// # extern crate hyper;
7115/// # extern crate hyper_rustls;
7116/// # extern crate google_dataproc1 as dataproc1;
7117/// use dataproc1::api::SetIamPolicyRequest;
7118/// # async fn dox() {
7119/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7120///
7121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7123/// #     secret,
7124/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7125/// # ).build().await.unwrap();
7126///
7127/// # let client = hyper_util::client::legacy::Client::builder(
7128/// #     hyper_util::rt::TokioExecutor::new()
7129/// # )
7130/// # .build(
7131/// #     hyper_rustls::HttpsConnectorBuilder::new()
7132/// #         .with_native_roots()
7133/// #         .unwrap()
7134/// #         .https_or_http()
7135/// #         .enable_http1()
7136/// #         .build()
7137/// # );
7138/// # let mut hub = Dataproc::new(client, auth);
7139/// // As the method needs a request, you would usually fill it with the desired information
7140/// // into the respective structure. Some of the parts shown here might not be applicable !
7141/// // Values shown here are possibly random and not representative !
7142/// let mut req = SetIamPolicyRequest::default();
7143///
7144/// // You can configure optional parameters by calling the respective setters at will, and
7145/// // execute the final call using `doit()`.
7146/// // Values shown here are possibly random and not representative !
7147/// let result = hub.projects().locations_autoscaling_policies_set_iam_policy(req, "resource")
7148///              .doit().await;
7149/// # }
7150/// ```
7151pub struct ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C>
7152where
7153    C: 'a,
7154{
7155    hub: &'a Dataproc<C>,
7156    _request: SetIamPolicyRequest,
7157    _resource: String,
7158    _delegate: Option<&'a mut dyn common::Delegate>,
7159    _additional_params: HashMap<String, String>,
7160    _scopes: BTreeSet<String>,
7161}
7162
7163impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {}
7164
7165impl<'a, C> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C>
7166where
7167    C: common::Connector,
7168{
7169    /// Perform the operation you have build so far.
7170    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7171        use std::borrow::Cow;
7172        use std::io::{Read, Seek};
7173
7174        use common::{url::Params, ToParts};
7175        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7176
7177        let mut dd = common::DefaultDelegate;
7178        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7179        dlg.begin(common::MethodInfo {
7180            id: "dataproc.projects.locations.autoscalingPolicies.setIamPolicy",
7181            http_method: hyper::Method::POST,
7182        });
7183
7184        for &field in ["alt", "resource"].iter() {
7185            if self._additional_params.contains_key(field) {
7186                dlg.finished(false);
7187                return Err(common::Error::FieldClash(field));
7188            }
7189        }
7190
7191        let mut params = Params::with_capacity(4 + self._additional_params.len());
7192        params.push("resource", self._resource);
7193
7194        params.extend(self._additional_params.iter());
7195
7196        params.push("alt", "json");
7197        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
7198        if self._scopes.is_empty() {
7199            self._scopes
7200                .insert(Scope::CloudPlatform.as_ref().to_string());
7201        }
7202
7203        #[allow(clippy::single_element_loop)]
7204        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7205            url = params.uri_replacement(url, param_name, find_this, true);
7206        }
7207        {
7208            let to_remove = ["resource"];
7209            params.remove_params(&to_remove);
7210        }
7211
7212        let url = params.parse_with_url(&url);
7213
7214        let mut json_mime_type = mime::APPLICATION_JSON;
7215        let mut request_value_reader = {
7216            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7217            common::remove_json_null_values(&mut value);
7218            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7219            serde_json::to_writer(&mut dst, &value).unwrap();
7220            dst
7221        };
7222        let request_size = request_value_reader
7223            .seek(std::io::SeekFrom::End(0))
7224            .unwrap();
7225        request_value_reader
7226            .seek(std::io::SeekFrom::Start(0))
7227            .unwrap();
7228
7229        loop {
7230            let token = match self
7231                .hub
7232                .auth
7233                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7234                .await
7235            {
7236                Ok(token) => token,
7237                Err(e) => match dlg.token(e) {
7238                    Ok(token) => token,
7239                    Err(e) => {
7240                        dlg.finished(false);
7241                        return Err(common::Error::MissingToken(e));
7242                    }
7243                },
7244            };
7245            request_value_reader
7246                .seek(std::io::SeekFrom::Start(0))
7247                .unwrap();
7248            let mut req_result = {
7249                let client = &self.hub.client;
7250                dlg.pre_request();
7251                let mut req_builder = hyper::Request::builder()
7252                    .method(hyper::Method::POST)
7253                    .uri(url.as_str())
7254                    .header(USER_AGENT, self.hub._user_agent.clone());
7255
7256                if let Some(token) = token.as_ref() {
7257                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7258                }
7259
7260                let request = req_builder
7261                    .header(CONTENT_TYPE, json_mime_type.to_string())
7262                    .header(CONTENT_LENGTH, request_size as u64)
7263                    .body(common::to_body(
7264                        request_value_reader.get_ref().clone().into(),
7265                    ));
7266
7267                client.request(request.unwrap()).await
7268            };
7269
7270            match req_result {
7271                Err(err) => {
7272                    if let common::Retry::After(d) = dlg.http_error(&err) {
7273                        sleep(d).await;
7274                        continue;
7275                    }
7276                    dlg.finished(false);
7277                    return Err(common::Error::HttpError(err));
7278                }
7279                Ok(res) => {
7280                    let (mut parts, body) = res.into_parts();
7281                    let mut body = common::Body::new(body);
7282                    if !parts.status.is_success() {
7283                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7284                        let error = serde_json::from_str(&common::to_string(&bytes));
7285                        let response = common::to_response(parts, bytes.into());
7286
7287                        if let common::Retry::After(d) =
7288                            dlg.http_failure(&response, error.as_ref().ok())
7289                        {
7290                            sleep(d).await;
7291                            continue;
7292                        }
7293
7294                        dlg.finished(false);
7295
7296                        return Err(match error {
7297                            Ok(value) => common::Error::BadRequest(value),
7298                            _ => common::Error::Failure(response),
7299                        });
7300                    }
7301                    let response = {
7302                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7303                        let encoded = common::to_string(&bytes);
7304                        match serde_json::from_str(&encoded) {
7305                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7306                            Err(error) => {
7307                                dlg.response_json_decode_error(&encoded, &error);
7308                                return Err(common::Error::JsonDecodeError(
7309                                    encoded.to_string(),
7310                                    error,
7311                                ));
7312                            }
7313                        }
7314                    };
7315
7316                    dlg.finished(true);
7317                    return Ok(response);
7318                }
7319            }
7320        }
7321    }
7322
7323    ///
7324    /// Sets the *request* property to the given value.
7325    ///
7326    /// Even though the property as already been set when instantiating this call,
7327    /// we provide this method for API completeness.
7328    pub fn request(
7329        mut self,
7330        new_value: SetIamPolicyRequest,
7331    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {
7332        self._request = new_value;
7333        self
7334    }
7335    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7336    ///
7337    /// Sets the *resource* path property to the given value.
7338    ///
7339    /// Even though the property as already been set when instantiating this call,
7340    /// we provide this method for API completeness.
7341    pub fn resource(
7342        mut self,
7343        new_value: &str,
7344    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {
7345        self._resource = new_value.to_string();
7346        self
7347    }
7348    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7349    /// while executing the actual API request.
7350    ///
7351    /// ````text
7352    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7353    /// ````
7354    ///
7355    /// Sets the *delegate* property to the given value.
7356    pub fn delegate(
7357        mut self,
7358        new_value: &'a mut dyn common::Delegate,
7359    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {
7360        self._delegate = Some(new_value);
7361        self
7362    }
7363
7364    /// Set any additional parameter of the query string used in the request.
7365    /// It should be used to set parameters which are not yet available through their own
7366    /// setters.
7367    ///
7368    /// Please note that this method must not be used to set any of the known parameters
7369    /// which have their own setter method. If done anyway, the request will fail.
7370    ///
7371    /// # Additional Parameters
7372    ///
7373    /// * *$.xgafv* (query-string) - V1 error format.
7374    /// * *access_token* (query-string) - OAuth access token.
7375    /// * *alt* (query-string) - Data format for response.
7376    /// * *callback* (query-string) - JSONP
7377    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7378    /// * *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.
7379    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7380    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7381    /// * *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.
7382    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7383    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7384    pub fn param<T>(
7385        mut self,
7386        name: T,
7387        value: T,
7388    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C>
7389    where
7390        T: AsRef<str>,
7391    {
7392        self._additional_params
7393            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7394        self
7395    }
7396
7397    /// Identifies the authorization scope for the method you are building.
7398    ///
7399    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7400    /// [`Scope::CloudPlatform`].
7401    ///
7402    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7403    /// tokens for more than one scope.
7404    ///
7405    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7406    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7407    /// sufficient, a read-write scope will do as well.
7408    pub fn add_scope<St>(
7409        mut self,
7410        scope: St,
7411    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C>
7412    where
7413        St: AsRef<str>,
7414    {
7415        self._scopes.insert(String::from(scope.as_ref()));
7416        self
7417    }
7418    /// Identifies the authorization scope(s) for the method you are building.
7419    ///
7420    /// See [`Self::add_scope()`] for details.
7421    pub fn add_scopes<I, St>(
7422        mut self,
7423        scopes: I,
7424    ) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C>
7425    where
7426        I: IntoIterator<Item = St>,
7427        St: AsRef<str>,
7428    {
7429        self._scopes
7430            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7431        self
7432    }
7433
7434    /// Removes all scopes, and no default scope will be used either.
7435    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7436    /// for details).
7437    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicySetIamPolicyCall<'a, C> {
7438        self._scopes.clear();
7439        self
7440    }
7441}
7442
7443/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
7444///
7445/// A builder for the *locations.autoscalingPolicies.testIamPermissions* method supported by a *project* resource.
7446/// It is not used directly, but through a [`ProjectMethods`] instance.
7447///
7448/// # Example
7449///
7450/// Instantiate a resource method builder
7451///
7452/// ```test_harness,no_run
7453/// # extern crate hyper;
7454/// # extern crate hyper_rustls;
7455/// # extern crate google_dataproc1 as dataproc1;
7456/// use dataproc1::api::TestIamPermissionsRequest;
7457/// # async fn dox() {
7458/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7459///
7460/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7461/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7462/// #     secret,
7463/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7464/// # ).build().await.unwrap();
7465///
7466/// # let client = hyper_util::client::legacy::Client::builder(
7467/// #     hyper_util::rt::TokioExecutor::new()
7468/// # )
7469/// # .build(
7470/// #     hyper_rustls::HttpsConnectorBuilder::new()
7471/// #         .with_native_roots()
7472/// #         .unwrap()
7473/// #         .https_or_http()
7474/// #         .enable_http1()
7475/// #         .build()
7476/// # );
7477/// # let mut hub = Dataproc::new(client, auth);
7478/// // As the method needs a request, you would usually fill it with the desired information
7479/// // into the respective structure. Some of the parts shown here might not be applicable !
7480/// // Values shown here are possibly random and not representative !
7481/// let mut req = TestIamPermissionsRequest::default();
7482///
7483/// // You can configure optional parameters by calling the respective setters at will, and
7484/// // execute the final call using `doit()`.
7485/// // Values shown here are possibly random and not representative !
7486/// let result = hub.projects().locations_autoscaling_policies_test_iam_permissions(req, "resource")
7487///              .doit().await;
7488/// # }
7489/// ```
7490pub struct ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C>
7491where
7492    C: 'a,
7493{
7494    hub: &'a Dataproc<C>,
7495    _request: TestIamPermissionsRequest,
7496    _resource: String,
7497    _delegate: Option<&'a mut dyn common::Delegate>,
7498    _additional_params: HashMap<String, String>,
7499    _scopes: BTreeSet<String>,
7500}
7501
7502impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {}
7503
7504impl<'a, C> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C>
7505where
7506    C: common::Connector,
7507{
7508    /// Perform the operation you have build so far.
7509    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7510        use std::borrow::Cow;
7511        use std::io::{Read, Seek};
7512
7513        use common::{url::Params, ToParts};
7514        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7515
7516        let mut dd = common::DefaultDelegate;
7517        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7518        dlg.begin(common::MethodInfo {
7519            id: "dataproc.projects.locations.autoscalingPolicies.testIamPermissions",
7520            http_method: hyper::Method::POST,
7521        });
7522
7523        for &field in ["alt", "resource"].iter() {
7524            if self._additional_params.contains_key(field) {
7525                dlg.finished(false);
7526                return Err(common::Error::FieldClash(field));
7527            }
7528        }
7529
7530        let mut params = Params::with_capacity(4 + self._additional_params.len());
7531        params.push("resource", self._resource);
7532
7533        params.extend(self._additional_params.iter());
7534
7535        params.push("alt", "json");
7536        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
7537        if self._scopes.is_empty() {
7538            self._scopes
7539                .insert(Scope::CloudPlatform.as_ref().to_string());
7540        }
7541
7542        #[allow(clippy::single_element_loop)]
7543        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7544            url = params.uri_replacement(url, param_name, find_this, true);
7545        }
7546        {
7547            let to_remove = ["resource"];
7548            params.remove_params(&to_remove);
7549        }
7550
7551        let url = params.parse_with_url(&url);
7552
7553        let mut json_mime_type = mime::APPLICATION_JSON;
7554        let mut request_value_reader = {
7555            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7556            common::remove_json_null_values(&mut value);
7557            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7558            serde_json::to_writer(&mut dst, &value).unwrap();
7559            dst
7560        };
7561        let request_size = request_value_reader
7562            .seek(std::io::SeekFrom::End(0))
7563            .unwrap();
7564        request_value_reader
7565            .seek(std::io::SeekFrom::Start(0))
7566            .unwrap();
7567
7568        loop {
7569            let token = match self
7570                .hub
7571                .auth
7572                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7573                .await
7574            {
7575                Ok(token) => token,
7576                Err(e) => match dlg.token(e) {
7577                    Ok(token) => token,
7578                    Err(e) => {
7579                        dlg.finished(false);
7580                        return Err(common::Error::MissingToken(e));
7581                    }
7582                },
7583            };
7584            request_value_reader
7585                .seek(std::io::SeekFrom::Start(0))
7586                .unwrap();
7587            let mut req_result = {
7588                let client = &self.hub.client;
7589                dlg.pre_request();
7590                let mut req_builder = hyper::Request::builder()
7591                    .method(hyper::Method::POST)
7592                    .uri(url.as_str())
7593                    .header(USER_AGENT, self.hub._user_agent.clone());
7594
7595                if let Some(token) = token.as_ref() {
7596                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7597                }
7598
7599                let request = req_builder
7600                    .header(CONTENT_TYPE, json_mime_type.to_string())
7601                    .header(CONTENT_LENGTH, request_size as u64)
7602                    .body(common::to_body(
7603                        request_value_reader.get_ref().clone().into(),
7604                    ));
7605
7606                client.request(request.unwrap()).await
7607            };
7608
7609            match req_result {
7610                Err(err) => {
7611                    if let common::Retry::After(d) = dlg.http_error(&err) {
7612                        sleep(d).await;
7613                        continue;
7614                    }
7615                    dlg.finished(false);
7616                    return Err(common::Error::HttpError(err));
7617                }
7618                Ok(res) => {
7619                    let (mut parts, body) = res.into_parts();
7620                    let mut body = common::Body::new(body);
7621                    if !parts.status.is_success() {
7622                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7623                        let error = serde_json::from_str(&common::to_string(&bytes));
7624                        let response = common::to_response(parts, bytes.into());
7625
7626                        if let common::Retry::After(d) =
7627                            dlg.http_failure(&response, error.as_ref().ok())
7628                        {
7629                            sleep(d).await;
7630                            continue;
7631                        }
7632
7633                        dlg.finished(false);
7634
7635                        return Err(match error {
7636                            Ok(value) => common::Error::BadRequest(value),
7637                            _ => common::Error::Failure(response),
7638                        });
7639                    }
7640                    let response = {
7641                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7642                        let encoded = common::to_string(&bytes);
7643                        match serde_json::from_str(&encoded) {
7644                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7645                            Err(error) => {
7646                                dlg.response_json_decode_error(&encoded, &error);
7647                                return Err(common::Error::JsonDecodeError(
7648                                    encoded.to_string(),
7649                                    error,
7650                                ));
7651                            }
7652                        }
7653                    };
7654
7655                    dlg.finished(true);
7656                    return Ok(response);
7657                }
7658            }
7659        }
7660    }
7661
7662    ///
7663    /// Sets the *request* property to the given value.
7664    ///
7665    /// Even though the property as already been set when instantiating this call,
7666    /// we provide this method for API completeness.
7667    pub fn request(
7668        mut self,
7669        new_value: TestIamPermissionsRequest,
7670    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {
7671        self._request = new_value;
7672        self
7673    }
7674    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7675    ///
7676    /// Sets the *resource* path property to the given value.
7677    ///
7678    /// Even though the property as already been set when instantiating this call,
7679    /// we provide this method for API completeness.
7680    pub fn resource(
7681        mut self,
7682        new_value: &str,
7683    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {
7684        self._resource = new_value.to_string();
7685        self
7686    }
7687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7688    /// while executing the actual API request.
7689    ///
7690    /// ````text
7691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7692    /// ````
7693    ///
7694    /// Sets the *delegate* property to the given value.
7695    pub fn delegate(
7696        mut self,
7697        new_value: &'a mut dyn common::Delegate,
7698    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {
7699        self._delegate = Some(new_value);
7700        self
7701    }
7702
7703    /// Set any additional parameter of the query string used in the request.
7704    /// It should be used to set parameters which are not yet available through their own
7705    /// setters.
7706    ///
7707    /// Please note that this method must not be used to set any of the known parameters
7708    /// which have their own setter method. If done anyway, the request will fail.
7709    ///
7710    /// # Additional Parameters
7711    ///
7712    /// * *$.xgafv* (query-string) - V1 error format.
7713    /// * *access_token* (query-string) - OAuth access token.
7714    /// * *alt* (query-string) - Data format for response.
7715    /// * *callback* (query-string) - JSONP
7716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7717    /// * *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.
7718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7720    /// * *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.
7721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7723    pub fn param<T>(
7724        mut self,
7725        name: T,
7726        value: T,
7727    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C>
7728    where
7729        T: AsRef<str>,
7730    {
7731        self._additional_params
7732            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7733        self
7734    }
7735
7736    /// Identifies the authorization scope for the method you are building.
7737    ///
7738    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7739    /// [`Scope::CloudPlatform`].
7740    ///
7741    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7742    /// tokens for more than one scope.
7743    ///
7744    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7745    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7746    /// sufficient, a read-write scope will do as well.
7747    pub fn add_scope<St>(
7748        mut self,
7749        scope: St,
7750    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C>
7751    where
7752        St: AsRef<str>,
7753    {
7754        self._scopes.insert(String::from(scope.as_ref()));
7755        self
7756    }
7757    /// Identifies the authorization scope(s) for the method you are building.
7758    ///
7759    /// See [`Self::add_scope()`] for details.
7760    pub fn add_scopes<I, St>(
7761        mut self,
7762        scopes: I,
7763    ) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C>
7764    where
7765        I: IntoIterator<Item = St>,
7766        St: AsRef<str>,
7767    {
7768        self._scopes
7769            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7770        self
7771    }
7772
7773    /// Removes all scopes, and no default scope will be used either.
7774    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7775    /// for details).
7776    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyTestIamPermissionCall<'a, C> {
7777        self._scopes.clear();
7778        self
7779    }
7780}
7781
7782/// Updates (replaces) autoscaling policy.Disabled check for update_mask, because all updates will be full replacements.
7783///
7784/// A builder for the *locations.autoscalingPolicies.update* method supported by a *project* resource.
7785/// It is not used directly, but through a [`ProjectMethods`] instance.
7786///
7787/// # Example
7788///
7789/// Instantiate a resource method builder
7790///
7791/// ```test_harness,no_run
7792/// # extern crate hyper;
7793/// # extern crate hyper_rustls;
7794/// # extern crate google_dataproc1 as dataproc1;
7795/// use dataproc1::api::AutoscalingPolicy;
7796/// # async fn dox() {
7797/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7798///
7799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7800/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7801/// #     secret,
7802/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7803/// # ).build().await.unwrap();
7804///
7805/// # let client = hyper_util::client::legacy::Client::builder(
7806/// #     hyper_util::rt::TokioExecutor::new()
7807/// # )
7808/// # .build(
7809/// #     hyper_rustls::HttpsConnectorBuilder::new()
7810/// #         .with_native_roots()
7811/// #         .unwrap()
7812/// #         .https_or_http()
7813/// #         .enable_http1()
7814/// #         .build()
7815/// # );
7816/// # let mut hub = Dataproc::new(client, auth);
7817/// // As the method needs a request, you would usually fill it with the desired information
7818/// // into the respective structure. Some of the parts shown here might not be applicable !
7819/// // Values shown here are possibly random and not representative !
7820/// let mut req = AutoscalingPolicy::default();
7821///
7822/// // You can configure optional parameters by calling the respective setters at will, and
7823/// // execute the final call using `doit()`.
7824/// // Values shown here are possibly random and not representative !
7825/// let result = hub.projects().locations_autoscaling_policies_update(req, "name")
7826///              .doit().await;
7827/// # }
7828/// ```
7829pub struct ProjectLocationAutoscalingPolicyUpdateCall<'a, C>
7830where
7831    C: 'a,
7832{
7833    hub: &'a Dataproc<C>,
7834    _request: AutoscalingPolicy,
7835    _name: String,
7836    _delegate: Option<&'a mut dyn common::Delegate>,
7837    _additional_params: HashMap<String, String>,
7838    _scopes: BTreeSet<String>,
7839}
7840
7841impl<'a, C> common::CallBuilder for ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {}
7842
7843impl<'a, C> ProjectLocationAutoscalingPolicyUpdateCall<'a, C>
7844where
7845    C: common::Connector,
7846{
7847    /// Perform the operation you have build so far.
7848    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
7849        use std::borrow::Cow;
7850        use std::io::{Read, Seek};
7851
7852        use common::{url::Params, ToParts};
7853        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7854
7855        let mut dd = common::DefaultDelegate;
7856        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7857        dlg.begin(common::MethodInfo {
7858            id: "dataproc.projects.locations.autoscalingPolicies.update",
7859            http_method: hyper::Method::PUT,
7860        });
7861
7862        for &field in ["alt", "name"].iter() {
7863            if self._additional_params.contains_key(field) {
7864                dlg.finished(false);
7865                return Err(common::Error::FieldClash(field));
7866            }
7867        }
7868
7869        let mut params = Params::with_capacity(4 + self._additional_params.len());
7870        params.push("name", self._name);
7871
7872        params.extend(self._additional_params.iter());
7873
7874        params.push("alt", "json");
7875        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7876        if self._scopes.is_empty() {
7877            self._scopes
7878                .insert(Scope::CloudPlatform.as_ref().to_string());
7879        }
7880
7881        #[allow(clippy::single_element_loop)]
7882        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7883            url = params.uri_replacement(url, param_name, find_this, true);
7884        }
7885        {
7886            let to_remove = ["name"];
7887            params.remove_params(&to_remove);
7888        }
7889
7890        let url = params.parse_with_url(&url);
7891
7892        let mut json_mime_type = mime::APPLICATION_JSON;
7893        let mut request_value_reader = {
7894            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7895            common::remove_json_null_values(&mut value);
7896            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7897            serde_json::to_writer(&mut dst, &value).unwrap();
7898            dst
7899        };
7900        let request_size = request_value_reader
7901            .seek(std::io::SeekFrom::End(0))
7902            .unwrap();
7903        request_value_reader
7904            .seek(std::io::SeekFrom::Start(0))
7905            .unwrap();
7906
7907        loop {
7908            let token = match self
7909                .hub
7910                .auth
7911                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7912                .await
7913            {
7914                Ok(token) => token,
7915                Err(e) => match dlg.token(e) {
7916                    Ok(token) => token,
7917                    Err(e) => {
7918                        dlg.finished(false);
7919                        return Err(common::Error::MissingToken(e));
7920                    }
7921                },
7922            };
7923            request_value_reader
7924                .seek(std::io::SeekFrom::Start(0))
7925                .unwrap();
7926            let mut req_result = {
7927                let client = &self.hub.client;
7928                dlg.pre_request();
7929                let mut req_builder = hyper::Request::builder()
7930                    .method(hyper::Method::PUT)
7931                    .uri(url.as_str())
7932                    .header(USER_AGENT, self.hub._user_agent.clone());
7933
7934                if let Some(token) = token.as_ref() {
7935                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7936                }
7937
7938                let request = req_builder
7939                    .header(CONTENT_TYPE, json_mime_type.to_string())
7940                    .header(CONTENT_LENGTH, request_size as u64)
7941                    .body(common::to_body(
7942                        request_value_reader.get_ref().clone().into(),
7943                    ));
7944
7945                client.request(request.unwrap()).await
7946            };
7947
7948            match req_result {
7949                Err(err) => {
7950                    if let common::Retry::After(d) = dlg.http_error(&err) {
7951                        sleep(d).await;
7952                        continue;
7953                    }
7954                    dlg.finished(false);
7955                    return Err(common::Error::HttpError(err));
7956                }
7957                Ok(res) => {
7958                    let (mut parts, body) = res.into_parts();
7959                    let mut body = common::Body::new(body);
7960                    if !parts.status.is_success() {
7961                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7962                        let error = serde_json::from_str(&common::to_string(&bytes));
7963                        let response = common::to_response(parts, bytes.into());
7964
7965                        if let common::Retry::After(d) =
7966                            dlg.http_failure(&response, error.as_ref().ok())
7967                        {
7968                            sleep(d).await;
7969                            continue;
7970                        }
7971
7972                        dlg.finished(false);
7973
7974                        return Err(match error {
7975                            Ok(value) => common::Error::BadRequest(value),
7976                            _ => common::Error::Failure(response),
7977                        });
7978                    }
7979                    let response = {
7980                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7981                        let encoded = common::to_string(&bytes);
7982                        match serde_json::from_str(&encoded) {
7983                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7984                            Err(error) => {
7985                                dlg.response_json_decode_error(&encoded, &error);
7986                                return Err(common::Error::JsonDecodeError(
7987                                    encoded.to_string(),
7988                                    error,
7989                                ));
7990                            }
7991                        }
7992                    };
7993
7994                    dlg.finished(true);
7995                    return Ok(response);
7996                }
7997            }
7998        }
7999    }
8000
8001    ///
8002    /// Sets the *request* property to the given value.
8003    ///
8004    /// Even though the property as already been set when instantiating this call,
8005    /// we provide this method for API completeness.
8006    pub fn request(
8007        mut self,
8008        new_value: AutoscalingPolicy,
8009    ) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {
8010        self._request = new_value;
8011        self
8012    }
8013    /// Output only. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
8014    ///
8015    /// Sets the *name* path property to the given value.
8016    ///
8017    /// Even though the property as already been set when instantiating this call,
8018    /// we provide this method for API completeness.
8019    pub fn name(mut self, new_value: &str) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {
8020        self._name = new_value.to_string();
8021        self
8022    }
8023    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8024    /// while executing the actual API request.
8025    ///
8026    /// ````text
8027    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8028    /// ````
8029    ///
8030    /// Sets the *delegate* property to the given value.
8031    pub fn delegate(
8032        mut self,
8033        new_value: &'a mut dyn common::Delegate,
8034    ) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {
8035        self._delegate = Some(new_value);
8036        self
8037    }
8038
8039    /// Set any additional parameter of the query string used in the request.
8040    /// It should be used to set parameters which are not yet available through their own
8041    /// setters.
8042    ///
8043    /// Please note that this method must not be used to set any of the known parameters
8044    /// which have their own setter method. If done anyway, the request will fail.
8045    ///
8046    /// # Additional Parameters
8047    ///
8048    /// * *$.xgafv* (query-string) - V1 error format.
8049    /// * *access_token* (query-string) - OAuth access token.
8050    /// * *alt* (query-string) - Data format for response.
8051    /// * *callback* (query-string) - JSONP
8052    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8053    /// * *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.
8054    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8055    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8056    /// * *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.
8057    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8058    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8059    pub fn param<T>(
8060        mut self,
8061        name: T,
8062        value: T,
8063    ) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C>
8064    where
8065        T: AsRef<str>,
8066    {
8067        self._additional_params
8068            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8069        self
8070    }
8071
8072    /// Identifies the authorization scope for the method you are building.
8073    ///
8074    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8075    /// [`Scope::CloudPlatform`].
8076    ///
8077    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8078    /// tokens for more than one scope.
8079    ///
8080    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8081    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8082    /// sufficient, a read-write scope will do as well.
8083    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C>
8084    where
8085        St: AsRef<str>,
8086    {
8087        self._scopes.insert(String::from(scope.as_ref()));
8088        self
8089    }
8090    /// Identifies the authorization scope(s) for the method you are building.
8091    ///
8092    /// See [`Self::add_scope()`] for details.
8093    pub fn add_scopes<I, St>(
8094        mut self,
8095        scopes: I,
8096    ) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C>
8097    where
8098        I: IntoIterator<Item = St>,
8099        St: AsRef<str>,
8100    {
8101        self._scopes
8102            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8103        self
8104    }
8105
8106    /// Removes all scopes, and no default scope will be used either.
8107    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8108    /// for details).
8109    pub fn clear_scopes(mut self) -> ProjectLocationAutoscalingPolicyUpdateCall<'a, C> {
8110        self._scopes.clear();
8111        self
8112    }
8113}
8114
8115/// Analyze a Batch for possible recommendations and insights.
8116///
8117/// A builder for the *locations.batches.analyze* method supported by a *project* resource.
8118/// It is not used directly, but through a [`ProjectMethods`] instance.
8119///
8120/// # Example
8121///
8122/// Instantiate a resource method builder
8123///
8124/// ```test_harness,no_run
8125/// # extern crate hyper;
8126/// # extern crate hyper_rustls;
8127/// # extern crate google_dataproc1 as dataproc1;
8128/// use dataproc1::api::AnalyzeBatchRequest;
8129/// # async fn dox() {
8130/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8131///
8132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8134/// #     secret,
8135/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8136/// # ).build().await.unwrap();
8137///
8138/// # let client = hyper_util::client::legacy::Client::builder(
8139/// #     hyper_util::rt::TokioExecutor::new()
8140/// # )
8141/// # .build(
8142/// #     hyper_rustls::HttpsConnectorBuilder::new()
8143/// #         .with_native_roots()
8144/// #         .unwrap()
8145/// #         .https_or_http()
8146/// #         .enable_http1()
8147/// #         .build()
8148/// # );
8149/// # let mut hub = Dataproc::new(client, auth);
8150/// // As the method needs a request, you would usually fill it with the desired information
8151/// // into the respective structure. Some of the parts shown here might not be applicable !
8152/// // Values shown here are possibly random and not representative !
8153/// let mut req = AnalyzeBatchRequest::default();
8154///
8155/// // You can configure optional parameters by calling the respective setters at will, and
8156/// // execute the final call using `doit()`.
8157/// // Values shown here are possibly random and not representative !
8158/// let result = hub.projects().locations_batches_analyze(req, "name")
8159///              .doit().await;
8160/// # }
8161/// ```
8162pub struct ProjectLocationBatchAnalyzeCall<'a, C>
8163where
8164    C: 'a,
8165{
8166    hub: &'a Dataproc<C>,
8167    _request: AnalyzeBatchRequest,
8168    _name: String,
8169    _delegate: Option<&'a mut dyn common::Delegate>,
8170    _additional_params: HashMap<String, String>,
8171    _scopes: BTreeSet<String>,
8172}
8173
8174impl<'a, C> common::CallBuilder for ProjectLocationBatchAnalyzeCall<'a, C> {}
8175
8176impl<'a, C> ProjectLocationBatchAnalyzeCall<'a, C>
8177where
8178    C: common::Connector,
8179{
8180    /// Perform the operation you have build so far.
8181    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8182        use std::borrow::Cow;
8183        use std::io::{Read, Seek};
8184
8185        use common::{url::Params, ToParts};
8186        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8187
8188        let mut dd = common::DefaultDelegate;
8189        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8190        dlg.begin(common::MethodInfo {
8191            id: "dataproc.projects.locations.batches.analyze",
8192            http_method: hyper::Method::POST,
8193        });
8194
8195        for &field in ["alt", "name"].iter() {
8196            if self._additional_params.contains_key(field) {
8197                dlg.finished(false);
8198                return Err(common::Error::FieldClash(field));
8199            }
8200        }
8201
8202        let mut params = Params::with_capacity(4 + self._additional_params.len());
8203        params.push("name", self._name);
8204
8205        params.extend(self._additional_params.iter());
8206
8207        params.push("alt", "json");
8208        let mut url = self.hub._base_url.clone() + "v1/{+name}:analyze";
8209        if self._scopes.is_empty() {
8210            self._scopes
8211                .insert(Scope::CloudPlatform.as_ref().to_string());
8212        }
8213
8214        #[allow(clippy::single_element_loop)]
8215        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8216            url = params.uri_replacement(url, param_name, find_this, true);
8217        }
8218        {
8219            let to_remove = ["name"];
8220            params.remove_params(&to_remove);
8221        }
8222
8223        let url = params.parse_with_url(&url);
8224
8225        let mut json_mime_type = mime::APPLICATION_JSON;
8226        let mut request_value_reader = {
8227            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8228            common::remove_json_null_values(&mut value);
8229            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8230            serde_json::to_writer(&mut dst, &value).unwrap();
8231            dst
8232        };
8233        let request_size = request_value_reader
8234            .seek(std::io::SeekFrom::End(0))
8235            .unwrap();
8236        request_value_reader
8237            .seek(std::io::SeekFrom::Start(0))
8238            .unwrap();
8239
8240        loop {
8241            let token = match self
8242                .hub
8243                .auth
8244                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8245                .await
8246            {
8247                Ok(token) => token,
8248                Err(e) => match dlg.token(e) {
8249                    Ok(token) => token,
8250                    Err(e) => {
8251                        dlg.finished(false);
8252                        return Err(common::Error::MissingToken(e));
8253                    }
8254                },
8255            };
8256            request_value_reader
8257                .seek(std::io::SeekFrom::Start(0))
8258                .unwrap();
8259            let mut req_result = {
8260                let client = &self.hub.client;
8261                dlg.pre_request();
8262                let mut req_builder = hyper::Request::builder()
8263                    .method(hyper::Method::POST)
8264                    .uri(url.as_str())
8265                    .header(USER_AGENT, self.hub._user_agent.clone());
8266
8267                if let Some(token) = token.as_ref() {
8268                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8269                }
8270
8271                let request = req_builder
8272                    .header(CONTENT_TYPE, json_mime_type.to_string())
8273                    .header(CONTENT_LENGTH, request_size as u64)
8274                    .body(common::to_body(
8275                        request_value_reader.get_ref().clone().into(),
8276                    ));
8277
8278                client.request(request.unwrap()).await
8279            };
8280
8281            match req_result {
8282                Err(err) => {
8283                    if let common::Retry::After(d) = dlg.http_error(&err) {
8284                        sleep(d).await;
8285                        continue;
8286                    }
8287                    dlg.finished(false);
8288                    return Err(common::Error::HttpError(err));
8289                }
8290                Ok(res) => {
8291                    let (mut parts, body) = res.into_parts();
8292                    let mut body = common::Body::new(body);
8293                    if !parts.status.is_success() {
8294                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8295                        let error = serde_json::from_str(&common::to_string(&bytes));
8296                        let response = common::to_response(parts, bytes.into());
8297
8298                        if let common::Retry::After(d) =
8299                            dlg.http_failure(&response, error.as_ref().ok())
8300                        {
8301                            sleep(d).await;
8302                            continue;
8303                        }
8304
8305                        dlg.finished(false);
8306
8307                        return Err(match error {
8308                            Ok(value) => common::Error::BadRequest(value),
8309                            _ => common::Error::Failure(response),
8310                        });
8311                    }
8312                    let response = {
8313                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8314                        let encoded = common::to_string(&bytes);
8315                        match serde_json::from_str(&encoded) {
8316                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8317                            Err(error) => {
8318                                dlg.response_json_decode_error(&encoded, &error);
8319                                return Err(common::Error::JsonDecodeError(
8320                                    encoded.to_string(),
8321                                    error,
8322                                ));
8323                            }
8324                        }
8325                    };
8326
8327                    dlg.finished(true);
8328                    return Ok(response);
8329                }
8330            }
8331        }
8332    }
8333
8334    ///
8335    /// Sets the *request* property to the given value.
8336    ///
8337    /// Even though the property as already been set when instantiating this call,
8338    /// we provide this method for API completeness.
8339    pub fn request(
8340        mut self,
8341        new_value: AnalyzeBatchRequest,
8342    ) -> ProjectLocationBatchAnalyzeCall<'a, C> {
8343        self._request = new_value;
8344        self
8345    }
8346    /// Required. The fully qualified name of the batch to analyze in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
8347    ///
8348    /// Sets the *name* path property to the given value.
8349    ///
8350    /// Even though the property as already been set when instantiating this call,
8351    /// we provide this method for API completeness.
8352    pub fn name(mut self, new_value: &str) -> ProjectLocationBatchAnalyzeCall<'a, C> {
8353        self._name = new_value.to_string();
8354        self
8355    }
8356    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8357    /// while executing the actual API request.
8358    ///
8359    /// ````text
8360    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8361    /// ````
8362    ///
8363    /// Sets the *delegate* property to the given value.
8364    pub fn delegate(
8365        mut self,
8366        new_value: &'a mut dyn common::Delegate,
8367    ) -> ProjectLocationBatchAnalyzeCall<'a, C> {
8368        self._delegate = Some(new_value);
8369        self
8370    }
8371
8372    /// Set any additional parameter of the query string used in the request.
8373    /// It should be used to set parameters which are not yet available through their own
8374    /// setters.
8375    ///
8376    /// Please note that this method must not be used to set any of the known parameters
8377    /// which have their own setter method. If done anyway, the request will fail.
8378    ///
8379    /// # Additional Parameters
8380    ///
8381    /// * *$.xgafv* (query-string) - V1 error format.
8382    /// * *access_token* (query-string) - OAuth access token.
8383    /// * *alt* (query-string) - Data format for response.
8384    /// * *callback* (query-string) - JSONP
8385    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8386    /// * *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.
8387    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8388    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8389    /// * *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.
8390    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8391    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8392    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBatchAnalyzeCall<'a, C>
8393    where
8394        T: AsRef<str>,
8395    {
8396        self._additional_params
8397            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8398        self
8399    }
8400
8401    /// Identifies the authorization scope for the method you are building.
8402    ///
8403    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8404    /// [`Scope::CloudPlatform`].
8405    ///
8406    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8407    /// tokens for more than one scope.
8408    ///
8409    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8410    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8411    /// sufficient, a read-write scope will do as well.
8412    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBatchAnalyzeCall<'a, C>
8413    where
8414        St: AsRef<str>,
8415    {
8416        self._scopes.insert(String::from(scope.as_ref()));
8417        self
8418    }
8419    /// Identifies the authorization scope(s) for the method you are building.
8420    ///
8421    /// See [`Self::add_scope()`] for details.
8422    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBatchAnalyzeCall<'a, C>
8423    where
8424        I: IntoIterator<Item = St>,
8425        St: AsRef<str>,
8426    {
8427        self._scopes
8428            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8429        self
8430    }
8431
8432    /// Removes all scopes, and no default scope will be used either.
8433    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8434    /// for details).
8435    pub fn clear_scopes(mut self) -> ProjectLocationBatchAnalyzeCall<'a, C> {
8436        self._scopes.clear();
8437        self
8438    }
8439}
8440
8441/// Creates a batch workload that executes asynchronously.
8442///
8443/// A builder for the *locations.batches.create* method supported by a *project* resource.
8444/// It is not used directly, but through a [`ProjectMethods`] instance.
8445///
8446/// # Example
8447///
8448/// Instantiate a resource method builder
8449///
8450/// ```test_harness,no_run
8451/// # extern crate hyper;
8452/// # extern crate hyper_rustls;
8453/// # extern crate google_dataproc1 as dataproc1;
8454/// use dataproc1::api::Batch;
8455/// # async fn dox() {
8456/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8457///
8458/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8459/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8460/// #     secret,
8461/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8462/// # ).build().await.unwrap();
8463///
8464/// # let client = hyper_util::client::legacy::Client::builder(
8465/// #     hyper_util::rt::TokioExecutor::new()
8466/// # )
8467/// # .build(
8468/// #     hyper_rustls::HttpsConnectorBuilder::new()
8469/// #         .with_native_roots()
8470/// #         .unwrap()
8471/// #         .https_or_http()
8472/// #         .enable_http1()
8473/// #         .build()
8474/// # );
8475/// # let mut hub = Dataproc::new(client, auth);
8476/// // As the method needs a request, you would usually fill it with the desired information
8477/// // into the respective structure. Some of the parts shown here might not be applicable !
8478/// // Values shown here are possibly random and not representative !
8479/// let mut req = Batch::default();
8480///
8481/// // You can configure optional parameters by calling the respective setters at will, and
8482/// // execute the final call using `doit()`.
8483/// // Values shown here are possibly random and not representative !
8484/// let result = hub.projects().locations_batches_create(req, "parent")
8485///              .request_id("rebum.")
8486///              .batch_id("est")
8487///              .doit().await;
8488/// # }
8489/// ```
8490pub struct ProjectLocationBatchCreateCall<'a, C>
8491where
8492    C: 'a,
8493{
8494    hub: &'a Dataproc<C>,
8495    _request: Batch,
8496    _parent: String,
8497    _request_id: Option<String>,
8498    _batch_id: Option<String>,
8499    _delegate: Option<&'a mut dyn common::Delegate>,
8500    _additional_params: HashMap<String, String>,
8501    _scopes: BTreeSet<String>,
8502}
8503
8504impl<'a, C> common::CallBuilder for ProjectLocationBatchCreateCall<'a, C> {}
8505
8506impl<'a, C> ProjectLocationBatchCreateCall<'a, C>
8507where
8508    C: common::Connector,
8509{
8510    /// Perform the operation you have build so far.
8511    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8512        use std::borrow::Cow;
8513        use std::io::{Read, Seek};
8514
8515        use common::{url::Params, ToParts};
8516        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8517
8518        let mut dd = common::DefaultDelegate;
8519        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8520        dlg.begin(common::MethodInfo {
8521            id: "dataproc.projects.locations.batches.create",
8522            http_method: hyper::Method::POST,
8523        });
8524
8525        for &field in ["alt", "parent", "requestId", "batchId"].iter() {
8526            if self._additional_params.contains_key(field) {
8527                dlg.finished(false);
8528                return Err(common::Error::FieldClash(field));
8529            }
8530        }
8531
8532        let mut params = Params::with_capacity(6 + self._additional_params.len());
8533        params.push("parent", self._parent);
8534        if let Some(value) = self._request_id.as_ref() {
8535            params.push("requestId", value);
8536        }
8537        if let Some(value) = self._batch_id.as_ref() {
8538            params.push("batchId", value);
8539        }
8540
8541        params.extend(self._additional_params.iter());
8542
8543        params.push("alt", "json");
8544        let mut url = self.hub._base_url.clone() + "v1/{+parent}/batches";
8545        if self._scopes.is_empty() {
8546            self._scopes
8547                .insert(Scope::CloudPlatform.as_ref().to_string());
8548        }
8549
8550        #[allow(clippy::single_element_loop)]
8551        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8552            url = params.uri_replacement(url, param_name, find_this, true);
8553        }
8554        {
8555            let to_remove = ["parent"];
8556            params.remove_params(&to_remove);
8557        }
8558
8559        let url = params.parse_with_url(&url);
8560
8561        let mut json_mime_type = mime::APPLICATION_JSON;
8562        let mut request_value_reader = {
8563            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8564            common::remove_json_null_values(&mut value);
8565            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8566            serde_json::to_writer(&mut dst, &value).unwrap();
8567            dst
8568        };
8569        let request_size = request_value_reader
8570            .seek(std::io::SeekFrom::End(0))
8571            .unwrap();
8572        request_value_reader
8573            .seek(std::io::SeekFrom::Start(0))
8574            .unwrap();
8575
8576        loop {
8577            let token = match self
8578                .hub
8579                .auth
8580                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8581                .await
8582            {
8583                Ok(token) => token,
8584                Err(e) => match dlg.token(e) {
8585                    Ok(token) => token,
8586                    Err(e) => {
8587                        dlg.finished(false);
8588                        return Err(common::Error::MissingToken(e));
8589                    }
8590                },
8591            };
8592            request_value_reader
8593                .seek(std::io::SeekFrom::Start(0))
8594                .unwrap();
8595            let mut req_result = {
8596                let client = &self.hub.client;
8597                dlg.pre_request();
8598                let mut req_builder = hyper::Request::builder()
8599                    .method(hyper::Method::POST)
8600                    .uri(url.as_str())
8601                    .header(USER_AGENT, self.hub._user_agent.clone());
8602
8603                if let Some(token) = token.as_ref() {
8604                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8605                }
8606
8607                let request = req_builder
8608                    .header(CONTENT_TYPE, json_mime_type.to_string())
8609                    .header(CONTENT_LENGTH, request_size as u64)
8610                    .body(common::to_body(
8611                        request_value_reader.get_ref().clone().into(),
8612                    ));
8613
8614                client.request(request.unwrap()).await
8615            };
8616
8617            match req_result {
8618                Err(err) => {
8619                    if let common::Retry::After(d) = dlg.http_error(&err) {
8620                        sleep(d).await;
8621                        continue;
8622                    }
8623                    dlg.finished(false);
8624                    return Err(common::Error::HttpError(err));
8625                }
8626                Ok(res) => {
8627                    let (mut parts, body) = res.into_parts();
8628                    let mut body = common::Body::new(body);
8629                    if !parts.status.is_success() {
8630                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8631                        let error = serde_json::from_str(&common::to_string(&bytes));
8632                        let response = common::to_response(parts, bytes.into());
8633
8634                        if let common::Retry::After(d) =
8635                            dlg.http_failure(&response, error.as_ref().ok())
8636                        {
8637                            sleep(d).await;
8638                            continue;
8639                        }
8640
8641                        dlg.finished(false);
8642
8643                        return Err(match error {
8644                            Ok(value) => common::Error::BadRequest(value),
8645                            _ => common::Error::Failure(response),
8646                        });
8647                    }
8648                    let response = {
8649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8650                        let encoded = common::to_string(&bytes);
8651                        match serde_json::from_str(&encoded) {
8652                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8653                            Err(error) => {
8654                                dlg.response_json_decode_error(&encoded, &error);
8655                                return Err(common::Error::JsonDecodeError(
8656                                    encoded.to_string(),
8657                                    error,
8658                                ));
8659                            }
8660                        }
8661                    };
8662
8663                    dlg.finished(true);
8664                    return Ok(response);
8665                }
8666            }
8667        }
8668    }
8669
8670    ///
8671    /// Sets the *request* property to the given value.
8672    ///
8673    /// Even though the property as already been set when instantiating this call,
8674    /// we provide this method for API completeness.
8675    pub fn request(mut self, new_value: Batch) -> ProjectLocationBatchCreateCall<'a, C> {
8676        self._request = new_value;
8677        self
8678    }
8679    /// Required. The parent resource where this batch will be created.
8680    ///
8681    /// Sets the *parent* path property to the given value.
8682    ///
8683    /// Even though the property as already been set when instantiating this call,
8684    /// we provide this method for API completeness.
8685    pub fn parent(mut self, new_value: &str) -> ProjectLocationBatchCreateCall<'a, C> {
8686        self._parent = new_value.to_string();
8687        self
8688    }
8689    /// Optional. A unique ID used to identify the request. If the service receives two CreateBatchRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s with the same request_id, the second request is ignored and the Operation that corresponds to the first Batch created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
8690    ///
8691    /// Sets the *request id* query property to the given value.
8692    pub fn request_id(mut self, new_value: &str) -> ProjectLocationBatchCreateCall<'a, C> {
8693        self._request_id = Some(new_value.to_string());
8694        self
8695    }
8696    /// Optional. The ID to use for the batch, which will become the final component of the batch's resource name.This value must be 4-63 characters. Valid characters are /[a-z][0-9]-/.
8697    ///
8698    /// Sets the *batch id* query property to the given value.
8699    pub fn batch_id(mut self, new_value: &str) -> ProjectLocationBatchCreateCall<'a, C> {
8700        self._batch_id = Some(new_value.to_string());
8701        self
8702    }
8703    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8704    /// while executing the actual API request.
8705    ///
8706    /// ````text
8707    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8708    /// ````
8709    ///
8710    /// Sets the *delegate* property to the given value.
8711    pub fn delegate(
8712        mut self,
8713        new_value: &'a mut dyn common::Delegate,
8714    ) -> ProjectLocationBatchCreateCall<'a, C> {
8715        self._delegate = Some(new_value);
8716        self
8717    }
8718
8719    /// Set any additional parameter of the query string used in the request.
8720    /// It should be used to set parameters which are not yet available through their own
8721    /// setters.
8722    ///
8723    /// Please note that this method must not be used to set any of the known parameters
8724    /// which have their own setter method. If done anyway, the request will fail.
8725    ///
8726    /// # Additional Parameters
8727    ///
8728    /// * *$.xgafv* (query-string) - V1 error format.
8729    /// * *access_token* (query-string) - OAuth access token.
8730    /// * *alt* (query-string) - Data format for response.
8731    /// * *callback* (query-string) - JSONP
8732    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8733    /// * *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.
8734    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8735    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8736    /// * *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.
8737    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8738    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8739    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBatchCreateCall<'a, C>
8740    where
8741        T: AsRef<str>,
8742    {
8743        self._additional_params
8744            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8745        self
8746    }
8747
8748    /// Identifies the authorization scope for the method you are building.
8749    ///
8750    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8751    /// [`Scope::CloudPlatform`].
8752    ///
8753    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8754    /// tokens for more than one scope.
8755    ///
8756    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8757    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8758    /// sufficient, a read-write scope will do as well.
8759    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBatchCreateCall<'a, C>
8760    where
8761        St: AsRef<str>,
8762    {
8763        self._scopes.insert(String::from(scope.as_ref()));
8764        self
8765    }
8766    /// Identifies the authorization scope(s) for the method you are building.
8767    ///
8768    /// See [`Self::add_scope()`] for details.
8769    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBatchCreateCall<'a, C>
8770    where
8771        I: IntoIterator<Item = St>,
8772        St: AsRef<str>,
8773    {
8774        self._scopes
8775            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8776        self
8777    }
8778
8779    /// Removes all scopes, and no default scope will be used either.
8780    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8781    /// for details).
8782    pub fn clear_scopes(mut self) -> ProjectLocationBatchCreateCall<'a, C> {
8783        self._scopes.clear();
8784        self
8785    }
8786}
8787
8788/// Deletes the batch workload resource. If the batch is not in a CANCELLED, SUCCEEDED or FAILED State, the delete operation fails and the response returns FAILED_PRECONDITION.
8789///
8790/// A builder for the *locations.batches.delete* method supported by a *project* resource.
8791/// It is not used directly, but through a [`ProjectMethods`] instance.
8792///
8793/// # Example
8794///
8795/// Instantiate a resource method builder
8796///
8797/// ```test_harness,no_run
8798/// # extern crate hyper;
8799/// # extern crate hyper_rustls;
8800/// # extern crate google_dataproc1 as dataproc1;
8801/// # async fn dox() {
8802/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8803///
8804/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8806/// #     secret,
8807/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8808/// # ).build().await.unwrap();
8809///
8810/// # let client = hyper_util::client::legacy::Client::builder(
8811/// #     hyper_util::rt::TokioExecutor::new()
8812/// # )
8813/// # .build(
8814/// #     hyper_rustls::HttpsConnectorBuilder::new()
8815/// #         .with_native_roots()
8816/// #         .unwrap()
8817/// #         .https_or_http()
8818/// #         .enable_http1()
8819/// #         .build()
8820/// # );
8821/// # let mut hub = Dataproc::new(client, auth);
8822/// // You can configure optional parameters by calling the respective setters at will, and
8823/// // execute the final call using `doit()`.
8824/// // Values shown here are possibly random and not representative !
8825/// let result = hub.projects().locations_batches_delete("name")
8826///              .doit().await;
8827/// # }
8828/// ```
8829pub struct ProjectLocationBatchDeleteCall<'a, C>
8830where
8831    C: 'a,
8832{
8833    hub: &'a Dataproc<C>,
8834    _name: String,
8835    _delegate: Option<&'a mut dyn common::Delegate>,
8836    _additional_params: HashMap<String, String>,
8837    _scopes: BTreeSet<String>,
8838}
8839
8840impl<'a, C> common::CallBuilder for ProjectLocationBatchDeleteCall<'a, C> {}
8841
8842impl<'a, C> ProjectLocationBatchDeleteCall<'a, C>
8843where
8844    C: common::Connector,
8845{
8846    /// Perform the operation you have build so far.
8847    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8848        use std::borrow::Cow;
8849        use std::io::{Read, Seek};
8850
8851        use common::{url::Params, ToParts};
8852        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8853
8854        let mut dd = common::DefaultDelegate;
8855        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8856        dlg.begin(common::MethodInfo {
8857            id: "dataproc.projects.locations.batches.delete",
8858            http_method: hyper::Method::DELETE,
8859        });
8860
8861        for &field in ["alt", "name"].iter() {
8862            if self._additional_params.contains_key(field) {
8863                dlg.finished(false);
8864                return Err(common::Error::FieldClash(field));
8865            }
8866        }
8867
8868        let mut params = Params::with_capacity(3 + self._additional_params.len());
8869        params.push("name", self._name);
8870
8871        params.extend(self._additional_params.iter());
8872
8873        params.push("alt", "json");
8874        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8875        if self._scopes.is_empty() {
8876            self._scopes
8877                .insert(Scope::CloudPlatform.as_ref().to_string());
8878        }
8879
8880        #[allow(clippy::single_element_loop)]
8881        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8882            url = params.uri_replacement(url, param_name, find_this, true);
8883        }
8884        {
8885            let to_remove = ["name"];
8886            params.remove_params(&to_remove);
8887        }
8888
8889        let url = params.parse_with_url(&url);
8890
8891        loop {
8892            let token = match self
8893                .hub
8894                .auth
8895                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8896                .await
8897            {
8898                Ok(token) => token,
8899                Err(e) => match dlg.token(e) {
8900                    Ok(token) => token,
8901                    Err(e) => {
8902                        dlg.finished(false);
8903                        return Err(common::Error::MissingToken(e));
8904                    }
8905                },
8906            };
8907            let mut req_result = {
8908                let client = &self.hub.client;
8909                dlg.pre_request();
8910                let mut req_builder = hyper::Request::builder()
8911                    .method(hyper::Method::DELETE)
8912                    .uri(url.as_str())
8913                    .header(USER_AGENT, self.hub._user_agent.clone());
8914
8915                if let Some(token) = token.as_ref() {
8916                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8917                }
8918
8919                let request = req_builder
8920                    .header(CONTENT_LENGTH, 0_u64)
8921                    .body(common::to_body::<String>(None));
8922
8923                client.request(request.unwrap()).await
8924            };
8925
8926            match req_result {
8927                Err(err) => {
8928                    if let common::Retry::After(d) = dlg.http_error(&err) {
8929                        sleep(d).await;
8930                        continue;
8931                    }
8932                    dlg.finished(false);
8933                    return Err(common::Error::HttpError(err));
8934                }
8935                Ok(res) => {
8936                    let (mut parts, body) = res.into_parts();
8937                    let mut body = common::Body::new(body);
8938                    if !parts.status.is_success() {
8939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8940                        let error = serde_json::from_str(&common::to_string(&bytes));
8941                        let response = common::to_response(parts, bytes.into());
8942
8943                        if let common::Retry::After(d) =
8944                            dlg.http_failure(&response, error.as_ref().ok())
8945                        {
8946                            sleep(d).await;
8947                            continue;
8948                        }
8949
8950                        dlg.finished(false);
8951
8952                        return Err(match error {
8953                            Ok(value) => common::Error::BadRequest(value),
8954                            _ => common::Error::Failure(response),
8955                        });
8956                    }
8957                    let response = {
8958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8959                        let encoded = common::to_string(&bytes);
8960                        match serde_json::from_str(&encoded) {
8961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8962                            Err(error) => {
8963                                dlg.response_json_decode_error(&encoded, &error);
8964                                return Err(common::Error::JsonDecodeError(
8965                                    encoded.to_string(),
8966                                    error,
8967                                ));
8968                            }
8969                        }
8970                    };
8971
8972                    dlg.finished(true);
8973                    return Ok(response);
8974                }
8975            }
8976        }
8977    }
8978
8979    /// Required. The fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
8980    ///
8981    /// Sets the *name* path property to the given value.
8982    ///
8983    /// Even though the property as already been set when instantiating this call,
8984    /// we provide this method for API completeness.
8985    pub fn name(mut self, new_value: &str) -> ProjectLocationBatchDeleteCall<'a, C> {
8986        self._name = new_value.to_string();
8987        self
8988    }
8989    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8990    /// while executing the actual API request.
8991    ///
8992    /// ````text
8993    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8994    /// ````
8995    ///
8996    /// Sets the *delegate* property to the given value.
8997    pub fn delegate(
8998        mut self,
8999        new_value: &'a mut dyn common::Delegate,
9000    ) -> ProjectLocationBatchDeleteCall<'a, C> {
9001        self._delegate = Some(new_value);
9002        self
9003    }
9004
9005    /// Set any additional parameter of the query string used in the request.
9006    /// It should be used to set parameters which are not yet available through their own
9007    /// setters.
9008    ///
9009    /// Please note that this method must not be used to set any of the known parameters
9010    /// which have their own setter method. If done anyway, the request will fail.
9011    ///
9012    /// # Additional Parameters
9013    ///
9014    /// * *$.xgafv* (query-string) - V1 error format.
9015    /// * *access_token* (query-string) - OAuth access token.
9016    /// * *alt* (query-string) - Data format for response.
9017    /// * *callback* (query-string) - JSONP
9018    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9019    /// * *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.
9020    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9021    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9022    /// * *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.
9023    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9024    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9025    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBatchDeleteCall<'a, C>
9026    where
9027        T: AsRef<str>,
9028    {
9029        self._additional_params
9030            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9031        self
9032    }
9033
9034    /// Identifies the authorization scope for the method you are building.
9035    ///
9036    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9037    /// [`Scope::CloudPlatform`].
9038    ///
9039    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9040    /// tokens for more than one scope.
9041    ///
9042    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9043    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9044    /// sufficient, a read-write scope will do as well.
9045    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBatchDeleteCall<'a, C>
9046    where
9047        St: AsRef<str>,
9048    {
9049        self._scopes.insert(String::from(scope.as_ref()));
9050        self
9051    }
9052    /// Identifies the authorization scope(s) for the method you are building.
9053    ///
9054    /// See [`Self::add_scope()`] for details.
9055    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBatchDeleteCall<'a, C>
9056    where
9057        I: IntoIterator<Item = St>,
9058        St: AsRef<str>,
9059    {
9060        self._scopes
9061            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9062        self
9063    }
9064
9065    /// Removes all scopes, and no default scope will be used either.
9066    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9067    /// for details).
9068    pub fn clear_scopes(mut self) -> ProjectLocationBatchDeleteCall<'a, C> {
9069        self._scopes.clear();
9070        self
9071    }
9072}
9073
9074/// Gets the batch workload resource representation.
9075///
9076/// A builder for the *locations.batches.get* method supported by a *project* resource.
9077/// It is not used directly, but through a [`ProjectMethods`] instance.
9078///
9079/// # Example
9080///
9081/// Instantiate a resource method builder
9082///
9083/// ```test_harness,no_run
9084/// # extern crate hyper;
9085/// # extern crate hyper_rustls;
9086/// # extern crate google_dataproc1 as dataproc1;
9087/// # async fn dox() {
9088/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9089///
9090/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9091/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9092/// #     secret,
9093/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9094/// # ).build().await.unwrap();
9095///
9096/// # let client = hyper_util::client::legacy::Client::builder(
9097/// #     hyper_util::rt::TokioExecutor::new()
9098/// # )
9099/// # .build(
9100/// #     hyper_rustls::HttpsConnectorBuilder::new()
9101/// #         .with_native_roots()
9102/// #         .unwrap()
9103/// #         .https_or_http()
9104/// #         .enable_http1()
9105/// #         .build()
9106/// # );
9107/// # let mut hub = Dataproc::new(client, auth);
9108/// // You can configure optional parameters by calling the respective setters at will, and
9109/// // execute the final call using `doit()`.
9110/// // Values shown here are possibly random and not representative !
9111/// let result = hub.projects().locations_batches_get("name")
9112///              .doit().await;
9113/// # }
9114/// ```
9115pub struct ProjectLocationBatchGetCall<'a, C>
9116where
9117    C: 'a,
9118{
9119    hub: &'a Dataproc<C>,
9120    _name: String,
9121    _delegate: Option<&'a mut dyn common::Delegate>,
9122    _additional_params: HashMap<String, String>,
9123    _scopes: BTreeSet<String>,
9124}
9125
9126impl<'a, C> common::CallBuilder for ProjectLocationBatchGetCall<'a, C> {}
9127
9128impl<'a, C> ProjectLocationBatchGetCall<'a, C>
9129where
9130    C: common::Connector,
9131{
9132    /// Perform the operation you have build so far.
9133    pub async fn doit(mut self) -> common::Result<(common::Response, Batch)> {
9134        use std::borrow::Cow;
9135        use std::io::{Read, Seek};
9136
9137        use common::{url::Params, ToParts};
9138        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9139
9140        let mut dd = common::DefaultDelegate;
9141        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9142        dlg.begin(common::MethodInfo {
9143            id: "dataproc.projects.locations.batches.get",
9144            http_method: hyper::Method::GET,
9145        });
9146
9147        for &field in ["alt", "name"].iter() {
9148            if self._additional_params.contains_key(field) {
9149                dlg.finished(false);
9150                return Err(common::Error::FieldClash(field));
9151            }
9152        }
9153
9154        let mut params = Params::with_capacity(3 + self._additional_params.len());
9155        params.push("name", self._name);
9156
9157        params.extend(self._additional_params.iter());
9158
9159        params.push("alt", "json");
9160        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9161        if self._scopes.is_empty() {
9162            self._scopes
9163                .insert(Scope::CloudPlatform.as_ref().to_string());
9164        }
9165
9166        #[allow(clippy::single_element_loop)]
9167        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9168            url = params.uri_replacement(url, param_name, find_this, true);
9169        }
9170        {
9171            let to_remove = ["name"];
9172            params.remove_params(&to_remove);
9173        }
9174
9175        let url = params.parse_with_url(&url);
9176
9177        loop {
9178            let token = match self
9179                .hub
9180                .auth
9181                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9182                .await
9183            {
9184                Ok(token) => token,
9185                Err(e) => match dlg.token(e) {
9186                    Ok(token) => token,
9187                    Err(e) => {
9188                        dlg.finished(false);
9189                        return Err(common::Error::MissingToken(e));
9190                    }
9191                },
9192            };
9193            let mut req_result = {
9194                let client = &self.hub.client;
9195                dlg.pre_request();
9196                let mut req_builder = hyper::Request::builder()
9197                    .method(hyper::Method::GET)
9198                    .uri(url.as_str())
9199                    .header(USER_AGENT, self.hub._user_agent.clone());
9200
9201                if let Some(token) = token.as_ref() {
9202                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9203                }
9204
9205                let request = req_builder
9206                    .header(CONTENT_LENGTH, 0_u64)
9207                    .body(common::to_body::<String>(None));
9208
9209                client.request(request.unwrap()).await
9210            };
9211
9212            match req_result {
9213                Err(err) => {
9214                    if let common::Retry::After(d) = dlg.http_error(&err) {
9215                        sleep(d).await;
9216                        continue;
9217                    }
9218                    dlg.finished(false);
9219                    return Err(common::Error::HttpError(err));
9220                }
9221                Ok(res) => {
9222                    let (mut parts, body) = res.into_parts();
9223                    let mut body = common::Body::new(body);
9224                    if !parts.status.is_success() {
9225                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9226                        let error = serde_json::from_str(&common::to_string(&bytes));
9227                        let response = common::to_response(parts, bytes.into());
9228
9229                        if let common::Retry::After(d) =
9230                            dlg.http_failure(&response, error.as_ref().ok())
9231                        {
9232                            sleep(d).await;
9233                            continue;
9234                        }
9235
9236                        dlg.finished(false);
9237
9238                        return Err(match error {
9239                            Ok(value) => common::Error::BadRequest(value),
9240                            _ => common::Error::Failure(response),
9241                        });
9242                    }
9243                    let response = {
9244                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9245                        let encoded = common::to_string(&bytes);
9246                        match serde_json::from_str(&encoded) {
9247                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9248                            Err(error) => {
9249                                dlg.response_json_decode_error(&encoded, &error);
9250                                return Err(common::Error::JsonDecodeError(
9251                                    encoded.to_string(),
9252                                    error,
9253                                ));
9254                            }
9255                        }
9256                    };
9257
9258                    dlg.finished(true);
9259                    return Ok(response);
9260                }
9261            }
9262        }
9263    }
9264
9265    /// Required. The fully qualified name of the batch to retrieve in the format "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
9266    ///
9267    /// Sets the *name* path property to the given value.
9268    ///
9269    /// Even though the property as already been set when instantiating this call,
9270    /// we provide this method for API completeness.
9271    pub fn name(mut self, new_value: &str) -> ProjectLocationBatchGetCall<'a, C> {
9272        self._name = new_value.to_string();
9273        self
9274    }
9275    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9276    /// while executing the actual API request.
9277    ///
9278    /// ````text
9279    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9280    /// ````
9281    ///
9282    /// Sets the *delegate* property to the given value.
9283    pub fn delegate(
9284        mut self,
9285        new_value: &'a mut dyn common::Delegate,
9286    ) -> ProjectLocationBatchGetCall<'a, C> {
9287        self._delegate = Some(new_value);
9288        self
9289    }
9290
9291    /// Set any additional parameter of the query string used in the request.
9292    /// It should be used to set parameters which are not yet available through their own
9293    /// setters.
9294    ///
9295    /// Please note that this method must not be used to set any of the known parameters
9296    /// which have their own setter method. If done anyway, the request will fail.
9297    ///
9298    /// # Additional Parameters
9299    ///
9300    /// * *$.xgafv* (query-string) - V1 error format.
9301    /// * *access_token* (query-string) - OAuth access token.
9302    /// * *alt* (query-string) - Data format for response.
9303    /// * *callback* (query-string) - JSONP
9304    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9305    /// * *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.
9306    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9307    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9308    /// * *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.
9309    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9310    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9311    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBatchGetCall<'a, C>
9312    where
9313        T: AsRef<str>,
9314    {
9315        self._additional_params
9316            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9317        self
9318    }
9319
9320    /// Identifies the authorization scope for the method you are building.
9321    ///
9322    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9323    /// [`Scope::CloudPlatform`].
9324    ///
9325    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9326    /// tokens for more than one scope.
9327    ///
9328    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9329    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9330    /// sufficient, a read-write scope will do as well.
9331    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBatchGetCall<'a, C>
9332    where
9333        St: AsRef<str>,
9334    {
9335        self._scopes.insert(String::from(scope.as_ref()));
9336        self
9337    }
9338    /// Identifies the authorization scope(s) for the method you are building.
9339    ///
9340    /// See [`Self::add_scope()`] for details.
9341    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBatchGetCall<'a, C>
9342    where
9343        I: IntoIterator<Item = St>,
9344        St: AsRef<str>,
9345    {
9346        self._scopes
9347            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9348        self
9349    }
9350
9351    /// Removes all scopes, and no default scope will be used either.
9352    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9353    /// for details).
9354    pub fn clear_scopes(mut self) -> ProjectLocationBatchGetCall<'a, C> {
9355        self._scopes.clear();
9356        self
9357    }
9358}
9359
9360/// Lists batch workloads.
9361///
9362/// A builder for the *locations.batches.list* method supported by a *project* resource.
9363/// It is not used directly, but through a [`ProjectMethods`] instance.
9364///
9365/// # Example
9366///
9367/// Instantiate a resource method builder
9368///
9369/// ```test_harness,no_run
9370/// # extern crate hyper;
9371/// # extern crate hyper_rustls;
9372/// # extern crate google_dataproc1 as dataproc1;
9373/// # async fn dox() {
9374/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9375///
9376/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9378/// #     secret,
9379/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9380/// # ).build().await.unwrap();
9381///
9382/// # let client = hyper_util::client::legacy::Client::builder(
9383/// #     hyper_util::rt::TokioExecutor::new()
9384/// # )
9385/// # .build(
9386/// #     hyper_rustls::HttpsConnectorBuilder::new()
9387/// #         .with_native_roots()
9388/// #         .unwrap()
9389/// #         .https_or_http()
9390/// #         .enable_http1()
9391/// #         .build()
9392/// # );
9393/// # let mut hub = Dataproc::new(client, auth);
9394/// // You can configure optional parameters by calling the respective setters at will, and
9395/// // execute the final call using `doit()`.
9396/// // Values shown here are possibly random and not representative !
9397/// let result = hub.projects().locations_batches_list("parent")
9398///              .page_token("gubergren")
9399///              .page_size(-17)
9400///              .order_by("dolor")
9401///              .filter("Lorem")
9402///              .doit().await;
9403/// # }
9404/// ```
9405pub struct ProjectLocationBatchListCall<'a, C>
9406where
9407    C: 'a,
9408{
9409    hub: &'a Dataproc<C>,
9410    _parent: String,
9411    _page_token: Option<String>,
9412    _page_size: Option<i32>,
9413    _order_by: Option<String>,
9414    _filter: Option<String>,
9415    _delegate: Option<&'a mut dyn common::Delegate>,
9416    _additional_params: HashMap<String, String>,
9417    _scopes: BTreeSet<String>,
9418}
9419
9420impl<'a, C> common::CallBuilder for ProjectLocationBatchListCall<'a, C> {}
9421
9422impl<'a, C> ProjectLocationBatchListCall<'a, C>
9423where
9424    C: common::Connector,
9425{
9426    /// Perform the operation you have build so far.
9427    pub async fn doit(mut self) -> common::Result<(common::Response, ListBatchesResponse)> {
9428        use std::borrow::Cow;
9429        use std::io::{Read, Seek};
9430
9431        use common::{url::Params, ToParts};
9432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9433
9434        let mut dd = common::DefaultDelegate;
9435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9436        dlg.begin(common::MethodInfo {
9437            id: "dataproc.projects.locations.batches.list",
9438            http_method: hyper::Method::GET,
9439        });
9440
9441        for &field in [
9442            "alt",
9443            "parent",
9444            "pageToken",
9445            "pageSize",
9446            "orderBy",
9447            "filter",
9448        ]
9449        .iter()
9450        {
9451            if self._additional_params.contains_key(field) {
9452                dlg.finished(false);
9453                return Err(common::Error::FieldClash(field));
9454            }
9455        }
9456
9457        let mut params = Params::with_capacity(7 + self._additional_params.len());
9458        params.push("parent", self._parent);
9459        if let Some(value) = self._page_token.as_ref() {
9460            params.push("pageToken", value);
9461        }
9462        if let Some(value) = self._page_size.as_ref() {
9463            params.push("pageSize", value.to_string());
9464        }
9465        if let Some(value) = self._order_by.as_ref() {
9466            params.push("orderBy", value);
9467        }
9468        if let Some(value) = self._filter.as_ref() {
9469            params.push("filter", value);
9470        }
9471
9472        params.extend(self._additional_params.iter());
9473
9474        params.push("alt", "json");
9475        let mut url = self.hub._base_url.clone() + "v1/{+parent}/batches";
9476        if self._scopes.is_empty() {
9477            self._scopes
9478                .insert(Scope::CloudPlatform.as_ref().to_string());
9479        }
9480
9481        #[allow(clippy::single_element_loop)]
9482        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9483            url = params.uri_replacement(url, param_name, find_this, true);
9484        }
9485        {
9486            let to_remove = ["parent"];
9487            params.remove_params(&to_remove);
9488        }
9489
9490        let url = params.parse_with_url(&url);
9491
9492        loop {
9493            let token = match self
9494                .hub
9495                .auth
9496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9497                .await
9498            {
9499                Ok(token) => token,
9500                Err(e) => match dlg.token(e) {
9501                    Ok(token) => token,
9502                    Err(e) => {
9503                        dlg.finished(false);
9504                        return Err(common::Error::MissingToken(e));
9505                    }
9506                },
9507            };
9508            let mut req_result = {
9509                let client = &self.hub.client;
9510                dlg.pre_request();
9511                let mut req_builder = hyper::Request::builder()
9512                    .method(hyper::Method::GET)
9513                    .uri(url.as_str())
9514                    .header(USER_AGENT, self.hub._user_agent.clone());
9515
9516                if let Some(token) = token.as_ref() {
9517                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9518                }
9519
9520                let request = req_builder
9521                    .header(CONTENT_LENGTH, 0_u64)
9522                    .body(common::to_body::<String>(None));
9523
9524                client.request(request.unwrap()).await
9525            };
9526
9527            match req_result {
9528                Err(err) => {
9529                    if let common::Retry::After(d) = dlg.http_error(&err) {
9530                        sleep(d).await;
9531                        continue;
9532                    }
9533                    dlg.finished(false);
9534                    return Err(common::Error::HttpError(err));
9535                }
9536                Ok(res) => {
9537                    let (mut parts, body) = res.into_parts();
9538                    let mut body = common::Body::new(body);
9539                    if !parts.status.is_success() {
9540                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9541                        let error = serde_json::from_str(&common::to_string(&bytes));
9542                        let response = common::to_response(parts, bytes.into());
9543
9544                        if let common::Retry::After(d) =
9545                            dlg.http_failure(&response, error.as_ref().ok())
9546                        {
9547                            sleep(d).await;
9548                            continue;
9549                        }
9550
9551                        dlg.finished(false);
9552
9553                        return Err(match error {
9554                            Ok(value) => common::Error::BadRequest(value),
9555                            _ => common::Error::Failure(response),
9556                        });
9557                    }
9558                    let response = {
9559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9560                        let encoded = common::to_string(&bytes);
9561                        match serde_json::from_str(&encoded) {
9562                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9563                            Err(error) => {
9564                                dlg.response_json_decode_error(&encoded, &error);
9565                                return Err(common::Error::JsonDecodeError(
9566                                    encoded.to_string(),
9567                                    error,
9568                                ));
9569                            }
9570                        }
9571                    };
9572
9573                    dlg.finished(true);
9574                    return Ok(response);
9575                }
9576            }
9577        }
9578    }
9579
9580    /// Required. The parent, which owns this collection of batches.
9581    ///
9582    /// Sets the *parent* path property to the given value.
9583    ///
9584    /// Even though the property as already been set when instantiating this call,
9585    /// we provide this method for API completeness.
9586    pub fn parent(mut self, new_value: &str) -> ProjectLocationBatchListCall<'a, C> {
9587        self._parent = new_value.to_string();
9588        self
9589    }
9590    /// Optional. A page token received from a previous ListBatches call. Provide this token to retrieve the subsequent page.
9591    ///
9592    /// Sets the *page token* query property to the given value.
9593    pub fn page_token(mut self, new_value: &str) -> ProjectLocationBatchListCall<'a, C> {
9594        self._page_token = Some(new_value.to_string());
9595        self
9596    }
9597    /// Optional. The maximum number of batches to return in each response. The service may return fewer than this value. The default page size is 20; the maximum page size is 1000.
9598    ///
9599    /// Sets the *page size* query property to the given value.
9600    pub fn page_size(mut self, new_value: i32) -> ProjectLocationBatchListCall<'a, C> {
9601        self._page_size = Some(new_value);
9602        self
9603    }
9604    /// Optional. Field(s) on which to sort the list of batches.Currently the only supported sort orders are unspecified (empty) and create_time desc to sort by most recently created batches first.See https://google.aip.dev/132#ordering for more details.
9605    ///
9606    /// Sets the *order by* query property to the given value.
9607    pub fn order_by(mut self, new_value: &str) -> ProjectLocationBatchListCall<'a, C> {
9608        self._order_by = Some(new_value.to_string());
9609        self
9610    }
9611    /// Optional. A filter for the batches to return in the response.A filter is a logical expression constraining the values of various fields in each batch resource. Filters are case sensitive, and may contain multiple clauses combined with logical operators (AND/OR). Supported fields are batch_id, batch_uuid, state, create_time, and labels.e.g. state = RUNNING and create_time < "2023-01-01T00:00:00Z" filters for batches in state RUNNING that were created before 2023-01-01. state = RUNNING and labels.environment=production filters for batches in state in a RUNNING state that have a production environment label.See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed description of the filter syntax and a list of supported comparisons.
9612    ///
9613    /// Sets the *filter* query property to the given value.
9614    pub fn filter(mut self, new_value: &str) -> ProjectLocationBatchListCall<'a, C> {
9615        self._filter = Some(new_value.to_string());
9616        self
9617    }
9618    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9619    /// while executing the actual API request.
9620    ///
9621    /// ````text
9622    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9623    /// ````
9624    ///
9625    /// Sets the *delegate* property to the given value.
9626    pub fn delegate(
9627        mut self,
9628        new_value: &'a mut dyn common::Delegate,
9629    ) -> ProjectLocationBatchListCall<'a, C> {
9630        self._delegate = Some(new_value);
9631        self
9632    }
9633
9634    /// Set any additional parameter of the query string used in the request.
9635    /// It should be used to set parameters which are not yet available through their own
9636    /// setters.
9637    ///
9638    /// Please note that this method must not be used to set any of the known parameters
9639    /// which have their own setter method. If done anyway, the request will fail.
9640    ///
9641    /// # Additional Parameters
9642    ///
9643    /// * *$.xgafv* (query-string) - V1 error format.
9644    /// * *access_token* (query-string) - OAuth access token.
9645    /// * *alt* (query-string) - Data format for response.
9646    /// * *callback* (query-string) - JSONP
9647    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9648    /// * *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.
9649    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9650    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9651    /// * *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.
9652    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9653    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9654    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationBatchListCall<'a, C>
9655    where
9656        T: AsRef<str>,
9657    {
9658        self._additional_params
9659            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9660        self
9661    }
9662
9663    /// Identifies the authorization scope for the method you are building.
9664    ///
9665    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9666    /// [`Scope::CloudPlatform`].
9667    ///
9668    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9669    /// tokens for more than one scope.
9670    ///
9671    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9672    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9673    /// sufficient, a read-write scope will do as well.
9674    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationBatchListCall<'a, C>
9675    where
9676        St: AsRef<str>,
9677    {
9678        self._scopes.insert(String::from(scope.as_ref()));
9679        self
9680    }
9681    /// Identifies the authorization scope(s) for the method you are building.
9682    ///
9683    /// See [`Self::add_scope()`] for details.
9684    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationBatchListCall<'a, C>
9685    where
9686        I: IntoIterator<Item = St>,
9687        St: AsRef<str>,
9688    {
9689        self._scopes
9690            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9691        self
9692    }
9693
9694    /// Removes all scopes, and no default scope will be used either.
9695    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9696    /// for details).
9697    pub fn clear_scopes(mut self) -> ProjectLocationBatchListCall<'a, C> {
9698        self._scopes.clear();
9699        self
9700    }
9701}
9702
9703/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
9704///
9705/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
9706/// It is not used directly, but through a [`ProjectMethods`] instance.
9707///
9708/// # Example
9709///
9710/// Instantiate a resource method builder
9711///
9712/// ```test_harness,no_run
9713/// # extern crate hyper;
9714/// # extern crate hyper_rustls;
9715/// # extern crate google_dataproc1 as dataproc1;
9716/// # async fn dox() {
9717/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9718///
9719/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9721/// #     secret,
9722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9723/// # ).build().await.unwrap();
9724///
9725/// # let client = hyper_util::client::legacy::Client::builder(
9726/// #     hyper_util::rt::TokioExecutor::new()
9727/// # )
9728/// # .build(
9729/// #     hyper_rustls::HttpsConnectorBuilder::new()
9730/// #         .with_native_roots()
9731/// #         .unwrap()
9732/// #         .https_or_http()
9733/// #         .enable_http1()
9734/// #         .build()
9735/// # );
9736/// # let mut hub = Dataproc::new(client, auth);
9737/// // You can configure optional parameters by calling the respective setters at will, and
9738/// // execute the final call using `doit()`.
9739/// // Values shown here are possibly random and not representative !
9740/// let result = hub.projects().locations_operations_cancel("name")
9741///              .doit().await;
9742/// # }
9743/// ```
9744pub struct ProjectLocationOperationCancelCall<'a, C>
9745where
9746    C: 'a,
9747{
9748    hub: &'a Dataproc<C>,
9749    _name: String,
9750    _delegate: Option<&'a mut dyn common::Delegate>,
9751    _additional_params: HashMap<String, String>,
9752    _scopes: BTreeSet<String>,
9753}
9754
9755impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
9756
9757impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
9758where
9759    C: common::Connector,
9760{
9761    /// Perform the operation you have build so far.
9762    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9763        use std::borrow::Cow;
9764        use std::io::{Read, Seek};
9765
9766        use common::{url::Params, ToParts};
9767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9768
9769        let mut dd = common::DefaultDelegate;
9770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9771        dlg.begin(common::MethodInfo {
9772            id: "dataproc.projects.locations.operations.cancel",
9773            http_method: hyper::Method::POST,
9774        });
9775
9776        for &field in ["alt", "name"].iter() {
9777            if self._additional_params.contains_key(field) {
9778                dlg.finished(false);
9779                return Err(common::Error::FieldClash(field));
9780            }
9781        }
9782
9783        let mut params = Params::with_capacity(3 + self._additional_params.len());
9784        params.push("name", self._name);
9785
9786        params.extend(self._additional_params.iter());
9787
9788        params.push("alt", "json");
9789        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
9790        if self._scopes.is_empty() {
9791            self._scopes
9792                .insert(Scope::CloudPlatform.as_ref().to_string());
9793        }
9794
9795        #[allow(clippy::single_element_loop)]
9796        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9797            url = params.uri_replacement(url, param_name, find_this, true);
9798        }
9799        {
9800            let to_remove = ["name"];
9801            params.remove_params(&to_remove);
9802        }
9803
9804        let url = params.parse_with_url(&url);
9805
9806        loop {
9807            let token = match self
9808                .hub
9809                .auth
9810                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9811                .await
9812            {
9813                Ok(token) => token,
9814                Err(e) => match dlg.token(e) {
9815                    Ok(token) => token,
9816                    Err(e) => {
9817                        dlg.finished(false);
9818                        return Err(common::Error::MissingToken(e));
9819                    }
9820                },
9821            };
9822            let mut req_result = {
9823                let client = &self.hub.client;
9824                dlg.pre_request();
9825                let mut req_builder = hyper::Request::builder()
9826                    .method(hyper::Method::POST)
9827                    .uri(url.as_str())
9828                    .header(USER_AGENT, self.hub._user_agent.clone());
9829
9830                if let Some(token) = token.as_ref() {
9831                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9832                }
9833
9834                let request = req_builder
9835                    .header(CONTENT_LENGTH, 0_u64)
9836                    .body(common::to_body::<String>(None));
9837
9838                client.request(request.unwrap()).await
9839            };
9840
9841            match req_result {
9842                Err(err) => {
9843                    if let common::Retry::After(d) = dlg.http_error(&err) {
9844                        sleep(d).await;
9845                        continue;
9846                    }
9847                    dlg.finished(false);
9848                    return Err(common::Error::HttpError(err));
9849                }
9850                Ok(res) => {
9851                    let (mut parts, body) = res.into_parts();
9852                    let mut body = common::Body::new(body);
9853                    if !parts.status.is_success() {
9854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9855                        let error = serde_json::from_str(&common::to_string(&bytes));
9856                        let response = common::to_response(parts, bytes.into());
9857
9858                        if let common::Retry::After(d) =
9859                            dlg.http_failure(&response, error.as_ref().ok())
9860                        {
9861                            sleep(d).await;
9862                            continue;
9863                        }
9864
9865                        dlg.finished(false);
9866
9867                        return Err(match error {
9868                            Ok(value) => common::Error::BadRequest(value),
9869                            _ => common::Error::Failure(response),
9870                        });
9871                    }
9872                    let response = {
9873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9874                        let encoded = common::to_string(&bytes);
9875                        match serde_json::from_str(&encoded) {
9876                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9877                            Err(error) => {
9878                                dlg.response_json_decode_error(&encoded, &error);
9879                                return Err(common::Error::JsonDecodeError(
9880                                    encoded.to_string(),
9881                                    error,
9882                                ));
9883                            }
9884                        }
9885                    };
9886
9887                    dlg.finished(true);
9888                    return Ok(response);
9889                }
9890            }
9891        }
9892    }
9893
9894    /// The name of the operation resource to be cancelled.
9895    ///
9896    /// Sets the *name* path property to the given value.
9897    ///
9898    /// Even though the property as already been set when instantiating this call,
9899    /// we provide this method for API completeness.
9900    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
9901        self._name = new_value.to_string();
9902        self
9903    }
9904    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9905    /// while executing the actual API request.
9906    ///
9907    /// ````text
9908    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9909    /// ````
9910    ///
9911    /// Sets the *delegate* property to the given value.
9912    pub fn delegate(
9913        mut self,
9914        new_value: &'a mut dyn common::Delegate,
9915    ) -> ProjectLocationOperationCancelCall<'a, C> {
9916        self._delegate = Some(new_value);
9917        self
9918    }
9919
9920    /// Set any additional parameter of the query string used in the request.
9921    /// It should be used to set parameters which are not yet available through their own
9922    /// setters.
9923    ///
9924    /// Please note that this method must not be used to set any of the known parameters
9925    /// which have their own setter method. If done anyway, the request will fail.
9926    ///
9927    /// # Additional Parameters
9928    ///
9929    /// * *$.xgafv* (query-string) - V1 error format.
9930    /// * *access_token* (query-string) - OAuth access token.
9931    /// * *alt* (query-string) - Data format for response.
9932    /// * *callback* (query-string) - JSONP
9933    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9934    /// * *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.
9935    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9936    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9937    /// * *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.
9938    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9939    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9940    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
9941    where
9942        T: AsRef<str>,
9943    {
9944        self._additional_params
9945            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9946        self
9947    }
9948
9949    /// Identifies the authorization scope for the method you are building.
9950    ///
9951    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9952    /// [`Scope::CloudPlatform`].
9953    ///
9954    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9955    /// tokens for more than one scope.
9956    ///
9957    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9958    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9959    /// sufficient, a read-write scope will do as well.
9960    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
9961    where
9962        St: AsRef<str>,
9963    {
9964        self._scopes.insert(String::from(scope.as_ref()));
9965        self
9966    }
9967    /// Identifies the authorization scope(s) for the method you are building.
9968    ///
9969    /// See [`Self::add_scope()`] for details.
9970    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
9971    where
9972        I: IntoIterator<Item = St>,
9973        St: AsRef<str>,
9974    {
9975        self._scopes
9976            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9977        self
9978    }
9979
9980    /// Removes all scopes, and no default scope will be used either.
9981    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9982    /// for details).
9983    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
9984        self._scopes.clear();
9985        self
9986    }
9987}
9988
9989/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
9990///
9991/// A builder for the *locations.operations.delete* method supported by a *project* resource.
9992/// It is not used directly, but through a [`ProjectMethods`] instance.
9993///
9994/// # Example
9995///
9996/// Instantiate a resource method builder
9997///
9998/// ```test_harness,no_run
9999/// # extern crate hyper;
10000/// # extern crate hyper_rustls;
10001/// # extern crate google_dataproc1 as dataproc1;
10002/// # async fn dox() {
10003/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10004///
10005/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10006/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10007/// #     secret,
10008/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10009/// # ).build().await.unwrap();
10010///
10011/// # let client = hyper_util::client::legacy::Client::builder(
10012/// #     hyper_util::rt::TokioExecutor::new()
10013/// # )
10014/// # .build(
10015/// #     hyper_rustls::HttpsConnectorBuilder::new()
10016/// #         .with_native_roots()
10017/// #         .unwrap()
10018/// #         .https_or_http()
10019/// #         .enable_http1()
10020/// #         .build()
10021/// # );
10022/// # let mut hub = Dataproc::new(client, auth);
10023/// // You can configure optional parameters by calling the respective setters at will, and
10024/// // execute the final call using `doit()`.
10025/// // Values shown here are possibly random and not representative !
10026/// let result = hub.projects().locations_operations_delete("name")
10027///              .doit().await;
10028/// # }
10029/// ```
10030pub struct ProjectLocationOperationDeleteCall<'a, C>
10031where
10032    C: 'a,
10033{
10034    hub: &'a Dataproc<C>,
10035    _name: String,
10036    _delegate: Option<&'a mut dyn common::Delegate>,
10037    _additional_params: HashMap<String, String>,
10038    _scopes: BTreeSet<String>,
10039}
10040
10041impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
10042
10043impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
10044where
10045    C: common::Connector,
10046{
10047    /// Perform the operation you have build so far.
10048    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10049        use std::borrow::Cow;
10050        use std::io::{Read, Seek};
10051
10052        use common::{url::Params, ToParts};
10053        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10054
10055        let mut dd = common::DefaultDelegate;
10056        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10057        dlg.begin(common::MethodInfo {
10058            id: "dataproc.projects.locations.operations.delete",
10059            http_method: hyper::Method::DELETE,
10060        });
10061
10062        for &field in ["alt", "name"].iter() {
10063            if self._additional_params.contains_key(field) {
10064                dlg.finished(false);
10065                return Err(common::Error::FieldClash(field));
10066            }
10067        }
10068
10069        let mut params = Params::with_capacity(3 + self._additional_params.len());
10070        params.push("name", self._name);
10071
10072        params.extend(self._additional_params.iter());
10073
10074        params.push("alt", "json");
10075        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10076        if self._scopes.is_empty() {
10077            self._scopes
10078                .insert(Scope::CloudPlatform.as_ref().to_string());
10079        }
10080
10081        #[allow(clippy::single_element_loop)]
10082        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10083            url = params.uri_replacement(url, param_name, find_this, true);
10084        }
10085        {
10086            let to_remove = ["name"];
10087            params.remove_params(&to_remove);
10088        }
10089
10090        let url = params.parse_with_url(&url);
10091
10092        loop {
10093            let token = match self
10094                .hub
10095                .auth
10096                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10097                .await
10098            {
10099                Ok(token) => token,
10100                Err(e) => match dlg.token(e) {
10101                    Ok(token) => token,
10102                    Err(e) => {
10103                        dlg.finished(false);
10104                        return Err(common::Error::MissingToken(e));
10105                    }
10106                },
10107            };
10108            let mut req_result = {
10109                let client = &self.hub.client;
10110                dlg.pre_request();
10111                let mut req_builder = hyper::Request::builder()
10112                    .method(hyper::Method::DELETE)
10113                    .uri(url.as_str())
10114                    .header(USER_AGENT, self.hub._user_agent.clone());
10115
10116                if let Some(token) = token.as_ref() {
10117                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10118                }
10119
10120                let request = req_builder
10121                    .header(CONTENT_LENGTH, 0_u64)
10122                    .body(common::to_body::<String>(None));
10123
10124                client.request(request.unwrap()).await
10125            };
10126
10127            match req_result {
10128                Err(err) => {
10129                    if let common::Retry::After(d) = dlg.http_error(&err) {
10130                        sleep(d).await;
10131                        continue;
10132                    }
10133                    dlg.finished(false);
10134                    return Err(common::Error::HttpError(err));
10135                }
10136                Ok(res) => {
10137                    let (mut parts, body) = res.into_parts();
10138                    let mut body = common::Body::new(body);
10139                    if !parts.status.is_success() {
10140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10141                        let error = serde_json::from_str(&common::to_string(&bytes));
10142                        let response = common::to_response(parts, bytes.into());
10143
10144                        if let common::Retry::After(d) =
10145                            dlg.http_failure(&response, error.as_ref().ok())
10146                        {
10147                            sleep(d).await;
10148                            continue;
10149                        }
10150
10151                        dlg.finished(false);
10152
10153                        return Err(match error {
10154                            Ok(value) => common::Error::BadRequest(value),
10155                            _ => common::Error::Failure(response),
10156                        });
10157                    }
10158                    let response = {
10159                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10160                        let encoded = common::to_string(&bytes);
10161                        match serde_json::from_str(&encoded) {
10162                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10163                            Err(error) => {
10164                                dlg.response_json_decode_error(&encoded, &error);
10165                                return Err(common::Error::JsonDecodeError(
10166                                    encoded.to_string(),
10167                                    error,
10168                                ));
10169                            }
10170                        }
10171                    };
10172
10173                    dlg.finished(true);
10174                    return Ok(response);
10175                }
10176            }
10177        }
10178    }
10179
10180    /// The name of the operation resource to be deleted.
10181    ///
10182    /// Sets the *name* path property to the given value.
10183    ///
10184    /// Even though the property as already been set when instantiating this call,
10185    /// we provide this method for API completeness.
10186    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
10187        self._name = new_value.to_string();
10188        self
10189    }
10190    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10191    /// while executing the actual API request.
10192    ///
10193    /// ````text
10194    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10195    /// ````
10196    ///
10197    /// Sets the *delegate* property to the given value.
10198    pub fn delegate(
10199        mut self,
10200        new_value: &'a mut dyn common::Delegate,
10201    ) -> ProjectLocationOperationDeleteCall<'a, C> {
10202        self._delegate = Some(new_value);
10203        self
10204    }
10205
10206    /// Set any additional parameter of the query string used in the request.
10207    /// It should be used to set parameters which are not yet available through their own
10208    /// setters.
10209    ///
10210    /// Please note that this method must not be used to set any of the known parameters
10211    /// which have their own setter method. If done anyway, the request will fail.
10212    ///
10213    /// # Additional Parameters
10214    ///
10215    /// * *$.xgafv* (query-string) - V1 error format.
10216    /// * *access_token* (query-string) - OAuth access token.
10217    /// * *alt* (query-string) - Data format for response.
10218    /// * *callback* (query-string) - JSONP
10219    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10220    /// * *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.
10221    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10222    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10223    /// * *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.
10224    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10225    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10226    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
10227    where
10228        T: AsRef<str>,
10229    {
10230        self._additional_params
10231            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10232        self
10233    }
10234
10235    /// Identifies the authorization scope for the method you are building.
10236    ///
10237    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10238    /// [`Scope::CloudPlatform`].
10239    ///
10240    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10241    /// tokens for more than one scope.
10242    ///
10243    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10244    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10245    /// sufficient, a read-write scope will do as well.
10246    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
10247    where
10248        St: AsRef<str>,
10249    {
10250        self._scopes.insert(String::from(scope.as_ref()));
10251        self
10252    }
10253    /// Identifies the authorization scope(s) for the method you are building.
10254    ///
10255    /// See [`Self::add_scope()`] for details.
10256    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
10257    where
10258        I: IntoIterator<Item = St>,
10259        St: AsRef<str>,
10260    {
10261        self._scopes
10262            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10263        self
10264    }
10265
10266    /// Removes all scopes, and no default scope will be used either.
10267    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10268    /// for details).
10269    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
10270        self._scopes.clear();
10271        self
10272    }
10273}
10274
10275/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
10276///
10277/// A builder for the *locations.operations.get* method supported by a *project* resource.
10278/// It is not used directly, but through a [`ProjectMethods`] instance.
10279///
10280/// # Example
10281///
10282/// Instantiate a resource method builder
10283///
10284/// ```test_harness,no_run
10285/// # extern crate hyper;
10286/// # extern crate hyper_rustls;
10287/// # extern crate google_dataproc1 as dataproc1;
10288/// # async fn dox() {
10289/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10290///
10291/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10293/// #     secret,
10294/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10295/// # ).build().await.unwrap();
10296///
10297/// # let client = hyper_util::client::legacy::Client::builder(
10298/// #     hyper_util::rt::TokioExecutor::new()
10299/// # )
10300/// # .build(
10301/// #     hyper_rustls::HttpsConnectorBuilder::new()
10302/// #         .with_native_roots()
10303/// #         .unwrap()
10304/// #         .https_or_http()
10305/// #         .enable_http1()
10306/// #         .build()
10307/// # );
10308/// # let mut hub = Dataproc::new(client, auth);
10309/// // You can configure optional parameters by calling the respective setters at will, and
10310/// // execute the final call using `doit()`.
10311/// // Values shown here are possibly random and not representative !
10312/// let result = hub.projects().locations_operations_get("name")
10313///              .doit().await;
10314/// # }
10315/// ```
10316pub struct ProjectLocationOperationGetCall<'a, C>
10317where
10318    C: 'a,
10319{
10320    hub: &'a Dataproc<C>,
10321    _name: String,
10322    _delegate: Option<&'a mut dyn common::Delegate>,
10323    _additional_params: HashMap<String, String>,
10324    _scopes: BTreeSet<String>,
10325}
10326
10327impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
10328
10329impl<'a, C> ProjectLocationOperationGetCall<'a, C>
10330where
10331    C: common::Connector,
10332{
10333    /// Perform the operation you have build so far.
10334    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10335        use std::borrow::Cow;
10336        use std::io::{Read, Seek};
10337
10338        use common::{url::Params, ToParts};
10339        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10340
10341        let mut dd = common::DefaultDelegate;
10342        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10343        dlg.begin(common::MethodInfo {
10344            id: "dataproc.projects.locations.operations.get",
10345            http_method: hyper::Method::GET,
10346        });
10347
10348        for &field in ["alt", "name"].iter() {
10349            if self._additional_params.contains_key(field) {
10350                dlg.finished(false);
10351                return Err(common::Error::FieldClash(field));
10352            }
10353        }
10354
10355        let mut params = Params::with_capacity(3 + self._additional_params.len());
10356        params.push("name", self._name);
10357
10358        params.extend(self._additional_params.iter());
10359
10360        params.push("alt", "json");
10361        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10362        if self._scopes.is_empty() {
10363            self._scopes
10364                .insert(Scope::CloudPlatform.as_ref().to_string());
10365        }
10366
10367        #[allow(clippy::single_element_loop)]
10368        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10369            url = params.uri_replacement(url, param_name, find_this, true);
10370        }
10371        {
10372            let to_remove = ["name"];
10373            params.remove_params(&to_remove);
10374        }
10375
10376        let url = params.parse_with_url(&url);
10377
10378        loop {
10379            let token = match self
10380                .hub
10381                .auth
10382                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10383                .await
10384            {
10385                Ok(token) => token,
10386                Err(e) => match dlg.token(e) {
10387                    Ok(token) => token,
10388                    Err(e) => {
10389                        dlg.finished(false);
10390                        return Err(common::Error::MissingToken(e));
10391                    }
10392                },
10393            };
10394            let mut req_result = {
10395                let client = &self.hub.client;
10396                dlg.pre_request();
10397                let mut req_builder = hyper::Request::builder()
10398                    .method(hyper::Method::GET)
10399                    .uri(url.as_str())
10400                    .header(USER_AGENT, self.hub._user_agent.clone());
10401
10402                if let Some(token) = token.as_ref() {
10403                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10404                }
10405
10406                let request = req_builder
10407                    .header(CONTENT_LENGTH, 0_u64)
10408                    .body(common::to_body::<String>(None));
10409
10410                client.request(request.unwrap()).await
10411            };
10412
10413            match req_result {
10414                Err(err) => {
10415                    if let common::Retry::After(d) = dlg.http_error(&err) {
10416                        sleep(d).await;
10417                        continue;
10418                    }
10419                    dlg.finished(false);
10420                    return Err(common::Error::HttpError(err));
10421                }
10422                Ok(res) => {
10423                    let (mut parts, body) = res.into_parts();
10424                    let mut body = common::Body::new(body);
10425                    if !parts.status.is_success() {
10426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10427                        let error = serde_json::from_str(&common::to_string(&bytes));
10428                        let response = common::to_response(parts, bytes.into());
10429
10430                        if let common::Retry::After(d) =
10431                            dlg.http_failure(&response, error.as_ref().ok())
10432                        {
10433                            sleep(d).await;
10434                            continue;
10435                        }
10436
10437                        dlg.finished(false);
10438
10439                        return Err(match error {
10440                            Ok(value) => common::Error::BadRequest(value),
10441                            _ => common::Error::Failure(response),
10442                        });
10443                    }
10444                    let response = {
10445                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10446                        let encoded = common::to_string(&bytes);
10447                        match serde_json::from_str(&encoded) {
10448                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10449                            Err(error) => {
10450                                dlg.response_json_decode_error(&encoded, &error);
10451                                return Err(common::Error::JsonDecodeError(
10452                                    encoded.to_string(),
10453                                    error,
10454                                ));
10455                            }
10456                        }
10457                    };
10458
10459                    dlg.finished(true);
10460                    return Ok(response);
10461                }
10462            }
10463        }
10464    }
10465
10466    /// The name of the operation resource.
10467    ///
10468    /// Sets the *name* path property to the given value.
10469    ///
10470    /// Even though the property as already been set when instantiating this call,
10471    /// we provide this method for API completeness.
10472    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
10473        self._name = new_value.to_string();
10474        self
10475    }
10476    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10477    /// while executing the actual API request.
10478    ///
10479    /// ````text
10480    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10481    /// ````
10482    ///
10483    /// Sets the *delegate* property to the given value.
10484    pub fn delegate(
10485        mut self,
10486        new_value: &'a mut dyn common::Delegate,
10487    ) -> ProjectLocationOperationGetCall<'a, C> {
10488        self._delegate = Some(new_value);
10489        self
10490    }
10491
10492    /// Set any additional parameter of the query string used in the request.
10493    /// It should be used to set parameters which are not yet available through their own
10494    /// setters.
10495    ///
10496    /// Please note that this method must not be used to set any of the known parameters
10497    /// which have their own setter method. If done anyway, the request will fail.
10498    ///
10499    /// # Additional Parameters
10500    ///
10501    /// * *$.xgafv* (query-string) - V1 error format.
10502    /// * *access_token* (query-string) - OAuth access token.
10503    /// * *alt* (query-string) - Data format for response.
10504    /// * *callback* (query-string) - JSONP
10505    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10506    /// * *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.
10507    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10508    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10509    /// * *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.
10510    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10511    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10512    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
10513    where
10514        T: AsRef<str>,
10515    {
10516        self._additional_params
10517            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10518        self
10519    }
10520
10521    /// Identifies the authorization scope for the method you are building.
10522    ///
10523    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10524    /// [`Scope::CloudPlatform`].
10525    ///
10526    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10527    /// tokens for more than one scope.
10528    ///
10529    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10530    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10531    /// sufficient, a read-write scope will do as well.
10532    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
10533    where
10534        St: AsRef<str>,
10535    {
10536        self._scopes.insert(String::from(scope.as_ref()));
10537        self
10538    }
10539    /// Identifies the authorization scope(s) for the method you are building.
10540    ///
10541    /// See [`Self::add_scope()`] for details.
10542    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
10543    where
10544        I: IntoIterator<Item = St>,
10545        St: AsRef<str>,
10546    {
10547        self._scopes
10548            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10549        self
10550    }
10551
10552    /// Removes all scopes, and no default scope will be used either.
10553    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10554    /// for details).
10555    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
10556        self._scopes.clear();
10557        self
10558    }
10559}
10560
10561/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
10562///
10563/// A builder for the *locations.operations.list* method supported by a *project* resource.
10564/// It is not used directly, but through a [`ProjectMethods`] instance.
10565///
10566/// # Example
10567///
10568/// Instantiate a resource method builder
10569///
10570/// ```test_harness,no_run
10571/// # extern crate hyper;
10572/// # extern crate hyper_rustls;
10573/// # extern crate google_dataproc1 as dataproc1;
10574/// # async fn dox() {
10575/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10576///
10577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10579/// #     secret,
10580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10581/// # ).build().await.unwrap();
10582///
10583/// # let client = hyper_util::client::legacy::Client::builder(
10584/// #     hyper_util::rt::TokioExecutor::new()
10585/// # )
10586/// # .build(
10587/// #     hyper_rustls::HttpsConnectorBuilder::new()
10588/// #         .with_native_roots()
10589/// #         .unwrap()
10590/// #         .https_or_http()
10591/// #         .enable_http1()
10592/// #         .build()
10593/// # );
10594/// # let mut hub = Dataproc::new(client, auth);
10595/// // You can configure optional parameters by calling the respective setters at will, and
10596/// // execute the final call using `doit()`.
10597/// // Values shown here are possibly random and not representative !
10598/// let result = hub.projects().locations_operations_list("name")
10599///              .page_token("sed")
10600///              .page_size(-61)
10601///              .filter("Stet")
10602///              .doit().await;
10603/// # }
10604/// ```
10605pub struct ProjectLocationOperationListCall<'a, C>
10606where
10607    C: 'a,
10608{
10609    hub: &'a Dataproc<C>,
10610    _name: String,
10611    _page_token: Option<String>,
10612    _page_size: Option<i32>,
10613    _filter: Option<String>,
10614    _delegate: Option<&'a mut dyn common::Delegate>,
10615    _additional_params: HashMap<String, String>,
10616    _scopes: BTreeSet<String>,
10617}
10618
10619impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
10620
10621impl<'a, C> ProjectLocationOperationListCall<'a, C>
10622where
10623    C: common::Connector,
10624{
10625    /// Perform the operation you have build so far.
10626    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
10627        use std::borrow::Cow;
10628        use std::io::{Read, Seek};
10629
10630        use common::{url::Params, ToParts};
10631        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10632
10633        let mut dd = common::DefaultDelegate;
10634        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10635        dlg.begin(common::MethodInfo {
10636            id: "dataproc.projects.locations.operations.list",
10637            http_method: hyper::Method::GET,
10638        });
10639
10640        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
10641            if self._additional_params.contains_key(field) {
10642                dlg.finished(false);
10643                return Err(common::Error::FieldClash(field));
10644            }
10645        }
10646
10647        let mut params = Params::with_capacity(6 + self._additional_params.len());
10648        params.push("name", self._name);
10649        if let Some(value) = self._page_token.as_ref() {
10650            params.push("pageToken", value);
10651        }
10652        if let Some(value) = self._page_size.as_ref() {
10653            params.push("pageSize", value.to_string());
10654        }
10655        if let Some(value) = self._filter.as_ref() {
10656            params.push("filter", value);
10657        }
10658
10659        params.extend(self._additional_params.iter());
10660
10661        params.push("alt", "json");
10662        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10663        if self._scopes.is_empty() {
10664            self._scopes
10665                .insert(Scope::CloudPlatform.as_ref().to_string());
10666        }
10667
10668        #[allow(clippy::single_element_loop)]
10669        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10670            url = params.uri_replacement(url, param_name, find_this, true);
10671        }
10672        {
10673            let to_remove = ["name"];
10674            params.remove_params(&to_remove);
10675        }
10676
10677        let url = params.parse_with_url(&url);
10678
10679        loop {
10680            let token = match self
10681                .hub
10682                .auth
10683                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10684                .await
10685            {
10686                Ok(token) => token,
10687                Err(e) => match dlg.token(e) {
10688                    Ok(token) => token,
10689                    Err(e) => {
10690                        dlg.finished(false);
10691                        return Err(common::Error::MissingToken(e));
10692                    }
10693                },
10694            };
10695            let mut req_result = {
10696                let client = &self.hub.client;
10697                dlg.pre_request();
10698                let mut req_builder = hyper::Request::builder()
10699                    .method(hyper::Method::GET)
10700                    .uri(url.as_str())
10701                    .header(USER_AGENT, self.hub._user_agent.clone());
10702
10703                if let Some(token) = token.as_ref() {
10704                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10705                }
10706
10707                let request = req_builder
10708                    .header(CONTENT_LENGTH, 0_u64)
10709                    .body(common::to_body::<String>(None));
10710
10711                client.request(request.unwrap()).await
10712            };
10713
10714            match req_result {
10715                Err(err) => {
10716                    if let common::Retry::After(d) = dlg.http_error(&err) {
10717                        sleep(d).await;
10718                        continue;
10719                    }
10720                    dlg.finished(false);
10721                    return Err(common::Error::HttpError(err));
10722                }
10723                Ok(res) => {
10724                    let (mut parts, body) = res.into_parts();
10725                    let mut body = common::Body::new(body);
10726                    if !parts.status.is_success() {
10727                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10728                        let error = serde_json::from_str(&common::to_string(&bytes));
10729                        let response = common::to_response(parts, bytes.into());
10730
10731                        if let common::Retry::After(d) =
10732                            dlg.http_failure(&response, error.as_ref().ok())
10733                        {
10734                            sleep(d).await;
10735                            continue;
10736                        }
10737
10738                        dlg.finished(false);
10739
10740                        return Err(match error {
10741                            Ok(value) => common::Error::BadRequest(value),
10742                            _ => common::Error::Failure(response),
10743                        });
10744                    }
10745                    let response = {
10746                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10747                        let encoded = common::to_string(&bytes);
10748                        match serde_json::from_str(&encoded) {
10749                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10750                            Err(error) => {
10751                                dlg.response_json_decode_error(&encoded, &error);
10752                                return Err(common::Error::JsonDecodeError(
10753                                    encoded.to_string(),
10754                                    error,
10755                                ));
10756                            }
10757                        }
10758                    };
10759
10760                    dlg.finished(true);
10761                    return Ok(response);
10762                }
10763            }
10764        }
10765    }
10766
10767    /// The name of the operation's parent resource.
10768    ///
10769    /// Sets the *name* path property to the given value.
10770    ///
10771    /// Even though the property as already been set when instantiating this call,
10772    /// we provide this method for API completeness.
10773    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10774        self._name = new_value.to_string();
10775        self
10776    }
10777    /// The standard list page token.
10778    ///
10779    /// Sets the *page token* query property to the given value.
10780    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10781        self._page_token = Some(new_value.to_string());
10782        self
10783    }
10784    /// The standard list page size.
10785    ///
10786    /// Sets the *page size* query property to the given value.
10787    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
10788        self._page_size = Some(new_value);
10789        self
10790    }
10791    /// The standard list filter.
10792    ///
10793    /// Sets the *filter* query property to the given value.
10794    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
10795        self._filter = Some(new_value.to_string());
10796        self
10797    }
10798    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10799    /// while executing the actual API request.
10800    ///
10801    /// ````text
10802    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10803    /// ````
10804    ///
10805    /// Sets the *delegate* property to the given value.
10806    pub fn delegate(
10807        mut self,
10808        new_value: &'a mut dyn common::Delegate,
10809    ) -> ProjectLocationOperationListCall<'a, C> {
10810        self._delegate = Some(new_value);
10811        self
10812    }
10813
10814    /// Set any additional parameter of the query string used in the request.
10815    /// It should be used to set parameters which are not yet available through their own
10816    /// setters.
10817    ///
10818    /// Please note that this method must not be used to set any of the known parameters
10819    /// which have their own setter method. If done anyway, the request will fail.
10820    ///
10821    /// # Additional Parameters
10822    ///
10823    /// * *$.xgafv* (query-string) - V1 error format.
10824    /// * *access_token* (query-string) - OAuth access token.
10825    /// * *alt* (query-string) - Data format for response.
10826    /// * *callback* (query-string) - JSONP
10827    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10828    /// * *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.
10829    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10830    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10831    /// * *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.
10832    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10833    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10834    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
10835    where
10836        T: AsRef<str>,
10837    {
10838        self._additional_params
10839            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10840        self
10841    }
10842
10843    /// Identifies the authorization scope for the method you are building.
10844    ///
10845    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10846    /// [`Scope::CloudPlatform`].
10847    ///
10848    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10849    /// tokens for more than one scope.
10850    ///
10851    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10852    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10853    /// sufficient, a read-write scope will do as well.
10854    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
10855    where
10856        St: AsRef<str>,
10857    {
10858        self._scopes.insert(String::from(scope.as_ref()));
10859        self
10860    }
10861    /// Identifies the authorization scope(s) for the method you are building.
10862    ///
10863    /// See [`Self::add_scope()`] for details.
10864    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
10865    where
10866        I: IntoIterator<Item = St>,
10867        St: AsRef<str>,
10868    {
10869        self._scopes
10870            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10871        self
10872    }
10873
10874    /// Removes all scopes, and no default scope will be used either.
10875    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10876    /// for details).
10877    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
10878        self._scopes.clear();
10879        self
10880    }
10881}
10882
10883/// Create a session template synchronously.
10884///
10885/// A builder for the *locations.sessionTemplates.create* method supported by a *project* resource.
10886/// It is not used directly, but through a [`ProjectMethods`] instance.
10887///
10888/// # Example
10889///
10890/// Instantiate a resource method builder
10891///
10892/// ```test_harness,no_run
10893/// # extern crate hyper;
10894/// # extern crate hyper_rustls;
10895/// # extern crate google_dataproc1 as dataproc1;
10896/// use dataproc1::api::SessionTemplate;
10897/// # async fn dox() {
10898/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10899///
10900/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10901/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10902/// #     secret,
10903/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10904/// # ).build().await.unwrap();
10905///
10906/// # let client = hyper_util::client::legacy::Client::builder(
10907/// #     hyper_util::rt::TokioExecutor::new()
10908/// # )
10909/// # .build(
10910/// #     hyper_rustls::HttpsConnectorBuilder::new()
10911/// #         .with_native_roots()
10912/// #         .unwrap()
10913/// #         .https_or_http()
10914/// #         .enable_http1()
10915/// #         .build()
10916/// # );
10917/// # let mut hub = Dataproc::new(client, auth);
10918/// // As the method needs a request, you would usually fill it with the desired information
10919/// // into the respective structure. Some of the parts shown here might not be applicable !
10920/// // Values shown here are possibly random and not representative !
10921/// let mut req = SessionTemplate::default();
10922///
10923/// // You can configure optional parameters by calling the respective setters at will, and
10924/// // execute the final call using `doit()`.
10925/// // Values shown here are possibly random and not representative !
10926/// let result = hub.projects().locations_session_templates_create(req, "parent")
10927///              .doit().await;
10928/// # }
10929/// ```
10930pub struct ProjectLocationSessionTemplateCreateCall<'a, C>
10931where
10932    C: 'a,
10933{
10934    hub: &'a Dataproc<C>,
10935    _request: SessionTemplate,
10936    _parent: String,
10937    _delegate: Option<&'a mut dyn common::Delegate>,
10938    _additional_params: HashMap<String, String>,
10939    _scopes: BTreeSet<String>,
10940}
10941
10942impl<'a, C> common::CallBuilder for ProjectLocationSessionTemplateCreateCall<'a, C> {}
10943
10944impl<'a, C> ProjectLocationSessionTemplateCreateCall<'a, C>
10945where
10946    C: common::Connector,
10947{
10948    /// Perform the operation you have build so far.
10949    pub async fn doit(mut self) -> common::Result<(common::Response, SessionTemplate)> {
10950        use std::borrow::Cow;
10951        use std::io::{Read, Seek};
10952
10953        use common::{url::Params, ToParts};
10954        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10955
10956        let mut dd = common::DefaultDelegate;
10957        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10958        dlg.begin(common::MethodInfo {
10959            id: "dataproc.projects.locations.sessionTemplates.create",
10960            http_method: hyper::Method::POST,
10961        });
10962
10963        for &field in ["alt", "parent"].iter() {
10964            if self._additional_params.contains_key(field) {
10965                dlg.finished(false);
10966                return Err(common::Error::FieldClash(field));
10967            }
10968        }
10969
10970        let mut params = Params::with_capacity(4 + self._additional_params.len());
10971        params.push("parent", self._parent);
10972
10973        params.extend(self._additional_params.iter());
10974
10975        params.push("alt", "json");
10976        let mut url = self.hub._base_url.clone() + "v1/{+parent}/sessionTemplates";
10977        if self._scopes.is_empty() {
10978            self._scopes
10979                .insert(Scope::CloudPlatform.as_ref().to_string());
10980        }
10981
10982        #[allow(clippy::single_element_loop)]
10983        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10984            url = params.uri_replacement(url, param_name, find_this, true);
10985        }
10986        {
10987            let to_remove = ["parent"];
10988            params.remove_params(&to_remove);
10989        }
10990
10991        let url = params.parse_with_url(&url);
10992
10993        let mut json_mime_type = mime::APPLICATION_JSON;
10994        let mut request_value_reader = {
10995            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10996            common::remove_json_null_values(&mut value);
10997            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10998            serde_json::to_writer(&mut dst, &value).unwrap();
10999            dst
11000        };
11001        let request_size = request_value_reader
11002            .seek(std::io::SeekFrom::End(0))
11003            .unwrap();
11004        request_value_reader
11005            .seek(std::io::SeekFrom::Start(0))
11006            .unwrap();
11007
11008        loop {
11009            let token = match self
11010                .hub
11011                .auth
11012                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11013                .await
11014            {
11015                Ok(token) => token,
11016                Err(e) => match dlg.token(e) {
11017                    Ok(token) => token,
11018                    Err(e) => {
11019                        dlg.finished(false);
11020                        return Err(common::Error::MissingToken(e));
11021                    }
11022                },
11023            };
11024            request_value_reader
11025                .seek(std::io::SeekFrom::Start(0))
11026                .unwrap();
11027            let mut req_result = {
11028                let client = &self.hub.client;
11029                dlg.pre_request();
11030                let mut req_builder = hyper::Request::builder()
11031                    .method(hyper::Method::POST)
11032                    .uri(url.as_str())
11033                    .header(USER_AGENT, self.hub._user_agent.clone());
11034
11035                if let Some(token) = token.as_ref() {
11036                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11037                }
11038
11039                let request = req_builder
11040                    .header(CONTENT_TYPE, json_mime_type.to_string())
11041                    .header(CONTENT_LENGTH, request_size as u64)
11042                    .body(common::to_body(
11043                        request_value_reader.get_ref().clone().into(),
11044                    ));
11045
11046                client.request(request.unwrap()).await
11047            };
11048
11049            match req_result {
11050                Err(err) => {
11051                    if let common::Retry::After(d) = dlg.http_error(&err) {
11052                        sleep(d).await;
11053                        continue;
11054                    }
11055                    dlg.finished(false);
11056                    return Err(common::Error::HttpError(err));
11057                }
11058                Ok(res) => {
11059                    let (mut parts, body) = res.into_parts();
11060                    let mut body = common::Body::new(body);
11061                    if !parts.status.is_success() {
11062                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11063                        let error = serde_json::from_str(&common::to_string(&bytes));
11064                        let response = common::to_response(parts, bytes.into());
11065
11066                        if let common::Retry::After(d) =
11067                            dlg.http_failure(&response, error.as_ref().ok())
11068                        {
11069                            sleep(d).await;
11070                            continue;
11071                        }
11072
11073                        dlg.finished(false);
11074
11075                        return Err(match error {
11076                            Ok(value) => common::Error::BadRequest(value),
11077                            _ => common::Error::Failure(response),
11078                        });
11079                    }
11080                    let response = {
11081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11082                        let encoded = common::to_string(&bytes);
11083                        match serde_json::from_str(&encoded) {
11084                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11085                            Err(error) => {
11086                                dlg.response_json_decode_error(&encoded, &error);
11087                                return Err(common::Error::JsonDecodeError(
11088                                    encoded.to_string(),
11089                                    error,
11090                                ));
11091                            }
11092                        }
11093                    };
11094
11095                    dlg.finished(true);
11096                    return Ok(response);
11097                }
11098            }
11099        }
11100    }
11101
11102    ///
11103    /// Sets the *request* property to the given value.
11104    ///
11105    /// Even though the property as already been set when instantiating this call,
11106    /// we provide this method for API completeness.
11107    pub fn request(
11108        mut self,
11109        new_value: SessionTemplate,
11110    ) -> ProjectLocationSessionTemplateCreateCall<'a, C> {
11111        self._request = new_value;
11112        self
11113    }
11114    /// Required. The parent resource where this session template will be created.
11115    ///
11116    /// Sets the *parent* path property to the given value.
11117    ///
11118    /// Even though the property as already been set when instantiating this call,
11119    /// we provide this method for API completeness.
11120    pub fn parent(mut self, new_value: &str) -> ProjectLocationSessionTemplateCreateCall<'a, C> {
11121        self._parent = new_value.to_string();
11122        self
11123    }
11124    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11125    /// while executing the actual API request.
11126    ///
11127    /// ````text
11128    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11129    /// ````
11130    ///
11131    /// Sets the *delegate* property to the given value.
11132    pub fn delegate(
11133        mut self,
11134        new_value: &'a mut dyn common::Delegate,
11135    ) -> ProjectLocationSessionTemplateCreateCall<'a, C> {
11136        self._delegate = Some(new_value);
11137        self
11138    }
11139
11140    /// Set any additional parameter of the query string used in the request.
11141    /// It should be used to set parameters which are not yet available through their own
11142    /// setters.
11143    ///
11144    /// Please note that this method must not be used to set any of the known parameters
11145    /// which have their own setter method. If done anyway, the request will fail.
11146    ///
11147    /// # Additional Parameters
11148    ///
11149    /// * *$.xgafv* (query-string) - V1 error format.
11150    /// * *access_token* (query-string) - OAuth access token.
11151    /// * *alt* (query-string) - Data format for response.
11152    /// * *callback* (query-string) - JSONP
11153    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11154    /// * *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.
11155    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11156    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11157    /// * *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.
11158    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11159    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11160    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTemplateCreateCall<'a, C>
11161    where
11162        T: AsRef<str>,
11163    {
11164        self._additional_params
11165            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11166        self
11167    }
11168
11169    /// Identifies the authorization scope for the method you are building.
11170    ///
11171    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11172    /// [`Scope::CloudPlatform`].
11173    ///
11174    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11175    /// tokens for more than one scope.
11176    ///
11177    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11178    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11179    /// sufficient, a read-write scope will do as well.
11180    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTemplateCreateCall<'a, C>
11181    where
11182        St: AsRef<str>,
11183    {
11184        self._scopes.insert(String::from(scope.as_ref()));
11185        self
11186    }
11187    /// Identifies the authorization scope(s) for the method you are building.
11188    ///
11189    /// See [`Self::add_scope()`] for details.
11190    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTemplateCreateCall<'a, C>
11191    where
11192        I: IntoIterator<Item = St>,
11193        St: AsRef<str>,
11194    {
11195        self._scopes
11196            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11197        self
11198    }
11199
11200    /// Removes all scopes, and no default scope will be used either.
11201    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11202    /// for details).
11203    pub fn clear_scopes(mut self) -> ProjectLocationSessionTemplateCreateCall<'a, C> {
11204        self._scopes.clear();
11205        self
11206    }
11207}
11208
11209/// Deletes a session template.
11210///
11211/// A builder for the *locations.sessionTemplates.delete* method supported by a *project* resource.
11212/// It is not used directly, but through a [`ProjectMethods`] instance.
11213///
11214/// # Example
11215///
11216/// Instantiate a resource method builder
11217///
11218/// ```test_harness,no_run
11219/// # extern crate hyper;
11220/// # extern crate hyper_rustls;
11221/// # extern crate google_dataproc1 as dataproc1;
11222/// # async fn dox() {
11223/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11224///
11225/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11227/// #     secret,
11228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11229/// # ).build().await.unwrap();
11230///
11231/// # let client = hyper_util::client::legacy::Client::builder(
11232/// #     hyper_util::rt::TokioExecutor::new()
11233/// # )
11234/// # .build(
11235/// #     hyper_rustls::HttpsConnectorBuilder::new()
11236/// #         .with_native_roots()
11237/// #         .unwrap()
11238/// #         .https_or_http()
11239/// #         .enable_http1()
11240/// #         .build()
11241/// # );
11242/// # let mut hub = Dataproc::new(client, auth);
11243/// // You can configure optional parameters by calling the respective setters at will, and
11244/// // execute the final call using `doit()`.
11245/// // Values shown here are possibly random and not representative !
11246/// let result = hub.projects().locations_session_templates_delete("name")
11247///              .doit().await;
11248/// # }
11249/// ```
11250pub struct ProjectLocationSessionTemplateDeleteCall<'a, C>
11251where
11252    C: 'a,
11253{
11254    hub: &'a Dataproc<C>,
11255    _name: String,
11256    _delegate: Option<&'a mut dyn common::Delegate>,
11257    _additional_params: HashMap<String, String>,
11258    _scopes: BTreeSet<String>,
11259}
11260
11261impl<'a, C> common::CallBuilder for ProjectLocationSessionTemplateDeleteCall<'a, C> {}
11262
11263impl<'a, C> ProjectLocationSessionTemplateDeleteCall<'a, C>
11264where
11265    C: common::Connector,
11266{
11267    /// Perform the operation you have build so far.
11268    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11269        use std::borrow::Cow;
11270        use std::io::{Read, Seek};
11271
11272        use common::{url::Params, ToParts};
11273        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11274
11275        let mut dd = common::DefaultDelegate;
11276        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11277        dlg.begin(common::MethodInfo {
11278            id: "dataproc.projects.locations.sessionTemplates.delete",
11279            http_method: hyper::Method::DELETE,
11280        });
11281
11282        for &field in ["alt", "name"].iter() {
11283            if self._additional_params.contains_key(field) {
11284                dlg.finished(false);
11285                return Err(common::Error::FieldClash(field));
11286            }
11287        }
11288
11289        let mut params = Params::with_capacity(3 + self._additional_params.len());
11290        params.push("name", self._name);
11291
11292        params.extend(self._additional_params.iter());
11293
11294        params.push("alt", "json");
11295        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11296        if self._scopes.is_empty() {
11297            self._scopes
11298                .insert(Scope::CloudPlatform.as_ref().to_string());
11299        }
11300
11301        #[allow(clippy::single_element_loop)]
11302        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11303            url = params.uri_replacement(url, param_name, find_this, true);
11304        }
11305        {
11306            let to_remove = ["name"];
11307            params.remove_params(&to_remove);
11308        }
11309
11310        let url = params.parse_with_url(&url);
11311
11312        loop {
11313            let token = match self
11314                .hub
11315                .auth
11316                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11317                .await
11318            {
11319                Ok(token) => token,
11320                Err(e) => match dlg.token(e) {
11321                    Ok(token) => token,
11322                    Err(e) => {
11323                        dlg.finished(false);
11324                        return Err(common::Error::MissingToken(e));
11325                    }
11326                },
11327            };
11328            let mut req_result = {
11329                let client = &self.hub.client;
11330                dlg.pre_request();
11331                let mut req_builder = hyper::Request::builder()
11332                    .method(hyper::Method::DELETE)
11333                    .uri(url.as_str())
11334                    .header(USER_AGENT, self.hub._user_agent.clone());
11335
11336                if let Some(token) = token.as_ref() {
11337                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11338                }
11339
11340                let request = req_builder
11341                    .header(CONTENT_LENGTH, 0_u64)
11342                    .body(common::to_body::<String>(None));
11343
11344                client.request(request.unwrap()).await
11345            };
11346
11347            match req_result {
11348                Err(err) => {
11349                    if let common::Retry::After(d) = dlg.http_error(&err) {
11350                        sleep(d).await;
11351                        continue;
11352                    }
11353                    dlg.finished(false);
11354                    return Err(common::Error::HttpError(err));
11355                }
11356                Ok(res) => {
11357                    let (mut parts, body) = res.into_parts();
11358                    let mut body = common::Body::new(body);
11359                    if !parts.status.is_success() {
11360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11361                        let error = serde_json::from_str(&common::to_string(&bytes));
11362                        let response = common::to_response(parts, bytes.into());
11363
11364                        if let common::Retry::After(d) =
11365                            dlg.http_failure(&response, error.as_ref().ok())
11366                        {
11367                            sleep(d).await;
11368                            continue;
11369                        }
11370
11371                        dlg.finished(false);
11372
11373                        return Err(match error {
11374                            Ok(value) => common::Error::BadRequest(value),
11375                            _ => common::Error::Failure(response),
11376                        });
11377                    }
11378                    let response = {
11379                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11380                        let encoded = common::to_string(&bytes);
11381                        match serde_json::from_str(&encoded) {
11382                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11383                            Err(error) => {
11384                                dlg.response_json_decode_error(&encoded, &error);
11385                                return Err(common::Error::JsonDecodeError(
11386                                    encoded.to_string(),
11387                                    error,
11388                                ));
11389                            }
11390                        }
11391                    };
11392
11393                    dlg.finished(true);
11394                    return Ok(response);
11395                }
11396            }
11397        }
11398    }
11399
11400    /// Required. The name of the session template resource to delete.
11401    ///
11402    /// Sets the *name* path property to the given value.
11403    ///
11404    /// Even though the property as already been set when instantiating this call,
11405    /// we provide this method for API completeness.
11406    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionTemplateDeleteCall<'a, C> {
11407        self._name = new_value.to_string();
11408        self
11409    }
11410    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11411    /// while executing the actual API request.
11412    ///
11413    /// ````text
11414    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11415    /// ````
11416    ///
11417    /// Sets the *delegate* property to the given value.
11418    pub fn delegate(
11419        mut self,
11420        new_value: &'a mut dyn common::Delegate,
11421    ) -> ProjectLocationSessionTemplateDeleteCall<'a, C> {
11422        self._delegate = Some(new_value);
11423        self
11424    }
11425
11426    /// Set any additional parameter of the query string used in the request.
11427    /// It should be used to set parameters which are not yet available through their own
11428    /// setters.
11429    ///
11430    /// Please note that this method must not be used to set any of the known parameters
11431    /// which have their own setter method. If done anyway, the request will fail.
11432    ///
11433    /// # Additional Parameters
11434    ///
11435    /// * *$.xgafv* (query-string) - V1 error format.
11436    /// * *access_token* (query-string) - OAuth access token.
11437    /// * *alt* (query-string) - Data format for response.
11438    /// * *callback* (query-string) - JSONP
11439    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11440    /// * *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.
11441    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11442    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11443    /// * *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.
11444    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11445    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11446    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTemplateDeleteCall<'a, C>
11447    where
11448        T: AsRef<str>,
11449    {
11450        self._additional_params
11451            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11452        self
11453    }
11454
11455    /// Identifies the authorization scope for the method you are building.
11456    ///
11457    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11458    /// [`Scope::CloudPlatform`].
11459    ///
11460    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11461    /// tokens for more than one scope.
11462    ///
11463    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11464    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11465    /// sufficient, a read-write scope will do as well.
11466    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTemplateDeleteCall<'a, C>
11467    where
11468        St: AsRef<str>,
11469    {
11470        self._scopes.insert(String::from(scope.as_ref()));
11471        self
11472    }
11473    /// Identifies the authorization scope(s) for the method you are building.
11474    ///
11475    /// See [`Self::add_scope()`] for details.
11476    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTemplateDeleteCall<'a, C>
11477    where
11478        I: IntoIterator<Item = St>,
11479        St: AsRef<str>,
11480    {
11481        self._scopes
11482            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11483        self
11484    }
11485
11486    /// Removes all scopes, and no default scope will be used either.
11487    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11488    /// for details).
11489    pub fn clear_scopes(mut self) -> ProjectLocationSessionTemplateDeleteCall<'a, C> {
11490        self._scopes.clear();
11491        self
11492    }
11493}
11494
11495/// Gets the resource representation for a session template.
11496///
11497/// A builder for the *locations.sessionTemplates.get* method supported by a *project* resource.
11498/// It is not used directly, but through a [`ProjectMethods`] instance.
11499///
11500/// # Example
11501///
11502/// Instantiate a resource method builder
11503///
11504/// ```test_harness,no_run
11505/// # extern crate hyper;
11506/// # extern crate hyper_rustls;
11507/// # extern crate google_dataproc1 as dataproc1;
11508/// # async fn dox() {
11509/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11510///
11511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11513/// #     secret,
11514/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11515/// # ).build().await.unwrap();
11516///
11517/// # let client = hyper_util::client::legacy::Client::builder(
11518/// #     hyper_util::rt::TokioExecutor::new()
11519/// # )
11520/// # .build(
11521/// #     hyper_rustls::HttpsConnectorBuilder::new()
11522/// #         .with_native_roots()
11523/// #         .unwrap()
11524/// #         .https_or_http()
11525/// #         .enable_http1()
11526/// #         .build()
11527/// # );
11528/// # let mut hub = Dataproc::new(client, auth);
11529/// // You can configure optional parameters by calling the respective setters at will, and
11530/// // execute the final call using `doit()`.
11531/// // Values shown here are possibly random and not representative !
11532/// let result = hub.projects().locations_session_templates_get("name")
11533///              .doit().await;
11534/// # }
11535/// ```
11536pub struct ProjectLocationSessionTemplateGetCall<'a, C>
11537where
11538    C: 'a,
11539{
11540    hub: &'a Dataproc<C>,
11541    _name: String,
11542    _delegate: Option<&'a mut dyn common::Delegate>,
11543    _additional_params: HashMap<String, String>,
11544    _scopes: BTreeSet<String>,
11545}
11546
11547impl<'a, C> common::CallBuilder for ProjectLocationSessionTemplateGetCall<'a, C> {}
11548
11549impl<'a, C> ProjectLocationSessionTemplateGetCall<'a, C>
11550where
11551    C: common::Connector,
11552{
11553    /// Perform the operation you have build so far.
11554    pub async fn doit(mut self) -> common::Result<(common::Response, SessionTemplate)> {
11555        use std::borrow::Cow;
11556        use std::io::{Read, Seek};
11557
11558        use common::{url::Params, ToParts};
11559        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11560
11561        let mut dd = common::DefaultDelegate;
11562        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11563        dlg.begin(common::MethodInfo {
11564            id: "dataproc.projects.locations.sessionTemplates.get",
11565            http_method: hyper::Method::GET,
11566        });
11567
11568        for &field in ["alt", "name"].iter() {
11569            if self._additional_params.contains_key(field) {
11570                dlg.finished(false);
11571                return Err(common::Error::FieldClash(field));
11572            }
11573        }
11574
11575        let mut params = Params::with_capacity(3 + self._additional_params.len());
11576        params.push("name", self._name);
11577
11578        params.extend(self._additional_params.iter());
11579
11580        params.push("alt", "json");
11581        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11582        if self._scopes.is_empty() {
11583            self._scopes
11584                .insert(Scope::CloudPlatform.as_ref().to_string());
11585        }
11586
11587        #[allow(clippy::single_element_loop)]
11588        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11589            url = params.uri_replacement(url, param_name, find_this, true);
11590        }
11591        {
11592            let to_remove = ["name"];
11593            params.remove_params(&to_remove);
11594        }
11595
11596        let url = params.parse_with_url(&url);
11597
11598        loop {
11599            let token = match self
11600                .hub
11601                .auth
11602                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11603                .await
11604            {
11605                Ok(token) => token,
11606                Err(e) => match dlg.token(e) {
11607                    Ok(token) => token,
11608                    Err(e) => {
11609                        dlg.finished(false);
11610                        return Err(common::Error::MissingToken(e));
11611                    }
11612                },
11613            };
11614            let mut req_result = {
11615                let client = &self.hub.client;
11616                dlg.pre_request();
11617                let mut req_builder = hyper::Request::builder()
11618                    .method(hyper::Method::GET)
11619                    .uri(url.as_str())
11620                    .header(USER_AGENT, self.hub._user_agent.clone());
11621
11622                if let Some(token) = token.as_ref() {
11623                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11624                }
11625
11626                let request = req_builder
11627                    .header(CONTENT_LENGTH, 0_u64)
11628                    .body(common::to_body::<String>(None));
11629
11630                client.request(request.unwrap()).await
11631            };
11632
11633            match req_result {
11634                Err(err) => {
11635                    if let common::Retry::After(d) = dlg.http_error(&err) {
11636                        sleep(d).await;
11637                        continue;
11638                    }
11639                    dlg.finished(false);
11640                    return Err(common::Error::HttpError(err));
11641                }
11642                Ok(res) => {
11643                    let (mut parts, body) = res.into_parts();
11644                    let mut body = common::Body::new(body);
11645                    if !parts.status.is_success() {
11646                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11647                        let error = serde_json::from_str(&common::to_string(&bytes));
11648                        let response = common::to_response(parts, bytes.into());
11649
11650                        if let common::Retry::After(d) =
11651                            dlg.http_failure(&response, error.as_ref().ok())
11652                        {
11653                            sleep(d).await;
11654                            continue;
11655                        }
11656
11657                        dlg.finished(false);
11658
11659                        return Err(match error {
11660                            Ok(value) => common::Error::BadRequest(value),
11661                            _ => common::Error::Failure(response),
11662                        });
11663                    }
11664                    let response = {
11665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11666                        let encoded = common::to_string(&bytes);
11667                        match serde_json::from_str(&encoded) {
11668                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11669                            Err(error) => {
11670                                dlg.response_json_decode_error(&encoded, &error);
11671                                return Err(common::Error::JsonDecodeError(
11672                                    encoded.to_string(),
11673                                    error,
11674                                ));
11675                            }
11676                        }
11677                    };
11678
11679                    dlg.finished(true);
11680                    return Ok(response);
11681                }
11682            }
11683        }
11684    }
11685
11686    /// Required. The name of the session template to retrieve.
11687    ///
11688    /// Sets the *name* path property to the given value.
11689    ///
11690    /// Even though the property as already been set when instantiating this call,
11691    /// we provide this method for API completeness.
11692    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionTemplateGetCall<'a, C> {
11693        self._name = new_value.to_string();
11694        self
11695    }
11696    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11697    /// while executing the actual API request.
11698    ///
11699    /// ````text
11700    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11701    /// ````
11702    ///
11703    /// Sets the *delegate* property to the given value.
11704    pub fn delegate(
11705        mut self,
11706        new_value: &'a mut dyn common::Delegate,
11707    ) -> ProjectLocationSessionTemplateGetCall<'a, C> {
11708        self._delegate = Some(new_value);
11709        self
11710    }
11711
11712    /// Set any additional parameter of the query string used in the request.
11713    /// It should be used to set parameters which are not yet available through their own
11714    /// setters.
11715    ///
11716    /// Please note that this method must not be used to set any of the known parameters
11717    /// which have their own setter method. If done anyway, the request will fail.
11718    ///
11719    /// # Additional Parameters
11720    ///
11721    /// * *$.xgafv* (query-string) - V1 error format.
11722    /// * *access_token* (query-string) - OAuth access token.
11723    /// * *alt* (query-string) - Data format for response.
11724    /// * *callback* (query-string) - JSONP
11725    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11726    /// * *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.
11727    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11728    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11729    /// * *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.
11730    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11731    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11732    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTemplateGetCall<'a, C>
11733    where
11734        T: AsRef<str>,
11735    {
11736        self._additional_params
11737            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11738        self
11739    }
11740
11741    /// Identifies the authorization scope for the method you are building.
11742    ///
11743    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11744    /// [`Scope::CloudPlatform`].
11745    ///
11746    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11747    /// tokens for more than one scope.
11748    ///
11749    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11750    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11751    /// sufficient, a read-write scope will do as well.
11752    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTemplateGetCall<'a, C>
11753    where
11754        St: AsRef<str>,
11755    {
11756        self._scopes.insert(String::from(scope.as_ref()));
11757        self
11758    }
11759    /// Identifies the authorization scope(s) for the method you are building.
11760    ///
11761    /// See [`Self::add_scope()`] for details.
11762    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTemplateGetCall<'a, C>
11763    where
11764        I: IntoIterator<Item = St>,
11765        St: AsRef<str>,
11766    {
11767        self._scopes
11768            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11769        self
11770    }
11771
11772    /// Removes all scopes, and no default scope will be used either.
11773    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11774    /// for details).
11775    pub fn clear_scopes(mut self) -> ProjectLocationSessionTemplateGetCall<'a, C> {
11776        self._scopes.clear();
11777        self
11778    }
11779}
11780
11781/// Lists session templates.
11782///
11783/// A builder for the *locations.sessionTemplates.list* method supported by a *project* resource.
11784/// It is not used directly, but through a [`ProjectMethods`] instance.
11785///
11786/// # Example
11787///
11788/// Instantiate a resource method builder
11789///
11790/// ```test_harness,no_run
11791/// # extern crate hyper;
11792/// # extern crate hyper_rustls;
11793/// # extern crate google_dataproc1 as dataproc1;
11794/// # async fn dox() {
11795/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11796///
11797/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11799/// #     secret,
11800/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11801/// # ).build().await.unwrap();
11802///
11803/// # let client = hyper_util::client::legacy::Client::builder(
11804/// #     hyper_util::rt::TokioExecutor::new()
11805/// # )
11806/// # .build(
11807/// #     hyper_rustls::HttpsConnectorBuilder::new()
11808/// #         .with_native_roots()
11809/// #         .unwrap()
11810/// #         .https_or_http()
11811/// #         .enable_http1()
11812/// #         .build()
11813/// # );
11814/// # let mut hub = Dataproc::new(client, auth);
11815/// // You can configure optional parameters by calling the respective setters at will, and
11816/// // execute the final call using `doit()`.
11817/// // Values shown here are possibly random and not representative !
11818/// let result = hub.projects().locations_session_templates_list("parent")
11819///              .page_token("et")
11820///              .page_size(-76)
11821///              .filter("erat")
11822///              .doit().await;
11823/// # }
11824/// ```
11825pub struct ProjectLocationSessionTemplateListCall<'a, C>
11826where
11827    C: 'a,
11828{
11829    hub: &'a Dataproc<C>,
11830    _parent: String,
11831    _page_token: Option<String>,
11832    _page_size: Option<i32>,
11833    _filter: Option<String>,
11834    _delegate: Option<&'a mut dyn common::Delegate>,
11835    _additional_params: HashMap<String, String>,
11836    _scopes: BTreeSet<String>,
11837}
11838
11839impl<'a, C> common::CallBuilder for ProjectLocationSessionTemplateListCall<'a, C> {}
11840
11841impl<'a, C> ProjectLocationSessionTemplateListCall<'a, C>
11842where
11843    C: common::Connector,
11844{
11845    /// Perform the operation you have build so far.
11846    pub async fn doit(
11847        mut self,
11848    ) -> common::Result<(common::Response, ListSessionTemplatesResponse)> {
11849        use std::borrow::Cow;
11850        use std::io::{Read, Seek};
11851
11852        use common::{url::Params, ToParts};
11853        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11854
11855        let mut dd = common::DefaultDelegate;
11856        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11857        dlg.begin(common::MethodInfo {
11858            id: "dataproc.projects.locations.sessionTemplates.list",
11859            http_method: hyper::Method::GET,
11860        });
11861
11862        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
11863            if self._additional_params.contains_key(field) {
11864                dlg.finished(false);
11865                return Err(common::Error::FieldClash(field));
11866            }
11867        }
11868
11869        let mut params = Params::with_capacity(6 + self._additional_params.len());
11870        params.push("parent", self._parent);
11871        if let Some(value) = self._page_token.as_ref() {
11872            params.push("pageToken", value);
11873        }
11874        if let Some(value) = self._page_size.as_ref() {
11875            params.push("pageSize", value.to_string());
11876        }
11877        if let Some(value) = self._filter.as_ref() {
11878            params.push("filter", value);
11879        }
11880
11881        params.extend(self._additional_params.iter());
11882
11883        params.push("alt", "json");
11884        let mut url = self.hub._base_url.clone() + "v1/{+parent}/sessionTemplates";
11885        if self._scopes.is_empty() {
11886            self._scopes
11887                .insert(Scope::CloudPlatform.as_ref().to_string());
11888        }
11889
11890        #[allow(clippy::single_element_loop)]
11891        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11892            url = params.uri_replacement(url, param_name, find_this, true);
11893        }
11894        {
11895            let to_remove = ["parent"];
11896            params.remove_params(&to_remove);
11897        }
11898
11899        let url = params.parse_with_url(&url);
11900
11901        loop {
11902            let token = match self
11903                .hub
11904                .auth
11905                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11906                .await
11907            {
11908                Ok(token) => token,
11909                Err(e) => match dlg.token(e) {
11910                    Ok(token) => token,
11911                    Err(e) => {
11912                        dlg.finished(false);
11913                        return Err(common::Error::MissingToken(e));
11914                    }
11915                },
11916            };
11917            let mut req_result = {
11918                let client = &self.hub.client;
11919                dlg.pre_request();
11920                let mut req_builder = hyper::Request::builder()
11921                    .method(hyper::Method::GET)
11922                    .uri(url.as_str())
11923                    .header(USER_AGENT, self.hub._user_agent.clone());
11924
11925                if let Some(token) = token.as_ref() {
11926                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11927                }
11928
11929                let request = req_builder
11930                    .header(CONTENT_LENGTH, 0_u64)
11931                    .body(common::to_body::<String>(None));
11932
11933                client.request(request.unwrap()).await
11934            };
11935
11936            match req_result {
11937                Err(err) => {
11938                    if let common::Retry::After(d) = dlg.http_error(&err) {
11939                        sleep(d).await;
11940                        continue;
11941                    }
11942                    dlg.finished(false);
11943                    return Err(common::Error::HttpError(err));
11944                }
11945                Ok(res) => {
11946                    let (mut parts, body) = res.into_parts();
11947                    let mut body = common::Body::new(body);
11948                    if !parts.status.is_success() {
11949                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11950                        let error = serde_json::from_str(&common::to_string(&bytes));
11951                        let response = common::to_response(parts, bytes.into());
11952
11953                        if let common::Retry::After(d) =
11954                            dlg.http_failure(&response, error.as_ref().ok())
11955                        {
11956                            sleep(d).await;
11957                            continue;
11958                        }
11959
11960                        dlg.finished(false);
11961
11962                        return Err(match error {
11963                            Ok(value) => common::Error::BadRequest(value),
11964                            _ => common::Error::Failure(response),
11965                        });
11966                    }
11967                    let response = {
11968                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11969                        let encoded = common::to_string(&bytes);
11970                        match serde_json::from_str(&encoded) {
11971                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11972                            Err(error) => {
11973                                dlg.response_json_decode_error(&encoded, &error);
11974                                return Err(common::Error::JsonDecodeError(
11975                                    encoded.to_string(),
11976                                    error,
11977                                ));
11978                            }
11979                        }
11980                    };
11981
11982                    dlg.finished(true);
11983                    return Ok(response);
11984                }
11985            }
11986        }
11987    }
11988
11989    /// Required. The parent that owns this collection of session templates.
11990    ///
11991    /// Sets the *parent* path property to the given value.
11992    ///
11993    /// Even though the property as already been set when instantiating this call,
11994    /// we provide this method for API completeness.
11995    pub fn parent(mut self, new_value: &str) -> ProjectLocationSessionTemplateListCall<'a, C> {
11996        self._parent = new_value.to_string();
11997        self
11998    }
11999    /// Optional. A page token received from a previous ListSessions call. Provide this token to retrieve the subsequent page.
12000    ///
12001    /// Sets the *page token* query property to the given value.
12002    pub fn page_token(mut self, new_value: &str) -> ProjectLocationSessionTemplateListCall<'a, C> {
12003        self._page_token = Some(new_value.to_string());
12004        self
12005    }
12006    /// Optional. The maximum number of sessions to return in each response. The service may return fewer than this value.
12007    ///
12008    /// Sets the *page size* query property to the given value.
12009    pub fn page_size(mut self, new_value: i32) -> ProjectLocationSessionTemplateListCall<'a, C> {
12010        self._page_size = Some(new_value);
12011        self
12012    }
12013    /// Optional. A filter for the session templates to return in the response. Filters are case sensitive and have the following syntax:field = value AND field = value ...
12014    ///
12015    /// Sets the *filter* query property to the given value.
12016    pub fn filter(mut self, new_value: &str) -> ProjectLocationSessionTemplateListCall<'a, C> {
12017        self._filter = Some(new_value.to_string());
12018        self
12019    }
12020    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12021    /// while executing the actual API request.
12022    ///
12023    /// ````text
12024    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12025    /// ````
12026    ///
12027    /// Sets the *delegate* property to the given value.
12028    pub fn delegate(
12029        mut self,
12030        new_value: &'a mut dyn common::Delegate,
12031    ) -> ProjectLocationSessionTemplateListCall<'a, C> {
12032        self._delegate = Some(new_value);
12033        self
12034    }
12035
12036    /// Set any additional parameter of the query string used in the request.
12037    /// It should be used to set parameters which are not yet available through their own
12038    /// setters.
12039    ///
12040    /// Please note that this method must not be used to set any of the known parameters
12041    /// which have their own setter method. If done anyway, the request will fail.
12042    ///
12043    /// # Additional Parameters
12044    ///
12045    /// * *$.xgafv* (query-string) - V1 error format.
12046    /// * *access_token* (query-string) - OAuth access token.
12047    /// * *alt* (query-string) - Data format for response.
12048    /// * *callback* (query-string) - JSONP
12049    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12050    /// * *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.
12051    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12052    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12053    /// * *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.
12054    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12055    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12056    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTemplateListCall<'a, C>
12057    where
12058        T: AsRef<str>,
12059    {
12060        self._additional_params
12061            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12062        self
12063    }
12064
12065    /// Identifies the authorization scope for the method you are building.
12066    ///
12067    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12068    /// [`Scope::CloudPlatform`].
12069    ///
12070    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12071    /// tokens for more than one scope.
12072    ///
12073    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12074    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12075    /// sufficient, a read-write scope will do as well.
12076    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTemplateListCall<'a, C>
12077    where
12078        St: AsRef<str>,
12079    {
12080        self._scopes.insert(String::from(scope.as_ref()));
12081        self
12082    }
12083    /// Identifies the authorization scope(s) for the method you are building.
12084    ///
12085    /// See [`Self::add_scope()`] for details.
12086    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTemplateListCall<'a, C>
12087    where
12088        I: IntoIterator<Item = St>,
12089        St: AsRef<str>,
12090    {
12091        self._scopes
12092            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12093        self
12094    }
12095
12096    /// Removes all scopes, and no default scope will be used either.
12097    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12098    /// for details).
12099    pub fn clear_scopes(mut self) -> ProjectLocationSessionTemplateListCall<'a, C> {
12100        self._scopes.clear();
12101        self
12102    }
12103}
12104
12105/// Updates the session template synchronously.
12106///
12107/// A builder for the *locations.sessionTemplates.patch* method supported by a *project* resource.
12108/// It is not used directly, but through a [`ProjectMethods`] instance.
12109///
12110/// # Example
12111///
12112/// Instantiate a resource method builder
12113///
12114/// ```test_harness,no_run
12115/// # extern crate hyper;
12116/// # extern crate hyper_rustls;
12117/// # extern crate google_dataproc1 as dataproc1;
12118/// use dataproc1::api::SessionTemplate;
12119/// # async fn dox() {
12120/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12121///
12122/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12123/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12124/// #     secret,
12125/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12126/// # ).build().await.unwrap();
12127///
12128/// # let client = hyper_util::client::legacy::Client::builder(
12129/// #     hyper_util::rt::TokioExecutor::new()
12130/// # )
12131/// # .build(
12132/// #     hyper_rustls::HttpsConnectorBuilder::new()
12133/// #         .with_native_roots()
12134/// #         .unwrap()
12135/// #         .https_or_http()
12136/// #         .enable_http1()
12137/// #         .build()
12138/// # );
12139/// # let mut hub = Dataproc::new(client, auth);
12140/// // As the method needs a request, you would usually fill it with the desired information
12141/// // into the respective structure. Some of the parts shown here might not be applicable !
12142/// // Values shown here are possibly random and not representative !
12143/// let mut req = SessionTemplate::default();
12144///
12145/// // You can configure optional parameters by calling the respective setters at will, and
12146/// // execute the final call using `doit()`.
12147/// // Values shown here are possibly random and not representative !
12148/// let result = hub.projects().locations_session_templates_patch(req, "name")
12149///              .doit().await;
12150/// # }
12151/// ```
12152pub struct ProjectLocationSessionTemplatePatchCall<'a, C>
12153where
12154    C: 'a,
12155{
12156    hub: &'a Dataproc<C>,
12157    _request: SessionTemplate,
12158    _name: String,
12159    _delegate: Option<&'a mut dyn common::Delegate>,
12160    _additional_params: HashMap<String, String>,
12161    _scopes: BTreeSet<String>,
12162}
12163
12164impl<'a, C> common::CallBuilder for ProjectLocationSessionTemplatePatchCall<'a, C> {}
12165
12166impl<'a, C> ProjectLocationSessionTemplatePatchCall<'a, C>
12167where
12168    C: common::Connector,
12169{
12170    /// Perform the operation you have build so far.
12171    pub async fn doit(mut self) -> common::Result<(common::Response, SessionTemplate)> {
12172        use std::borrow::Cow;
12173        use std::io::{Read, Seek};
12174
12175        use common::{url::Params, ToParts};
12176        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12177
12178        let mut dd = common::DefaultDelegate;
12179        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12180        dlg.begin(common::MethodInfo {
12181            id: "dataproc.projects.locations.sessionTemplates.patch",
12182            http_method: hyper::Method::PATCH,
12183        });
12184
12185        for &field in ["alt", "name"].iter() {
12186            if self._additional_params.contains_key(field) {
12187                dlg.finished(false);
12188                return Err(common::Error::FieldClash(field));
12189            }
12190        }
12191
12192        let mut params = Params::with_capacity(4 + self._additional_params.len());
12193        params.push("name", self._name);
12194
12195        params.extend(self._additional_params.iter());
12196
12197        params.push("alt", "json");
12198        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12199        if self._scopes.is_empty() {
12200            self._scopes
12201                .insert(Scope::CloudPlatform.as_ref().to_string());
12202        }
12203
12204        #[allow(clippy::single_element_loop)]
12205        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12206            url = params.uri_replacement(url, param_name, find_this, true);
12207        }
12208        {
12209            let to_remove = ["name"];
12210            params.remove_params(&to_remove);
12211        }
12212
12213        let url = params.parse_with_url(&url);
12214
12215        let mut json_mime_type = mime::APPLICATION_JSON;
12216        let mut request_value_reader = {
12217            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12218            common::remove_json_null_values(&mut value);
12219            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12220            serde_json::to_writer(&mut dst, &value).unwrap();
12221            dst
12222        };
12223        let request_size = request_value_reader
12224            .seek(std::io::SeekFrom::End(0))
12225            .unwrap();
12226        request_value_reader
12227            .seek(std::io::SeekFrom::Start(0))
12228            .unwrap();
12229
12230        loop {
12231            let token = match self
12232                .hub
12233                .auth
12234                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12235                .await
12236            {
12237                Ok(token) => token,
12238                Err(e) => match dlg.token(e) {
12239                    Ok(token) => token,
12240                    Err(e) => {
12241                        dlg.finished(false);
12242                        return Err(common::Error::MissingToken(e));
12243                    }
12244                },
12245            };
12246            request_value_reader
12247                .seek(std::io::SeekFrom::Start(0))
12248                .unwrap();
12249            let mut req_result = {
12250                let client = &self.hub.client;
12251                dlg.pre_request();
12252                let mut req_builder = hyper::Request::builder()
12253                    .method(hyper::Method::PATCH)
12254                    .uri(url.as_str())
12255                    .header(USER_AGENT, self.hub._user_agent.clone());
12256
12257                if let Some(token) = token.as_ref() {
12258                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12259                }
12260
12261                let request = req_builder
12262                    .header(CONTENT_TYPE, json_mime_type.to_string())
12263                    .header(CONTENT_LENGTH, request_size as u64)
12264                    .body(common::to_body(
12265                        request_value_reader.get_ref().clone().into(),
12266                    ));
12267
12268                client.request(request.unwrap()).await
12269            };
12270
12271            match req_result {
12272                Err(err) => {
12273                    if let common::Retry::After(d) = dlg.http_error(&err) {
12274                        sleep(d).await;
12275                        continue;
12276                    }
12277                    dlg.finished(false);
12278                    return Err(common::Error::HttpError(err));
12279                }
12280                Ok(res) => {
12281                    let (mut parts, body) = res.into_parts();
12282                    let mut body = common::Body::new(body);
12283                    if !parts.status.is_success() {
12284                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12285                        let error = serde_json::from_str(&common::to_string(&bytes));
12286                        let response = common::to_response(parts, bytes.into());
12287
12288                        if let common::Retry::After(d) =
12289                            dlg.http_failure(&response, error.as_ref().ok())
12290                        {
12291                            sleep(d).await;
12292                            continue;
12293                        }
12294
12295                        dlg.finished(false);
12296
12297                        return Err(match error {
12298                            Ok(value) => common::Error::BadRequest(value),
12299                            _ => common::Error::Failure(response),
12300                        });
12301                    }
12302                    let response = {
12303                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12304                        let encoded = common::to_string(&bytes);
12305                        match serde_json::from_str(&encoded) {
12306                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12307                            Err(error) => {
12308                                dlg.response_json_decode_error(&encoded, &error);
12309                                return Err(common::Error::JsonDecodeError(
12310                                    encoded.to_string(),
12311                                    error,
12312                                ));
12313                            }
12314                        }
12315                    };
12316
12317                    dlg.finished(true);
12318                    return Ok(response);
12319                }
12320            }
12321        }
12322    }
12323
12324    ///
12325    /// Sets the *request* property to the given value.
12326    ///
12327    /// Even though the property as already been set when instantiating this call,
12328    /// we provide this method for API completeness.
12329    pub fn request(
12330        mut self,
12331        new_value: SessionTemplate,
12332    ) -> ProjectLocationSessionTemplatePatchCall<'a, C> {
12333        self._request = new_value;
12334        self
12335    }
12336    /// Required. The resource name of the session template.
12337    ///
12338    /// Sets the *name* path property to the given value.
12339    ///
12340    /// Even though the property as already been set when instantiating this call,
12341    /// we provide this method for API completeness.
12342    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionTemplatePatchCall<'a, C> {
12343        self._name = new_value.to_string();
12344        self
12345    }
12346    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12347    /// while executing the actual API request.
12348    ///
12349    /// ````text
12350    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12351    /// ````
12352    ///
12353    /// Sets the *delegate* property to the given value.
12354    pub fn delegate(
12355        mut self,
12356        new_value: &'a mut dyn common::Delegate,
12357    ) -> ProjectLocationSessionTemplatePatchCall<'a, C> {
12358        self._delegate = Some(new_value);
12359        self
12360    }
12361
12362    /// Set any additional parameter of the query string used in the request.
12363    /// It should be used to set parameters which are not yet available through their own
12364    /// setters.
12365    ///
12366    /// Please note that this method must not be used to set any of the known parameters
12367    /// which have their own setter method. If done anyway, the request will fail.
12368    ///
12369    /// # Additional Parameters
12370    ///
12371    /// * *$.xgafv* (query-string) - V1 error format.
12372    /// * *access_token* (query-string) - OAuth access token.
12373    /// * *alt* (query-string) - Data format for response.
12374    /// * *callback* (query-string) - JSONP
12375    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12376    /// * *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.
12377    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12378    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12379    /// * *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.
12380    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12381    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12382    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTemplatePatchCall<'a, C>
12383    where
12384        T: AsRef<str>,
12385    {
12386        self._additional_params
12387            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12388        self
12389    }
12390
12391    /// Identifies the authorization scope for the method you are building.
12392    ///
12393    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12394    /// [`Scope::CloudPlatform`].
12395    ///
12396    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12397    /// tokens for more than one scope.
12398    ///
12399    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12400    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12401    /// sufficient, a read-write scope will do as well.
12402    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTemplatePatchCall<'a, C>
12403    where
12404        St: AsRef<str>,
12405    {
12406        self._scopes.insert(String::from(scope.as_ref()));
12407        self
12408    }
12409    /// Identifies the authorization scope(s) for the method you are building.
12410    ///
12411    /// See [`Self::add_scope()`] for details.
12412    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTemplatePatchCall<'a, C>
12413    where
12414        I: IntoIterator<Item = St>,
12415        St: AsRef<str>,
12416    {
12417        self._scopes
12418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12419        self
12420    }
12421
12422    /// Removes all scopes, and no default scope will be used either.
12423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12424    /// for details).
12425    pub fn clear_scopes(mut self) -> ProjectLocationSessionTemplatePatchCall<'a, C> {
12426        self._scopes.clear();
12427        self
12428    }
12429}
12430
12431/// Create an interactive session asynchronously.
12432///
12433/// A builder for the *locations.sessions.create* method supported by a *project* resource.
12434/// It is not used directly, but through a [`ProjectMethods`] instance.
12435///
12436/// # Example
12437///
12438/// Instantiate a resource method builder
12439///
12440/// ```test_harness,no_run
12441/// # extern crate hyper;
12442/// # extern crate hyper_rustls;
12443/// # extern crate google_dataproc1 as dataproc1;
12444/// use dataproc1::api::Session;
12445/// # async fn dox() {
12446/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12447///
12448/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12449/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12450/// #     secret,
12451/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12452/// # ).build().await.unwrap();
12453///
12454/// # let client = hyper_util::client::legacy::Client::builder(
12455/// #     hyper_util::rt::TokioExecutor::new()
12456/// # )
12457/// # .build(
12458/// #     hyper_rustls::HttpsConnectorBuilder::new()
12459/// #         .with_native_roots()
12460/// #         .unwrap()
12461/// #         .https_or_http()
12462/// #         .enable_http1()
12463/// #         .build()
12464/// # );
12465/// # let mut hub = Dataproc::new(client, auth);
12466/// // As the method needs a request, you would usually fill it with the desired information
12467/// // into the respective structure. Some of the parts shown here might not be applicable !
12468/// // Values shown here are possibly random and not representative !
12469/// let mut req = Session::default();
12470///
12471/// // You can configure optional parameters by calling the respective setters at will, and
12472/// // execute the final call using `doit()`.
12473/// // Values shown here are possibly random and not representative !
12474/// let result = hub.projects().locations_sessions_create(req, "parent")
12475///              .session_id("dolore")
12476///              .request_id("et")
12477///              .doit().await;
12478/// # }
12479/// ```
12480pub struct ProjectLocationSessionCreateCall<'a, C>
12481where
12482    C: 'a,
12483{
12484    hub: &'a Dataproc<C>,
12485    _request: Session,
12486    _parent: String,
12487    _session_id: Option<String>,
12488    _request_id: Option<String>,
12489    _delegate: Option<&'a mut dyn common::Delegate>,
12490    _additional_params: HashMap<String, String>,
12491    _scopes: BTreeSet<String>,
12492}
12493
12494impl<'a, C> common::CallBuilder for ProjectLocationSessionCreateCall<'a, C> {}
12495
12496impl<'a, C> ProjectLocationSessionCreateCall<'a, C>
12497where
12498    C: common::Connector,
12499{
12500    /// Perform the operation you have build so far.
12501    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12502        use std::borrow::Cow;
12503        use std::io::{Read, Seek};
12504
12505        use common::{url::Params, ToParts};
12506        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12507
12508        let mut dd = common::DefaultDelegate;
12509        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12510        dlg.begin(common::MethodInfo {
12511            id: "dataproc.projects.locations.sessions.create",
12512            http_method: hyper::Method::POST,
12513        });
12514
12515        for &field in ["alt", "parent", "sessionId", "requestId"].iter() {
12516            if self._additional_params.contains_key(field) {
12517                dlg.finished(false);
12518                return Err(common::Error::FieldClash(field));
12519            }
12520        }
12521
12522        let mut params = Params::with_capacity(6 + self._additional_params.len());
12523        params.push("parent", self._parent);
12524        if let Some(value) = self._session_id.as_ref() {
12525            params.push("sessionId", value);
12526        }
12527        if let Some(value) = self._request_id.as_ref() {
12528            params.push("requestId", value);
12529        }
12530
12531        params.extend(self._additional_params.iter());
12532
12533        params.push("alt", "json");
12534        let mut url = self.hub._base_url.clone() + "v1/{+parent}/sessions";
12535        if self._scopes.is_empty() {
12536            self._scopes
12537                .insert(Scope::CloudPlatform.as_ref().to_string());
12538        }
12539
12540        #[allow(clippy::single_element_loop)]
12541        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12542            url = params.uri_replacement(url, param_name, find_this, true);
12543        }
12544        {
12545            let to_remove = ["parent"];
12546            params.remove_params(&to_remove);
12547        }
12548
12549        let url = params.parse_with_url(&url);
12550
12551        let mut json_mime_type = mime::APPLICATION_JSON;
12552        let mut request_value_reader = {
12553            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12554            common::remove_json_null_values(&mut value);
12555            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12556            serde_json::to_writer(&mut dst, &value).unwrap();
12557            dst
12558        };
12559        let request_size = request_value_reader
12560            .seek(std::io::SeekFrom::End(0))
12561            .unwrap();
12562        request_value_reader
12563            .seek(std::io::SeekFrom::Start(0))
12564            .unwrap();
12565
12566        loop {
12567            let token = match self
12568                .hub
12569                .auth
12570                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12571                .await
12572            {
12573                Ok(token) => token,
12574                Err(e) => match dlg.token(e) {
12575                    Ok(token) => token,
12576                    Err(e) => {
12577                        dlg.finished(false);
12578                        return Err(common::Error::MissingToken(e));
12579                    }
12580                },
12581            };
12582            request_value_reader
12583                .seek(std::io::SeekFrom::Start(0))
12584                .unwrap();
12585            let mut req_result = {
12586                let client = &self.hub.client;
12587                dlg.pre_request();
12588                let mut req_builder = hyper::Request::builder()
12589                    .method(hyper::Method::POST)
12590                    .uri(url.as_str())
12591                    .header(USER_AGENT, self.hub._user_agent.clone());
12592
12593                if let Some(token) = token.as_ref() {
12594                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12595                }
12596
12597                let request = req_builder
12598                    .header(CONTENT_TYPE, json_mime_type.to_string())
12599                    .header(CONTENT_LENGTH, request_size as u64)
12600                    .body(common::to_body(
12601                        request_value_reader.get_ref().clone().into(),
12602                    ));
12603
12604                client.request(request.unwrap()).await
12605            };
12606
12607            match req_result {
12608                Err(err) => {
12609                    if let common::Retry::After(d) = dlg.http_error(&err) {
12610                        sleep(d).await;
12611                        continue;
12612                    }
12613                    dlg.finished(false);
12614                    return Err(common::Error::HttpError(err));
12615                }
12616                Ok(res) => {
12617                    let (mut parts, body) = res.into_parts();
12618                    let mut body = common::Body::new(body);
12619                    if !parts.status.is_success() {
12620                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12621                        let error = serde_json::from_str(&common::to_string(&bytes));
12622                        let response = common::to_response(parts, bytes.into());
12623
12624                        if let common::Retry::After(d) =
12625                            dlg.http_failure(&response, error.as_ref().ok())
12626                        {
12627                            sleep(d).await;
12628                            continue;
12629                        }
12630
12631                        dlg.finished(false);
12632
12633                        return Err(match error {
12634                            Ok(value) => common::Error::BadRequest(value),
12635                            _ => common::Error::Failure(response),
12636                        });
12637                    }
12638                    let response = {
12639                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12640                        let encoded = common::to_string(&bytes);
12641                        match serde_json::from_str(&encoded) {
12642                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12643                            Err(error) => {
12644                                dlg.response_json_decode_error(&encoded, &error);
12645                                return Err(common::Error::JsonDecodeError(
12646                                    encoded.to_string(),
12647                                    error,
12648                                ));
12649                            }
12650                        }
12651                    };
12652
12653                    dlg.finished(true);
12654                    return Ok(response);
12655                }
12656            }
12657        }
12658    }
12659
12660    ///
12661    /// Sets the *request* property to the given value.
12662    ///
12663    /// Even though the property as already been set when instantiating this call,
12664    /// we provide this method for API completeness.
12665    pub fn request(mut self, new_value: Session) -> ProjectLocationSessionCreateCall<'a, C> {
12666        self._request = new_value;
12667        self
12668    }
12669    /// Required. The parent resource where this session will be created.
12670    ///
12671    /// Sets the *parent* path property to the given value.
12672    ///
12673    /// Even though the property as already been set when instantiating this call,
12674    /// we provide this method for API completeness.
12675    pub fn parent(mut self, new_value: &str) -> ProjectLocationSessionCreateCall<'a, C> {
12676        self._parent = new_value.to_string();
12677        self
12678    }
12679    /// Required. The ID to use for the session, which becomes the final component of the session's resource name.This value must be 4-63 characters. Valid characters are /a-z-/.
12680    ///
12681    /// Sets the *session id* query property to the given value.
12682    pub fn session_id(mut self, new_value: &str) -> ProjectLocationSessionCreateCall<'a, C> {
12683        self._session_id = Some(new_value.to_string());
12684        self
12685    }
12686    /// Optional. A unique ID used to identify the request. If the service receives two CreateSessionRequests (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s with the same ID, the second request is ignored, and the first Session is created and stored in the backend.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
12687    ///
12688    /// Sets the *request id* query property to the given value.
12689    pub fn request_id(mut self, new_value: &str) -> ProjectLocationSessionCreateCall<'a, C> {
12690        self._request_id = Some(new_value.to_string());
12691        self
12692    }
12693    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12694    /// while executing the actual API request.
12695    ///
12696    /// ````text
12697    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12698    /// ````
12699    ///
12700    /// Sets the *delegate* property to the given value.
12701    pub fn delegate(
12702        mut self,
12703        new_value: &'a mut dyn common::Delegate,
12704    ) -> ProjectLocationSessionCreateCall<'a, C> {
12705        self._delegate = Some(new_value);
12706        self
12707    }
12708
12709    /// Set any additional parameter of the query string used in the request.
12710    /// It should be used to set parameters which are not yet available through their own
12711    /// setters.
12712    ///
12713    /// Please note that this method must not be used to set any of the known parameters
12714    /// which have their own setter method. If done anyway, the request will fail.
12715    ///
12716    /// # Additional Parameters
12717    ///
12718    /// * *$.xgafv* (query-string) - V1 error format.
12719    /// * *access_token* (query-string) - OAuth access token.
12720    /// * *alt* (query-string) - Data format for response.
12721    /// * *callback* (query-string) - JSONP
12722    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12723    /// * *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.
12724    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12725    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12726    /// * *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.
12727    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12728    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12729    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionCreateCall<'a, C>
12730    where
12731        T: AsRef<str>,
12732    {
12733        self._additional_params
12734            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12735        self
12736    }
12737
12738    /// Identifies the authorization scope for the method you are building.
12739    ///
12740    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12741    /// [`Scope::CloudPlatform`].
12742    ///
12743    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12744    /// tokens for more than one scope.
12745    ///
12746    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12747    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12748    /// sufficient, a read-write scope will do as well.
12749    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionCreateCall<'a, C>
12750    where
12751        St: AsRef<str>,
12752    {
12753        self._scopes.insert(String::from(scope.as_ref()));
12754        self
12755    }
12756    /// Identifies the authorization scope(s) for the method you are building.
12757    ///
12758    /// See [`Self::add_scope()`] for details.
12759    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionCreateCall<'a, C>
12760    where
12761        I: IntoIterator<Item = St>,
12762        St: AsRef<str>,
12763    {
12764        self._scopes
12765            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12766        self
12767    }
12768
12769    /// Removes all scopes, and no default scope will be used either.
12770    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12771    /// for details).
12772    pub fn clear_scopes(mut self) -> ProjectLocationSessionCreateCall<'a, C> {
12773        self._scopes.clear();
12774        self
12775    }
12776}
12777
12778/// Deletes the interactive session resource. If the session is not in terminal state, it is terminated, and then deleted.
12779///
12780/// A builder for the *locations.sessions.delete* method supported by a *project* resource.
12781/// It is not used directly, but through a [`ProjectMethods`] instance.
12782///
12783/// # Example
12784///
12785/// Instantiate a resource method builder
12786///
12787/// ```test_harness,no_run
12788/// # extern crate hyper;
12789/// # extern crate hyper_rustls;
12790/// # extern crate google_dataproc1 as dataproc1;
12791/// # async fn dox() {
12792/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12793///
12794/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12795/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12796/// #     secret,
12797/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12798/// # ).build().await.unwrap();
12799///
12800/// # let client = hyper_util::client::legacy::Client::builder(
12801/// #     hyper_util::rt::TokioExecutor::new()
12802/// # )
12803/// # .build(
12804/// #     hyper_rustls::HttpsConnectorBuilder::new()
12805/// #         .with_native_roots()
12806/// #         .unwrap()
12807/// #         .https_or_http()
12808/// #         .enable_http1()
12809/// #         .build()
12810/// # );
12811/// # let mut hub = Dataproc::new(client, auth);
12812/// // You can configure optional parameters by calling the respective setters at will, and
12813/// // execute the final call using `doit()`.
12814/// // Values shown here are possibly random and not representative !
12815/// let result = hub.projects().locations_sessions_delete("name")
12816///              .request_id("amet.")
12817///              .doit().await;
12818/// # }
12819/// ```
12820pub struct ProjectLocationSessionDeleteCall<'a, C>
12821where
12822    C: 'a,
12823{
12824    hub: &'a Dataproc<C>,
12825    _name: String,
12826    _request_id: Option<String>,
12827    _delegate: Option<&'a mut dyn common::Delegate>,
12828    _additional_params: HashMap<String, String>,
12829    _scopes: BTreeSet<String>,
12830}
12831
12832impl<'a, C> common::CallBuilder for ProjectLocationSessionDeleteCall<'a, C> {}
12833
12834impl<'a, C> ProjectLocationSessionDeleteCall<'a, C>
12835where
12836    C: common::Connector,
12837{
12838    /// Perform the operation you have build so far.
12839    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12840        use std::borrow::Cow;
12841        use std::io::{Read, Seek};
12842
12843        use common::{url::Params, ToParts};
12844        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12845
12846        let mut dd = common::DefaultDelegate;
12847        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12848        dlg.begin(common::MethodInfo {
12849            id: "dataproc.projects.locations.sessions.delete",
12850            http_method: hyper::Method::DELETE,
12851        });
12852
12853        for &field in ["alt", "name", "requestId"].iter() {
12854            if self._additional_params.contains_key(field) {
12855                dlg.finished(false);
12856                return Err(common::Error::FieldClash(field));
12857            }
12858        }
12859
12860        let mut params = Params::with_capacity(4 + self._additional_params.len());
12861        params.push("name", self._name);
12862        if let Some(value) = self._request_id.as_ref() {
12863            params.push("requestId", value);
12864        }
12865
12866        params.extend(self._additional_params.iter());
12867
12868        params.push("alt", "json");
12869        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12870        if self._scopes.is_empty() {
12871            self._scopes
12872                .insert(Scope::CloudPlatform.as_ref().to_string());
12873        }
12874
12875        #[allow(clippy::single_element_loop)]
12876        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12877            url = params.uri_replacement(url, param_name, find_this, true);
12878        }
12879        {
12880            let to_remove = ["name"];
12881            params.remove_params(&to_remove);
12882        }
12883
12884        let url = params.parse_with_url(&url);
12885
12886        loop {
12887            let token = match self
12888                .hub
12889                .auth
12890                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12891                .await
12892            {
12893                Ok(token) => token,
12894                Err(e) => match dlg.token(e) {
12895                    Ok(token) => token,
12896                    Err(e) => {
12897                        dlg.finished(false);
12898                        return Err(common::Error::MissingToken(e));
12899                    }
12900                },
12901            };
12902            let mut req_result = {
12903                let client = &self.hub.client;
12904                dlg.pre_request();
12905                let mut req_builder = hyper::Request::builder()
12906                    .method(hyper::Method::DELETE)
12907                    .uri(url.as_str())
12908                    .header(USER_AGENT, self.hub._user_agent.clone());
12909
12910                if let Some(token) = token.as_ref() {
12911                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12912                }
12913
12914                let request = req_builder
12915                    .header(CONTENT_LENGTH, 0_u64)
12916                    .body(common::to_body::<String>(None));
12917
12918                client.request(request.unwrap()).await
12919            };
12920
12921            match req_result {
12922                Err(err) => {
12923                    if let common::Retry::After(d) = dlg.http_error(&err) {
12924                        sleep(d).await;
12925                        continue;
12926                    }
12927                    dlg.finished(false);
12928                    return Err(common::Error::HttpError(err));
12929                }
12930                Ok(res) => {
12931                    let (mut parts, body) = res.into_parts();
12932                    let mut body = common::Body::new(body);
12933                    if !parts.status.is_success() {
12934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12935                        let error = serde_json::from_str(&common::to_string(&bytes));
12936                        let response = common::to_response(parts, bytes.into());
12937
12938                        if let common::Retry::After(d) =
12939                            dlg.http_failure(&response, error.as_ref().ok())
12940                        {
12941                            sleep(d).await;
12942                            continue;
12943                        }
12944
12945                        dlg.finished(false);
12946
12947                        return Err(match error {
12948                            Ok(value) => common::Error::BadRequest(value),
12949                            _ => common::Error::Failure(response),
12950                        });
12951                    }
12952                    let response = {
12953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12954                        let encoded = common::to_string(&bytes);
12955                        match serde_json::from_str(&encoded) {
12956                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12957                            Err(error) => {
12958                                dlg.response_json_decode_error(&encoded, &error);
12959                                return Err(common::Error::JsonDecodeError(
12960                                    encoded.to_string(),
12961                                    error,
12962                                ));
12963                            }
12964                        }
12965                    };
12966
12967                    dlg.finished(true);
12968                    return Ok(response);
12969                }
12970            }
12971        }
12972    }
12973
12974    /// Required. The name of the session resource to delete.
12975    ///
12976    /// Sets the *name* path property to the given value.
12977    ///
12978    /// Even though the property as already been set when instantiating this call,
12979    /// we provide this method for API completeness.
12980    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionDeleteCall<'a, C> {
12981        self._name = new_value.to_string();
12982        self
12983    }
12984    /// Optional. A unique ID used to identify the request. If the service receives two DeleteSessionRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteSessionRequest)s with the same ID, the second request is ignored.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
12985    ///
12986    /// Sets the *request id* query property to the given value.
12987    pub fn request_id(mut self, new_value: &str) -> ProjectLocationSessionDeleteCall<'a, C> {
12988        self._request_id = Some(new_value.to_string());
12989        self
12990    }
12991    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12992    /// while executing the actual API request.
12993    ///
12994    /// ````text
12995    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12996    /// ````
12997    ///
12998    /// Sets the *delegate* property to the given value.
12999    pub fn delegate(
13000        mut self,
13001        new_value: &'a mut dyn common::Delegate,
13002    ) -> ProjectLocationSessionDeleteCall<'a, C> {
13003        self._delegate = Some(new_value);
13004        self
13005    }
13006
13007    /// Set any additional parameter of the query string used in the request.
13008    /// It should be used to set parameters which are not yet available through their own
13009    /// setters.
13010    ///
13011    /// Please note that this method must not be used to set any of the known parameters
13012    /// which have their own setter method. If done anyway, the request will fail.
13013    ///
13014    /// # Additional Parameters
13015    ///
13016    /// * *$.xgafv* (query-string) - V1 error format.
13017    /// * *access_token* (query-string) - OAuth access token.
13018    /// * *alt* (query-string) - Data format for response.
13019    /// * *callback* (query-string) - JSONP
13020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13021    /// * *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.
13022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13024    /// * *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.
13025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13027    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionDeleteCall<'a, C>
13028    where
13029        T: AsRef<str>,
13030    {
13031        self._additional_params
13032            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13033        self
13034    }
13035
13036    /// Identifies the authorization scope for the method you are building.
13037    ///
13038    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13039    /// [`Scope::CloudPlatform`].
13040    ///
13041    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13042    /// tokens for more than one scope.
13043    ///
13044    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13045    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13046    /// sufficient, a read-write scope will do as well.
13047    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionDeleteCall<'a, C>
13048    where
13049        St: AsRef<str>,
13050    {
13051        self._scopes.insert(String::from(scope.as_ref()));
13052        self
13053    }
13054    /// Identifies the authorization scope(s) for the method you are building.
13055    ///
13056    /// See [`Self::add_scope()`] for details.
13057    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionDeleteCall<'a, C>
13058    where
13059        I: IntoIterator<Item = St>,
13060        St: AsRef<str>,
13061    {
13062        self._scopes
13063            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13064        self
13065    }
13066
13067    /// Removes all scopes, and no default scope will be used either.
13068    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13069    /// for details).
13070    pub fn clear_scopes(mut self) -> ProjectLocationSessionDeleteCall<'a, C> {
13071        self._scopes.clear();
13072        self
13073    }
13074}
13075
13076/// Gets the resource representation for an interactive session.
13077///
13078/// A builder for the *locations.sessions.get* method supported by a *project* resource.
13079/// It is not used directly, but through a [`ProjectMethods`] instance.
13080///
13081/// # Example
13082///
13083/// Instantiate a resource method builder
13084///
13085/// ```test_harness,no_run
13086/// # extern crate hyper;
13087/// # extern crate hyper_rustls;
13088/// # extern crate google_dataproc1 as dataproc1;
13089/// # async fn dox() {
13090/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13091///
13092/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13093/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13094/// #     secret,
13095/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13096/// # ).build().await.unwrap();
13097///
13098/// # let client = hyper_util::client::legacy::Client::builder(
13099/// #     hyper_util::rt::TokioExecutor::new()
13100/// # )
13101/// # .build(
13102/// #     hyper_rustls::HttpsConnectorBuilder::new()
13103/// #         .with_native_roots()
13104/// #         .unwrap()
13105/// #         .https_or_http()
13106/// #         .enable_http1()
13107/// #         .build()
13108/// # );
13109/// # let mut hub = Dataproc::new(client, auth);
13110/// // You can configure optional parameters by calling the respective setters at will, and
13111/// // execute the final call using `doit()`.
13112/// // Values shown here are possibly random and not representative !
13113/// let result = hub.projects().locations_sessions_get("name")
13114///              .doit().await;
13115/// # }
13116/// ```
13117pub struct ProjectLocationSessionGetCall<'a, C>
13118where
13119    C: 'a,
13120{
13121    hub: &'a Dataproc<C>,
13122    _name: String,
13123    _delegate: Option<&'a mut dyn common::Delegate>,
13124    _additional_params: HashMap<String, String>,
13125    _scopes: BTreeSet<String>,
13126}
13127
13128impl<'a, C> common::CallBuilder for ProjectLocationSessionGetCall<'a, C> {}
13129
13130impl<'a, C> ProjectLocationSessionGetCall<'a, C>
13131where
13132    C: common::Connector,
13133{
13134    /// Perform the operation you have build so far.
13135    pub async fn doit(mut self) -> common::Result<(common::Response, Session)> {
13136        use std::borrow::Cow;
13137        use std::io::{Read, Seek};
13138
13139        use common::{url::Params, ToParts};
13140        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13141
13142        let mut dd = common::DefaultDelegate;
13143        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13144        dlg.begin(common::MethodInfo {
13145            id: "dataproc.projects.locations.sessions.get",
13146            http_method: hyper::Method::GET,
13147        });
13148
13149        for &field in ["alt", "name"].iter() {
13150            if self._additional_params.contains_key(field) {
13151                dlg.finished(false);
13152                return Err(common::Error::FieldClash(field));
13153            }
13154        }
13155
13156        let mut params = Params::with_capacity(3 + self._additional_params.len());
13157        params.push("name", self._name);
13158
13159        params.extend(self._additional_params.iter());
13160
13161        params.push("alt", "json");
13162        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13163        if self._scopes.is_empty() {
13164            self._scopes
13165                .insert(Scope::CloudPlatform.as_ref().to_string());
13166        }
13167
13168        #[allow(clippy::single_element_loop)]
13169        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13170            url = params.uri_replacement(url, param_name, find_this, true);
13171        }
13172        {
13173            let to_remove = ["name"];
13174            params.remove_params(&to_remove);
13175        }
13176
13177        let url = params.parse_with_url(&url);
13178
13179        loop {
13180            let token = match self
13181                .hub
13182                .auth
13183                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13184                .await
13185            {
13186                Ok(token) => token,
13187                Err(e) => match dlg.token(e) {
13188                    Ok(token) => token,
13189                    Err(e) => {
13190                        dlg.finished(false);
13191                        return Err(common::Error::MissingToken(e));
13192                    }
13193                },
13194            };
13195            let mut req_result = {
13196                let client = &self.hub.client;
13197                dlg.pre_request();
13198                let mut req_builder = hyper::Request::builder()
13199                    .method(hyper::Method::GET)
13200                    .uri(url.as_str())
13201                    .header(USER_AGENT, self.hub._user_agent.clone());
13202
13203                if let Some(token) = token.as_ref() {
13204                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13205                }
13206
13207                let request = req_builder
13208                    .header(CONTENT_LENGTH, 0_u64)
13209                    .body(common::to_body::<String>(None));
13210
13211                client.request(request.unwrap()).await
13212            };
13213
13214            match req_result {
13215                Err(err) => {
13216                    if let common::Retry::After(d) = dlg.http_error(&err) {
13217                        sleep(d).await;
13218                        continue;
13219                    }
13220                    dlg.finished(false);
13221                    return Err(common::Error::HttpError(err));
13222                }
13223                Ok(res) => {
13224                    let (mut parts, body) = res.into_parts();
13225                    let mut body = common::Body::new(body);
13226                    if !parts.status.is_success() {
13227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13228                        let error = serde_json::from_str(&common::to_string(&bytes));
13229                        let response = common::to_response(parts, bytes.into());
13230
13231                        if let common::Retry::After(d) =
13232                            dlg.http_failure(&response, error.as_ref().ok())
13233                        {
13234                            sleep(d).await;
13235                            continue;
13236                        }
13237
13238                        dlg.finished(false);
13239
13240                        return Err(match error {
13241                            Ok(value) => common::Error::BadRequest(value),
13242                            _ => common::Error::Failure(response),
13243                        });
13244                    }
13245                    let response = {
13246                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13247                        let encoded = common::to_string(&bytes);
13248                        match serde_json::from_str(&encoded) {
13249                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13250                            Err(error) => {
13251                                dlg.response_json_decode_error(&encoded, &error);
13252                                return Err(common::Error::JsonDecodeError(
13253                                    encoded.to_string(),
13254                                    error,
13255                                ));
13256                            }
13257                        }
13258                    };
13259
13260                    dlg.finished(true);
13261                    return Ok(response);
13262                }
13263            }
13264        }
13265    }
13266
13267    /// Required. The name of the session to retrieve.
13268    ///
13269    /// Sets the *name* path property to the given value.
13270    ///
13271    /// Even though the property as already been set when instantiating this call,
13272    /// we provide this method for API completeness.
13273    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionGetCall<'a, C> {
13274        self._name = new_value.to_string();
13275        self
13276    }
13277    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13278    /// while executing the actual API request.
13279    ///
13280    /// ````text
13281    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13282    /// ````
13283    ///
13284    /// Sets the *delegate* property to the given value.
13285    pub fn delegate(
13286        mut self,
13287        new_value: &'a mut dyn common::Delegate,
13288    ) -> ProjectLocationSessionGetCall<'a, C> {
13289        self._delegate = Some(new_value);
13290        self
13291    }
13292
13293    /// Set any additional parameter of the query string used in the request.
13294    /// It should be used to set parameters which are not yet available through their own
13295    /// setters.
13296    ///
13297    /// Please note that this method must not be used to set any of the known parameters
13298    /// which have their own setter method. If done anyway, the request will fail.
13299    ///
13300    /// # Additional Parameters
13301    ///
13302    /// * *$.xgafv* (query-string) - V1 error format.
13303    /// * *access_token* (query-string) - OAuth access token.
13304    /// * *alt* (query-string) - Data format for response.
13305    /// * *callback* (query-string) - JSONP
13306    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13307    /// * *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.
13308    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13309    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13310    /// * *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.
13311    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13312    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13313    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionGetCall<'a, C>
13314    where
13315        T: AsRef<str>,
13316    {
13317        self._additional_params
13318            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13319        self
13320    }
13321
13322    /// Identifies the authorization scope for the method you are building.
13323    ///
13324    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13325    /// [`Scope::CloudPlatform`].
13326    ///
13327    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13328    /// tokens for more than one scope.
13329    ///
13330    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13331    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13332    /// sufficient, a read-write scope will do as well.
13333    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionGetCall<'a, C>
13334    where
13335        St: AsRef<str>,
13336    {
13337        self._scopes.insert(String::from(scope.as_ref()));
13338        self
13339    }
13340    /// Identifies the authorization scope(s) for the method you are building.
13341    ///
13342    /// See [`Self::add_scope()`] for details.
13343    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionGetCall<'a, C>
13344    where
13345        I: IntoIterator<Item = St>,
13346        St: AsRef<str>,
13347    {
13348        self._scopes
13349            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13350        self
13351    }
13352
13353    /// Removes all scopes, and no default scope will be used either.
13354    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13355    /// for details).
13356    pub fn clear_scopes(mut self) -> ProjectLocationSessionGetCall<'a, C> {
13357        self._scopes.clear();
13358        self
13359    }
13360}
13361
13362/// Lists interactive sessions.
13363///
13364/// A builder for the *locations.sessions.list* method supported by a *project* resource.
13365/// It is not used directly, but through a [`ProjectMethods`] instance.
13366///
13367/// # Example
13368///
13369/// Instantiate a resource method builder
13370///
13371/// ```test_harness,no_run
13372/// # extern crate hyper;
13373/// # extern crate hyper_rustls;
13374/// # extern crate google_dataproc1 as dataproc1;
13375/// # async fn dox() {
13376/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13377///
13378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13379/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13380/// #     secret,
13381/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13382/// # ).build().await.unwrap();
13383///
13384/// # let client = hyper_util::client::legacy::Client::builder(
13385/// #     hyper_util::rt::TokioExecutor::new()
13386/// # )
13387/// # .build(
13388/// #     hyper_rustls::HttpsConnectorBuilder::new()
13389/// #         .with_native_roots()
13390/// #         .unwrap()
13391/// #         .https_or_http()
13392/// #         .enable_http1()
13393/// #         .build()
13394/// # );
13395/// # let mut hub = Dataproc::new(client, auth);
13396/// // You can configure optional parameters by calling the respective setters at will, and
13397/// // execute the final call using `doit()`.
13398/// // Values shown here are possibly random and not representative !
13399/// let result = hub.projects().locations_sessions_list("parent")
13400///              .page_token("dolor")
13401///              .page_size(-18)
13402///              .filter("et")
13403///              .doit().await;
13404/// # }
13405/// ```
13406pub struct ProjectLocationSessionListCall<'a, C>
13407where
13408    C: 'a,
13409{
13410    hub: &'a Dataproc<C>,
13411    _parent: String,
13412    _page_token: Option<String>,
13413    _page_size: Option<i32>,
13414    _filter: Option<String>,
13415    _delegate: Option<&'a mut dyn common::Delegate>,
13416    _additional_params: HashMap<String, String>,
13417    _scopes: BTreeSet<String>,
13418}
13419
13420impl<'a, C> common::CallBuilder for ProjectLocationSessionListCall<'a, C> {}
13421
13422impl<'a, C> ProjectLocationSessionListCall<'a, C>
13423where
13424    C: common::Connector,
13425{
13426    /// Perform the operation you have build so far.
13427    pub async fn doit(mut self) -> common::Result<(common::Response, ListSessionsResponse)> {
13428        use std::borrow::Cow;
13429        use std::io::{Read, Seek};
13430
13431        use common::{url::Params, ToParts};
13432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13433
13434        let mut dd = common::DefaultDelegate;
13435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13436        dlg.begin(common::MethodInfo {
13437            id: "dataproc.projects.locations.sessions.list",
13438            http_method: hyper::Method::GET,
13439        });
13440
13441        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
13442            if self._additional_params.contains_key(field) {
13443                dlg.finished(false);
13444                return Err(common::Error::FieldClash(field));
13445            }
13446        }
13447
13448        let mut params = Params::with_capacity(6 + self._additional_params.len());
13449        params.push("parent", self._parent);
13450        if let Some(value) = self._page_token.as_ref() {
13451            params.push("pageToken", value);
13452        }
13453        if let Some(value) = self._page_size.as_ref() {
13454            params.push("pageSize", value.to_string());
13455        }
13456        if let Some(value) = self._filter.as_ref() {
13457            params.push("filter", value);
13458        }
13459
13460        params.extend(self._additional_params.iter());
13461
13462        params.push("alt", "json");
13463        let mut url = self.hub._base_url.clone() + "v1/{+parent}/sessions";
13464        if self._scopes.is_empty() {
13465            self._scopes
13466                .insert(Scope::CloudPlatform.as_ref().to_string());
13467        }
13468
13469        #[allow(clippy::single_element_loop)]
13470        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13471            url = params.uri_replacement(url, param_name, find_this, true);
13472        }
13473        {
13474            let to_remove = ["parent"];
13475            params.remove_params(&to_remove);
13476        }
13477
13478        let url = params.parse_with_url(&url);
13479
13480        loop {
13481            let token = match self
13482                .hub
13483                .auth
13484                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13485                .await
13486            {
13487                Ok(token) => token,
13488                Err(e) => match dlg.token(e) {
13489                    Ok(token) => token,
13490                    Err(e) => {
13491                        dlg.finished(false);
13492                        return Err(common::Error::MissingToken(e));
13493                    }
13494                },
13495            };
13496            let mut req_result = {
13497                let client = &self.hub.client;
13498                dlg.pre_request();
13499                let mut req_builder = hyper::Request::builder()
13500                    .method(hyper::Method::GET)
13501                    .uri(url.as_str())
13502                    .header(USER_AGENT, self.hub._user_agent.clone());
13503
13504                if let Some(token) = token.as_ref() {
13505                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13506                }
13507
13508                let request = req_builder
13509                    .header(CONTENT_LENGTH, 0_u64)
13510                    .body(common::to_body::<String>(None));
13511
13512                client.request(request.unwrap()).await
13513            };
13514
13515            match req_result {
13516                Err(err) => {
13517                    if let common::Retry::After(d) = dlg.http_error(&err) {
13518                        sleep(d).await;
13519                        continue;
13520                    }
13521                    dlg.finished(false);
13522                    return Err(common::Error::HttpError(err));
13523                }
13524                Ok(res) => {
13525                    let (mut parts, body) = res.into_parts();
13526                    let mut body = common::Body::new(body);
13527                    if !parts.status.is_success() {
13528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13529                        let error = serde_json::from_str(&common::to_string(&bytes));
13530                        let response = common::to_response(parts, bytes.into());
13531
13532                        if let common::Retry::After(d) =
13533                            dlg.http_failure(&response, error.as_ref().ok())
13534                        {
13535                            sleep(d).await;
13536                            continue;
13537                        }
13538
13539                        dlg.finished(false);
13540
13541                        return Err(match error {
13542                            Ok(value) => common::Error::BadRequest(value),
13543                            _ => common::Error::Failure(response),
13544                        });
13545                    }
13546                    let response = {
13547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13548                        let encoded = common::to_string(&bytes);
13549                        match serde_json::from_str(&encoded) {
13550                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13551                            Err(error) => {
13552                                dlg.response_json_decode_error(&encoded, &error);
13553                                return Err(common::Error::JsonDecodeError(
13554                                    encoded.to_string(),
13555                                    error,
13556                                ));
13557                            }
13558                        }
13559                    };
13560
13561                    dlg.finished(true);
13562                    return Ok(response);
13563                }
13564            }
13565        }
13566    }
13567
13568    /// Required. The parent, which owns this collection of sessions.
13569    ///
13570    /// Sets the *parent* path property to the given value.
13571    ///
13572    /// Even though the property as already been set when instantiating this call,
13573    /// we provide this method for API completeness.
13574    pub fn parent(mut self, new_value: &str) -> ProjectLocationSessionListCall<'a, C> {
13575        self._parent = new_value.to_string();
13576        self
13577    }
13578    /// Optional. A page token received from a previous ListSessions call. Provide this token to retrieve the subsequent page.
13579    ///
13580    /// Sets the *page token* query property to the given value.
13581    pub fn page_token(mut self, new_value: &str) -> ProjectLocationSessionListCall<'a, C> {
13582        self._page_token = Some(new_value.to_string());
13583        self
13584    }
13585    /// Optional. The maximum number of sessions to return in each response. The service may return fewer than this value.
13586    ///
13587    /// Sets the *page size* query property to the given value.
13588    pub fn page_size(mut self, new_value: i32) -> ProjectLocationSessionListCall<'a, C> {
13589        self._page_size = Some(new_value);
13590        self
13591    }
13592    /// Optional. A filter for the sessions to return in the response.A filter is a logical expression constraining the values of various fields in each session resource. Filters are case sensitive, and may contain multiple clauses combined with logical operators (AND, OR). Supported fields are session_id, session_uuid, state, create_time, and labels.Example: state = ACTIVE and create_time < "2023-01-01T00:00:00Z" is a filter for sessions in an ACTIVE state that were created before 2023-01-01. state = ACTIVE and labels.environment=production is a filter for sessions in an ACTIVE state that have a production environment label.See https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed description of the filter syntax and a list of supported comparators.
13593    ///
13594    /// Sets the *filter* query property to the given value.
13595    pub fn filter(mut self, new_value: &str) -> ProjectLocationSessionListCall<'a, C> {
13596        self._filter = Some(new_value.to_string());
13597        self
13598    }
13599    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13600    /// while executing the actual API request.
13601    ///
13602    /// ````text
13603    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13604    /// ````
13605    ///
13606    /// Sets the *delegate* property to the given value.
13607    pub fn delegate(
13608        mut self,
13609        new_value: &'a mut dyn common::Delegate,
13610    ) -> ProjectLocationSessionListCall<'a, C> {
13611        self._delegate = Some(new_value);
13612        self
13613    }
13614
13615    /// Set any additional parameter of the query string used in the request.
13616    /// It should be used to set parameters which are not yet available through their own
13617    /// setters.
13618    ///
13619    /// Please note that this method must not be used to set any of the known parameters
13620    /// which have their own setter method. If done anyway, the request will fail.
13621    ///
13622    /// # Additional Parameters
13623    ///
13624    /// * *$.xgafv* (query-string) - V1 error format.
13625    /// * *access_token* (query-string) - OAuth access token.
13626    /// * *alt* (query-string) - Data format for response.
13627    /// * *callback* (query-string) - JSONP
13628    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13629    /// * *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.
13630    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13631    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13632    /// * *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.
13633    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13634    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13635    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionListCall<'a, C>
13636    where
13637        T: AsRef<str>,
13638    {
13639        self._additional_params
13640            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13641        self
13642    }
13643
13644    /// Identifies the authorization scope for the method you are building.
13645    ///
13646    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13647    /// [`Scope::CloudPlatform`].
13648    ///
13649    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13650    /// tokens for more than one scope.
13651    ///
13652    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13653    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13654    /// sufficient, a read-write scope will do as well.
13655    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionListCall<'a, C>
13656    where
13657        St: AsRef<str>,
13658    {
13659        self._scopes.insert(String::from(scope.as_ref()));
13660        self
13661    }
13662    /// Identifies the authorization scope(s) for the method you are building.
13663    ///
13664    /// See [`Self::add_scope()`] for details.
13665    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionListCall<'a, C>
13666    where
13667        I: IntoIterator<Item = St>,
13668        St: AsRef<str>,
13669    {
13670        self._scopes
13671            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13672        self
13673    }
13674
13675    /// Removes all scopes, and no default scope will be used either.
13676    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13677    /// for details).
13678    pub fn clear_scopes(mut self) -> ProjectLocationSessionListCall<'a, C> {
13679        self._scopes.clear();
13680        self
13681    }
13682}
13683
13684/// Terminates the interactive session.
13685///
13686/// A builder for the *locations.sessions.terminate* method supported by a *project* resource.
13687/// It is not used directly, but through a [`ProjectMethods`] instance.
13688///
13689/// # Example
13690///
13691/// Instantiate a resource method builder
13692///
13693/// ```test_harness,no_run
13694/// # extern crate hyper;
13695/// # extern crate hyper_rustls;
13696/// # extern crate google_dataproc1 as dataproc1;
13697/// use dataproc1::api::TerminateSessionRequest;
13698/// # async fn dox() {
13699/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13700///
13701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13702/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13703/// #     secret,
13704/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13705/// # ).build().await.unwrap();
13706///
13707/// # let client = hyper_util::client::legacy::Client::builder(
13708/// #     hyper_util::rt::TokioExecutor::new()
13709/// # )
13710/// # .build(
13711/// #     hyper_rustls::HttpsConnectorBuilder::new()
13712/// #         .with_native_roots()
13713/// #         .unwrap()
13714/// #         .https_or_http()
13715/// #         .enable_http1()
13716/// #         .build()
13717/// # );
13718/// # let mut hub = Dataproc::new(client, auth);
13719/// // As the method needs a request, you would usually fill it with the desired information
13720/// // into the respective structure. Some of the parts shown here might not be applicable !
13721/// // Values shown here are possibly random and not representative !
13722/// let mut req = TerminateSessionRequest::default();
13723///
13724/// // You can configure optional parameters by calling the respective setters at will, and
13725/// // execute the final call using `doit()`.
13726/// // Values shown here are possibly random and not representative !
13727/// let result = hub.projects().locations_sessions_terminate(req, "name")
13728///              .doit().await;
13729/// # }
13730/// ```
13731pub struct ProjectLocationSessionTerminateCall<'a, C>
13732where
13733    C: 'a,
13734{
13735    hub: &'a Dataproc<C>,
13736    _request: TerminateSessionRequest,
13737    _name: String,
13738    _delegate: Option<&'a mut dyn common::Delegate>,
13739    _additional_params: HashMap<String, String>,
13740    _scopes: BTreeSet<String>,
13741}
13742
13743impl<'a, C> common::CallBuilder for ProjectLocationSessionTerminateCall<'a, C> {}
13744
13745impl<'a, C> ProjectLocationSessionTerminateCall<'a, C>
13746where
13747    C: common::Connector,
13748{
13749    /// Perform the operation you have build so far.
13750    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13751        use std::borrow::Cow;
13752        use std::io::{Read, Seek};
13753
13754        use common::{url::Params, ToParts};
13755        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13756
13757        let mut dd = common::DefaultDelegate;
13758        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13759        dlg.begin(common::MethodInfo {
13760            id: "dataproc.projects.locations.sessions.terminate",
13761            http_method: hyper::Method::POST,
13762        });
13763
13764        for &field in ["alt", "name"].iter() {
13765            if self._additional_params.contains_key(field) {
13766                dlg.finished(false);
13767                return Err(common::Error::FieldClash(field));
13768            }
13769        }
13770
13771        let mut params = Params::with_capacity(4 + self._additional_params.len());
13772        params.push("name", self._name);
13773
13774        params.extend(self._additional_params.iter());
13775
13776        params.push("alt", "json");
13777        let mut url = self.hub._base_url.clone() + "v1/{+name}:terminate";
13778        if self._scopes.is_empty() {
13779            self._scopes
13780                .insert(Scope::CloudPlatform.as_ref().to_string());
13781        }
13782
13783        #[allow(clippy::single_element_loop)]
13784        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13785            url = params.uri_replacement(url, param_name, find_this, true);
13786        }
13787        {
13788            let to_remove = ["name"];
13789            params.remove_params(&to_remove);
13790        }
13791
13792        let url = params.parse_with_url(&url);
13793
13794        let mut json_mime_type = mime::APPLICATION_JSON;
13795        let mut request_value_reader = {
13796            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13797            common::remove_json_null_values(&mut value);
13798            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13799            serde_json::to_writer(&mut dst, &value).unwrap();
13800            dst
13801        };
13802        let request_size = request_value_reader
13803            .seek(std::io::SeekFrom::End(0))
13804            .unwrap();
13805        request_value_reader
13806            .seek(std::io::SeekFrom::Start(0))
13807            .unwrap();
13808
13809        loop {
13810            let token = match self
13811                .hub
13812                .auth
13813                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13814                .await
13815            {
13816                Ok(token) => token,
13817                Err(e) => match dlg.token(e) {
13818                    Ok(token) => token,
13819                    Err(e) => {
13820                        dlg.finished(false);
13821                        return Err(common::Error::MissingToken(e));
13822                    }
13823                },
13824            };
13825            request_value_reader
13826                .seek(std::io::SeekFrom::Start(0))
13827                .unwrap();
13828            let mut req_result = {
13829                let client = &self.hub.client;
13830                dlg.pre_request();
13831                let mut req_builder = hyper::Request::builder()
13832                    .method(hyper::Method::POST)
13833                    .uri(url.as_str())
13834                    .header(USER_AGENT, self.hub._user_agent.clone());
13835
13836                if let Some(token) = token.as_ref() {
13837                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13838                }
13839
13840                let request = req_builder
13841                    .header(CONTENT_TYPE, json_mime_type.to_string())
13842                    .header(CONTENT_LENGTH, request_size as u64)
13843                    .body(common::to_body(
13844                        request_value_reader.get_ref().clone().into(),
13845                    ));
13846
13847                client.request(request.unwrap()).await
13848            };
13849
13850            match req_result {
13851                Err(err) => {
13852                    if let common::Retry::After(d) = dlg.http_error(&err) {
13853                        sleep(d).await;
13854                        continue;
13855                    }
13856                    dlg.finished(false);
13857                    return Err(common::Error::HttpError(err));
13858                }
13859                Ok(res) => {
13860                    let (mut parts, body) = res.into_parts();
13861                    let mut body = common::Body::new(body);
13862                    if !parts.status.is_success() {
13863                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13864                        let error = serde_json::from_str(&common::to_string(&bytes));
13865                        let response = common::to_response(parts, bytes.into());
13866
13867                        if let common::Retry::After(d) =
13868                            dlg.http_failure(&response, error.as_ref().ok())
13869                        {
13870                            sleep(d).await;
13871                            continue;
13872                        }
13873
13874                        dlg.finished(false);
13875
13876                        return Err(match error {
13877                            Ok(value) => common::Error::BadRequest(value),
13878                            _ => common::Error::Failure(response),
13879                        });
13880                    }
13881                    let response = {
13882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13883                        let encoded = common::to_string(&bytes);
13884                        match serde_json::from_str(&encoded) {
13885                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13886                            Err(error) => {
13887                                dlg.response_json_decode_error(&encoded, &error);
13888                                return Err(common::Error::JsonDecodeError(
13889                                    encoded.to_string(),
13890                                    error,
13891                                ));
13892                            }
13893                        }
13894                    };
13895
13896                    dlg.finished(true);
13897                    return Ok(response);
13898                }
13899            }
13900        }
13901    }
13902
13903    ///
13904    /// Sets the *request* property to the given value.
13905    ///
13906    /// Even though the property as already been set when instantiating this call,
13907    /// we provide this method for API completeness.
13908    pub fn request(
13909        mut self,
13910        new_value: TerminateSessionRequest,
13911    ) -> ProjectLocationSessionTerminateCall<'a, C> {
13912        self._request = new_value;
13913        self
13914    }
13915    /// Required. The name of the session resource to terminate.
13916    ///
13917    /// Sets the *name* path property to the given value.
13918    ///
13919    /// Even though the property as already been set when instantiating this call,
13920    /// we provide this method for API completeness.
13921    pub fn name(mut self, new_value: &str) -> ProjectLocationSessionTerminateCall<'a, C> {
13922        self._name = new_value.to_string();
13923        self
13924    }
13925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13926    /// while executing the actual API request.
13927    ///
13928    /// ````text
13929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13930    /// ````
13931    ///
13932    /// Sets the *delegate* property to the given value.
13933    pub fn delegate(
13934        mut self,
13935        new_value: &'a mut dyn common::Delegate,
13936    ) -> ProjectLocationSessionTerminateCall<'a, C> {
13937        self._delegate = Some(new_value);
13938        self
13939    }
13940
13941    /// Set any additional parameter of the query string used in the request.
13942    /// It should be used to set parameters which are not yet available through their own
13943    /// setters.
13944    ///
13945    /// Please note that this method must not be used to set any of the known parameters
13946    /// which have their own setter method. If done anyway, the request will fail.
13947    ///
13948    /// # Additional Parameters
13949    ///
13950    /// * *$.xgafv* (query-string) - V1 error format.
13951    /// * *access_token* (query-string) - OAuth access token.
13952    /// * *alt* (query-string) - Data format for response.
13953    /// * *callback* (query-string) - JSONP
13954    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13955    /// * *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.
13956    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13957    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13958    /// * *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.
13959    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13960    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13961    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationSessionTerminateCall<'a, C>
13962    where
13963        T: AsRef<str>,
13964    {
13965        self._additional_params
13966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13967        self
13968    }
13969
13970    /// Identifies the authorization scope for the method you are building.
13971    ///
13972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13973    /// [`Scope::CloudPlatform`].
13974    ///
13975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13976    /// tokens for more than one scope.
13977    ///
13978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13980    /// sufficient, a read-write scope will do as well.
13981    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationSessionTerminateCall<'a, C>
13982    where
13983        St: AsRef<str>,
13984    {
13985        self._scopes.insert(String::from(scope.as_ref()));
13986        self
13987    }
13988    /// Identifies the authorization scope(s) for the method you are building.
13989    ///
13990    /// See [`Self::add_scope()`] for details.
13991    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationSessionTerminateCall<'a, C>
13992    where
13993        I: IntoIterator<Item = St>,
13994        St: AsRef<str>,
13995    {
13996        self._scopes
13997            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13998        self
13999    }
14000
14001    /// Removes all scopes, and no default scope will be used either.
14002    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14003    /// for details).
14004    pub fn clear_scopes(mut self) -> ProjectLocationSessionTerminateCall<'a, C> {
14005        self._scopes.clear();
14006        self
14007    }
14008}
14009
14010/// Creates new workflow template.
14011///
14012/// A builder for the *locations.workflowTemplates.create* method supported by a *project* resource.
14013/// It is not used directly, but through a [`ProjectMethods`] instance.
14014///
14015/// # Example
14016///
14017/// Instantiate a resource method builder
14018///
14019/// ```test_harness,no_run
14020/// # extern crate hyper;
14021/// # extern crate hyper_rustls;
14022/// # extern crate google_dataproc1 as dataproc1;
14023/// use dataproc1::api::WorkflowTemplate;
14024/// # async fn dox() {
14025/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14026///
14027/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14029/// #     secret,
14030/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14031/// # ).build().await.unwrap();
14032///
14033/// # let client = hyper_util::client::legacy::Client::builder(
14034/// #     hyper_util::rt::TokioExecutor::new()
14035/// # )
14036/// # .build(
14037/// #     hyper_rustls::HttpsConnectorBuilder::new()
14038/// #         .with_native_roots()
14039/// #         .unwrap()
14040/// #         .https_or_http()
14041/// #         .enable_http1()
14042/// #         .build()
14043/// # );
14044/// # let mut hub = Dataproc::new(client, auth);
14045/// // As the method needs a request, you would usually fill it with the desired information
14046/// // into the respective structure. Some of the parts shown here might not be applicable !
14047/// // Values shown here are possibly random and not representative !
14048/// let mut req = WorkflowTemplate::default();
14049///
14050/// // You can configure optional parameters by calling the respective setters at will, and
14051/// // execute the final call using `doit()`.
14052/// // Values shown here are possibly random and not representative !
14053/// let result = hub.projects().locations_workflow_templates_create(req, "parent")
14054///              .doit().await;
14055/// # }
14056/// ```
14057pub struct ProjectLocationWorkflowTemplateCreateCall<'a, C>
14058where
14059    C: 'a,
14060{
14061    hub: &'a Dataproc<C>,
14062    _request: WorkflowTemplate,
14063    _parent: String,
14064    _delegate: Option<&'a mut dyn common::Delegate>,
14065    _additional_params: HashMap<String, String>,
14066    _scopes: BTreeSet<String>,
14067}
14068
14069impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateCreateCall<'a, C> {}
14070
14071impl<'a, C> ProjectLocationWorkflowTemplateCreateCall<'a, C>
14072where
14073    C: common::Connector,
14074{
14075    /// Perform the operation you have build so far.
14076    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
14077        use std::borrow::Cow;
14078        use std::io::{Read, Seek};
14079
14080        use common::{url::Params, ToParts};
14081        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14082
14083        let mut dd = common::DefaultDelegate;
14084        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14085        dlg.begin(common::MethodInfo {
14086            id: "dataproc.projects.locations.workflowTemplates.create",
14087            http_method: hyper::Method::POST,
14088        });
14089
14090        for &field in ["alt", "parent"].iter() {
14091            if self._additional_params.contains_key(field) {
14092                dlg.finished(false);
14093                return Err(common::Error::FieldClash(field));
14094            }
14095        }
14096
14097        let mut params = Params::with_capacity(4 + self._additional_params.len());
14098        params.push("parent", self._parent);
14099
14100        params.extend(self._additional_params.iter());
14101
14102        params.push("alt", "json");
14103        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates";
14104        if self._scopes.is_empty() {
14105            self._scopes
14106                .insert(Scope::CloudPlatform.as_ref().to_string());
14107        }
14108
14109        #[allow(clippy::single_element_loop)]
14110        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14111            url = params.uri_replacement(url, param_name, find_this, true);
14112        }
14113        {
14114            let to_remove = ["parent"];
14115            params.remove_params(&to_remove);
14116        }
14117
14118        let url = params.parse_with_url(&url);
14119
14120        let mut json_mime_type = mime::APPLICATION_JSON;
14121        let mut request_value_reader = {
14122            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14123            common::remove_json_null_values(&mut value);
14124            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14125            serde_json::to_writer(&mut dst, &value).unwrap();
14126            dst
14127        };
14128        let request_size = request_value_reader
14129            .seek(std::io::SeekFrom::End(0))
14130            .unwrap();
14131        request_value_reader
14132            .seek(std::io::SeekFrom::Start(0))
14133            .unwrap();
14134
14135        loop {
14136            let token = match self
14137                .hub
14138                .auth
14139                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14140                .await
14141            {
14142                Ok(token) => token,
14143                Err(e) => match dlg.token(e) {
14144                    Ok(token) => token,
14145                    Err(e) => {
14146                        dlg.finished(false);
14147                        return Err(common::Error::MissingToken(e));
14148                    }
14149                },
14150            };
14151            request_value_reader
14152                .seek(std::io::SeekFrom::Start(0))
14153                .unwrap();
14154            let mut req_result = {
14155                let client = &self.hub.client;
14156                dlg.pre_request();
14157                let mut req_builder = hyper::Request::builder()
14158                    .method(hyper::Method::POST)
14159                    .uri(url.as_str())
14160                    .header(USER_AGENT, self.hub._user_agent.clone());
14161
14162                if let Some(token) = token.as_ref() {
14163                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14164                }
14165
14166                let request = req_builder
14167                    .header(CONTENT_TYPE, json_mime_type.to_string())
14168                    .header(CONTENT_LENGTH, request_size as u64)
14169                    .body(common::to_body(
14170                        request_value_reader.get_ref().clone().into(),
14171                    ));
14172
14173                client.request(request.unwrap()).await
14174            };
14175
14176            match req_result {
14177                Err(err) => {
14178                    if let common::Retry::After(d) = dlg.http_error(&err) {
14179                        sleep(d).await;
14180                        continue;
14181                    }
14182                    dlg.finished(false);
14183                    return Err(common::Error::HttpError(err));
14184                }
14185                Ok(res) => {
14186                    let (mut parts, body) = res.into_parts();
14187                    let mut body = common::Body::new(body);
14188                    if !parts.status.is_success() {
14189                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14190                        let error = serde_json::from_str(&common::to_string(&bytes));
14191                        let response = common::to_response(parts, bytes.into());
14192
14193                        if let common::Retry::After(d) =
14194                            dlg.http_failure(&response, error.as_ref().ok())
14195                        {
14196                            sleep(d).await;
14197                            continue;
14198                        }
14199
14200                        dlg.finished(false);
14201
14202                        return Err(match error {
14203                            Ok(value) => common::Error::BadRequest(value),
14204                            _ => common::Error::Failure(response),
14205                        });
14206                    }
14207                    let response = {
14208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14209                        let encoded = common::to_string(&bytes);
14210                        match serde_json::from_str(&encoded) {
14211                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14212                            Err(error) => {
14213                                dlg.response_json_decode_error(&encoded, &error);
14214                                return Err(common::Error::JsonDecodeError(
14215                                    encoded.to_string(),
14216                                    error,
14217                                ));
14218                            }
14219                        }
14220                    };
14221
14222                    dlg.finished(true);
14223                    return Ok(response);
14224                }
14225            }
14226        }
14227    }
14228
14229    ///
14230    /// Sets the *request* property to the given value.
14231    ///
14232    /// Even though the property as already been set when instantiating this call,
14233    /// we provide this method for API completeness.
14234    pub fn request(
14235        mut self,
14236        new_value: WorkflowTemplate,
14237    ) -> ProjectLocationWorkflowTemplateCreateCall<'a, C> {
14238        self._request = new_value;
14239        self
14240    }
14241    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
14242    ///
14243    /// Sets the *parent* path property to the given value.
14244    ///
14245    /// Even though the property as already been set when instantiating this call,
14246    /// we provide this method for API completeness.
14247    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateCreateCall<'a, C> {
14248        self._parent = new_value.to_string();
14249        self
14250    }
14251    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14252    /// while executing the actual API request.
14253    ///
14254    /// ````text
14255    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14256    /// ````
14257    ///
14258    /// Sets the *delegate* property to the given value.
14259    pub fn delegate(
14260        mut self,
14261        new_value: &'a mut dyn common::Delegate,
14262    ) -> ProjectLocationWorkflowTemplateCreateCall<'a, C> {
14263        self._delegate = Some(new_value);
14264        self
14265    }
14266
14267    /// Set any additional parameter of the query string used in the request.
14268    /// It should be used to set parameters which are not yet available through their own
14269    /// setters.
14270    ///
14271    /// Please note that this method must not be used to set any of the known parameters
14272    /// which have their own setter method. If done anyway, the request will fail.
14273    ///
14274    /// # Additional Parameters
14275    ///
14276    /// * *$.xgafv* (query-string) - V1 error format.
14277    /// * *access_token* (query-string) - OAuth access token.
14278    /// * *alt* (query-string) - Data format for response.
14279    /// * *callback* (query-string) - JSONP
14280    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14281    /// * *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.
14282    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14283    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14284    /// * *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.
14285    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14286    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14287    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateCreateCall<'a, C>
14288    where
14289        T: AsRef<str>,
14290    {
14291        self._additional_params
14292            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14293        self
14294    }
14295
14296    /// Identifies the authorization scope for the method you are building.
14297    ///
14298    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14299    /// [`Scope::CloudPlatform`].
14300    ///
14301    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14302    /// tokens for more than one scope.
14303    ///
14304    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14305    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14306    /// sufficient, a read-write scope will do as well.
14307    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowTemplateCreateCall<'a, C>
14308    where
14309        St: AsRef<str>,
14310    {
14311        self._scopes.insert(String::from(scope.as_ref()));
14312        self
14313    }
14314    /// Identifies the authorization scope(s) for the method you are building.
14315    ///
14316    /// See [`Self::add_scope()`] for details.
14317    pub fn add_scopes<I, St>(
14318        mut self,
14319        scopes: I,
14320    ) -> ProjectLocationWorkflowTemplateCreateCall<'a, C>
14321    where
14322        I: IntoIterator<Item = St>,
14323        St: AsRef<str>,
14324    {
14325        self._scopes
14326            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14327        self
14328    }
14329
14330    /// Removes all scopes, and no default scope will be used either.
14331    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14332    /// for details).
14333    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateCreateCall<'a, C> {
14334        self._scopes.clear();
14335        self
14336    }
14337}
14338
14339/// Deletes a workflow template. It does not cancel in-progress workflows.
14340///
14341/// A builder for the *locations.workflowTemplates.delete* method supported by a *project* resource.
14342/// It is not used directly, but through a [`ProjectMethods`] instance.
14343///
14344/// # Example
14345///
14346/// Instantiate a resource method builder
14347///
14348/// ```test_harness,no_run
14349/// # extern crate hyper;
14350/// # extern crate hyper_rustls;
14351/// # extern crate google_dataproc1 as dataproc1;
14352/// # async fn dox() {
14353/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14354///
14355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14357/// #     secret,
14358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14359/// # ).build().await.unwrap();
14360///
14361/// # let client = hyper_util::client::legacy::Client::builder(
14362/// #     hyper_util::rt::TokioExecutor::new()
14363/// # )
14364/// # .build(
14365/// #     hyper_rustls::HttpsConnectorBuilder::new()
14366/// #         .with_native_roots()
14367/// #         .unwrap()
14368/// #         .https_or_http()
14369/// #         .enable_http1()
14370/// #         .build()
14371/// # );
14372/// # let mut hub = Dataproc::new(client, auth);
14373/// // You can configure optional parameters by calling the respective setters at will, and
14374/// // execute the final call using `doit()`.
14375/// // Values shown here are possibly random and not representative !
14376/// let result = hub.projects().locations_workflow_templates_delete("name")
14377///              .version(-20)
14378///              .doit().await;
14379/// # }
14380/// ```
14381pub struct ProjectLocationWorkflowTemplateDeleteCall<'a, C>
14382where
14383    C: 'a,
14384{
14385    hub: &'a Dataproc<C>,
14386    _name: String,
14387    _version: Option<i32>,
14388    _delegate: Option<&'a mut dyn common::Delegate>,
14389    _additional_params: HashMap<String, String>,
14390    _scopes: BTreeSet<String>,
14391}
14392
14393impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateDeleteCall<'a, C> {}
14394
14395impl<'a, C> ProjectLocationWorkflowTemplateDeleteCall<'a, C>
14396where
14397    C: common::Connector,
14398{
14399    /// Perform the operation you have build so far.
14400    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
14401        use std::borrow::Cow;
14402        use std::io::{Read, Seek};
14403
14404        use common::{url::Params, ToParts};
14405        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14406
14407        let mut dd = common::DefaultDelegate;
14408        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14409        dlg.begin(common::MethodInfo {
14410            id: "dataproc.projects.locations.workflowTemplates.delete",
14411            http_method: hyper::Method::DELETE,
14412        });
14413
14414        for &field in ["alt", "name", "version"].iter() {
14415            if self._additional_params.contains_key(field) {
14416                dlg.finished(false);
14417                return Err(common::Error::FieldClash(field));
14418            }
14419        }
14420
14421        let mut params = Params::with_capacity(4 + self._additional_params.len());
14422        params.push("name", self._name);
14423        if let Some(value) = self._version.as_ref() {
14424            params.push("version", value.to_string());
14425        }
14426
14427        params.extend(self._additional_params.iter());
14428
14429        params.push("alt", "json");
14430        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14431        if self._scopes.is_empty() {
14432            self._scopes
14433                .insert(Scope::CloudPlatform.as_ref().to_string());
14434        }
14435
14436        #[allow(clippy::single_element_loop)]
14437        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14438            url = params.uri_replacement(url, param_name, find_this, true);
14439        }
14440        {
14441            let to_remove = ["name"];
14442            params.remove_params(&to_remove);
14443        }
14444
14445        let url = params.parse_with_url(&url);
14446
14447        loop {
14448            let token = match self
14449                .hub
14450                .auth
14451                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14452                .await
14453            {
14454                Ok(token) => token,
14455                Err(e) => match dlg.token(e) {
14456                    Ok(token) => token,
14457                    Err(e) => {
14458                        dlg.finished(false);
14459                        return Err(common::Error::MissingToken(e));
14460                    }
14461                },
14462            };
14463            let mut req_result = {
14464                let client = &self.hub.client;
14465                dlg.pre_request();
14466                let mut req_builder = hyper::Request::builder()
14467                    .method(hyper::Method::DELETE)
14468                    .uri(url.as_str())
14469                    .header(USER_AGENT, self.hub._user_agent.clone());
14470
14471                if let Some(token) = token.as_ref() {
14472                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14473                }
14474
14475                let request = req_builder
14476                    .header(CONTENT_LENGTH, 0_u64)
14477                    .body(common::to_body::<String>(None));
14478
14479                client.request(request.unwrap()).await
14480            };
14481
14482            match req_result {
14483                Err(err) => {
14484                    if let common::Retry::After(d) = dlg.http_error(&err) {
14485                        sleep(d).await;
14486                        continue;
14487                    }
14488                    dlg.finished(false);
14489                    return Err(common::Error::HttpError(err));
14490                }
14491                Ok(res) => {
14492                    let (mut parts, body) = res.into_parts();
14493                    let mut body = common::Body::new(body);
14494                    if !parts.status.is_success() {
14495                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14496                        let error = serde_json::from_str(&common::to_string(&bytes));
14497                        let response = common::to_response(parts, bytes.into());
14498
14499                        if let common::Retry::After(d) =
14500                            dlg.http_failure(&response, error.as_ref().ok())
14501                        {
14502                            sleep(d).await;
14503                            continue;
14504                        }
14505
14506                        dlg.finished(false);
14507
14508                        return Err(match error {
14509                            Ok(value) => common::Error::BadRequest(value),
14510                            _ => common::Error::Failure(response),
14511                        });
14512                    }
14513                    let response = {
14514                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14515                        let encoded = common::to_string(&bytes);
14516                        match serde_json::from_str(&encoded) {
14517                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14518                            Err(error) => {
14519                                dlg.response_json_decode_error(&encoded, &error);
14520                                return Err(common::Error::JsonDecodeError(
14521                                    encoded.to_string(),
14522                                    error,
14523                                ));
14524                            }
14525                        }
14526                    };
14527
14528                    dlg.finished(true);
14529                    return Ok(response);
14530                }
14531            }
14532        }
14533    }
14534
14535    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
14536    ///
14537    /// Sets the *name* path property to the given value.
14538    ///
14539    /// Even though the property as already been set when instantiating this call,
14540    /// we provide this method for API completeness.
14541    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C> {
14542        self._name = new_value.to_string();
14543        self
14544    }
14545    /// Optional. The version of workflow template to delete. If specified, will only delete the template if the current server version matches specified version.
14546    ///
14547    /// Sets the *version* query property to the given value.
14548    pub fn version(mut self, new_value: i32) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C> {
14549        self._version = Some(new_value);
14550        self
14551    }
14552    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14553    /// while executing the actual API request.
14554    ///
14555    /// ````text
14556    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14557    /// ````
14558    ///
14559    /// Sets the *delegate* property to the given value.
14560    pub fn delegate(
14561        mut self,
14562        new_value: &'a mut dyn common::Delegate,
14563    ) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C> {
14564        self._delegate = Some(new_value);
14565        self
14566    }
14567
14568    /// Set any additional parameter of the query string used in the request.
14569    /// It should be used to set parameters which are not yet available through their own
14570    /// setters.
14571    ///
14572    /// Please note that this method must not be used to set any of the known parameters
14573    /// which have their own setter method. If done anyway, the request will fail.
14574    ///
14575    /// # Additional Parameters
14576    ///
14577    /// * *$.xgafv* (query-string) - V1 error format.
14578    /// * *access_token* (query-string) - OAuth access token.
14579    /// * *alt* (query-string) - Data format for response.
14580    /// * *callback* (query-string) - JSONP
14581    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14582    /// * *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.
14583    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14584    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14585    /// * *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.
14586    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14587    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14588    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C>
14589    where
14590        T: AsRef<str>,
14591    {
14592        self._additional_params
14593            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14594        self
14595    }
14596
14597    /// Identifies the authorization scope for the method you are building.
14598    ///
14599    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14600    /// [`Scope::CloudPlatform`].
14601    ///
14602    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14603    /// tokens for more than one scope.
14604    ///
14605    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14606    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14607    /// sufficient, a read-write scope will do as well.
14608    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C>
14609    where
14610        St: AsRef<str>,
14611    {
14612        self._scopes.insert(String::from(scope.as_ref()));
14613        self
14614    }
14615    /// Identifies the authorization scope(s) for the method you are building.
14616    ///
14617    /// See [`Self::add_scope()`] for details.
14618    pub fn add_scopes<I, St>(
14619        mut self,
14620        scopes: I,
14621    ) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C>
14622    where
14623        I: IntoIterator<Item = St>,
14624        St: AsRef<str>,
14625    {
14626        self._scopes
14627            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14628        self
14629    }
14630
14631    /// Removes all scopes, and no default scope will be used either.
14632    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14633    /// for details).
14634    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateDeleteCall<'a, C> {
14635        self._scopes.clear();
14636        self
14637    }
14638}
14639
14640/// Retrieves the latest workflow template.Can retrieve previously instantiated template by specifying optional version parameter.
14641///
14642/// A builder for the *locations.workflowTemplates.get* method supported by a *project* resource.
14643/// It is not used directly, but through a [`ProjectMethods`] instance.
14644///
14645/// # Example
14646///
14647/// Instantiate a resource method builder
14648///
14649/// ```test_harness,no_run
14650/// # extern crate hyper;
14651/// # extern crate hyper_rustls;
14652/// # extern crate google_dataproc1 as dataproc1;
14653/// # async fn dox() {
14654/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14655///
14656/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14657/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14658/// #     secret,
14659/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14660/// # ).build().await.unwrap();
14661///
14662/// # let client = hyper_util::client::legacy::Client::builder(
14663/// #     hyper_util::rt::TokioExecutor::new()
14664/// # )
14665/// # .build(
14666/// #     hyper_rustls::HttpsConnectorBuilder::new()
14667/// #         .with_native_roots()
14668/// #         .unwrap()
14669/// #         .https_or_http()
14670/// #         .enable_http1()
14671/// #         .build()
14672/// # );
14673/// # let mut hub = Dataproc::new(client, auth);
14674/// // You can configure optional parameters by calling the respective setters at will, and
14675/// // execute the final call using `doit()`.
14676/// // Values shown here are possibly random and not representative !
14677/// let result = hub.projects().locations_workflow_templates_get("name")
14678///              .version(-76)
14679///              .doit().await;
14680/// # }
14681/// ```
14682pub struct ProjectLocationWorkflowTemplateGetCall<'a, C>
14683where
14684    C: 'a,
14685{
14686    hub: &'a Dataproc<C>,
14687    _name: String,
14688    _version: Option<i32>,
14689    _delegate: Option<&'a mut dyn common::Delegate>,
14690    _additional_params: HashMap<String, String>,
14691    _scopes: BTreeSet<String>,
14692}
14693
14694impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateGetCall<'a, C> {}
14695
14696impl<'a, C> ProjectLocationWorkflowTemplateGetCall<'a, C>
14697where
14698    C: common::Connector,
14699{
14700    /// Perform the operation you have build so far.
14701    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
14702        use std::borrow::Cow;
14703        use std::io::{Read, Seek};
14704
14705        use common::{url::Params, ToParts};
14706        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14707
14708        let mut dd = common::DefaultDelegate;
14709        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14710        dlg.begin(common::MethodInfo {
14711            id: "dataproc.projects.locations.workflowTemplates.get",
14712            http_method: hyper::Method::GET,
14713        });
14714
14715        for &field in ["alt", "name", "version"].iter() {
14716            if self._additional_params.contains_key(field) {
14717                dlg.finished(false);
14718                return Err(common::Error::FieldClash(field));
14719            }
14720        }
14721
14722        let mut params = Params::with_capacity(4 + self._additional_params.len());
14723        params.push("name", self._name);
14724        if let Some(value) = self._version.as_ref() {
14725            params.push("version", value.to_string());
14726        }
14727
14728        params.extend(self._additional_params.iter());
14729
14730        params.push("alt", "json");
14731        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14732        if self._scopes.is_empty() {
14733            self._scopes
14734                .insert(Scope::CloudPlatform.as_ref().to_string());
14735        }
14736
14737        #[allow(clippy::single_element_loop)]
14738        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14739            url = params.uri_replacement(url, param_name, find_this, true);
14740        }
14741        {
14742            let to_remove = ["name"];
14743            params.remove_params(&to_remove);
14744        }
14745
14746        let url = params.parse_with_url(&url);
14747
14748        loop {
14749            let token = match self
14750                .hub
14751                .auth
14752                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14753                .await
14754            {
14755                Ok(token) => token,
14756                Err(e) => match dlg.token(e) {
14757                    Ok(token) => token,
14758                    Err(e) => {
14759                        dlg.finished(false);
14760                        return Err(common::Error::MissingToken(e));
14761                    }
14762                },
14763            };
14764            let mut req_result = {
14765                let client = &self.hub.client;
14766                dlg.pre_request();
14767                let mut req_builder = hyper::Request::builder()
14768                    .method(hyper::Method::GET)
14769                    .uri(url.as_str())
14770                    .header(USER_AGENT, self.hub._user_agent.clone());
14771
14772                if let Some(token) = token.as_ref() {
14773                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14774                }
14775
14776                let request = req_builder
14777                    .header(CONTENT_LENGTH, 0_u64)
14778                    .body(common::to_body::<String>(None));
14779
14780                client.request(request.unwrap()).await
14781            };
14782
14783            match req_result {
14784                Err(err) => {
14785                    if let common::Retry::After(d) = dlg.http_error(&err) {
14786                        sleep(d).await;
14787                        continue;
14788                    }
14789                    dlg.finished(false);
14790                    return Err(common::Error::HttpError(err));
14791                }
14792                Ok(res) => {
14793                    let (mut parts, body) = res.into_parts();
14794                    let mut body = common::Body::new(body);
14795                    if !parts.status.is_success() {
14796                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14797                        let error = serde_json::from_str(&common::to_string(&bytes));
14798                        let response = common::to_response(parts, bytes.into());
14799
14800                        if let common::Retry::After(d) =
14801                            dlg.http_failure(&response, error.as_ref().ok())
14802                        {
14803                            sleep(d).await;
14804                            continue;
14805                        }
14806
14807                        dlg.finished(false);
14808
14809                        return Err(match error {
14810                            Ok(value) => common::Error::BadRequest(value),
14811                            _ => common::Error::Failure(response),
14812                        });
14813                    }
14814                    let response = {
14815                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14816                        let encoded = common::to_string(&bytes);
14817                        match serde_json::from_str(&encoded) {
14818                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14819                            Err(error) => {
14820                                dlg.response_json_decode_error(&encoded, &error);
14821                                return Err(common::Error::JsonDecodeError(
14822                                    encoded.to_string(),
14823                                    error,
14824                                ));
14825                            }
14826                        }
14827                    };
14828
14829                    dlg.finished(true);
14830                    return Ok(response);
14831                }
14832            }
14833        }
14834    }
14835
14836    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
14837    ///
14838    /// Sets the *name* path property to the given value.
14839    ///
14840    /// Even though the property as already been set when instantiating this call,
14841    /// we provide this method for API completeness.
14842    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateGetCall<'a, C> {
14843        self._name = new_value.to_string();
14844        self
14845    }
14846    /// Optional. The version of workflow template to retrieve. Only previously instantiated versions can be retrieved.If unspecified, retrieves the current version.
14847    ///
14848    /// Sets the *version* query property to the given value.
14849    pub fn version(mut self, new_value: i32) -> ProjectLocationWorkflowTemplateGetCall<'a, C> {
14850        self._version = Some(new_value);
14851        self
14852    }
14853    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14854    /// while executing the actual API request.
14855    ///
14856    /// ````text
14857    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14858    /// ````
14859    ///
14860    /// Sets the *delegate* property to the given value.
14861    pub fn delegate(
14862        mut self,
14863        new_value: &'a mut dyn common::Delegate,
14864    ) -> ProjectLocationWorkflowTemplateGetCall<'a, C> {
14865        self._delegate = Some(new_value);
14866        self
14867    }
14868
14869    /// Set any additional parameter of the query string used in the request.
14870    /// It should be used to set parameters which are not yet available through their own
14871    /// setters.
14872    ///
14873    /// Please note that this method must not be used to set any of the known parameters
14874    /// which have their own setter method. If done anyway, the request will fail.
14875    ///
14876    /// # Additional Parameters
14877    ///
14878    /// * *$.xgafv* (query-string) - V1 error format.
14879    /// * *access_token* (query-string) - OAuth access token.
14880    /// * *alt* (query-string) - Data format for response.
14881    /// * *callback* (query-string) - JSONP
14882    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14883    /// * *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.
14884    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14885    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14886    /// * *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.
14887    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14888    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14889    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateGetCall<'a, C>
14890    where
14891        T: AsRef<str>,
14892    {
14893        self._additional_params
14894            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14895        self
14896    }
14897
14898    /// Identifies the authorization scope for the method you are building.
14899    ///
14900    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14901    /// [`Scope::CloudPlatform`].
14902    ///
14903    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14904    /// tokens for more than one scope.
14905    ///
14906    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14907    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14908    /// sufficient, a read-write scope will do as well.
14909    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowTemplateGetCall<'a, C>
14910    where
14911        St: AsRef<str>,
14912    {
14913        self._scopes.insert(String::from(scope.as_ref()));
14914        self
14915    }
14916    /// Identifies the authorization scope(s) for the method you are building.
14917    ///
14918    /// See [`Self::add_scope()`] for details.
14919    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowTemplateGetCall<'a, C>
14920    where
14921        I: IntoIterator<Item = St>,
14922        St: AsRef<str>,
14923    {
14924        self._scopes
14925            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14926        self
14927    }
14928
14929    /// Removes all scopes, and no default scope will be used either.
14930    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14931    /// for details).
14932    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateGetCall<'a, C> {
14933        self._scopes.clear();
14934        self
14935    }
14936}
14937
14938/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
14939///
14940/// A builder for the *locations.workflowTemplates.getIamPolicy* method supported by a *project* resource.
14941/// It is not used directly, but through a [`ProjectMethods`] instance.
14942///
14943/// # Example
14944///
14945/// Instantiate a resource method builder
14946///
14947/// ```test_harness,no_run
14948/// # extern crate hyper;
14949/// # extern crate hyper_rustls;
14950/// # extern crate google_dataproc1 as dataproc1;
14951/// use dataproc1::api::GetIamPolicyRequest;
14952/// # async fn dox() {
14953/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14954///
14955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14957/// #     secret,
14958/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14959/// # ).build().await.unwrap();
14960///
14961/// # let client = hyper_util::client::legacy::Client::builder(
14962/// #     hyper_util::rt::TokioExecutor::new()
14963/// # )
14964/// # .build(
14965/// #     hyper_rustls::HttpsConnectorBuilder::new()
14966/// #         .with_native_roots()
14967/// #         .unwrap()
14968/// #         .https_or_http()
14969/// #         .enable_http1()
14970/// #         .build()
14971/// # );
14972/// # let mut hub = Dataproc::new(client, auth);
14973/// // As the method needs a request, you would usually fill it with the desired information
14974/// // into the respective structure. Some of the parts shown here might not be applicable !
14975/// // Values shown here are possibly random and not representative !
14976/// let mut req = GetIamPolicyRequest::default();
14977///
14978/// // You can configure optional parameters by calling the respective setters at will, and
14979/// // execute the final call using `doit()`.
14980/// // Values shown here are possibly random and not representative !
14981/// let result = hub.projects().locations_workflow_templates_get_iam_policy(req, "resource")
14982///              .doit().await;
14983/// # }
14984/// ```
14985pub struct ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C>
14986where
14987    C: 'a,
14988{
14989    hub: &'a Dataproc<C>,
14990    _request: GetIamPolicyRequest,
14991    _resource: String,
14992    _delegate: Option<&'a mut dyn common::Delegate>,
14993    _additional_params: HashMap<String, String>,
14994    _scopes: BTreeSet<String>,
14995}
14996
14997impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {}
14998
14999impl<'a, C> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C>
15000where
15001    C: common::Connector,
15002{
15003    /// Perform the operation you have build so far.
15004    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15005        use std::borrow::Cow;
15006        use std::io::{Read, Seek};
15007
15008        use common::{url::Params, ToParts};
15009        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15010
15011        let mut dd = common::DefaultDelegate;
15012        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15013        dlg.begin(common::MethodInfo {
15014            id: "dataproc.projects.locations.workflowTemplates.getIamPolicy",
15015            http_method: hyper::Method::POST,
15016        });
15017
15018        for &field in ["alt", "resource"].iter() {
15019            if self._additional_params.contains_key(field) {
15020                dlg.finished(false);
15021                return Err(common::Error::FieldClash(field));
15022            }
15023        }
15024
15025        let mut params = Params::with_capacity(4 + self._additional_params.len());
15026        params.push("resource", self._resource);
15027
15028        params.extend(self._additional_params.iter());
15029
15030        params.push("alt", "json");
15031        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
15032        if self._scopes.is_empty() {
15033            self._scopes
15034                .insert(Scope::CloudPlatform.as_ref().to_string());
15035        }
15036
15037        #[allow(clippy::single_element_loop)]
15038        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15039            url = params.uri_replacement(url, param_name, find_this, true);
15040        }
15041        {
15042            let to_remove = ["resource"];
15043            params.remove_params(&to_remove);
15044        }
15045
15046        let url = params.parse_with_url(&url);
15047
15048        let mut json_mime_type = mime::APPLICATION_JSON;
15049        let mut request_value_reader = {
15050            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15051            common::remove_json_null_values(&mut value);
15052            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15053            serde_json::to_writer(&mut dst, &value).unwrap();
15054            dst
15055        };
15056        let request_size = request_value_reader
15057            .seek(std::io::SeekFrom::End(0))
15058            .unwrap();
15059        request_value_reader
15060            .seek(std::io::SeekFrom::Start(0))
15061            .unwrap();
15062
15063        loop {
15064            let token = match self
15065                .hub
15066                .auth
15067                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15068                .await
15069            {
15070                Ok(token) => token,
15071                Err(e) => match dlg.token(e) {
15072                    Ok(token) => token,
15073                    Err(e) => {
15074                        dlg.finished(false);
15075                        return Err(common::Error::MissingToken(e));
15076                    }
15077                },
15078            };
15079            request_value_reader
15080                .seek(std::io::SeekFrom::Start(0))
15081                .unwrap();
15082            let mut req_result = {
15083                let client = &self.hub.client;
15084                dlg.pre_request();
15085                let mut req_builder = hyper::Request::builder()
15086                    .method(hyper::Method::POST)
15087                    .uri(url.as_str())
15088                    .header(USER_AGENT, self.hub._user_agent.clone());
15089
15090                if let Some(token) = token.as_ref() {
15091                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15092                }
15093
15094                let request = req_builder
15095                    .header(CONTENT_TYPE, json_mime_type.to_string())
15096                    .header(CONTENT_LENGTH, request_size as u64)
15097                    .body(common::to_body(
15098                        request_value_reader.get_ref().clone().into(),
15099                    ));
15100
15101                client.request(request.unwrap()).await
15102            };
15103
15104            match req_result {
15105                Err(err) => {
15106                    if let common::Retry::After(d) = dlg.http_error(&err) {
15107                        sleep(d).await;
15108                        continue;
15109                    }
15110                    dlg.finished(false);
15111                    return Err(common::Error::HttpError(err));
15112                }
15113                Ok(res) => {
15114                    let (mut parts, body) = res.into_parts();
15115                    let mut body = common::Body::new(body);
15116                    if !parts.status.is_success() {
15117                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15118                        let error = serde_json::from_str(&common::to_string(&bytes));
15119                        let response = common::to_response(parts, bytes.into());
15120
15121                        if let common::Retry::After(d) =
15122                            dlg.http_failure(&response, error.as_ref().ok())
15123                        {
15124                            sleep(d).await;
15125                            continue;
15126                        }
15127
15128                        dlg.finished(false);
15129
15130                        return Err(match error {
15131                            Ok(value) => common::Error::BadRequest(value),
15132                            _ => common::Error::Failure(response),
15133                        });
15134                    }
15135                    let response = {
15136                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15137                        let encoded = common::to_string(&bytes);
15138                        match serde_json::from_str(&encoded) {
15139                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15140                            Err(error) => {
15141                                dlg.response_json_decode_error(&encoded, &error);
15142                                return Err(common::Error::JsonDecodeError(
15143                                    encoded.to_string(),
15144                                    error,
15145                                ));
15146                            }
15147                        }
15148                    };
15149
15150                    dlg.finished(true);
15151                    return Ok(response);
15152                }
15153            }
15154        }
15155    }
15156
15157    ///
15158    /// Sets the *request* property to the given value.
15159    ///
15160    /// Even though the property as already been set when instantiating this call,
15161    /// we provide this method for API completeness.
15162    pub fn request(
15163        mut self,
15164        new_value: GetIamPolicyRequest,
15165    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {
15166        self._request = new_value;
15167        self
15168    }
15169    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
15170    ///
15171    /// Sets the *resource* path property to the given value.
15172    ///
15173    /// Even though the property as already been set when instantiating this call,
15174    /// we provide this method for API completeness.
15175    pub fn resource(
15176        mut self,
15177        new_value: &str,
15178    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {
15179        self._resource = new_value.to_string();
15180        self
15181    }
15182    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15183    /// while executing the actual API request.
15184    ///
15185    /// ````text
15186    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15187    /// ````
15188    ///
15189    /// Sets the *delegate* property to the given value.
15190    pub fn delegate(
15191        mut self,
15192        new_value: &'a mut dyn common::Delegate,
15193    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {
15194        self._delegate = Some(new_value);
15195        self
15196    }
15197
15198    /// Set any additional parameter of the query string used in the request.
15199    /// It should be used to set parameters which are not yet available through their own
15200    /// setters.
15201    ///
15202    /// Please note that this method must not be used to set any of the known parameters
15203    /// which have their own setter method. If done anyway, the request will fail.
15204    ///
15205    /// # Additional Parameters
15206    ///
15207    /// * *$.xgafv* (query-string) - V1 error format.
15208    /// * *access_token* (query-string) - OAuth access token.
15209    /// * *alt* (query-string) - Data format for response.
15210    /// * *callback* (query-string) - JSONP
15211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15212    /// * *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.
15213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15215    /// * *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.
15216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15218    pub fn param<T>(
15219        mut self,
15220        name: T,
15221        value: T,
15222    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C>
15223    where
15224        T: AsRef<str>,
15225    {
15226        self._additional_params
15227            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15228        self
15229    }
15230
15231    /// Identifies the authorization scope for the method you are building.
15232    ///
15233    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15234    /// [`Scope::CloudPlatform`].
15235    ///
15236    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15237    /// tokens for more than one scope.
15238    ///
15239    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15240    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15241    /// sufficient, a read-write scope will do as well.
15242    pub fn add_scope<St>(
15243        mut self,
15244        scope: St,
15245    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C>
15246    where
15247        St: AsRef<str>,
15248    {
15249        self._scopes.insert(String::from(scope.as_ref()));
15250        self
15251    }
15252    /// Identifies the authorization scope(s) for the method you are building.
15253    ///
15254    /// See [`Self::add_scope()`] for details.
15255    pub fn add_scopes<I, St>(
15256        mut self,
15257        scopes: I,
15258    ) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C>
15259    where
15260        I: IntoIterator<Item = St>,
15261        St: AsRef<str>,
15262    {
15263        self._scopes
15264            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15265        self
15266    }
15267
15268    /// Removes all scopes, and no default scope will be used either.
15269    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15270    /// for details).
15271    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateGetIamPolicyCall<'a, C> {
15272        self._scopes.clear();
15273        self
15274    }
15275}
15276
15277/// Instantiates a template and begins execution.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
15278///
15279/// A builder for the *locations.workflowTemplates.instantiate* method supported by a *project* resource.
15280/// It is not used directly, but through a [`ProjectMethods`] instance.
15281///
15282/// # Example
15283///
15284/// Instantiate a resource method builder
15285///
15286/// ```test_harness,no_run
15287/// # extern crate hyper;
15288/// # extern crate hyper_rustls;
15289/// # extern crate google_dataproc1 as dataproc1;
15290/// use dataproc1::api::InstantiateWorkflowTemplateRequest;
15291/// # async fn dox() {
15292/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15293///
15294/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15296/// #     secret,
15297/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15298/// # ).build().await.unwrap();
15299///
15300/// # let client = hyper_util::client::legacy::Client::builder(
15301/// #     hyper_util::rt::TokioExecutor::new()
15302/// # )
15303/// # .build(
15304/// #     hyper_rustls::HttpsConnectorBuilder::new()
15305/// #         .with_native_roots()
15306/// #         .unwrap()
15307/// #         .https_or_http()
15308/// #         .enable_http1()
15309/// #         .build()
15310/// # );
15311/// # let mut hub = Dataproc::new(client, auth);
15312/// // As the method needs a request, you would usually fill it with the desired information
15313/// // into the respective structure. Some of the parts shown here might not be applicable !
15314/// // Values shown here are possibly random and not representative !
15315/// let mut req = InstantiateWorkflowTemplateRequest::default();
15316///
15317/// // You can configure optional parameters by calling the respective setters at will, and
15318/// // execute the final call using `doit()`.
15319/// // Values shown here are possibly random and not representative !
15320/// let result = hub.projects().locations_workflow_templates_instantiate(req, "name")
15321///              .doit().await;
15322/// # }
15323/// ```
15324pub struct ProjectLocationWorkflowTemplateInstantiateCall<'a, C>
15325where
15326    C: 'a,
15327{
15328    hub: &'a Dataproc<C>,
15329    _request: InstantiateWorkflowTemplateRequest,
15330    _name: String,
15331    _delegate: Option<&'a mut dyn common::Delegate>,
15332    _additional_params: HashMap<String, String>,
15333    _scopes: BTreeSet<String>,
15334}
15335
15336impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {}
15337
15338impl<'a, C> ProjectLocationWorkflowTemplateInstantiateCall<'a, C>
15339where
15340    C: common::Connector,
15341{
15342    /// Perform the operation you have build so far.
15343    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15344        use std::borrow::Cow;
15345        use std::io::{Read, Seek};
15346
15347        use common::{url::Params, ToParts};
15348        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15349
15350        let mut dd = common::DefaultDelegate;
15351        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15352        dlg.begin(common::MethodInfo {
15353            id: "dataproc.projects.locations.workflowTemplates.instantiate",
15354            http_method: hyper::Method::POST,
15355        });
15356
15357        for &field in ["alt", "name"].iter() {
15358            if self._additional_params.contains_key(field) {
15359                dlg.finished(false);
15360                return Err(common::Error::FieldClash(field));
15361            }
15362        }
15363
15364        let mut params = Params::with_capacity(4 + self._additional_params.len());
15365        params.push("name", self._name);
15366
15367        params.extend(self._additional_params.iter());
15368
15369        params.push("alt", "json");
15370        let mut url = self.hub._base_url.clone() + "v1/{+name}:instantiate";
15371        if self._scopes.is_empty() {
15372            self._scopes
15373                .insert(Scope::CloudPlatform.as_ref().to_string());
15374        }
15375
15376        #[allow(clippy::single_element_loop)]
15377        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15378            url = params.uri_replacement(url, param_name, find_this, true);
15379        }
15380        {
15381            let to_remove = ["name"];
15382            params.remove_params(&to_remove);
15383        }
15384
15385        let url = params.parse_with_url(&url);
15386
15387        let mut json_mime_type = mime::APPLICATION_JSON;
15388        let mut request_value_reader = {
15389            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15390            common::remove_json_null_values(&mut value);
15391            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15392            serde_json::to_writer(&mut dst, &value).unwrap();
15393            dst
15394        };
15395        let request_size = request_value_reader
15396            .seek(std::io::SeekFrom::End(0))
15397            .unwrap();
15398        request_value_reader
15399            .seek(std::io::SeekFrom::Start(0))
15400            .unwrap();
15401
15402        loop {
15403            let token = match self
15404                .hub
15405                .auth
15406                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15407                .await
15408            {
15409                Ok(token) => token,
15410                Err(e) => match dlg.token(e) {
15411                    Ok(token) => token,
15412                    Err(e) => {
15413                        dlg.finished(false);
15414                        return Err(common::Error::MissingToken(e));
15415                    }
15416                },
15417            };
15418            request_value_reader
15419                .seek(std::io::SeekFrom::Start(0))
15420                .unwrap();
15421            let mut req_result = {
15422                let client = &self.hub.client;
15423                dlg.pre_request();
15424                let mut req_builder = hyper::Request::builder()
15425                    .method(hyper::Method::POST)
15426                    .uri(url.as_str())
15427                    .header(USER_AGENT, self.hub._user_agent.clone());
15428
15429                if let Some(token) = token.as_ref() {
15430                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15431                }
15432
15433                let request = req_builder
15434                    .header(CONTENT_TYPE, json_mime_type.to_string())
15435                    .header(CONTENT_LENGTH, request_size as u64)
15436                    .body(common::to_body(
15437                        request_value_reader.get_ref().clone().into(),
15438                    ));
15439
15440                client.request(request.unwrap()).await
15441            };
15442
15443            match req_result {
15444                Err(err) => {
15445                    if let common::Retry::After(d) = dlg.http_error(&err) {
15446                        sleep(d).await;
15447                        continue;
15448                    }
15449                    dlg.finished(false);
15450                    return Err(common::Error::HttpError(err));
15451                }
15452                Ok(res) => {
15453                    let (mut parts, body) = res.into_parts();
15454                    let mut body = common::Body::new(body);
15455                    if !parts.status.is_success() {
15456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15457                        let error = serde_json::from_str(&common::to_string(&bytes));
15458                        let response = common::to_response(parts, bytes.into());
15459
15460                        if let common::Retry::After(d) =
15461                            dlg.http_failure(&response, error.as_ref().ok())
15462                        {
15463                            sleep(d).await;
15464                            continue;
15465                        }
15466
15467                        dlg.finished(false);
15468
15469                        return Err(match error {
15470                            Ok(value) => common::Error::BadRequest(value),
15471                            _ => common::Error::Failure(response),
15472                        });
15473                    }
15474                    let response = {
15475                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15476                        let encoded = common::to_string(&bytes);
15477                        match serde_json::from_str(&encoded) {
15478                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15479                            Err(error) => {
15480                                dlg.response_json_decode_error(&encoded, &error);
15481                                return Err(common::Error::JsonDecodeError(
15482                                    encoded.to_string(),
15483                                    error,
15484                                ));
15485                            }
15486                        }
15487                    };
15488
15489                    dlg.finished(true);
15490                    return Ok(response);
15491                }
15492            }
15493        }
15494    }
15495
15496    ///
15497    /// Sets the *request* property to the given value.
15498    ///
15499    /// Even though the property as already been set when instantiating this call,
15500    /// we provide this method for API completeness.
15501    pub fn request(
15502        mut self,
15503        new_value: InstantiateWorkflowTemplateRequest,
15504    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {
15505        self._request = new_value;
15506        self
15507    }
15508    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
15509    ///
15510    /// Sets the *name* path property to the given value.
15511    ///
15512    /// Even though the property as already been set when instantiating this call,
15513    /// we provide this method for API completeness.
15514    pub fn name(
15515        mut self,
15516        new_value: &str,
15517    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {
15518        self._name = new_value.to_string();
15519        self
15520    }
15521    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15522    /// while executing the actual API request.
15523    ///
15524    /// ````text
15525    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15526    /// ````
15527    ///
15528    /// Sets the *delegate* property to the given value.
15529    pub fn delegate(
15530        mut self,
15531        new_value: &'a mut dyn common::Delegate,
15532    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {
15533        self._delegate = Some(new_value);
15534        self
15535    }
15536
15537    /// Set any additional parameter of the query string used in the request.
15538    /// It should be used to set parameters which are not yet available through their own
15539    /// setters.
15540    ///
15541    /// Please note that this method must not be used to set any of the known parameters
15542    /// which have their own setter method. If done anyway, the request will fail.
15543    ///
15544    /// # Additional Parameters
15545    ///
15546    /// * *$.xgafv* (query-string) - V1 error format.
15547    /// * *access_token* (query-string) - OAuth access token.
15548    /// * *alt* (query-string) - Data format for response.
15549    /// * *callback* (query-string) - JSONP
15550    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15551    /// * *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.
15552    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15553    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15554    /// * *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.
15555    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15556    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15557    pub fn param<T>(
15558        mut self,
15559        name: T,
15560        value: T,
15561    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C>
15562    where
15563        T: AsRef<str>,
15564    {
15565        self._additional_params
15566            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15567        self
15568    }
15569
15570    /// Identifies the authorization scope for the method you are building.
15571    ///
15572    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15573    /// [`Scope::CloudPlatform`].
15574    ///
15575    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15576    /// tokens for more than one scope.
15577    ///
15578    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15579    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15580    /// sufficient, a read-write scope will do as well.
15581    pub fn add_scope<St>(
15582        mut self,
15583        scope: St,
15584    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C>
15585    where
15586        St: AsRef<str>,
15587    {
15588        self._scopes.insert(String::from(scope.as_ref()));
15589        self
15590    }
15591    /// Identifies the authorization scope(s) for the method you are building.
15592    ///
15593    /// See [`Self::add_scope()`] for details.
15594    pub fn add_scopes<I, St>(
15595        mut self,
15596        scopes: I,
15597    ) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C>
15598    where
15599        I: IntoIterator<Item = St>,
15600        St: AsRef<str>,
15601    {
15602        self._scopes
15603            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15604        self
15605    }
15606
15607    /// Removes all scopes, and no default scope will be used either.
15608    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15609    /// for details).
15610    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateInstantiateCall<'a, C> {
15611        self._scopes.clear();
15612        self
15613    }
15614}
15615
15616/// Instantiates a template and begins execution.This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
15617///
15618/// A builder for the *locations.workflowTemplates.instantiateInline* method supported by a *project* resource.
15619/// It is not used directly, but through a [`ProjectMethods`] instance.
15620///
15621/// # Example
15622///
15623/// Instantiate a resource method builder
15624///
15625/// ```test_harness,no_run
15626/// # extern crate hyper;
15627/// # extern crate hyper_rustls;
15628/// # extern crate google_dataproc1 as dataproc1;
15629/// use dataproc1::api::WorkflowTemplate;
15630/// # async fn dox() {
15631/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15632///
15633/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15634/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15635/// #     secret,
15636/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15637/// # ).build().await.unwrap();
15638///
15639/// # let client = hyper_util::client::legacy::Client::builder(
15640/// #     hyper_util::rt::TokioExecutor::new()
15641/// # )
15642/// # .build(
15643/// #     hyper_rustls::HttpsConnectorBuilder::new()
15644/// #         .with_native_roots()
15645/// #         .unwrap()
15646/// #         .https_or_http()
15647/// #         .enable_http1()
15648/// #         .build()
15649/// # );
15650/// # let mut hub = Dataproc::new(client, auth);
15651/// // As the method needs a request, you would usually fill it with the desired information
15652/// // into the respective structure. Some of the parts shown here might not be applicable !
15653/// // Values shown here are possibly random and not representative !
15654/// let mut req = WorkflowTemplate::default();
15655///
15656/// // You can configure optional parameters by calling the respective setters at will, and
15657/// // execute the final call using `doit()`.
15658/// // Values shown here are possibly random and not representative !
15659/// let result = hub.projects().locations_workflow_templates_instantiate_inline(req, "parent")
15660///              .request_id("elitr")
15661///              .doit().await;
15662/// # }
15663/// ```
15664pub struct ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C>
15665where
15666    C: 'a,
15667{
15668    hub: &'a Dataproc<C>,
15669    _request: WorkflowTemplate,
15670    _parent: String,
15671    _request_id: Option<String>,
15672    _delegate: Option<&'a mut dyn common::Delegate>,
15673    _additional_params: HashMap<String, String>,
15674    _scopes: BTreeSet<String>,
15675}
15676
15677impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {}
15678
15679impl<'a, C> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C>
15680where
15681    C: common::Connector,
15682{
15683    /// Perform the operation you have build so far.
15684    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15685        use std::borrow::Cow;
15686        use std::io::{Read, Seek};
15687
15688        use common::{url::Params, ToParts};
15689        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15690
15691        let mut dd = common::DefaultDelegate;
15692        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15693        dlg.begin(common::MethodInfo {
15694            id: "dataproc.projects.locations.workflowTemplates.instantiateInline",
15695            http_method: hyper::Method::POST,
15696        });
15697
15698        for &field in ["alt", "parent", "requestId"].iter() {
15699            if self._additional_params.contains_key(field) {
15700                dlg.finished(false);
15701                return Err(common::Error::FieldClash(field));
15702            }
15703        }
15704
15705        let mut params = Params::with_capacity(5 + self._additional_params.len());
15706        params.push("parent", self._parent);
15707        if let Some(value) = self._request_id.as_ref() {
15708            params.push("requestId", value);
15709        }
15710
15711        params.extend(self._additional_params.iter());
15712
15713        params.push("alt", "json");
15714        let mut url =
15715            self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates:instantiateInline";
15716        if self._scopes.is_empty() {
15717            self._scopes
15718                .insert(Scope::CloudPlatform.as_ref().to_string());
15719        }
15720
15721        #[allow(clippy::single_element_loop)]
15722        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15723            url = params.uri_replacement(url, param_name, find_this, true);
15724        }
15725        {
15726            let to_remove = ["parent"];
15727            params.remove_params(&to_remove);
15728        }
15729
15730        let url = params.parse_with_url(&url);
15731
15732        let mut json_mime_type = mime::APPLICATION_JSON;
15733        let mut request_value_reader = {
15734            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15735            common::remove_json_null_values(&mut value);
15736            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15737            serde_json::to_writer(&mut dst, &value).unwrap();
15738            dst
15739        };
15740        let request_size = request_value_reader
15741            .seek(std::io::SeekFrom::End(0))
15742            .unwrap();
15743        request_value_reader
15744            .seek(std::io::SeekFrom::Start(0))
15745            .unwrap();
15746
15747        loop {
15748            let token = match self
15749                .hub
15750                .auth
15751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15752                .await
15753            {
15754                Ok(token) => token,
15755                Err(e) => match dlg.token(e) {
15756                    Ok(token) => token,
15757                    Err(e) => {
15758                        dlg.finished(false);
15759                        return Err(common::Error::MissingToken(e));
15760                    }
15761                },
15762            };
15763            request_value_reader
15764                .seek(std::io::SeekFrom::Start(0))
15765                .unwrap();
15766            let mut req_result = {
15767                let client = &self.hub.client;
15768                dlg.pre_request();
15769                let mut req_builder = hyper::Request::builder()
15770                    .method(hyper::Method::POST)
15771                    .uri(url.as_str())
15772                    .header(USER_AGENT, self.hub._user_agent.clone());
15773
15774                if let Some(token) = token.as_ref() {
15775                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15776                }
15777
15778                let request = req_builder
15779                    .header(CONTENT_TYPE, json_mime_type.to_string())
15780                    .header(CONTENT_LENGTH, request_size as u64)
15781                    .body(common::to_body(
15782                        request_value_reader.get_ref().clone().into(),
15783                    ));
15784
15785                client.request(request.unwrap()).await
15786            };
15787
15788            match req_result {
15789                Err(err) => {
15790                    if let common::Retry::After(d) = dlg.http_error(&err) {
15791                        sleep(d).await;
15792                        continue;
15793                    }
15794                    dlg.finished(false);
15795                    return Err(common::Error::HttpError(err));
15796                }
15797                Ok(res) => {
15798                    let (mut parts, body) = res.into_parts();
15799                    let mut body = common::Body::new(body);
15800                    if !parts.status.is_success() {
15801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15802                        let error = serde_json::from_str(&common::to_string(&bytes));
15803                        let response = common::to_response(parts, bytes.into());
15804
15805                        if let common::Retry::After(d) =
15806                            dlg.http_failure(&response, error.as_ref().ok())
15807                        {
15808                            sleep(d).await;
15809                            continue;
15810                        }
15811
15812                        dlg.finished(false);
15813
15814                        return Err(match error {
15815                            Ok(value) => common::Error::BadRequest(value),
15816                            _ => common::Error::Failure(response),
15817                        });
15818                    }
15819                    let response = {
15820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15821                        let encoded = common::to_string(&bytes);
15822                        match serde_json::from_str(&encoded) {
15823                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15824                            Err(error) => {
15825                                dlg.response_json_decode_error(&encoded, &error);
15826                                return Err(common::Error::JsonDecodeError(
15827                                    encoded.to_string(),
15828                                    error,
15829                                ));
15830                            }
15831                        }
15832                    };
15833
15834                    dlg.finished(true);
15835                    return Ok(response);
15836                }
15837            }
15838        }
15839    }
15840
15841    ///
15842    /// Sets the *request* property to the given value.
15843    ///
15844    /// Even though the property as already been set when instantiating this call,
15845    /// we provide this method for API completeness.
15846    pub fn request(
15847        mut self,
15848        new_value: WorkflowTemplate,
15849    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
15850        self._request = new_value;
15851        self
15852    }
15853    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}
15854    ///
15855    /// Sets the *parent* path property to the given value.
15856    ///
15857    /// Even though the property as already been set when instantiating this call,
15858    /// we provide this method for API completeness.
15859    pub fn parent(
15860        mut self,
15861        new_value: &str,
15862    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
15863        self._parent = new_value.to_string();
15864        self
15865    }
15866    /// Optional. A tag that prevents multiple concurrent workflow instances with the same tag from running. This mitigates risk of concurrent instances started due to retries.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The tag must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
15867    ///
15868    /// Sets the *request id* query property to the given value.
15869    pub fn request_id(
15870        mut self,
15871        new_value: &str,
15872    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
15873        self._request_id = Some(new_value.to_string());
15874        self
15875    }
15876    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15877    /// while executing the actual API request.
15878    ///
15879    /// ````text
15880    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15881    /// ````
15882    ///
15883    /// Sets the *delegate* property to the given value.
15884    pub fn delegate(
15885        mut self,
15886        new_value: &'a mut dyn common::Delegate,
15887    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
15888        self._delegate = Some(new_value);
15889        self
15890    }
15891
15892    /// Set any additional parameter of the query string used in the request.
15893    /// It should be used to set parameters which are not yet available through their own
15894    /// setters.
15895    ///
15896    /// Please note that this method must not be used to set any of the known parameters
15897    /// which have their own setter method. If done anyway, the request will fail.
15898    ///
15899    /// # Additional Parameters
15900    ///
15901    /// * *$.xgafv* (query-string) - V1 error format.
15902    /// * *access_token* (query-string) - OAuth access token.
15903    /// * *alt* (query-string) - Data format for response.
15904    /// * *callback* (query-string) - JSONP
15905    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15906    /// * *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.
15907    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15908    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15909    /// * *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.
15910    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15911    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15912    pub fn param<T>(
15913        mut self,
15914        name: T,
15915        value: T,
15916    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C>
15917    where
15918        T: AsRef<str>,
15919    {
15920        self._additional_params
15921            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15922        self
15923    }
15924
15925    /// Identifies the authorization scope for the method you are building.
15926    ///
15927    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15928    /// [`Scope::CloudPlatform`].
15929    ///
15930    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15931    /// tokens for more than one scope.
15932    ///
15933    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15934    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15935    /// sufficient, a read-write scope will do as well.
15936    pub fn add_scope<St>(
15937        mut self,
15938        scope: St,
15939    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C>
15940    where
15941        St: AsRef<str>,
15942    {
15943        self._scopes.insert(String::from(scope.as_ref()));
15944        self
15945    }
15946    /// Identifies the authorization scope(s) for the method you are building.
15947    ///
15948    /// See [`Self::add_scope()`] for details.
15949    pub fn add_scopes<I, St>(
15950        mut self,
15951        scopes: I,
15952    ) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C>
15953    where
15954        I: IntoIterator<Item = St>,
15955        St: AsRef<str>,
15956    {
15957        self._scopes
15958            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15959        self
15960    }
15961
15962    /// Removes all scopes, and no default scope will be used either.
15963    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15964    /// for details).
15965    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateInstantiateInlineCall<'a, C> {
15966        self._scopes.clear();
15967        self
15968    }
15969}
15970
15971/// Lists workflows that match the specified filter in the request.
15972///
15973/// A builder for the *locations.workflowTemplates.list* method supported by a *project* resource.
15974/// It is not used directly, but through a [`ProjectMethods`] instance.
15975///
15976/// # Example
15977///
15978/// Instantiate a resource method builder
15979///
15980/// ```test_harness,no_run
15981/// # extern crate hyper;
15982/// # extern crate hyper_rustls;
15983/// # extern crate google_dataproc1 as dataproc1;
15984/// # async fn dox() {
15985/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15986///
15987/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15989/// #     secret,
15990/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15991/// # ).build().await.unwrap();
15992///
15993/// # let client = hyper_util::client::legacy::Client::builder(
15994/// #     hyper_util::rt::TokioExecutor::new()
15995/// # )
15996/// # .build(
15997/// #     hyper_rustls::HttpsConnectorBuilder::new()
15998/// #         .with_native_roots()
15999/// #         .unwrap()
16000/// #         .https_or_http()
16001/// #         .enable_http1()
16002/// #         .build()
16003/// # );
16004/// # let mut hub = Dataproc::new(client, auth);
16005/// // You can configure optional parameters by calling the respective setters at will, and
16006/// // execute the final call using `doit()`.
16007/// // Values shown here are possibly random and not representative !
16008/// let result = hub.projects().locations_workflow_templates_list("parent")
16009///              .page_token("diam")
16010///              .page_size(-61)
16011///              .doit().await;
16012/// # }
16013/// ```
16014pub struct ProjectLocationWorkflowTemplateListCall<'a, C>
16015where
16016    C: 'a,
16017{
16018    hub: &'a Dataproc<C>,
16019    _parent: String,
16020    _page_token: Option<String>,
16021    _page_size: Option<i32>,
16022    _delegate: Option<&'a mut dyn common::Delegate>,
16023    _additional_params: HashMap<String, String>,
16024    _scopes: BTreeSet<String>,
16025}
16026
16027impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateListCall<'a, C> {}
16028
16029impl<'a, C> ProjectLocationWorkflowTemplateListCall<'a, C>
16030where
16031    C: common::Connector,
16032{
16033    /// Perform the operation you have build so far.
16034    pub async fn doit(
16035        mut self,
16036    ) -> common::Result<(common::Response, ListWorkflowTemplatesResponse)> {
16037        use std::borrow::Cow;
16038        use std::io::{Read, Seek};
16039
16040        use common::{url::Params, ToParts};
16041        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16042
16043        let mut dd = common::DefaultDelegate;
16044        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16045        dlg.begin(common::MethodInfo {
16046            id: "dataproc.projects.locations.workflowTemplates.list",
16047            http_method: hyper::Method::GET,
16048        });
16049
16050        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16051            if self._additional_params.contains_key(field) {
16052                dlg.finished(false);
16053                return Err(common::Error::FieldClash(field));
16054            }
16055        }
16056
16057        let mut params = Params::with_capacity(5 + self._additional_params.len());
16058        params.push("parent", self._parent);
16059        if let Some(value) = self._page_token.as_ref() {
16060            params.push("pageToken", value);
16061        }
16062        if let Some(value) = self._page_size.as_ref() {
16063            params.push("pageSize", value.to_string());
16064        }
16065
16066        params.extend(self._additional_params.iter());
16067
16068        params.push("alt", "json");
16069        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates";
16070        if self._scopes.is_empty() {
16071            self._scopes
16072                .insert(Scope::CloudPlatform.as_ref().to_string());
16073        }
16074
16075        #[allow(clippy::single_element_loop)]
16076        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16077            url = params.uri_replacement(url, param_name, find_this, true);
16078        }
16079        {
16080            let to_remove = ["parent"];
16081            params.remove_params(&to_remove);
16082        }
16083
16084        let url = params.parse_with_url(&url);
16085
16086        loop {
16087            let token = match self
16088                .hub
16089                .auth
16090                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16091                .await
16092            {
16093                Ok(token) => token,
16094                Err(e) => match dlg.token(e) {
16095                    Ok(token) => token,
16096                    Err(e) => {
16097                        dlg.finished(false);
16098                        return Err(common::Error::MissingToken(e));
16099                    }
16100                },
16101            };
16102            let mut req_result = {
16103                let client = &self.hub.client;
16104                dlg.pre_request();
16105                let mut req_builder = hyper::Request::builder()
16106                    .method(hyper::Method::GET)
16107                    .uri(url.as_str())
16108                    .header(USER_AGENT, self.hub._user_agent.clone());
16109
16110                if let Some(token) = token.as_ref() {
16111                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16112                }
16113
16114                let request = req_builder
16115                    .header(CONTENT_LENGTH, 0_u64)
16116                    .body(common::to_body::<String>(None));
16117
16118                client.request(request.unwrap()).await
16119            };
16120
16121            match req_result {
16122                Err(err) => {
16123                    if let common::Retry::After(d) = dlg.http_error(&err) {
16124                        sleep(d).await;
16125                        continue;
16126                    }
16127                    dlg.finished(false);
16128                    return Err(common::Error::HttpError(err));
16129                }
16130                Ok(res) => {
16131                    let (mut parts, body) = res.into_parts();
16132                    let mut body = common::Body::new(body);
16133                    if !parts.status.is_success() {
16134                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16135                        let error = serde_json::from_str(&common::to_string(&bytes));
16136                        let response = common::to_response(parts, bytes.into());
16137
16138                        if let common::Retry::After(d) =
16139                            dlg.http_failure(&response, error.as_ref().ok())
16140                        {
16141                            sleep(d).await;
16142                            continue;
16143                        }
16144
16145                        dlg.finished(false);
16146
16147                        return Err(match error {
16148                            Ok(value) => common::Error::BadRequest(value),
16149                            _ => common::Error::Failure(response),
16150                        });
16151                    }
16152                    let response = {
16153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16154                        let encoded = common::to_string(&bytes);
16155                        match serde_json::from_str(&encoded) {
16156                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16157                            Err(error) => {
16158                                dlg.response_json_decode_error(&encoded, &error);
16159                                return Err(common::Error::JsonDecodeError(
16160                                    encoded.to_string(),
16161                                    error,
16162                                ));
16163                            }
16164                        }
16165                    };
16166
16167                    dlg.finished(true);
16168                    return Ok(response);
16169                }
16170            }
16171        }
16172    }
16173
16174    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
16175    ///
16176    /// Sets the *parent* path property to the given value.
16177    ///
16178    /// Even though the property as already been set when instantiating this call,
16179    /// we provide this method for API completeness.
16180    pub fn parent(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
16181        self._parent = new_value.to_string();
16182        self
16183    }
16184    /// Optional. The page token, returned by a previous call, to request the next page of results.
16185    ///
16186    /// Sets the *page token* query property to the given value.
16187    pub fn page_token(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
16188        self._page_token = Some(new_value.to_string());
16189        self
16190    }
16191    /// Optional. The maximum number of results to return in each response.
16192    ///
16193    /// Sets the *page size* query property to the given value.
16194    pub fn page_size(mut self, new_value: i32) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
16195        self._page_size = Some(new_value);
16196        self
16197    }
16198    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16199    /// while executing the actual API request.
16200    ///
16201    /// ````text
16202    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16203    /// ````
16204    ///
16205    /// Sets the *delegate* property to the given value.
16206    pub fn delegate(
16207        mut self,
16208        new_value: &'a mut dyn common::Delegate,
16209    ) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
16210        self._delegate = Some(new_value);
16211        self
16212    }
16213
16214    /// Set any additional parameter of the query string used in the request.
16215    /// It should be used to set parameters which are not yet available through their own
16216    /// setters.
16217    ///
16218    /// Please note that this method must not be used to set any of the known parameters
16219    /// which have their own setter method. If done anyway, the request will fail.
16220    ///
16221    /// # Additional Parameters
16222    ///
16223    /// * *$.xgafv* (query-string) - V1 error format.
16224    /// * *access_token* (query-string) - OAuth access token.
16225    /// * *alt* (query-string) - Data format for response.
16226    /// * *callback* (query-string) - JSONP
16227    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16228    /// * *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.
16229    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16230    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16231    /// * *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.
16232    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16233    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16234    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateListCall<'a, C>
16235    where
16236        T: AsRef<str>,
16237    {
16238        self._additional_params
16239            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16240        self
16241    }
16242
16243    /// Identifies the authorization scope for the method you are building.
16244    ///
16245    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16246    /// [`Scope::CloudPlatform`].
16247    ///
16248    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16249    /// tokens for more than one scope.
16250    ///
16251    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16252    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16253    /// sufficient, a read-write scope will do as well.
16254    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowTemplateListCall<'a, C>
16255    where
16256        St: AsRef<str>,
16257    {
16258        self._scopes.insert(String::from(scope.as_ref()));
16259        self
16260    }
16261    /// Identifies the authorization scope(s) for the method you are building.
16262    ///
16263    /// See [`Self::add_scope()`] for details.
16264    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationWorkflowTemplateListCall<'a, C>
16265    where
16266        I: IntoIterator<Item = St>,
16267        St: AsRef<str>,
16268    {
16269        self._scopes
16270            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16271        self
16272    }
16273
16274    /// Removes all scopes, and no default scope will be used either.
16275    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16276    /// for details).
16277    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateListCall<'a, C> {
16278        self._scopes.clear();
16279        self
16280    }
16281}
16282
16283/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
16284///
16285/// A builder for the *locations.workflowTemplates.setIamPolicy* method supported by a *project* resource.
16286/// It is not used directly, but through a [`ProjectMethods`] instance.
16287///
16288/// # Example
16289///
16290/// Instantiate a resource method builder
16291///
16292/// ```test_harness,no_run
16293/// # extern crate hyper;
16294/// # extern crate hyper_rustls;
16295/// # extern crate google_dataproc1 as dataproc1;
16296/// use dataproc1::api::SetIamPolicyRequest;
16297/// # async fn dox() {
16298/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16299///
16300/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16301/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16302/// #     secret,
16303/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16304/// # ).build().await.unwrap();
16305///
16306/// # let client = hyper_util::client::legacy::Client::builder(
16307/// #     hyper_util::rt::TokioExecutor::new()
16308/// # )
16309/// # .build(
16310/// #     hyper_rustls::HttpsConnectorBuilder::new()
16311/// #         .with_native_roots()
16312/// #         .unwrap()
16313/// #         .https_or_http()
16314/// #         .enable_http1()
16315/// #         .build()
16316/// # );
16317/// # let mut hub = Dataproc::new(client, auth);
16318/// // As the method needs a request, you would usually fill it with the desired information
16319/// // into the respective structure. Some of the parts shown here might not be applicable !
16320/// // Values shown here are possibly random and not representative !
16321/// let mut req = SetIamPolicyRequest::default();
16322///
16323/// // You can configure optional parameters by calling the respective setters at will, and
16324/// // execute the final call using `doit()`.
16325/// // Values shown here are possibly random and not representative !
16326/// let result = hub.projects().locations_workflow_templates_set_iam_policy(req, "resource")
16327///              .doit().await;
16328/// # }
16329/// ```
16330pub struct ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C>
16331where
16332    C: 'a,
16333{
16334    hub: &'a Dataproc<C>,
16335    _request: SetIamPolicyRequest,
16336    _resource: String,
16337    _delegate: Option<&'a mut dyn common::Delegate>,
16338    _additional_params: HashMap<String, String>,
16339    _scopes: BTreeSet<String>,
16340}
16341
16342impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {}
16343
16344impl<'a, C> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C>
16345where
16346    C: common::Connector,
16347{
16348    /// Perform the operation you have build so far.
16349    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16350        use std::borrow::Cow;
16351        use std::io::{Read, Seek};
16352
16353        use common::{url::Params, ToParts};
16354        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16355
16356        let mut dd = common::DefaultDelegate;
16357        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16358        dlg.begin(common::MethodInfo {
16359            id: "dataproc.projects.locations.workflowTemplates.setIamPolicy",
16360            http_method: hyper::Method::POST,
16361        });
16362
16363        for &field in ["alt", "resource"].iter() {
16364            if self._additional_params.contains_key(field) {
16365                dlg.finished(false);
16366                return Err(common::Error::FieldClash(field));
16367            }
16368        }
16369
16370        let mut params = Params::with_capacity(4 + self._additional_params.len());
16371        params.push("resource", self._resource);
16372
16373        params.extend(self._additional_params.iter());
16374
16375        params.push("alt", "json");
16376        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
16377        if self._scopes.is_empty() {
16378            self._scopes
16379                .insert(Scope::CloudPlatform.as_ref().to_string());
16380        }
16381
16382        #[allow(clippy::single_element_loop)]
16383        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16384            url = params.uri_replacement(url, param_name, find_this, true);
16385        }
16386        {
16387            let to_remove = ["resource"];
16388            params.remove_params(&to_remove);
16389        }
16390
16391        let url = params.parse_with_url(&url);
16392
16393        let mut json_mime_type = mime::APPLICATION_JSON;
16394        let mut request_value_reader = {
16395            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16396            common::remove_json_null_values(&mut value);
16397            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16398            serde_json::to_writer(&mut dst, &value).unwrap();
16399            dst
16400        };
16401        let request_size = request_value_reader
16402            .seek(std::io::SeekFrom::End(0))
16403            .unwrap();
16404        request_value_reader
16405            .seek(std::io::SeekFrom::Start(0))
16406            .unwrap();
16407
16408        loop {
16409            let token = match self
16410                .hub
16411                .auth
16412                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16413                .await
16414            {
16415                Ok(token) => token,
16416                Err(e) => match dlg.token(e) {
16417                    Ok(token) => token,
16418                    Err(e) => {
16419                        dlg.finished(false);
16420                        return Err(common::Error::MissingToken(e));
16421                    }
16422                },
16423            };
16424            request_value_reader
16425                .seek(std::io::SeekFrom::Start(0))
16426                .unwrap();
16427            let mut req_result = {
16428                let client = &self.hub.client;
16429                dlg.pre_request();
16430                let mut req_builder = hyper::Request::builder()
16431                    .method(hyper::Method::POST)
16432                    .uri(url.as_str())
16433                    .header(USER_AGENT, self.hub._user_agent.clone());
16434
16435                if let Some(token) = token.as_ref() {
16436                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16437                }
16438
16439                let request = req_builder
16440                    .header(CONTENT_TYPE, json_mime_type.to_string())
16441                    .header(CONTENT_LENGTH, request_size as u64)
16442                    .body(common::to_body(
16443                        request_value_reader.get_ref().clone().into(),
16444                    ));
16445
16446                client.request(request.unwrap()).await
16447            };
16448
16449            match req_result {
16450                Err(err) => {
16451                    if let common::Retry::After(d) = dlg.http_error(&err) {
16452                        sleep(d).await;
16453                        continue;
16454                    }
16455                    dlg.finished(false);
16456                    return Err(common::Error::HttpError(err));
16457                }
16458                Ok(res) => {
16459                    let (mut parts, body) = res.into_parts();
16460                    let mut body = common::Body::new(body);
16461                    if !parts.status.is_success() {
16462                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16463                        let error = serde_json::from_str(&common::to_string(&bytes));
16464                        let response = common::to_response(parts, bytes.into());
16465
16466                        if let common::Retry::After(d) =
16467                            dlg.http_failure(&response, error.as_ref().ok())
16468                        {
16469                            sleep(d).await;
16470                            continue;
16471                        }
16472
16473                        dlg.finished(false);
16474
16475                        return Err(match error {
16476                            Ok(value) => common::Error::BadRequest(value),
16477                            _ => common::Error::Failure(response),
16478                        });
16479                    }
16480                    let response = {
16481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16482                        let encoded = common::to_string(&bytes);
16483                        match serde_json::from_str(&encoded) {
16484                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16485                            Err(error) => {
16486                                dlg.response_json_decode_error(&encoded, &error);
16487                                return Err(common::Error::JsonDecodeError(
16488                                    encoded.to_string(),
16489                                    error,
16490                                ));
16491                            }
16492                        }
16493                    };
16494
16495                    dlg.finished(true);
16496                    return Ok(response);
16497                }
16498            }
16499        }
16500    }
16501
16502    ///
16503    /// Sets the *request* property to the given value.
16504    ///
16505    /// Even though the property as already been set when instantiating this call,
16506    /// we provide this method for API completeness.
16507    pub fn request(
16508        mut self,
16509        new_value: SetIamPolicyRequest,
16510    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {
16511        self._request = new_value;
16512        self
16513    }
16514    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16515    ///
16516    /// Sets the *resource* path property to the given value.
16517    ///
16518    /// Even though the property as already been set when instantiating this call,
16519    /// we provide this method for API completeness.
16520    pub fn resource(
16521        mut self,
16522        new_value: &str,
16523    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {
16524        self._resource = new_value.to_string();
16525        self
16526    }
16527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16528    /// while executing the actual API request.
16529    ///
16530    /// ````text
16531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16532    /// ````
16533    ///
16534    /// Sets the *delegate* property to the given value.
16535    pub fn delegate(
16536        mut self,
16537        new_value: &'a mut dyn common::Delegate,
16538    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {
16539        self._delegate = Some(new_value);
16540        self
16541    }
16542
16543    /// Set any additional parameter of the query string used in the request.
16544    /// It should be used to set parameters which are not yet available through their own
16545    /// setters.
16546    ///
16547    /// Please note that this method must not be used to set any of the known parameters
16548    /// which have their own setter method. If done anyway, the request will fail.
16549    ///
16550    /// # Additional Parameters
16551    ///
16552    /// * *$.xgafv* (query-string) - V1 error format.
16553    /// * *access_token* (query-string) - OAuth access token.
16554    /// * *alt* (query-string) - Data format for response.
16555    /// * *callback* (query-string) - JSONP
16556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16557    /// * *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.
16558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16560    /// * *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.
16561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16563    pub fn param<T>(
16564        mut self,
16565        name: T,
16566        value: T,
16567    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C>
16568    where
16569        T: AsRef<str>,
16570    {
16571        self._additional_params
16572            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16573        self
16574    }
16575
16576    /// Identifies the authorization scope for the method you are building.
16577    ///
16578    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16579    /// [`Scope::CloudPlatform`].
16580    ///
16581    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16582    /// tokens for more than one scope.
16583    ///
16584    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16585    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16586    /// sufficient, a read-write scope will do as well.
16587    pub fn add_scope<St>(
16588        mut self,
16589        scope: St,
16590    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C>
16591    where
16592        St: AsRef<str>,
16593    {
16594        self._scopes.insert(String::from(scope.as_ref()));
16595        self
16596    }
16597    /// Identifies the authorization scope(s) for the method you are building.
16598    ///
16599    /// See [`Self::add_scope()`] for details.
16600    pub fn add_scopes<I, St>(
16601        mut self,
16602        scopes: I,
16603    ) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C>
16604    where
16605        I: IntoIterator<Item = St>,
16606        St: AsRef<str>,
16607    {
16608        self._scopes
16609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16610        self
16611    }
16612
16613    /// Removes all scopes, and no default scope will be used either.
16614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16615    /// for details).
16616    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateSetIamPolicyCall<'a, C> {
16617        self._scopes.clear();
16618        self
16619    }
16620}
16621
16622/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
16623///
16624/// A builder for the *locations.workflowTemplates.testIamPermissions* method supported by a *project* resource.
16625/// It is not used directly, but through a [`ProjectMethods`] instance.
16626///
16627/// # Example
16628///
16629/// Instantiate a resource method builder
16630///
16631/// ```test_harness,no_run
16632/// # extern crate hyper;
16633/// # extern crate hyper_rustls;
16634/// # extern crate google_dataproc1 as dataproc1;
16635/// use dataproc1::api::TestIamPermissionsRequest;
16636/// # async fn dox() {
16637/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16638///
16639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16640/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16641/// #     secret,
16642/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16643/// # ).build().await.unwrap();
16644///
16645/// # let client = hyper_util::client::legacy::Client::builder(
16646/// #     hyper_util::rt::TokioExecutor::new()
16647/// # )
16648/// # .build(
16649/// #     hyper_rustls::HttpsConnectorBuilder::new()
16650/// #         .with_native_roots()
16651/// #         .unwrap()
16652/// #         .https_or_http()
16653/// #         .enable_http1()
16654/// #         .build()
16655/// # );
16656/// # let mut hub = Dataproc::new(client, auth);
16657/// // As the method needs a request, you would usually fill it with the desired information
16658/// // into the respective structure. Some of the parts shown here might not be applicable !
16659/// // Values shown here are possibly random and not representative !
16660/// let mut req = TestIamPermissionsRequest::default();
16661///
16662/// // You can configure optional parameters by calling the respective setters at will, and
16663/// // execute the final call using `doit()`.
16664/// // Values shown here are possibly random and not representative !
16665/// let result = hub.projects().locations_workflow_templates_test_iam_permissions(req, "resource")
16666///              .doit().await;
16667/// # }
16668/// ```
16669pub struct ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C>
16670where
16671    C: 'a,
16672{
16673    hub: &'a Dataproc<C>,
16674    _request: TestIamPermissionsRequest,
16675    _resource: String,
16676    _delegate: Option<&'a mut dyn common::Delegate>,
16677    _additional_params: HashMap<String, String>,
16678    _scopes: BTreeSet<String>,
16679}
16680
16681impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {}
16682
16683impl<'a, C> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C>
16684where
16685    C: common::Connector,
16686{
16687    /// Perform the operation you have build so far.
16688    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
16689        use std::borrow::Cow;
16690        use std::io::{Read, Seek};
16691
16692        use common::{url::Params, ToParts};
16693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16694
16695        let mut dd = common::DefaultDelegate;
16696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16697        dlg.begin(common::MethodInfo {
16698            id: "dataproc.projects.locations.workflowTemplates.testIamPermissions",
16699            http_method: hyper::Method::POST,
16700        });
16701
16702        for &field in ["alt", "resource"].iter() {
16703            if self._additional_params.contains_key(field) {
16704                dlg.finished(false);
16705                return Err(common::Error::FieldClash(field));
16706            }
16707        }
16708
16709        let mut params = Params::with_capacity(4 + self._additional_params.len());
16710        params.push("resource", self._resource);
16711
16712        params.extend(self._additional_params.iter());
16713
16714        params.push("alt", "json");
16715        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
16716        if self._scopes.is_empty() {
16717            self._scopes
16718                .insert(Scope::CloudPlatform.as_ref().to_string());
16719        }
16720
16721        #[allow(clippy::single_element_loop)]
16722        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16723            url = params.uri_replacement(url, param_name, find_this, true);
16724        }
16725        {
16726            let to_remove = ["resource"];
16727            params.remove_params(&to_remove);
16728        }
16729
16730        let url = params.parse_with_url(&url);
16731
16732        let mut json_mime_type = mime::APPLICATION_JSON;
16733        let mut request_value_reader = {
16734            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16735            common::remove_json_null_values(&mut value);
16736            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16737            serde_json::to_writer(&mut dst, &value).unwrap();
16738            dst
16739        };
16740        let request_size = request_value_reader
16741            .seek(std::io::SeekFrom::End(0))
16742            .unwrap();
16743        request_value_reader
16744            .seek(std::io::SeekFrom::Start(0))
16745            .unwrap();
16746
16747        loop {
16748            let token = match self
16749                .hub
16750                .auth
16751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16752                .await
16753            {
16754                Ok(token) => token,
16755                Err(e) => match dlg.token(e) {
16756                    Ok(token) => token,
16757                    Err(e) => {
16758                        dlg.finished(false);
16759                        return Err(common::Error::MissingToken(e));
16760                    }
16761                },
16762            };
16763            request_value_reader
16764                .seek(std::io::SeekFrom::Start(0))
16765                .unwrap();
16766            let mut req_result = {
16767                let client = &self.hub.client;
16768                dlg.pre_request();
16769                let mut req_builder = hyper::Request::builder()
16770                    .method(hyper::Method::POST)
16771                    .uri(url.as_str())
16772                    .header(USER_AGENT, self.hub._user_agent.clone());
16773
16774                if let Some(token) = token.as_ref() {
16775                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16776                }
16777
16778                let request = req_builder
16779                    .header(CONTENT_TYPE, json_mime_type.to_string())
16780                    .header(CONTENT_LENGTH, request_size as u64)
16781                    .body(common::to_body(
16782                        request_value_reader.get_ref().clone().into(),
16783                    ));
16784
16785                client.request(request.unwrap()).await
16786            };
16787
16788            match req_result {
16789                Err(err) => {
16790                    if let common::Retry::After(d) = dlg.http_error(&err) {
16791                        sleep(d).await;
16792                        continue;
16793                    }
16794                    dlg.finished(false);
16795                    return Err(common::Error::HttpError(err));
16796                }
16797                Ok(res) => {
16798                    let (mut parts, body) = res.into_parts();
16799                    let mut body = common::Body::new(body);
16800                    if !parts.status.is_success() {
16801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16802                        let error = serde_json::from_str(&common::to_string(&bytes));
16803                        let response = common::to_response(parts, bytes.into());
16804
16805                        if let common::Retry::After(d) =
16806                            dlg.http_failure(&response, error.as_ref().ok())
16807                        {
16808                            sleep(d).await;
16809                            continue;
16810                        }
16811
16812                        dlg.finished(false);
16813
16814                        return Err(match error {
16815                            Ok(value) => common::Error::BadRequest(value),
16816                            _ => common::Error::Failure(response),
16817                        });
16818                    }
16819                    let response = {
16820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16821                        let encoded = common::to_string(&bytes);
16822                        match serde_json::from_str(&encoded) {
16823                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16824                            Err(error) => {
16825                                dlg.response_json_decode_error(&encoded, &error);
16826                                return Err(common::Error::JsonDecodeError(
16827                                    encoded.to_string(),
16828                                    error,
16829                                ));
16830                            }
16831                        }
16832                    };
16833
16834                    dlg.finished(true);
16835                    return Ok(response);
16836                }
16837            }
16838        }
16839    }
16840
16841    ///
16842    /// Sets the *request* property to the given value.
16843    ///
16844    /// Even though the property as already been set when instantiating this call,
16845    /// we provide this method for API completeness.
16846    pub fn request(
16847        mut self,
16848        new_value: TestIamPermissionsRequest,
16849    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {
16850        self._request = new_value;
16851        self
16852    }
16853    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16854    ///
16855    /// Sets the *resource* path property to the given value.
16856    ///
16857    /// Even though the property as already been set when instantiating this call,
16858    /// we provide this method for API completeness.
16859    pub fn resource(
16860        mut self,
16861        new_value: &str,
16862    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {
16863        self._resource = new_value.to_string();
16864        self
16865    }
16866    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16867    /// while executing the actual API request.
16868    ///
16869    /// ````text
16870    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16871    /// ````
16872    ///
16873    /// Sets the *delegate* property to the given value.
16874    pub fn delegate(
16875        mut self,
16876        new_value: &'a mut dyn common::Delegate,
16877    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {
16878        self._delegate = Some(new_value);
16879        self
16880    }
16881
16882    /// Set any additional parameter of the query string used in the request.
16883    /// It should be used to set parameters which are not yet available through their own
16884    /// setters.
16885    ///
16886    /// Please note that this method must not be used to set any of the known parameters
16887    /// which have their own setter method. If done anyway, the request will fail.
16888    ///
16889    /// # Additional Parameters
16890    ///
16891    /// * *$.xgafv* (query-string) - V1 error format.
16892    /// * *access_token* (query-string) - OAuth access token.
16893    /// * *alt* (query-string) - Data format for response.
16894    /// * *callback* (query-string) - JSONP
16895    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16896    /// * *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.
16897    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16898    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16899    /// * *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.
16900    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16901    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16902    pub fn param<T>(
16903        mut self,
16904        name: T,
16905        value: T,
16906    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C>
16907    where
16908        T: AsRef<str>,
16909    {
16910        self._additional_params
16911            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16912        self
16913    }
16914
16915    /// Identifies the authorization scope for the method you are building.
16916    ///
16917    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16918    /// [`Scope::CloudPlatform`].
16919    ///
16920    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16921    /// tokens for more than one scope.
16922    ///
16923    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16924    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16925    /// sufficient, a read-write scope will do as well.
16926    pub fn add_scope<St>(
16927        mut self,
16928        scope: St,
16929    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C>
16930    where
16931        St: AsRef<str>,
16932    {
16933        self._scopes.insert(String::from(scope.as_ref()));
16934        self
16935    }
16936    /// Identifies the authorization scope(s) for the method you are building.
16937    ///
16938    /// See [`Self::add_scope()`] for details.
16939    pub fn add_scopes<I, St>(
16940        mut self,
16941        scopes: I,
16942    ) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C>
16943    where
16944        I: IntoIterator<Item = St>,
16945        St: AsRef<str>,
16946    {
16947        self._scopes
16948            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16949        self
16950    }
16951
16952    /// Removes all scopes, and no default scope will be used either.
16953    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16954    /// for details).
16955    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateTestIamPermissionCall<'a, C> {
16956        self._scopes.clear();
16957        self
16958    }
16959}
16960
16961/// Updates (replaces) workflow template. The updated template must contain version that matches the current server version.
16962///
16963/// A builder for the *locations.workflowTemplates.update* method supported by a *project* resource.
16964/// It is not used directly, but through a [`ProjectMethods`] instance.
16965///
16966/// # Example
16967///
16968/// Instantiate a resource method builder
16969///
16970/// ```test_harness,no_run
16971/// # extern crate hyper;
16972/// # extern crate hyper_rustls;
16973/// # extern crate google_dataproc1 as dataproc1;
16974/// use dataproc1::api::WorkflowTemplate;
16975/// # async fn dox() {
16976/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16977///
16978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16979/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16980/// #     secret,
16981/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16982/// # ).build().await.unwrap();
16983///
16984/// # let client = hyper_util::client::legacy::Client::builder(
16985/// #     hyper_util::rt::TokioExecutor::new()
16986/// # )
16987/// # .build(
16988/// #     hyper_rustls::HttpsConnectorBuilder::new()
16989/// #         .with_native_roots()
16990/// #         .unwrap()
16991/// #         .https_or_http()
16992/// #         .enable_http1()
16993/// #         .build()
16994/// # );
16995/// # let mut hub = Dataproc::new(client, auth);
16996/// // As the method needs a request, you would usually fill it with the desired information
16997/// // into the respective structure. Some of the parts shown here might not be applicable !
16998/// // Values shown here are possibly random and not representative !
16999/// let mut req = WorkflowTemplate::default();
17000///
17001/// // You can configure optional parameters by calling the respective setters at will, and
17002/// // execute the final call using `doit()`.
17003/// // Values shown here are possibly random and not representative !
17004/// let result = hub.projects().locations_workflow_templates_update(req, "name")
17005///              .doit().await;
17006/// # }
17007/// ```
17008pub struct ProjectLocationWorkflowTemplateUpdateCall<'a, C>
17009where
17010    C: 'a,
17011{
17012    hub: &'a Dataproc<C>,
17013    _request: WorkflowTemplate,
17014    _name: String,
17015    _delegate: Option<&'a mut dyn common::Delegate>,
17016    _additional_params: HashMap<String, String>,
17017    _scopes: BTreeSet<String>,
17018}
17019
17020impl<'a, C> common::CallBuilder for ProjectLocationWorkflowTemplateUpdateCall<'a, C> {}
17021
17022impl<'a, C> ProjectLocationWorkflowTemplateUpdateCall<'a, C>
17023where
17024    C: common::Connector,
17025{
17026    /// Perform the operation you have build so far.
17027    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
17028        use std::borrow::Cow;
17029        use std::io::{Read, Seek};
17030
17031        use common::{url::Params, ToParts};
17032        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17033
17034        let mut dd = common::DefaultDelegate;
17035        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17036        dlg.begin(common::MethodInfo {
17037            id: "dataproc.projects.locations.workflowTemplates.update",
17038            http_method: hyper::Method::PUT,
17039        });
17040
17041        for &field in ["alt", "name"].iter() {
17042            if self._additional_params.contains_key(field) {
17043                dlg.finished(false);
17044                return Err(common::Error::FieldClash(field));
17045            }
17046        }
17047
17048        let mut params = Params::with_capacity(4 + self._additional_params.len());
17049        params.push("name", self._name);
17050
17051        params.extend(self._additional_params.iter());
17052
17053        params.push("alt", "json");
17054        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17055        if self._scopes.is_empty() {
17056            self._scopes
17057                .insert(Scope::CloudPlatform.as_ref().to_string());
17058        }
17059
17060        #[allow(clippy::single_element_loop)]
17061        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17062            url = params.uri_replacement(url, param_name, find_this, true);
17063        }
17064        {
17065            let to_remove = ["name"];
17066            params.remove_params(&to_remove);
17067        }
17068
17069        let url = params.parse_with_url(&url);
17070
17071        let mut json_mime_type = mime::APPLICATION_JSON;
17072        let mut request_value_reader = {
17073            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17074            common::remove_json_null_values(&mut value);
17075            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17076            serde_json::to_writer(&mut dst, &value).unwrap();
17077            dst
17078        };
17079        let request_size = request_value_reader
17080            .seek(std::io::SeekFrom::End(0))
17081            .unwrap();
17082        request_value_reader
17083            .seek(std::io::SeekFrom::Start(0))
17084            .unwrap();
17085
17086        loop {
17087            let token = match self
17088                .hub
17089                .auth
17090                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17091                .await
17092            {
17093                Ok(token) => token,
17094                Err(e) => match dlg.token(e) {
17095                    Ok(token) => token,
17096                    Err(e) => {
17097                        dlg.finished(false);
17098                        return Err(common::Error::MissingToken(e));
17099                    }
17100                },
17101            };
17102            request_value_reader
17103                .seek(std::io::SeekFrom::Start(0))
17104                .unwrap();
17105            let mut req_result = {
17106                let client = &self.hub.client;
17107                dlg.pre_request();
17108                let mut req_builder = hyper::Request::builder()
17109                    .method(hyper::Method::PUT)
17110                    .uri(url.as_str())
17111                    .header(USER_AGENT, self.hub._user_agent.clone());
17112
17113                if let Some(token) = token.as_ref() {
17114                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17115                }
17116
17117                let request = req_builder
17118                    .header(CONTENT_TYPE, json_mime_type.to_string())
17119                    .header(CONTENT_LENGTH, request_size as u64)
17120                    .body(common::to_body(
17121                        request_value_reader.get_ref().clone().into(),
17122                    ));
17123
17124                client.request(request.unwrap()).await
17125            };
17126
17127            match req_result {
17128                Err(err) => {
17129                    if let common::Retry::After(d) = dlg.http_error(&err) {
17130                        sleep(d).await;
17131                        continue;
17132                    }
17133                    dlg.finished(false);
17134                    return Err(common::Error::HttpError(err));
17135                }
17136                Ok(res) => {
17137                    let (mut parts, body) = res.into_parts();
17138                    let mut body = common::Body::new(body);
17139                    if !parts.status.is_success() {
17140                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17141                        let error = serde_json::from_str(&common::to_string(&bytes));
17142                        let response = common::to_response(parts, bytes.into());
17143
17144                        if let common::Retry::After(d) =
17145                            dlg.http_failure(&response, error.as_ref().ok())
17146                        {
17147                            sleep(d).await;
17148                            continue;
17149                        }
17150
17151                        dlg.finished(false);
17152
17153                        return Err(match error {
17154                            Ok(value) => common::Error::BadRequest(value),
17155                            _ => common::Error::Failure(response),
17156                        });
17157                    }
17158                    let response = {
17159                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17160                        let encoded = common::to_string(&bytes);
17161                        match serde_json::from_str(&encoded) {
17162                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17163                            Err(error) => {
17164                                dlg.response_json_decode_error(&encoded, &error);
17165                                return Err(common::Error::JsonDecodeError(
17166                                    encoded.to_string(),
17167                                    error,
17168                                ));
17169                            }
17170                        }
17171                    };
17172
17173                    dlg.finished(true);
17174                    return Ok(response);
17175                }
17176            }
17177        }
17178    }
17179
17180    ///
17181    /// Sets the *request* property to the given value.
17182    ///
17183    /// Even though the property as already been set when instantiating this call,
17184    /// we provide this method for API completeness.
17185    pub fn request(
17186        mut self,
17187        new_value: WorkflowTemplate,
17188    ) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C> {
17189        self._request = new_value;
17190        self
17191    }
17192    /// Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
17193    ///
17194    /// Sets the *name* path property to the given value.
17195    ///
17196    /// Even though the property as already been set when instantiating this call,
17197    /// we provide this method for API completeness.
17198    pub fn name(mut self, new_value: &str) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C> {
17199        self._name = new_value.to_string();
17200        self
17201    }
17202    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17203    /// while executing the actual API request.
17204    ///
17205    /// ````text
17206    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17207    /// ````
17208    ///
17209    /// Sets the *delegate* property to the given value.
17210    pub fn delegate(
17211        mut self,
17212        new_value: &'a mut dyn common::Delegate,
17213    ) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C> {
17214        self._delegate = Some(new_value);
17215        self
17216    }
17217
17218    /// Set any additional parameter of the query string used in the request.
17219    /// It should be used to set parameters which are not yet available through their own
17220    /// setters.
17221    ///
17222    /// Please note that this method must not be used to set any of the known parameters
17223    /// which have their own setter method. If done anyway, the request will fail.
17224    ///
17225    /// # Additional Parameters
17226    ///
17227    /// * *$.xgafv* (query-string) - V1 error format.
17228    /// * *access_token* (query-string) - OAuth access token.
17229    /// * *alt* (query-string) - Data format for response.
17230    /// * *callback* (query-string) - JSONP
17231    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17232    /// * *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.
17233    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17234    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17235    /// * *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.
17236    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17237    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17238    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C>
17239    where
17240        T: AsRef<str>,
17241    {
17242        self._additional_params
17243            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17244        self
17245    }
17246
17247    /// Identifies the authorization scope for the method you are building.
17248    ///
17249    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17250    /// [`Scope::CloudPlatform`].
17251    ///
17252    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17253    /// tokens for more than one scope.
17254    ///
17255    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17256    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17257    /// sufficient, a read-write scope will do as well.
17258    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C>
17259    where
17260        St: AsRef<str>,
17261    {
17262        self._scopes.insert(String::from(scope.as_ref()));
17263        self
17264    }
17265    /// Identifies the authorization scope(s) for the method you are building.
17266    ///
17267    /// See [`Self::add_scope()`] for details.
17268    pub fn add_scopes<I, St>(
17269        mut self,
17270        scopes: I,
17271    ) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C>
17272    where
17273        I: IntoIterator<Item = St>,
17274        St: AsRef<str>,
17275    {
17276        self._scopes
17277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17278        self
17279    }
17280
17281    /// Removes all scopes, and no default scope will be used either.
17282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17283    /// for details).
17284    pub fn clear_scopes(mut self) -> ProjectLocationWorkflowTemplateUpdateCall<'a, C> {
17285        self._scopes.clear();
17286        self
17287    }
17288}
17289
17290/// Creates new autoscaling policy.
17291///
17292/// A builder for the *regions.autoscalingPolicies.create* method supported by a *project* resource.
17293/// It is not used directly, but through a [`ProjectMethods`] instance.
17294///
17295/// # Example
17296///
17297/// Instantiate a resource method builder
17298///
17299/// ```test_harness,no_run
17300/// # extern crate hyper;
17301/// # extern crate hyper_rustls;
17302/// # extern crate google_dataproc1 as dataproc1;
17303/// use dataproc1::api::AutoscalingPolicy;
17304/// # async fn dox() {
17305/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17306///
17307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17308/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17309/// #     secret,
17310/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17311/// # ).build().await.unwrap();
17312///
17313/// # let client = hyper_util::client::legacy::Client::builder(
17314/// #     hyper_util::rt::TokioExecutor::new()
17315/// # )
17316/// # .build(
17317/// #     hyper_rustls::HttpsConnectorBuilder::new()
17318/// #         .with_native_roots()
17319/// #         .unwrap()
17320/// #         .https_or_http()
17321/// #         .enable_http1()
17322/// #         .build()
17323/// # );
17324/// # let mut hub = Dataproc::new(client, auth);
17325/// // As the method needs a request, you would usually fill it with the desired information
17326/// // into the respective structure. Some of the parts shown here might not be applicable !
17327/// // Values shown here are possibly random and not representative !
17328/// let mut req = AutoscalingPolicy::default();
17329///
17330/// // You can configure optional parameters by calling the respective setters at will, and
17331/// // execute the final call using `doit()`.
17332/// // Values shown here are possibly random and not representative !
17333/// let result = hub.projects().regions_autoscaling_policies_create(req, "parent")
17334///              .doit().await;
17335/// # }
17336/// ```
17337pub struct ProjectRegionAutoscalingPolicyCreateCall<'a, C>
17338where
17339    C: 'a,
17340{
17341    hub: &'a Dataproc<C>,
17342    _request: AutoscalingPolicy,
17343    _parent: String,
17344    _delegate: Option<&'a mut dyn common::Delegate>,
17345    _additional_params: HashMap<String, String>,
17346    _scopes: BTreeSet<String>,
17347}
17348
17349impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyCreateCall<'a, C> {}
17350
17351impl<'a, C> ProjectRegionAutoscalingPolicyCreateCall<'a, C>
17352where
17353    C: common::Connector,
17354{
17355    /// Perform the operation you have build so far.
17356    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
17357        use std::borrow::Cow;
17358        use std::io::{Read, Seek};
17359
17360        use common::{url::Params, ToParts};
17361        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17362
17363        let mut dd = common::DefaultDelegate;
17364        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17365        dlg.begin(common::MethodInfo {
17366            id: "dataproc.projects.regions.autoscalingPolicies.create",
17367            http_method: hyper::Method::POST,
17368        });
17369
17370        for &field in ["alt", "parent"].iter() {
17371            if self._additional_params.contains_key(field) {
17372                dlg.finished(false);
17373                return Err(common::Error::FieldClash(field));
17374            }
17375        }
17376
17377        let mut params = Params::with_capacity(4 + self._additional_params.len());
17378        params.push("parent", self._parent);
17379
17380        params.extend(self._additional_params.iter());
17381
17382        params.push("alt", "json");
17383        let mut url = self.hub._base_url.clone() + "v1/{+parent}/autoscalingPolicies";
17384        if self._scopes.is_empty() {
17385            self._scopes
17386                .insert(Scope::CloudPlatform.as_ref().to_string());
17387        }
17388
17389        #[allow(clippy::single_element_loop)]
17390        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17391            url = params.uri_replacement(url, param_name, find_this, true);
17392        }
17393        {
17394            let to_remove = ["parent"];
17395            params.remove_params(&to_remove);
17396        }
17397
17398        let url = params.parse_with_url(&url);
17399
17400        let mut json_mime_type = mime::APPLICATION_JSON;
17401        let mut request_value_reader = {
17402            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17403            common::remove_json_null_values(&mut value);
17404            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17405            serde_json::to_writer(&mut dst, &value).unwrap();
17406            dst
17407        };
17408        let request_size = request_value_reader
17409            .seek(std::io::SeekFrom::End(0))
17410            .unwrap();
17411        request_value_reader
17412            .seek(std::io::SeekFrom::Start(0))
17413            .unwrap();
17414
17415        loop {
17416            let token = match self
17417                .hub
17418                .auth
17419                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17420                .await
17421            {
17422                Ok(token) => token,
17423                Err(e) => match dlg.token(e) {
17424                    Ok(token) => token,
17425                    Err(e) => {
17426                        dlg.finished(false);
17427                        return Err(common::Error::MissingToken(e));
17428                    }
17429                },
17430            };
17431            request_value_reader
17432                .seek(std::io::SeekFrom::Start(0))
17433                .unwrap();
17434            let mut req_result = {
17435                let client = &self.hub.client;
17436                dlg.pre_request();
17437                let mut req_builder = hyper::Request::builder()
17438                    .method(hyper::Method::POST)
17439                    .uri(url.as_str())
17440                    .header(USER_AGENT, self.hub._user_agent.clone());
17441
17442                if let Some(token) = token.as_ref() {
17443                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17444                }
17445
17446                let request = req_builder
17447                    .header(CONTENT_TYPE, json_mime_type.to_string())
17448                    .header(CONTENT_LENGTH, request_size as u64)
17449                    .body(common::to_body(
17450                        request_value_reader.get_ref().clone().into(),
17451                    ));
17452
17453                client.request(request.unwrap()).await
17454            };
17455
17456            match req_result {
17457                Err(err) => {
17458                    if let common::Retry::After(d) = dlg.http_error(&err) {
17459                        sleep(d).await;
17460                        continue;
17461                    }
17462                    dlg.finished(false);
17463                    return Err(common::Error::HttpError(err));
17464                }
17465                Ok(res) => {
17466                    let (mut parts, body) = res.into_parts();
17467                    let mut body = common::Body::new(body);
17468                    if !parts.status.is_success() {
17469                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17470                        let error = serde_json::from_str(&common::to_string(&bytes));
17471                        let response = common::to_response(parts, bytes.into());
17472
17473                        if let common::Retry::After(d) =
17474                            dlg.http_failure(&response, error.as_ref().ok())
17475                        {
17476                            sleep(d).await;
17477                            continue;
17478                        }
17479
17480                        dlg.finished(false);
17481
17482                        return Err(match error {
17483                            Ok(value) => common::Error::BadRequest(value),
17484                            _ => common::Error::Failure(response),
17485                        });
17486                    }
17487                    let response = {
17488                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17489                        let encoded = common::to_string(&bytes);
17490                        match serde_json::from_str(&encoded) {
17491                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17492                            Err(error) => {
17493                                dlg.response_json_decode_error(&encoded, &error);
17494                                return Err(common::Error::JsonDecodeError(
17495                                    encoded.to_string(),
17496                                    error,
17497                                ));
17498                            }
17499                        }
17500                    };
17501
17502                    dlg.finished(true);
17503                    return Ok(response);
17504                }
17505            }
17506        }
17507    }
17508
17509    ///
17510    /// Sets the *request* property to the given value.
17511    ///
17512    /// Even though the property as already been set when instantiating this call,
17513    /// we provide this method for API completeness.
17514    pub fn request(
17515        mut self,
17516        new_value: AutoscalingPolicy,
17517    ) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C> {
17518        self._request = new_value;
17519        self
17520    }
17521    /// Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
17522    ///
17523    /// Sets the *parent* path property to the given value.
17524    ///
17525    /// Even though the property as already been set when instantiating this call,
17526    /// we provide this method for API completeness.
17527    pub fn parent(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C> {
17528        self._parent = new_value.to_string();
17529        self
17530    }
17531    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17532    /// while executing the actual API request.
17533    ///
17534    /// ````text
17535    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17536    /// ````
17537    ///
17538    /// Sets the *delegate* property to the given value.
17539    pub fn delegate(
17540        mut self,
17541        new_value: &'a mut dyn common::Delegate,
17542    ) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C> {
17543        self._delegate = Some(new_value);
17544        self
17545    }
17546
17547    /// Set any additional parameter of the query string used in the request.
17548    /// It should be used to set parameters which are not yet available through their own
17549    /// setters.
17550    ///
17551    /// Please note that this method must not be used to set any of the known parameters
17552    /// which have their own setter method. If done anyway, the request will fail.
17553    ///
17554    /// # Additional Parameters
17555    ///
17556    /// * *$.xgafv* (query-string) - V1 error format.
17557    /// * *access_token* (query-string) - OAuth access token.
17558    /// * *alt* (query-string) - Data format for response.
17559    /// * *callback* (query-string) - JSONP
17560    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17561    /// * *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.
17562    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17563    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17564    /// * *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.
17565    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17566    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17567    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C>
17568    where
17569        T: AsRef<str>,
17570    {
17571        self._additional_params
17572            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17573        self
17574    }
17575
17576    /// Identifies the authorization scope for the method you are building.
17577    ///
17578    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17579    /// [`Scope::CloudPlatform`].
17580    ///
17581    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17582    /// tokens for more than one scope.
17583    ///
17584    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17585    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17586    /// sufficient, a read-write scope will do as well.
17587    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C>
17588    where
17589        St: AsRef<str>,
17590    {
17591        self._scopes.insert(String::from(scope.as_ref()));
17592        self
17593    }
17594    /// Identifies the authorization scope(s) for the method you are building.
17595    ///
17596    /// See [`Self::add_scope()`] for details.
17597    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C>
17598    where
17599        I: IntoIterator<Item = St>,
17600        St: AsRef<str>,
17601    {
17602        self._scopes
17603            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17604        self
17605    }
17606
17607    /// Removes all scopes, and no default scope will be used either.
17608    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17609    /// for details).
17610    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyCreateCall<'a, C> {
17611        self._scopes.clear();
17612        self
17613    }
17614}
17615
17616/// Deletes an autoscaling policy. It is an error to delete an autoscaling policy that is in use by one or more clusters.
17617///
17618/// A builder for the *regions.autoscalingPolicies.delete* method supported by a *project* resource.
17619/// It is not used directly, but through a [`ProjectMethods`] instance.
17620///
17621/// # Example
17622///
17623/// Instantiate a resource method builder
17624///
17625/// ```test_harness,no_run
17626/// # extern crate hyper;
17627/// # extern crate hyper_rustls;
17628/// # extern crate google_dataproc1 as dataproc1;
17629/// # async fn dox() {
17630/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17631///
17632/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17633/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17634/// #     secret,
17635/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17636/// # ).build().await.unwrap();
17637///
17638/// # let client = hyper_util::client::legacy::Client::builder(
17639/// #     hyper_util::rt::TokioExecutor::new()
17640/// # )
17641/// # .build(
17642/// #     hyper_rustls::HttpsConnectorBuilder::new()
17643/// #         .with_native_roots()
17644/// #         .unwrap()
17645/// #         .https_or_http()
17646/// #         .enable_http1()
17647/// #         .build()
17648/// # );
17649/// # let mut hub = Dataproc::new(client, auth);
17650/// // You can configure optional parameters by calling the respective setters at will, and
17651/// // execute the final call using `doit()`.
17652/// // Values shown here are possibly random and not representative !
17653/// let result = hub.projects().regions_autoscaling_policies_delete("name")
17654///              .doit().await;
17655/// # }
17656/// ```
17657pub struct ProjectRegionAutoscalingPolicyDeleteCall<'a, C>
17658where
17659    C: 'a,
17660{
17661    hub: &'a Dataproc<C>,
17662    _name: String,
17663    _delegate: Option<&'a mut dyn common::Delegate>,
17664    _additional_params: HashMap<String, String>,
17665    _scopes: BTreeSet<String>,
17666}
17667
17668impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyDeleteCall<'a, C> {}
17669
17670impl<'a, C> ProjectRegionAutoscalingPolicyDeleteCall<'a, C>
17671where
17672    C: common::Connector,
17673{
17674    /// Perform the operation you have build so far.
17675    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17676        use std::borrow::Cow;
17677        use std::io::{Read, Seek};
17678
17679        use common::{url::Params, ToParts};
17680        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17681
17682        let mut dd = common::DefaultDelegate;
17683        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17684        dlg.begin(common::MethodInfo {
17685            id: "dataproc.projects.regions.autoscalingPolicies.delete",
17686            http_method: hyper::Method::DELETE,
17687        });
17688
17689        for &field in ["alt", "name"].iter() {
17690            if self._additional_params.contains_key(field) {
17691                dlg.finished(false);
17692                return Err(common::Error::FieldClash(field));
17693            }
17694        }
17695
17696        let mut params = Params::with_capacity(3 + self._additional_params.len());
17697        params.push("name", self._name);
17698
17699        params.extend(self._additional_params.iter());
17700
17701        params.push("alt", "json");
17702        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17703        if self._scopes.is_empty() {
17704            self._scopes
17705                .insert(Scope::CloudPlatform.as_ref().to_string());
17706        }
17707
17708        #[allow(clippy::single_element_loop)]
17709        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17710            url = params.uri_replacement(url, param_name, find_this, true);
17711        }
17712        {
17713            let to_remove = ["name"];
17714            params.remove_params(&to_remove);
17715        }
17716
17717        let url = params.parse_with_url(&url);
17718
17719        loop {
17720            let token = match self
17721                .hub
17722                .auth
17723                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17724                .await
17725            {
17726                Ok(token) => token,
17727                Err(e) => match dlg.token(e) {
17728                    Ok(token) => token,
17729                    Err(e) => {
17730                        dlg.finished(false);
17731                        return Err(common::Error::MissingToken(e));
17732                    }
17733                },
17734            };
17735            let mut req_result = {
17736                let client = &self.hub.client;
17737                dlg.pre_request();
17738                let mut req_builder = hyper::Request::builder()
17739                    .method(hyper::Method::DELETE)
17740                    .uri(url.as_str())
17741                    .header(USER_AGENT, self.hub._user_agent.clone());
17742
17743                if let Some(token) = token.as_ref() {
17744                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17745                }
17746
17747                let request = req_builder
17748                    .header(CONTENT_LENGTH, 0_u64)
17749                    .body(common::to_body::<String>(None));
17750
17751                client.request(request.unwrap()).await
17752            };
17753
17754            match req_result {
17755                Err(err) => {
17756                    if let common::Retry::After(d) = dlg.http_error(&err) {
17757                        sleep(d).await;
17758                        continue;
17759                    }
17760                    dlg.finished(false);
17761                    return Err(common::Error::HttpError(err));
17762                }
17763                Ok(res) => {
17764                    let (mut parts, body) = res.into_parts();
17765                    let mut body = common::Body::new(body);
17766                    if !parts.status.is_success() {
17767                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17768                        let error = serde_json::from_str(&common::to_string(&bytes));
17769                        let response = common::to_response(parts, bytes.into());
17770
17771                        if let common::Retry::After(d) =
17772                            dlg.http_failure(&response, error.as_ref().ok())
17773                        {
17774                            sleep(d).await;
17775                            continue;
17776                        }
17777
17778                        dlg.finished(false);
17779
17780                        return Err(match error {
17781                            Ok(value) => common::Error::BadRequest(value),
17782                            _ => common::Error::Failure(response),
17783                        });
17784                    }
17785                    let response = {
17786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17787                        let encoded = common::to_string(&bytes);
17788                        match serde_json::from_str(&encoded) {
17789                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17790                            Err(error) => {
17791                                dlg.response_json_decode_error(&encoded, &error);
17792                                return Err(common::Error::JsonDecodeError(
17793                                    encoded.to_string(),
17794                                    error,
17795                                ));
17796                            }
17797                        }
17798                    };
17799
17800                    dlg.finished(true);
17801                    return Ok(response);
17802                }
17803            }
17804        }
17805    }
17806
17807    /// Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.delete, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
17808    ///
17809    /// Sets the *name* path property to the given value.
17810    ///
17811    /// Even though the property as already been set when instantiating this call,
17812    /// we provide this method for API completeness.
17813    pub fn name(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C> {
17814        self._name = new_value.to_string();
17815        self
17816    }
17817    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17818    /// while executing the actual API request.
17819    ///
17820    /// ````text
17821    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17822    /// ````
17823    ///
17824    /// Sets the *delegate* property to the given value.
17825    pub fn delegate(
17826        mut self,
17827        new_value: &'a mut dyn common::Delegate,
17828    ) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C> {
17829        self._delegate = Some(new_value);
17830        self
17831    }
17832
17833    /// Set any additional parameter of the query string used in the request.
17834    /// It should be used to set parameters which are not yet available through their own
17835    /// setters.
17836    ///
17837    /// Please note that this method must not be used to set any of the known parameters
17838    /// which have their own setter method. If done anyway, the request will fail.
17839    ///
17840    /// # Additional Parameters
17841    ///
17842    /// * *$.xgafv* (query-string) - V1 error format.
17843    /// * *access_token* (query-string) - OAuth access token.
17844    /// * *alt* (query-string) - Data format for response.
17845    /// * *callback* (query-string) - JSONP
17846    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17847    /// * *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.
17848    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17849    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17850    /// * *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.
17851    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17852    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17853    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C>
17854    where
17855        T: AsRef<str>,
17856    {
17857        self._additional_params
17858            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17859        self
17860    }
17861
17862    /// Identifies the authorization scope for the method you are building.
17863    ///
17864    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17865    /// [`Scope::CloudPlatform`].
17866    ///
17867    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17868    /// tokens for more than one scope.
17869    ///
17870    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17871    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17872    /// sufficient, a read-write scope will do as well.
17873    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C>
17874    where
17875        St: AsRef<str>,
17876    {
17877        self._scopes.insert(String::from(scope.as_ref()));
17878        self
17879    }
17880    /// Identifies the authorization scope(s) for the method you are building.
17881    ///
17882    /// See [`Self::add_scope()`] for details.
17883    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C>
17884    where
17885        I: IntoIterator<Item = St>,
17886        St: AsRef<str>,
17887    {
17888        self._scopes
17889            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17890        self
17891    }
17892
17893    /// Removes all scopes, and no default scope will be used either.
17894    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17895    /// for details).
17896    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyDeleteCall<'a, C> {
17897        self._scopes.clear();
17898        self
17899    }
17900}
17901
17902/// Retrieves autoscaling policy.
17903///
17904/// A builder for the *regions.autoscalingPolicies.get* method supported by a *project* resource.
17905/// It is not used directly, but through a [`ProjectMethods`] instance.
17906///
17907/// # Example
17908///
17909/// Instantiate a resource method builder
17910///
17911/// ```test_harness,no_run
17912/// # extern crate hyper;
17913/// # extern crate hyper_rustls;
17914/// # extern crate google_dataproc1 as dataproc1;
17915/// # async fn dox() {
17916/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17917///
17918/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17919/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17920/// #     secret,
17921/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17922/// # ).build().await.unwrap();
17923///
17924/// # let client = hyper_util::client::legacy::Client::builder(
17925/// #     hyper_util::rt::TokioExecutor::new()
17926/// # )
17927/// # .build(
17928/// #     hyper_rustls::HttpsConnectorBuilder::new()
17929/// #         .with_native_roots()
17930/// #         .unwrap()
17931/// #         .https_or_http()
17932/// #         .enable_http1()
17933/// #         .build()
17934/// # );
17935/// # let mut hub = Dataproc::new(client, auth);
17936/// // You can configure optional parameters by calling the respective setters at will, and
17937/// // execute the final call using `doit()`.
17938/// // Values shown here are possibly random and not representative !
17939/// let result = hub.projects().regions_autoscaling_policies_get("name")
17940///              .doit().await;
17941/// # }
17942/// ```
17943pub struct ProjectRegionAutoscalingPolicyGetCall<'a, C>
17944where
17945    C: 'a,
17946{
17947    hub: &'a Dataproc<C>,
17948    _name: String,
17949    _delegate: Option<&'a mut dyn common::Delegate>,
17950    _additional_params: HashMap<String, String>,
17951    _scopes: BTreeSet<String>,
17952}
17953
17954impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyGetCall<'a, C> {}
17955
17956impl<'a, C> ProjectRegionAutoscalingPolicyGetCall<'a, C>
17957where
17958    C: common::Connector,
17959{
17960    /// Perform the operation you have build so far.
17961    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
17962        use std::borrow::Cow;
17963        use std::io::{Read, Seek};
17964
17965        use common::{url::Params, ToParts};
17966        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17967
17968        let mut dd = common::DefaultDelegate;
17969        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17970        dlg.begin(common::MethodInfo {
17971            id: "dataproc.projects.regions.autoscalingPolicies.get",
17972            http_method: hyper::Method::GET,
17973        });
17974
17975        for &field in ["alt", "name"].iter() {
17976            if self._additional_params.contains_key(field) {
17977                dlg.finished(false);
17978                return Err(common::Error::FieldClash(field));
17979            }
17980        }
17981
17982        let mut params = Params::with_capacity(3 + self._additional_params.len());
17983        params.push("name", self._name);
17984
17985        params.extend(self._additional_params.iter());
17986
17987        params.push("alt", "json");
17988        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17989        if self._scopes.is_empty() {
17990            self._scopes
17991                .insert(Scope::CloudPlatform.as_ref().to_string());
17992        }
17993
17994        #[allow(clippy::single_element_loop)]
17995        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17996            url = params.uri_replacement(url, param_name, find_this, true);
17997        }
17998        {
17999            let to_remove = ["name"];
18000            params.remove_params(&to_remove);
18001        }
18002
18003        let url = params.parse_with_url(&url);
18004
18005        loop {
18006            let token = match self
18007                .hub
18008                .auth
18009                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18010                .await
18011            {
18012                Ok(token) => token,
18013                Err(e) => match dlg.token(e) {
18014                    Ok(token) => token,
18015                    Err(e) => {
18016                        dlg.finished(false);
18017                        return Err(common::Error::MissingToken(e));
18018                    }
18019                },
18020            };
18021            let mut req_result = {
18022                let client = &self.hub.client;
18023                dlg.pre_request();
18024                let mut req_builder = hyper::Request::builder()
18025                    .method(hyper::Method::GET)
18026                    .uri(url.as_str())
18027                    .header(USER_AGENT, self.hub._user_agent.clone());
18028
18029                if let Some(token) = token.as_ref() {
18030                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18031                }
18032
18033                let request = req_builder
18034                    .header(CONTENT_LENGTH, 0_u64)
18035                    .body(common::to_body::<String>(None));
18036
18037                client.request(request.unwrap()).await
18038            };
18039
18040            match req_result {
18041                Err(err) => {
18042                    if let common::Retry::After(d) = dlg.http_error(&err) {
18043                        sleep(d).await;
18044                        continue;
18045                    }
18046                    dlg.finished(false);
18047                    return Err(common::Error::HttpError(err));
18048                }
18049                Ok(res) => {
18050                    let (mut parts, body) = res.into_parts();
18051                    let mut body = common::Body::new(body);
18052                    if !parts.status.is_success() {
18053                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18054                        let error = serde_json::from_str(&common::to_string(&bytes));
18055                        let response = common::to_response(parts, bytes.into());
18056
18057                        if let common::Retry::After(d) =
18058                            dlg.http_failure(&response, error.as_ref().ok())
18059                        {
18060                            sleep(d).await;
18061                            continue;
18062                        }
18063
18064                        dlg.finished(false);
18065
18066                        return Err(match error {
18067                            Ok(value) => common::Error::BadRequest(value),
18068                            _ => common::Error::Failure(response),
18069                        });
18070                    }
18071                    let response = {
18072                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18073                        let encoded = common::to_string(&bytes);
18074                        match serde_json::from_str(&encoded) {
18075                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18076                            Err(error) => {
18077                                dlg.response_json_decode_error(&encoded, &error);
18078                                return Err(common::Error::JsonDecodeError(
18079                                    encoded.to_string(),
18080                                    error,
18081                                ));
18082                            }
18083                        }
18084                    };
18085
18086                    dlg.finished(true);
18087                    return Ok(response);
18088                }
18089            }
18090        }
18091    }
18092
18093    /// Required. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies.get, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
18094    ///
18095    /// Sets the *name* path property to the given value.
18096    ///
18097    /// Even though the property as already been set when instantiating this call,
18098    /// we provide this method for API completeness.
18099    pub fn name(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyGetCall<'a, C> {
18100        self._name = new_value.to_string();
18101        self
18102    }
18103    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18104    /// while executing the actual API request.
18105    ///
18106    /// ````text
18107    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18108    /// ````
18109    ///
18110    /// Sets the *delegate* property to the given value.
18111    pub fn delegate(
18112        mut self,
18113        new_value: &'a mut dyn common::Delegate,
18114    ) -> ProjectRegionAutoscalingPolicyGetCall<'a, C> {
18115        self._delegate = Some(new_value);
18116        self
18117    }
18118
18119    /// Set any additional parameter of the query string used in the request.
18120    /// It should be used to set parameters which are not yet available through their own
18121    /// setters.
18122    ///
18123    /// Please note that this method must not be used to set any of the known parameters
18124    /// which have their own setter method. If done anyway, the request will fail.
18125    ///
18126    /// # Additional Parameters
18127    ///
18128    /// * *$.xgafv* (query-string) - V1 error format.
18129    /// * *access_token* (query-string) - OAuth access token.
18130    /// * *alt* (query-string) - Data format for response.
18131    /// * *callback* (query-string) - JSONP
18132    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18133    /// * *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.
18134    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18135    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18136    /// * *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.
18137    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18138    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18139    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionAutoscalingPolicyGetCall<'a, C>
18140    where
18141        T: AsRef<str>,
18142    {
18143        self._additional_params
18144            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18145        self
18146    }
18147
18148    /// Identifies the authorization scope for the method you are building.
18149    ///
18150    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18151    /// [`Scope::CloudPlatform`].
18152    ///
18153    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18154    /// tokens for more than one scope.
18155    ///
18156    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18157    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18158    /// sufficient, a read-write scope will do as well.
18159    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionAutoscalingPolicyGetCall<'a, C>
18160    where
18161        St: AsRef<str>,
18162    {
18163        self._scopes.insert(String::from(scope.as_ref()));
18164        self
18165    }
18166    /// Identifies the authorization scope(s) for the method you are building.
18167    ///
18168    /// See [`Self::add_scope()`] for details.
18169    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionAutoscalingPolicyGetCall<'a, C>
18170    where
18171        I: IntoIterator<Item = St>,
18172        St: AsRef<str>,
18173    {
18174        self._scopes
18175            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18176        self
18177    }
18178
18179    /// Removes all scopes, and no default scope will be used either.
18180    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18181    /// for details).
18182    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyGetCall<'a, C> {
18183        self._scopes.clear();
18184        self
18185    }
18186}
18187
18188/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
18189///
18190/// A builder for the *regions.autoscalingPolicies.getIamPolicy* method supported by a *project* resource.
18191/// It is not used directly, but through a [`ProjectMethods`] instance.
18192///
18193/// # Example
18194///
18195/// Instantiate a resource method builder
18196///
18197/// ```test_harness,no_run
18198/// # extern crate hyper;
18199/// # extern crate hyper_rustls;
18200/// # extern crate google_dataproc1 as dataproc1;
18201/// use dataproc1::api::GetIamPolicyRequest;
18202/// # async fn dox() {
18203/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18204///
18205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18206/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18207/// #     secret,
18208/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18209/// # ).build().await.unwrap();
18210///
18211/// # let client = hyper_util::client::legacy::Client::builder(
18212/// #     hyper_util::rt::TokioExecutor::new()
18213/// # )
18214/// # .build(
18215/// #     hyper_rustls::HttpsConnectorBuilder::new()
18216/// #         .with_native_roots()
18217/// #         .unwrap()
18218/// #         .https_or_http()
18219/// #         .enable_http1()
18220/// #         .build()
18221/// # );
18222/// # let mut hub = Dataproc::new(client, auth);
18223/// // As the method needs a request, you would usually fill it with the desired information
18224/// // into the respective structure. Some of the parts shown here might not be applicable !
18225/// // Values shown here are possibly random and not representative !
18226/// let mut req = GetIamPolicyRequest::default();
18227///
18228/// // You can configure optional parameters by calling the respective setters at will, and
18229/// // execute the final call using `doit()`.
18230/// // Values shown here are possibly random and not representative !
18231/// let result = hub.projects().regions_autoscaling_policies_get_iam_policy(req, "resource")
18232///              .doit().await;
18233/// # }
18234/// ```
18235pub struct ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C>
18236where
18237    C: 'a,
18238{
18239    hub: &'a Dataproc<C>,
18240    _request: GetIamPolicyRequest,
18241    _resource: String,
18242    _delegate: Option<&'a mut dyn common::Delegate>,
18243    _additional_params: HashMap<String, String>,
18244    _scopes: BTreeSet<String>,
18245}
18246
18247impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {}
18248
18249impl<'a, C> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C>
18250where
18251    C: common::Connector,
18252{
18253    /// Perform the operation you have build so far.
18254    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18255        use std::borrow::Cow;
18256        use std::io::{Read, Seek};
18257
18258        use common::{url::Params, ToParts};
18259        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18260
18261        let mut dd = common::DefaultDelegate;
18262        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18263        dlg.begin(common::MethodInfo {
18264            id: "dataproc.projects.regions.autoscalingPolicies.getIamPolicy",
18265            http_method: hyper::Method::POST,
18266        });
18267
18268        for &field in ["alt", "resource"].iter() {
18269            if self._additional_params.contains_key(field) {
18270                dlg.finished(false);
18271                return Err(common::Error::FieldClash(field));
18272            }
18273        }
18274
18275        let mut params = Params::with_capacity(4 + self._additional_params.len());
18276        params.push("resource", self._resource);
18277
18278        params.extend(self._additional_params.iter());
18279
18280        params.push("alt", "json");
18281        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
18282        if self._scopes.is_empty() {
18283            self._scopes
18284                .insert(Scope::CloudPlatform.as_ref().to_string());
18285        }
18286
18287        #[allow(clippy::single_element_loop)]
18288        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18289            url = params.uri_replacement(url, param_name, find_this, true);
18290        }
18291        {
18292            let to_remove = ["resource"];
18293            params.remove_params(&to_remove);
18294        }
18295
18296        let url = params.parse_with_url(&url);
18297
18298        let mut json_mime_type = mime::APPLICATION_JSON;
18299        let mut request_value_reader = {
18300            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18301            common::remove_json_null_values(&mut value);
18302            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18303            serde_json::to_writer(&mut dst, &value).unwrap();
18304            dst
18305        };
18306        let request_size = request_value_reader
18307            .seek(std::io::SeekFrom::End(0))
18308            .unwrap();
18309        request_value_reader
18310            .seek(std::io::SeekFrom::Start(0))
18311            .unwrap();
18312
18313        loop {
18314            let token = match self
18315                .hub
18316                .auth
18317                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18318                .await
18319            {
18320                Ok(token) => token,
18321                Err(e) => match dlg.token(e) {
18322                    Ok(token) => token,
18323                    Err(e) => {
18324                        dlg.finished(false);
18325                        return Err(common::Error::MissingToken(e));
18326                    }
18327                },
18328            };
18329            request_value_reader
18330                .seek(std::io::SeekFrom::Start(0))
18331                .unwrap();
18332            let mut req_result = {
18333                let client = &self.hub.client;
18334                dlg.pre_request();
18335                let mut req_builder = hyper::Request::builder()
18336                    .method(hyper::Method::POST)
18337                    .uri(url.as_str())
18338                    .header(USER_AGENT, self.hub._user_agent.clone());
18339
18340                if let Some(token) = token.as_ref() {
18341                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18342                }
18343
18344                let request = req_builder
18345                    .header(CONTENT_TYPE, json_mime_type.to_string())
18346                    .header(CONTENT_LENGTH, request_size as u64)
18347                    .body(common::to_body(
18348                        request_value_reader.get_ref().clone().into(),
18349                    ));
18350
18351                client.request(request.unwrap()).await
18352            };
18353
18354            match req_result {
18355                Err(err) => {
18356                    if let common::Retry::After(d) = dlg.http_error(&err) {
18357                        sleep(d).await;
18358                        continue;
18359                    }
18360                    dlg.finished(false);
18361                    return Err(common::Error::HttpError(err));
18362                }
18363                Ok(res) => {
18364                    let (mut parts, body) = res.into_parts();
18365                    let mut body = common::Body::new(body);
18366                    if !parts.status.is_success() {
18367                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18368                        let error = serde_json::from_str(&common::to_string(&bytes));
18369                        let response = common::to_response(parts, bytes.into());
18370
18371                        if let common::Retry::After(d) =
18372                            dlg.http_failure(&response, error.as_ref().ok())
18373                        {
18374                            sleep(d).await;
18375                            continue;
18376                        }
18377
18378                        dlg.finished(false);
18379
18380                        return Err(match error {
18381                            Ok(value) => common::Error::BadRequest(value),
18382                            _ => common::Error::Failure(response),
18383                        });
18384                    }
18385                    let response = {
18386                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18387                        let encoded = common::to_string(&bytes);
18388                        match serde_json::from_str(&encoded) {
18389                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18390                            Err(error) => {
18391                                dlg.response_json_decode_error(&encoded, &error);
18392                                return Err(common::Error::JsonDecodeError(
18393                                    encoded.to_string(),
18394                                    error,
18395                                ));
18396                            }
18397                        }
18398                    };
18399
18400                    dlg.finished(true);
18401                    return Ok(response);
18402                }
18403            }
18404        }
18405    }
18406
18407    ///
18408    /// Sets the *request* property to the given value.
18409    ///
18410    /// Even though the property as already been set when instantiating this call,
18411    /// we provide this method for API completeness.
18412    pub fn request(
18413        mut self,
18414        new_value: GetIamPolicyRequest,
18415    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {
18416        self._request = new_value;
18417        self
18418    }
18419    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
18420    ///
18421    /// Sets the *resource* path property to the given value.
18422    ///
18423    /// Even though the property as already been set when instantiating this call,
18424    /// we provide this method for API completeness.
18425    pub fn resource(
18426        mut self,
18427        new_value: &str,
18428    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {
18429        self._resource = new_value.to_string();
18430        self
18431    }
18432    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18433    /// while executing the actual API request.
18434    ///
18435    /// ````text
18436    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18437    /// ````
18438    ///
18439    /// Sets the *delegate* property to the given value.
18440    pub fn delegate(
18441        mut self,
18442        new_value: &'a mut dyn common::Delegate,
18443    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {
18444        self._delegate = Some(new_value);
18445        self
18446    }
18447
18448    /// Set any additional parameter of the query string used in the request.
18449    /// It should be used to set parameters which are not yet available through their own
18450    /// setters.
18451    ///
18452    /// Please note that this method must not be used to set any of the known parameters
18453    /// which have their own setter method. If done anyway, the request will fail.
18454    ///
18455    /// # Additional Parameters
18456    ///
18457    /// * *$.xgafv* (query-string) - V1 error format.
18458    /// * *access_token* (query-string) - OAuth access token.
18459    /// * *alt* (query-string) - Data format for response.
18460    /// * *callback* (query-string) - JSONP
18461    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18462    /// * *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.
18463    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18464    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18465    /// * *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.
18466    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18467    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18468    pub fn param<T>(
18469        mut self,
18470        name: T,
18471        value: T,
18472    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C>
18473    where
18474        T: AsRef<str>,
18475    {
18476        self._additional_params
18477            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18478        self
18479    }
18480
18481    /// Identifies the authorization scope for the method you are building.
18482    ///
18483    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18484    /// [`Scope::CloudPlatform`].
18485    ///
18486    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18487    /// tokens for more than one scope.
18488    ///
18489    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18490    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18491    /// sufficient, a read-write scope will do as well.
18492    pub fn add_scope<St>(
18493        mut self,
18494        scope: St,
18495    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C>
18496    where
18497        St: AsRef<str>,
18498    {
18499        self._scopes.insert(String::from(scope.as_ref()));
18500        self
18501    }
18502    /// Identifies the authorization scope(s) for the method you are building.
18503    ///
18504    /// See [`Self::add_scope()`] for details.
18505    pub fn add_scopes<I, St>(
18506        mut self,
18507        scopes: I,
18508    ) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C>
18509    where
18510        I: IntoIterator<Item = St>,
18511        St: AsRef<str>,
18512    {
18513        self._scopes
18514            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18515        self
18516    }
18517
18518    /// Removes all scopes, and no default scope will be used either.
18519    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18520    /// for details).
18521    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyGetIamPolicyCall<'a, C> {
18522        self._scopes.clear();
18523        self
18524    }
18525}
18526
18527/// Lists autoscaling policies in the project.
18528///
18529/// A builder for the *regions.autoscalingPolicies.list* method supported by a *project* resource.
18530/// It is not used directly, but through a [`ProjectMethods`] instance.
18531///
18532/// # Example
18533///
18534/// Instantiate a resource method builder
18535///
18536/// ```test_harness,no_run
18537/// # extern crate hyper;
18538/// # extern crate hyper_rustls;
18539/// # extern crate google_dataproc1 as dataproc1;
18540/// # async fn dox() {
18541/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18542///
18543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18545/// #     secret,
18546/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18547/// # ).build().await.unwrap();
18548///
18549/// # let client = hyper_util::client::legacy::Client::builder(
18550/// #     hyper_util::rt::TokioExecutor::new()
18551/// # )
18552/// # .build(
18553/// #     hyper_rustls::HttpsConnectorBuilder::new()
18554/// #         .with_native_roots()
18555/// #         .unwrap()
18556/// #         .https_or_http()
18557/// #         .enable_http1()
18558/// #         .build()
18559/// # );
18560/// # let mut hub = Dataproc::new(client, auth);
18561/// // You can configure optional parameters by calling the respective setters at will, and
18562/// // execute the final call using `doit()`.
18563/// // Values shown here are possibly random and not representative !
18564/// let result = hub.projects().regions_autoscaling_policies_list("parent")
18565///              .page_token("amet.")
18566///              .page_size(-30)
18567///              .doit().await;
18568/// # }
18569/// ```
18570pub struct ProjectRegionAutoscalingPolicyListCall<'a, C>
18571where
18572    C: 'a,
18573{
18574    hub: &'a Dataproc<C>,
18575    _parent: String,
18576    _page_token: Option<String>,
18577    _page_size: Option<i32>,
18578    _delegate: Option<&'a mut dyn common::Delegate>,
18579    _additional_params: HashMap<String, String>,
18580    _scopes: BTreeSet<String>,
18581}
18582
18583impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyListCall<'a, C> {}
18584
18585impl<'a, C> ProjectRegionAutoscalingPolicyListCall<'a, C>
18586where
18587    C: common::Connector,
18588{
18589    /// Perform the operation you have build so far.
18590    pub async fn doit(
18591        mut self,
18592    ) -> common::Result<(common::Response, ListAutoscalingPoliciesResponse)> {
18593        use std::borrow::Cow;
18594        use std::io::{Read, Seek};
18595
18596        use common::{url::Params, ToParts};
18597        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18598
18599        let mut dd = common::DefaultDelegate;
18600        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18601        dlg.begin(common::MethodInfo {
18602            id: "dataproc.projects.regions.autoscalingPolicies.list",
18603            http_method: hyper::Method::GET,
18604        });
18605
18606        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
18607            if self._additional_params.contains_key(field) {
18608                dlg.finished(false);
18609                return Err(common::Error::FieldClash(field));
18610            }
18611        }
18612
18613        let mut params = Params::with_capacity(5 + self._additional_params.len());
18614        params.push("parent", self._parent);
18615        if let Some(value) = self._page_token.as_ref() {
18616            params.push("pageToken", value);
18617        }
18618        if let Some(value) = self._page_size.as_ref() {
18619            params.push("pageSize", value.to_string());
18620        }
18621
18622        params.extend(self._additional_params.iter());
18623
18624        params.push("alt", "json");
18625        let mut url = self.hub._base_url.clone() + "v1/{+parent}/autoscalingPolicies";
18626        if self._scopes.is_empty() {
18627            self._scopes
18628                .insert(Scope::CloudPlatform.as_ref().to_string());
18629        }
18630
18631        #[allow(clippy::single_element_loop)]
18632        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18633            url = params.uri_replacement(url, param_name, find_this, true);
18634        }
18635        {
18636            let to_remove = ["parent"];
18637            params.remove_params(&to_remove);
18638        }
18639
18640        let url = params.parse_with_url(&url);
18641
18642        loop {
18643            let token = match self
18644                .hub
18645                .auth
18646                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18647                .await
18648            {
18649                Ok(token) => token,
18650                Err(e) => match dlg.token(e) {
18651                    Ok(token) => token,
18652                    Err(e) => {
18653                        dlg.finished(false);
18654                        return Err(common::Error::MissingToken(e));
18655                    }
18656                },
18657            };
18658            let mut req_result = {
18659                let client = &self.hub.client;
18660                dlg.pre_request();
18661                let mut req_builder = hyper::Request::builder()
18662                    .method(hyper::Method::GET)
18663                    .uri(url.as_str())
18664                    .header(USER_AGENT, self.hub._user_agent.clone());
18665
18666                if let Some(token) = token.as_ref() {
18667                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18668                }
18669
18670                let request = req_builder
18671                    .header(CONTENT_LENGTH, 0_u64)
18672                    .body(common::to_body::<String>(None));
18673
18674                client.request(request.unwrap()).await
18675            };
18676
18677            match req_result {
18678                Err(err) => {
18679                    if let common::Retry::After(d) = dlg.http_error(&err) {
18680                        sleep(d).await;
18681                        continue;
18682                    }
18683                    dlg.finished(false);
18684                    return Err(common::Error::HttpError(err));
18685                }
18686                Ok(res) => {
18687                    let (mut parts, body) = res.into_parts();
18688                    let mut body = common::Body::new(body);
18689                    if !parts.status.is_success() {
18690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18691                        let error = serde_json::from_str(&common::to_string(&bytes));
18692                        let response = common::to_response(parts, bytes.into());
18693
18694                        if let common::Retry::After(d) =
18695                            dlg.http_failure(&response, error.as_ref().ok())
18696                        {
18697                            sleep(d).await;
18698                            continue;
18699                        }
18700
18701                        dlg.finished(false);
18702
18703                        return Err(match error {
18704                            Ok(value) => common::Error::BadRequest(value),
18705                            _ => common::Error::Failure(response),
18706                        });
18707                    }
18708                    let response = {
18709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18710                        let encoded = common::to_string(&bytes);
18711                        match serde_json::from_str(&encoded) {
18712                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18713                            Err(error) => {
18714                                dlg.response_json_decode_error(&encoded, &error);
18715                                return Err(common::Error::JsonDecodeError(
18716                                    encoded.to_string(),
18717                                    error,
18718                                ));
18719                            }
18720                        }
18721                    };
18722
18723                    dlg.finished(true);
18724                    return Ok(response);
18725                }
18726            }
18727        }
18728    }
18729
18730    /// Required. The "resource name" of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies.list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.autoscalingPolicies.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
18731    ///
18732    /// Sets the *parent* path property to the given value.
18733    ///
18734    /// Even though the property as already been set when instantiating this call,
18735    /// we provide this method for API completeness.
18736    pub fn parent(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
18737        self._parent = new_value.to_string();
18738        self
18739    }
18740    /// Optional. The page token, returned by a previous call, to request the next page of results.
18741    ///
18742    /// Sets the *page token* query property to the given value.
18743    pub fn page_token(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
18744        self._page_token = Some(new_value.to_string());
18745        self
18746    }
18747    /// Optional. The maximum number of results to return in each response. Must be less than or equal to 1000. Defaults to 100.
18748    ///
18749    /// Sets the *page size* query property to the given value.
18750    pub fn page_size(mut self, new_value: i32) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
18751        self._page_size = Some(new_value);
18752        self
18753    }
18754    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18755    /// while executing the actual API request.
18756    ///
18757    /// ````text
18758    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18759    /// ````
18760    ///
18761    /// Sets the *delegate* property to the given value.
18762    pub fn delegate(
18763        mut self,
18764        new_value: &'a mut dyn common::Delegate,
18765    ) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
18766        self._delegate = Some(new_value);
18767        self
18768    }
18769
18770    /// Set any additional parameter of the query string used in the request.
18771    /// It should be used to set parameters which are not yet available through their own
18772    /// setters.
18773    ///
18774    /// Please note that this method must not be used to set any of the known parameters
18775    /// which have their own setter method. If done anyway, the request will fail.
18776    ///
18777    /// # Additional Parameters
18778    ///
18779    /// * *$.xgafv* (query-string) - V1 error format.
18780    /// * *access_token* (query-string) - OAuth access token.
18781    /// * *alt* (query-string) - Data format for response.
18782    /// * *callback* (query-string) - JSONP
18783    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18784    /// * *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.
18785    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18786    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18787    /// * *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.
18788    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18789    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18790    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionAutoscalingPolicyListCall<'a, C>
18791    where
18792        T: AsRef<str>,
18793    {
18794        self._additional_params
18795            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18796        self
18797    }
18798
18799    /// Identifies the authorization scope for the method you are building.
18800    ///
18801    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18802    /// [`Scope::CloudPlatform`].
18803    ///
18804    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18805    /// tokens for more than one scope.
18806    ///
18807    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18808    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18809    /// sufficient, a read-write scope will do as well.
18810    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionAutoscalingPolicyListCall<'a, C>
18811    where
18812        St: AsRef<str>,
18813    {
18814        self._scopes.insert(String::from(scope.as_ref()));
18815        self
18816    }
18817    /// Identifies the authorization scope(s) for the method you are building.
18818    ///
18819    /// See [`Self::add_scope()`] for details.
18820    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionAutoscalingPolicyListCall<'a, C>
18821    where
18822        I: IntoIterator<Item = St>,
18823        St: AsRef<str>,
18824    {
18825        self._scopes
18826            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18827        self
18828    }
18829
18830    /// Removes all scopes, and no default scope will be used either.
18831    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18832    /// for details).
18833    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyListCall<'a, C> {
18834        self._scopes.clear();
18835        self
18836    }
18837}
18838
18839/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
18840///
18841/// A builder for the *regions.autoscalingPolicies.setIamPolicy* method supported by a *project* resource.
18842/// It is not used directly, but through a [`ProjectMethods`] instance.
18843///
18844/// # Example
18845///
18846/// Instantiate a resource method builder
18847///
18848/// ```test_harness,no_run
18849/// # extern crate hyper;
18850/// # extern crate hyper_rustls;
18851/// # extern crate google_dataproc1 as dataproc1;
18852/// use dataproc1::api::SetIamPolicyRequest;
18853/// # async fn dox() {
18854/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18855///
18856/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18857/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18858/// #     secret,
18859/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18860/// # ).build().await.unwrap();
18861///
18862/// # let client = hyper_util::client::legacy::Client::builder(
18863/// #     hyper_util::rt::TokioExecutor::new()
18864/// # )
18865/// # .build(
18866/// #     hyper_rustls::HttpsConnectorBuilder::new()
18867/// #         .with_native_roots()
18868/// #         .unwrap()
18869/// #         .https_or_http()
18870/// #         .enable_http1()
18871/// #         .build()
18872/// # );
18873/// # let mut hub = Dataproc::new(client, auth);
18874/// // As the method needs a request, you would usually fill it with the desired information
18875/// // into the respective structure. Some of the parts shown here might not be applicable !
18876/// // Values shown here are possibly random and not representative !
18877/// let mut req = SetIamPolicyRequest::default();
18878///
18879/// // You can configure optional parameters by calling the respective setters at will, and
18880/// // execute the final call using `doit()`.
18881/// // Values shown here are possibly random and not representative !
18882/// let result = hub.projects().regions_autoscaling_policies_set_iam_policy(req, "resource")
18883///              .doit().await;
18884/// # }
18885/// ```
18886pub struct ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C>
18887where
18888    C: 'a,
18889{
18890    hub: &'a Dataproc<C>,
18891    _request: SetIamPolicyRequest,
18892    _resource: String,
18893    _delegate: Option<&'a mut dyn common::Delegate>,
18894    _additional_params: HashMap<String, String>,
18895    _scopes: BTreeSet<String>,
18896}
18897
18898impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {}
18899
18900impl<'a, C> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C>
18901where
18902    C: common::Connector,
18903{
18904    /// Perform the operation you have build so far.
18905    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18906        use std::borrow::Cow;
18907        use std::io::{Read, Seek};
18908
18909        use common::{url::Params, ToParts};
18910        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18911
18912        let mut dd = common::DefaultDelegate;
18913        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18914        dlg.begin(common::MethodInfo {
18915            id: "dataproc.projects.regions.autoscalingPolicies.setIamPolicy",
18916            http_method: hyper::Method::POST,
18917        });
18918
18919        for &field in ["alt", "resource"].iter() {
18920            if self._additional_params.contains_key(field) {
18921                dlg.finished(false);
18922                return Err(common::Error::FieldClash(field));
18923            }
18924        }
18925
18926        let mut params = Params::with_capacity(4 + self._additional_params.len());
18927        params.push("resource", self._resource);
18928
18929        params.extend(self._additional_params.iter());
18930
18931        params.push("alt", "json");
18932        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
18933        if self._scopes.is_empty() {
18934            self._scopes
18935                .insert(Scope::CloudPlatform.as_ref().to_string());
18936        }
18937
18938        #[allow(clippy::single_element_loop)]
18939        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18940            url = params.uri_replacement(url, param_name, find_this, true);
18941        }
18942        {
18943            let to_remove = ["resource"];
18944            params.remove_params(&to_remove);
18945        }
18946
18947        let url = params.parse_with_url(&url);
18948
18949        let mut json_mime_type = mime::APPLICATION_JSON;
18950        let mut request_value_reader = {
18951            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18952            common::remove_json_null_values(&mut value);
18953            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18954            serde_json::to_writer(&mut dst, &value).unwrap();
18955            dst
18956        };
18957        let request_size = request_value_reader
18958            .seek(std::io::SeekFrom::End(0))
18959            .unwrap();
18960        request_value_reader
18961            .seek(std::io::SeekFrom::Start(0))
18962            .unwrap();
18963
18964        loop {
18965            let token = match self
18966                .hub
18967                .auth
18968                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18969                .await
18970            {
18971                Ok(token) => token,
18972                Err(e) => match dlg.token(e) {
18973                    Ok(token) => token,
18974                    Err(e) => {
18975                        dlg.finished(false);
18976                        return Err(common::Error::MissingToken(e));
18977                    }
18978                },
18979            };
18980            request_value_reader
18981                .seek(std::io::SeekFrom::Start(0))
18982                .unwrap();
18983            let mut req_result = {
18984                let client = &self.hub.client;
18985                dlg.pre_request();
18986                let mut req_builder = hyper::Request::builder()
18987                    .method(hyper::Method::POST)
18988                    .uri(url.as_str())
18989                    .header(USER_AGENT, self.hub._user_agent.clone());
18990
18991                if let Some(token) = token.as_ref() {
18992                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18993                }
18994
18995                let request = req_builder
18996                    .header(CONTENT_TYPE, json_mime_type.to_string())
18997                    .header(CONTENT_LENGTH, request_size as u64)
18998                    .body(common::to_body(
18999                        request_value_reader.get_ref().clone().into(),
19000                    ));
19001
19002                client.request(request.unwrap()).await
19003            };
19004
19005            match req_result {
19006                Err(err) => {
19007                    if let common::Retry::After(d) = dlg.http_error(&err) {
19008                        sleep(d).await;
19009                        continue;
19010                    }
19011                    dlg.finished(false);
19012                    return Err(common::Error::HttpError(err));
19013                }
19014                Ok(res) => {
19015                    let (mut parts, body) = res.into_parts();
19016                    let mut body = common::Body::new(body);
19017                    if !parts.status.is_success() {
19018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19019                        let error = serde_json::from_str(&common::to_string(&bytes));
19020                        let response = common::to_response(parts, bytes.into());
19021
19022                        if let common::Retry::After(d) =
19023                            dlg.http_failure(&response, error.as_ref().ok())
19024                        {
19025                            sleep(d).await;
19026                            continue;
19027                        }
19028
19029                        dlg.finished(false);
19030
19031                        return Err(match error {
19032                            Ok(value) => common::Error::BadRequest(value),
19033                            _ => common::Error::Failure(response),
19034                        });
19035                    }
19036                    let response = {
19037                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19038                        let encoded = common::to_string(&bytes);
19039                        match serde_json::from_str(&encoded) {
19040                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19041                            Err(error) => {
19042                                dlg.response_json_decode_error(&encoded, &error);
19043                                return Err(common::Error::JsonDecodeError(
19044                                    encoded.to_string(),
19045                                    error,
19046                                ));
19047                            }
19048                        }
19049                    };
19050
19051                    dlg.finished(true);
19052                    return Ok(response);
19053                }
19054            }
19055        }
19056    }
19057
19058    ///
19059    /// Sets the *request* property to the given value.
19060    ///
19061    /// Even though the property as already been set when instantiating this call,
19062    /// we provide this method for API completeness.
19063    pub fn request(
19064        mut self,
19065        new_value: SetIamPolicyRequest,
19066    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {
19067        self._request = new_value;
19068        self
19069    }
19070    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
19071    ///
19072    /// Sets the *resource* path property to the given value.
19073    ///
19074    /// Even though the property as already been set when instantiating this call,
19075    /// we provide this method for API completeness.
19076    pub fn resource(
19077        mut self,
19078        new_value: &str,
19079    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {
19080        self._resource = new_value.to_string();
19081        self
19082    }
19083    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19084    /// while executing the actual API request.
19085    ///
19086    /// ````text
19087    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19088    /// ````
19089    ///
19090    /// Sets the *delegate* property to the given value.
19091    pub fn delegate(
19092        mut self,
19093        new_value: &'a mut dyn common::Delegate,
19094    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {
19095        self._delegate = Some(new_value);
19096        self
19097    }
19098
19099    /// Set any additional parameter of the query string used in the request.
19100    /// It should be used to set parameters which are not yet available through their own
19101    /// setters.
19102    ///
19103    /// Please note that this method must not be used to set any of the known parameters
19104    /// which have their own setter method. If done anyway, the request will fail.
19105    ///
19106    /// # Additional Parameters
19107    ///
19108    /// * *$.xgafv* (query-string) - V1 error format.
19109    /// * *access_token* (query-string) - OAuth access token.
19110    /// * *alt* (query-string) - Data format for response.
19111    /// * *callback* (query-string) - JSONP
19112    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19113    /// * *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.
19114    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19115    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19116    /// * *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.
19117    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19118    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19119    pub fn param<T>(
19120        mut self,
19121        name: T,
19122        value: T,
19123    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C>
19124    where
19125        T: AsRef<str>,
19126    {
19127        self._additional_params
19128            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19129        self
19130    }
19131
19132    /// Identifies the authorization scope for the method you are building.
19133    ///
19134    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19135    /// [`Scope::CloudPlatform`].
19136    ///
19137    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19138    /// tokens for more than one scope.
19139    ///
19140    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19141    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19142    /// sufficient, a read-write scope will do as well.
19143    pub fn add_scope<St>(
19144        mut self,
19145        scope: St,
19146    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C>
19147    where
19148        St: AsRef<str>,
19149    {
19150        self._scopes.insert(String::from(scope.as_ref()));
19151        self
19152    }
19153    /// Identifies the authorization scope(s) for the method you are building.
19154    ///
19155    /// See [`Self::add_scope()`] for details.
19156    pub fn add_scopes<I, St>(
19157        mut self,
19158        scopes: I,
19159    ) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C>
19160    where
19161        I: IntoIterator<Item = St>,
19162        St: AsRef<str>,
19163    {
19164        self._scopes
19165            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19166        self
19167    }
19168
19169    /// Removes all scopes, and no default scope will be used either.
19170    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19171    /// for details).
19172    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicySetIamPolicyCall<'a, C> {
19173        self._scopes.clear();
19174        self
19175    }
19176}
19177
19178/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
19179///
19180/// A builder for the *regions.autoscalingPolicies.testIamPermissions* method supported by a *project* resource.
19181/// It is not used directly, but through a [`ProjectMethods`] instance.
19182///
19183/// # Example
19184///
19185/// Instantiate a resource method builder
19186///
19187/// ```test_harness,no_run
19188/// # extern crate hyper;
19189/// # extern crate hyper_rustls;
19190/// # extern crate google_dataproc1 as dataproc1;
19191/// use dataproc1::api::TestIamPermissionsRequest;
19192/// # async fn dox() {
19193/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19194///
19195/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19196/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19197/// #     secret,
19198/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19199/// # ).build().await.unwrap();
19200///
19201/// # let client = hyper_util::client::legacy::Client::builder(
19202/// #     hyper_util::rt::TokioExecutor::new()
19203/// # )
19204/// # .build(
19205/// #     hyper_rustls::HttpsConnectorBuilder::new()
19206/// #         .with_native_roots()
19207/// #         .unwrap()
19208/// #         .https_or_http()
19209/// #         .enable_http1()
19210/// #         .build()
19211/// # );
19212/// # let mut hub = Dataproc::new(client, auth);
19213/// // As the method needs a request, you would usually fill it with the desired information
19214/// // into the respective structure. Some of the parts shown here might not be applicable !
19215/// // Values shown here are possibly random and not representative !
19216/// let mut req = TestIamPermissionsRequest::default();
19217///
19218/// // You can configure optional parameters by calling the respective setters at will, and
19219/// // execute the final call using `doit()`.
19220/// // Values shown here are possibly random and not representative !
19221/// let result = hub.projects().regions_autoscaling_policies_test_iam_permissions(req, "resource")
19222///              .doit().await;
19223/// # }
19224/// ```
19225pub struct ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C>
19226where
19227    C: 'a,
19228{
19229    hub: &'a Dataproc<C>,
19230    _request: TestIamPermissionsRequest,
19231    _resource: String,
19232    _delegate: Option<&'a mut dyn common::Delegate>,
19233    _additional_params: HashMap<String, String>,
19234    _scopes: BTreeSet<String>,
19235}
19236
19237impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {}
19238
19239impl<'a, C> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C>
19240where
19241    C: common::Connector,
19242{
19243    /// Perform the operation you have build so far.
19244    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
19245        use std::borrow::Cow;
19246        use std::io::{Read, Seek};
19247
19248        use common::{url::Params, ToParts};
19249        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19250
19251        let mut dd = common::DefaultDelegate;
19252        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19253        dlg.begin(common::MethodInfo {
19254            id: "dataproc.projects.regions.autoscalingPolicies.testIamPermissions",
19255            http_method: hyper::Method::POST,
19256        });
19257
19258        for &field in ["alt", "resource"].iter() {
19259            if self._additional_params.contains_key(field) {
19260                dlg.finished(false);
19261                return Err(common::Error::FieldClash(field));
19262            }
19263        }
19264
19265        let mut params = Params::with_capacity(4 + self._additional_params.len());
19266        params.push("resource", self._resource);
19267
19268        params.extend(self._additional_params.iter());
19269
19270        params.push("alt", "json");
19271        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
19272        if self._scopes.is_empty() {
19273            self._scopes
19274                .insert(Scope::CloudPlatform.as_ref().to_string());
19275        }
19276
19277        #[allow(clippy::single_element_loop)]
19278        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19279            url = params.uri_replacement(url, param_name, find_this, true);
19280        }
19281        {
19282            let to_remove = ["resource"];
19283            params.remove_params(&to_remove);
19284        }
19285
19286        let url = params.parse_with_url(&url);
19287
19288        let mut json_mime_type = mime::APPLICATION_JSON;
19289        let mut request_value_reader = {
19290            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19291            common::remove_json_null_values(&mut value);
19292            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19293            serde_json::to_writer(&mut dst, &value).unwrap();
19294            dst
19295        };
19296        let request_size = request_value_reader
19297            .seek(std::io::SeekFrom::End(0))
19298            .unwrap();
19299        request_value_reader
19300            .seek(std::io::SeekFrom::Start(0))
19301            .unwrap();
19302
19303        loop {
19304            let token = match self
19305                .hub
19306                .auth
19307                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19308                .await
19309            {
19310                Ok(token) => token,
19311                Err(e) => match dlg.token(e) {
19312                    Ok(token) => token,
19313                    Err(e) => {
19314                        dlg.finished(false);
19315                        return Err(common::Error::MissingToken(e));
19316                    }
19317                },
19318            };
19319            request_value_reader
19320                .seek(std::io::SeekFrom::Start(0))
19321                .unwrap();
19322            let mut req_result = {
19323                let client = &self.hub.client;
19324                dlg.pre_request();
19325                let mut req_builder = hyper::Request::builder()
19326                    .method(hyper::Method::POST)
19327                    .uri(url.as_str())
19328                    .header(USER_AGENT, self.hub._user_agent.clone());
19329
19330                if let Some(token) = token.as_ref() {
19331                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19332                }
19333
19334                let request = req_builder
19335                    .header(CONTENT_TYPE, json_mime_type.to_string())
19336                    .header(CONTENT_LENGTH, request_size as u64)
19337                    .body(common::to_body(
19338                        request_value_reader.get_ref().clone().into(),
19339                    ));
19340
19341                client.request(request.unwrap()).await
19342            };
19343
19344            match req_result {
19345                Err(err) => {
19346                    if let common::Retry::After(d) = dlg.http_error(&err) {
19347                        sleep(d).await;
19348                        continue;
19349                    }
19350                    dlg.finished(false);
19351                    return Err(common::Error::HttpError(err));
19352                }
19353                Ok(res) => {
19354                    let (mut parts, body) = res.into_parts();
19355                    let mut body = common::Body::new(body);
19356                    if !parts.status.is_success() {
19357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19358                        let error = serde_json::from_str(&common::to_string(&bytes));
19359                        let response = common::to_response(parts, bytes.into());
19360
19361                        if let common::Retry::After(d) =
19362                            dlg.http_failure(&response, error.as_ref().ok())
19363                        {
19364                            sleep(d).await;
19365                            continue;
19366                        }
19367
19368                        dlg.finished(false);
19369
19370                        return Err(match error {
19371                            Ok(value) => common::Error::BadRequest(value),
19372                            _ => common::Error::Failure(response),
19373                        });
19374                    }
19375                    let response = {
19376                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19377                        let encoded = common::to_string(&bytes);
19378                        match serde_json::from_str(&encoded) {
19379                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19380                            Err(error) => {
19381                                dlg.response_json_decode_error(&encoded, &error);
19382                                return Err(common::Error::JsonDecodeError(
19383                                    encoded.to_string(),
19384                                    error,
19385                                ));
19386                            }
19387                        }
19388                    };
19389
19390                    dlg.finished(true);
19391                    return Ok(response);
19392                }
19393            }
19394        }
19395    }
19396
19397    ///
19398    /// Sets the *request* property to the given value.
19399    ///
19400    /// Even though the property as already been set when instantiating this call,
19401    /// we provide this method for API completeness.
19402    pub fn request(
19403        mut self,
19404        new_value: TestIamPermissionsRequest,
19405    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {
19406        self._request = new_value;
19407        self
19408    }
19409    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
19410    ///
19411    /// Sets the *resource* path property to the given value.
19412    ///
19413    /// Even though the property as already been set when instantiating this call,
19414    /// we provide this method for API completeness.
19415    pub fn resource(
19416        mut self,
19417        new_value: &str,
19418    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {
19419        self._resource = new_value.to_string();
19420        self
19421    }
19422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19423    /// while executing the actual API request.
19424    ///
19425    /// ````text
19426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19427    /// ````
19428    ///
19429    /// Sets the *delegate* property to the given value.
19430    pub fn delegate(
19431        mut self,
19432        new_value: &'a mut dyn common::Delegate,
19433    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {
19434        self._delegate = Some(new_value);
19435        self
19436    }
19437
19438    /// Set any additional parameter of the query string used in the request.
19439    /// It should be used to set parameters which are not yet available through their own
19440    /// setters.
19441    ///
19442    /// Please note that this method must not be used to set any of the known parameters
19443    /// which have their own setter method. If done anyway, the request will fail.
19444    ///
19445    /// # Additional Parameters
19446    ///
19447    /// * *$.xgafv* (query-string) - V1 error format.
19448    /// * *access_token* (query-string) - OAuth access token.
19449    /// * *alt* (query-string) - Data format for response.
19450    /// * *callback* (query-string) - JSONP
19451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19452    /// * *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.
19453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19455    /// * *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.
19456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19458    pub fn param<T>(
19459        mut self,
19460        name: T,
19461        value: T,
19462    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C>
19463    where
19464        T: AsRef<str>,
19465    {
19466        self._additional_params
19467            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19468        self
19469    }
19470
19471    /// Identifies the authorization scope for the method you are building.
19472    ///
19473    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19474    /// [`Scope::CloudPlatform`].
19475    ///
19476    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19477    /// tokens for more than one scope.
19478    ///
19479    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19480    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19481    /// sufficient, a read-write scope will do as well.
19482    pub fn add_scope<St>(
19483        mut self,
19484        scope: St,
19485    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C>
19486    where
19487        St: AsRef<str>,
19488    {
19489        self._scopes.insert(String::from(scope.as_ref()));
19490        self
19491    }
19492    /// Identifies the authorization scope(s) for the method you are building.
19493    ///
19494    /// See [`Self::add_scope()`] for details.
19495    pub fn add_scopes<I, St>(
19496        mut self,
19497        scopes: I,
19498    ) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C>
19499    where
19500        I: IntoIterator<Item = St>,
19501        St: AsRef<str>,
19502    {
19503        self._scopes
19504            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19505        self
19506    }
19507
19508    /// Removes all scopes, and no default scope will be used either.
19509    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19510    /// for details).
19511    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyTestIamPermissionCall<'a, C> {
19512        self._scopes.clear();
19513        self
19514    }
19515}
19516
19517/// Updates (replaces) autoscaling policy.Disabled check for update_mask, because all updates will be full replacements.
19518///
19519/// A builder for the *regions.autoscalingPolicies.update* method supported by a *project* resource.
19520/// It is not used directly, but through a [`ProjectMethods`] instance.
19521///
19522/// # Example
19523///
19524/// Instantiate a resource method builder
19525///
19526/// ```test_harness,no_run
19527/// # extern crate hyper;
19528/// # extern crate hyper_rustls;
19529/// # extern crate google_dataproc1 as dataproc1;
19530/// use dataproc1::api::AutoscalingPolicy;
19531/// # async fn dox() {
19532/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19533///
19534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19535/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19536/// #     secret,
19537/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19538/// # ).build().await.unwrap();
19539///
19540/// # let client = hyper_util::client::legacy::Client::builder(
19541/// #     hyper_util::rt::TokioExecutor::new()
19542/// # )
19543/// # .build(
19544/// #     hyper_rustls::HttpsConnectorBuilder::new()
19545/// #         .with_native_roots()
19546/// #         .unwrap()
19547/// #         .https_or_http()
19548/// #         .enable_http1()
19549/// #         .build()
19550/// # );
19551/// # let mut hub = Dataproc::new(client, auth);
19552/// // As the method needs a request, you would usually fill it with the desired information
19553/// // into the respective structure. Some of the parts shown here might not be applicable !
19554/// // Values shown here are possibly random and not representative !
19555/// let mut req = AutoscalingPolicy::default();
19556///
19557/// // You can configure optional parameters by calling the respective setters at will, and
19558/// // execute the final call using `doit()`.
19559/// // Values shown here are possibly random and not representative !
19560/// let result = hub.projects().regions_autoscaling_policies_update(req, "name")
19561///              .doit().await;
19562/// # }
19563/// ```
19564pub struct ProjectRegionAutoscalingPolicyUpdateCall<'a, C>
19565where
19566    C: 'a,
19567{
19568    hub: &'a Dataproc<C>,
19569    _request: AutoscalingPolicy,
19570    _name: String,
19571    _delegate: Option<&'a mut dyn common::Delegate>,
19572    _additional_params: HashMap<String, String>,
19573    _scopes: BTreeSet<String>,
19574}
19575
19576impl<'a, C> common::CallBuilder for ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {}
19577
19578impl<'a, C> ProjectRegionAutoscalingPolicyUpdateCall<'a, C>
19579where
19580    C: common::Connector,
19581{
19582    /// Perform the operation you have build so far.
19583    pub async fn doit(mut self) -> common::Result<(common::Response, AutoscalingPolicy)> {
19584        use std::borrow::Cow;
19585        use std::io::{Read, Seek};
19586
19587        use common::{url::Params, ToParts};
19588        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19589
19590        let mut dd = common::DefaultDelegate;
19591        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19592        dlg.begin(common::MethodInfo {
19593            id: "dataproc.projects.regions.autoscalingPolicies.update",
19594            http_method: hyper::Method::PUT,
19595        });
19596
19597        for &field in ["alt", "name"].iter() {
19598            if self._additional_params.contains_key(field) {
19599                dlg.finished(false);
19600                return Err(common::Error::FieldClash(field));
19601            }
19602        }
19603
19604        let mut params = Params::with_capacity(4 + self._additional_params.len());
19605        params.push("name", self._name);
19606
19607        params.extend(self._additional_params.iter());
19608
19609        params.push("alt", "json");
19610        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19611        if self._scopes.is_empty() {
19612            self._scopes
19613                .insert(Scope::CloudPlatform.as_ref().to_string());
19614        }
19615
19616        #[allow(clippy::single_element_loop)]
19617        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19618            url = params.uri_replacement(url, param_name, find_this, true);
19619        }
19620        {
19621            let to_remove = ["name"];
19622            params.remove_params(&to_remove);
19623        }
19624
19625        let url = params.parse_with_url(&url);
19626
19627        let mut json_mime_type = mime::APPLICATION_JSON;
19628        let mut request_value_reader = {
19629            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19630            common::remove_json_null_values(&mut value);
19631            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19632            serde_json::to_writer(&mut dst, &value).unwrap();
19633            dst
19634        };
19635        let request_size = request_value_reader
19636            .seek(std::io::SeekFrom::End(0))
19637            .unwrap();
19638        request_value_reader
19639            .seek(std::io::SeekFrom::Start(0))
19640            .unwrap();
19641
19642        loop {
19643            let token = match self
19644                .hub
19645                .auth
19646                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19647                .await
19648            {
19649                Ok(token) => token,
19650                Err(e) => match dlg.token(e) {
19651                    Ok(token) => token,
19652                    Err(e) => {
19653                        dlg.finished(false);
19654                        return Err(common::Error::MissingToken(e));
19655                    }
19656                },
19657            };
19658            request_value_reader
19659                .seek(std::io::SeekFrom::Start(0))
19660                .unwrap();
19661            let mut req_result = {
19662                let client = &self.hub.client;
19663                dlg.pre_request();
19664                let mut req_builder = hyper::Request::builder()
19665                    .method(hyper::Method::PUT)
19666                    .uri(url.as_str())
19667                    .header(USER_AGENT, self.hub._user_agent.clone());
19668
19669                if let Some(token) = token.as_ref() {
19670                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19671                }
19672
19673                let request = req_builder
19674                    .header(CONTENT_TYPE, json_mime_type.to_string())
19675                    .header(CONTENT_LENGTH, request_size as u64)
19676                    .body(common::to_body(
19677                        request_value_reader.get_ref().clone().into(),
19678                    ));
19679
19680                client.request(request.unwrap()).await
19681            };
19682
19683            match req_result {
19684                Err(err) => {
19685                    if let common::Retry::After(d) = dlg.http_error(&err) {
19686                        sleep(d).await;
19687                        continue;
19688                    }
19689                    dlg.finished(false);
19690                    return Err(common::Error::HttpError(err));
19691                }
19692                Ok(res) => {
19693                    let (mut parts, body) = res.into_parts();
19694                    let mut body = common::Body::new(body);
19695                    if !parts.status.is_success() {
19696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19697                        let error = serde_json::from_str(&common::to_string(&bytes));
19698                        let response = common::to_response(parts, bytes.into());
19699
19700                        if let common::Retry::After(d) =
19701                            dlg.http_failure(&response, error.as_ref().ok())
19702                        {
19703                            sleep(d).await;
19704                            continue;
19705                        }
19706
19707                        dlg.finished(false);
19708
19709                        return Err(match error {
19710                            Ok(value) => common::Error::BadRequest(value),
19711                            _ => common::Error::Failure(response),
19712                        });
19713                    }
19714                    let response = {
19715                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19716                        let encoded = common::to_string(&bytes);
19717                        match serde_json::from_str(&encoded) {
19718                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19719                            Err(error) => {
19720                                dlg.response_json_decode_error(&encoded, &error);
19721                                return Err(common::Error::JsonDecodeError(
19722                                    encoded.to_string(),
19723                                    error,
19724                                ));
19725                            }
19726                        }
19727                    };
19728
19729                    dlg.finished(true);
19730                    return Ok(response);
19731                }
19732            }
19733        }
19734    }
19735
19736    ///
19737    /// Sets the *request* property to the given value.
19738    ///
19739    /// Even though the property as already been set when instantiating this call,
19740    /// we provide this method for API completeness.
19741    pub fn request(
19742        mut self,
19743        new_value: AutoscalingPolicy,
19744    ) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {
19745        self._request = new_value;
19746        self
19747    }
19748    /// Output only. The "resource name" of the autoscaling policy, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id} For projects.locations.autoscalingPolicies, the resource name of the policy has the following format: projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}
19749    ///
19750    /// Sets the *name* path property to the given value.
19751    ///
19752    /// Even though the property as already been set when instantiating this call,
19753    /// we provide this method for API completeness.
19754    pub fn name(mut self, new_value: &str) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {
19755        self._name = new_value.to_string();
19756        self
19757    }
19758    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19759    /// while executing the actual API request.
19760    ///
19761    /// ````text
19762    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19763    /// ````
19764    ///
19765    /// Sets the *delegate* property to the given value.
19766    pub fn delegate(
19767        mut self,
19768        new_value: &'a mut dyn common::Delegate,
19769    ) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {
19770        self._delegate = Some(new_value);
19771        self
19772    }
19773
19774    /// Set any additional parameter of the query string used in the request.
19775    /// It should be used to set parameters which are not yet available through their own
19776    /// setters.
19777    ///
19778    /// Please note that this method must not be used to set any of the known parameters
19779    /// which have their own setter method. If done anyway, the request will fail.
19780    ///
19781    /// # Additional Parameters
19782    ///
19783    /// * *$.xgafv* (query-string) - V1 error format.
19784    /// * *access_token* (query-string) - OAuth access token.
19785    /// * *alt* (query-string) - Data format for response.
19786    /// * *callback* (query-string) - JSONP
19787    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19788    /// * *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.
19789    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19790    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19791    /// * *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.
19792    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19793    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19794    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C>
19795    where
19796        T: AsRef<str>,
19797    {
19798        self._additional_params
19799            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19800        self
19801    }
19802
19803    /// Identifies the authorization scope for the method you are building.
19804    ///
19805    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19806    /// [`Scope::CloudPlatform`].
19807    ///
19808    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19809    /// tokens for more than one scope.
19810    ///
19811    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19812    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19813    /// sufficient, a read-write scope will do as well.
19814    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C>
19815    where
19816        St: AsRef<str>,
19817    {
19818        self._scopes.insert(String::from(scope.as_ref()));
19819        self
19820    }
19821    /// Identifies the authorization scope(s) for the method you are building.
19822    ///
19823    /// See [`Self::add_scope()`] for details.
19824    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C>
19825    where
19826        I: IntoIterator<Item = St>,
19827        St: AsRef<str>,
19828    {
19829        self._scopes
19830            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19831        self
19832    }
19833
19834    /// Removes all scopes, and no default scope will be used either.
19835    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19836    /// for details).
19837    pub fn clear_scopes(mut self) -> ProjectRegionAutoscalingPolicyUpdateCall<'a, C> {
19838        self._scopes.clear();
19839        self
19840    }
19841}
19842
19843/// Creates a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
19844///
19845/// A builder for the *regions.clusters.nodeGroups.create* method supported by a *project* resource.
19846/// It is not used directly, but through a [`ProjectMethods`] instance.
19847///
19848/// # Example
19849///
19850/// Instantiate a resource method builder
19851///
19852/// ```test_harness,no_run
19853/// # extern crate hyper;
19854/// # extern crate hyper_rustls;
19855/// # extern crate google_dataproc1 as dataproc1;
19856/// use dataproc1::api::NodeGroup;
19857/// # async fn dox() {
19858/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19859///
19860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19862/// #     secret,
19863/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19864/// # ).build().await.unwrap();
19865///
19866/// # let client = hyper_util::client::legacy::Client::builder(
19867/// #     hyper_util::rt::TokioExecutor::new()
19868/// # )
19869/// # .build(
19870/// #     hyper_rustls::HttpsConnectorBuilder::new()
19871/// #         .with_native_roots()
19872/// #         .unwrap()
19873/// #         .https_or_http()
19874/// #         .enable_http1()
19875/// #         .build()
19876/// # );
19877/// # let mut hub = Dataproc::new(client, auth);
19878/// // As the method needs a request, you would usually fill it with the desired information
19879/// // into the respective structure. Some of the parts shown here might not be applicable !
19880/// // Values shown here are possibly random and not representative !
19881/// let mut req = NodeGroup::default();
19882///
19883/// // You can configure optional parameters by calling the respective setters at will, and
19884/// // execute the final call using `doit()`.
19885/// // Values shown here are possibly random and not representative !
19886/// let result = hub.projects().regions_clusters_node_groups_create(req, "parent")
19887///              .request_id("accusam")
19888///              .parent_operation_id("voluptua.")
19889///              .node_group_id("dolore")
19890///              .doit().await;
19891/// # }
19892/// ```
19893pub struct ProjectRegionClusterNodeGroupCreateCall<'a, C>
19894where
19895    C: 'a,
19896{
19897    hub: &'a Dataproc<C>,
19898    _request: NodeGroup,
19899    _parent: String,
19900    _request_id: Option<String>,
19901    _parent_operation_id: Option<String>,
19902    _node_group_id: Option<String>,
19903    _delegate: Option<&'a mut dyn common::Delegate>,
19904    _additional_params: HashMap<String, String>,
19905    _scopes: BTreeSet<String>,
19906}
19907
19908impl<'a, C> common::CallBuilder for ProjectRegionClusterNodeGroupCreateCall<'a, C> {}
19909
19910impl<'a, C> ProjectRegionClusterNodeGroupCreateCall<'a, C>
19911where
19912    C: common::Connector,
19913{
19914    /// Perform the operation you have build so far.
19915    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19916        use std::borrow::Cow;
19917        use std::io::{Read, Seek};
19918
19919        use common::{url::Params, ToParts};
19920        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19921
19922        let mut dd = common::DefaultDelegate;
19923        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19924        dlg.begin(common::MethodInfo {
19925            id: "dataproc.projects.regions.clusters.nodeGroups.create",
19926            http_method: hyper::Method::POST,
19927        });
19928
19929        for &field in [
19930            "alt",
19931            "parent",
19932            "requestId",
19933            "parentOperationId",
19934            "nodeGroupId",
19935        ]
19936        .iter()
19937        {
19938            if self._additional_params.contains_key(field) {
19939                dlg.finished(false);
19940                return Err(common::Error::FieldClash(field));
19941            }
19942        }
19943
19944        let mut params = Params::with_capacity(7 + self._additional_params.len());
19945        params.push("parent", self._parent);
19946        if let Some(value) = self._request_id.as_ref() {
19947            params.push("requestId", value);
19948        }
19949        if let Some(value) = self._parent_operation_id.as_ref() {
19950            params.push("parentOperationId", value);
19951        }
19952        if let Some(value) = self._node_group_id.as_ref() {
19953            params.push("nodeGroupId", value);
19954        }
19955
19956        params.extend(self._additional_params.iter());
19957
19958        params.push("alt", "json");
19959        let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodeGroups";
19960        if self._scopes.is_empty() {
19961            self._scopes
19962                .insert(Scope::CloudPlatform.as_ref().to_string());
19963        }
19964
19965        #[allow(clippy::single_element_loop)]
19966        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19967            url = params.uri_replacement(url, param_name, find_this, true);
19968        }
19969        {
19970            let to_remove = ["parent"];
19971            params.remove_params(&to_remove);
19972        }
19973
19974        let url = params.parse_with_url(&url);
19975
19976        let mut json_mime_type = mime::APPLICATION_JSON;
19977        let mut request_value_reader = {
19978            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19979            common::remove_json_null_values(&mut value);
19980            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19981            serde_json::to_writer(&mut dst, &value).unwrap();
19982            dst
19983        };
19984        let request_size = request_value_reader
19985            .seek(std::io::SeekFrom::End(0))
19986            .unwrap();
19987        request_value_reader
19988            .seek(std::io::SeekFrom::Start(0))
19989            .unwrap();
19990
19991        loop {
19992            let token = match self
19993                .hub
19994                .auth
19995                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19996                .await
19997            {
19998                Ok(token) => token,
19999                Err(e) => match dlg.token(e) {
20000                    Ok(token) => token,
20001                    Err(e) => {
20002                        dlg.finished(false);
20003                        return Err(common::Error::MissingToken(e));
20004                    }
20005                },
20006            };
20007            request_value_reader
20008                .seek(std::io::SeekFrom::Start(0))
20009                .unwrap();
20010            let mut req_result = {
20011                let client = &self.hub.client;
20012                dlg.pre_request();
20013                let mut req_builder = hyper::Request::builder()
20014                    .method(hyper::Method::POST)
20015                    .uri(url.as_str())
20016                    .header(USER_AGENT, self.hub._user_agent.clone());
20017
20018                if let Some(token) = token.as_ref() {
20019                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20020                }
20021
20022                let request = req_builder
20023                    .header(CONTENT_TYPE, json_mime_type.to_string())
20024                    .header(CONTENT_LENGTH, request_size as u64)
20025                    .body(common::to_body(
20026                        request_value_reader.get_ref().clone().into(),
20027                    ));
20028
20029                client.request(request.unwrap()).await
20030            };
20031
20032            match req_result {
20033                Err(err) => {
20034                    if let common::Retry::After(d) = dlg.http_error(&err) {
20035                        sleep(d).await;
20036                        continue;
20037                    }
20038                    dlg.finished(false);
20039                    return Err(common::Error::HttpError(err));
20040                }
20041                Ok(res) => {
20042                    let (mut parts, body) = res.into_parts();
20043                    let mut body = common::Body::new(body);
20044                    if !parts.status.is_success() {
20045                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20046                        let error = serde_json::from_str(&common::to_string(&bytes));
20047                        let response = common::to_response(parts, bytes.into());
20048
20049                        if let common::Retry::After(d) =
20050                            dlg.http_failure(&response, error.as_ref().ok())
20051                        {
20052                            sleep(d).await;
20053                            continue;
20054                        }
20055
20056                        dlg.finished(false);
20057
20058                        return Err(match error {
20059                            Ok(value) => common::Error::BadRequest(value),
20060                            _ => common::Error::Failure(response),
20061                        });
20062                    }
20063                    let response = {
20064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20065                        let encoded = common::to_string(&bytes);
20066                        match serde_json::from_str(&encoded) {
20067                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20068                            Err(error) => {
20069                                dlg.response_json_decode_error(&encoded, &error);
20070                                return Err(common::Error::JsonDecodeError(
20071                                    encoded.to_string(),
20072                                    error,
20073                                ));
20074                            }
20075                        }
20076                    };
20077
20078                    dlg.finished(true);
20079                    return Ok(response);
20080                }
20081            }
20082        }
20083    }
20084
20085    ///
20086    /// Sets the *request* property to the given value.
20087    ///
20088    /// Even though the property as already been set when instantiating this call,
20089    /// we provide this method for API completeness.
20090    pub fn request(
20091        mut self,
20092        new_value: NodeGroup,
20093    ) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20094        self._request = new_value;
20095        self
20096    }
20097    /// Required. The parent resource where this node group will be created. Format: projects/{project}/regions/{region}/clusters/{cluster}
20098    ///
20099    /// Sets the *parent* path property to the given value.
20100    ///
20101    /// Even though the property as already been set when instantiating this call,
20102    /// we provide this method for API completeness.
20103    pub fn parent(mut self, new_value: &str) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20104        self._parent = new_value.to_string();
20105        self
20106    }
20107    /// Optional. A unique ID used to identify the request. If the server receives two CreateNodeGroupRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequest) with the same ID, the second request is ignored and the first google.longrunning.Operation created and stored in the backend is returned.Recommendation: Set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
20108    ///
20109    /// Sets the *request id* query property to the given value.
20110    pub fn request_id(mut self, new_value: &str) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20111        self._request_id = Some(new_value.to_string());
20112        self
20113    }
20114    /// Optional. operation id of the parent operation sending the create request
20115    ///
20116    /// Sets the *parent operation id* query property to the given value.
20117    pub fn parent_operation_id(
20118        mut self,
20119        new_value: &str,
20120    ) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20121        self._parent_operation_id = Some(new_value.to_string());
20122        self
20123    }
20124    /// Optional. An optional node group ID. Generated if not specified.The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of from 3 to 33 characters.
20125    ///
20126    /// Sets the *node group id* query property to the given value.
20127    pub fn node_group_id(
20128        mut self,
20129        new_value: &str,
20130    ) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20131        self._node_group_id = Some(new_value.to_string());
20132        self
20133    }
20134    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20135    /// while executing the actual API request.
20136    ///
20137    /// ````text
20138    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20139    /// ````
20140    ///
20141    /// Sets the *delegate* property to the given value.
20142    pub fn delegate(
20143        mut self,
20144        new_value: &'a mut dyn common::Delegate,
20145    ) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20146        self._delegate = Some(new_value);
20147        self
20148    }
20149
20150    /// Set any additional parameter of the query string used in the request.
20151    /// It should be used to set parameters which are not yet available through their own
20152    /// setters.
20153    ///
20154    /// Please note that this method must not be used to set any of the known parameters
20155    /// which have their own setter method. If done anyway, the request will fail.
20156    ///
20157    /// # Additional Parameters
20158    ///
20159    /// * *$.xgafv* (query-string) - V1 error format.
20160    /// * *access_token* (query-string) - OAuth access token.
20161    /// * *alt* (query-string) - Data format for response.
20162    /// * *callback* (query-string) - JSONP
20163    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20164    /// * *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.
20165    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20166    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20167    /// * *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.
20168    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20169    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20170    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterNodeGroupCreateCall<'a, C>
20171    where
20172        T: AsRef<str>,
20173    {
20174        self._additional_params
20175            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20176        self
20177    }
20178
20179    /// Identifies the authorization scope for the method you are building.
20180    ///
20181    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20182    /// [`Scope::CloudPlatform`].
20183    ///
20184    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20185    /// tokens for more than one scope.
20186    ///
20187    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20188    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20189    /// sufficient, a read-write scope will do as well.
20190    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterNodeGroupCreateCall<'a, C>
20191    where
20192        St: AsRef<str>,
20193    {
20194        self._scopes.insert(String::from(scope.as_ref()));
20195        self
20196    }
20197    /// Identifies the authorization scope(s) for the method you are building.
20198    ///
20199    /// See [`Self::add_scope()`] for details.
20200    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterNodeGroupCreateCall<'a, C>
20201    where
20202        I: IntoIterator<Item = St>,
20203        St: AsRef<str>,
20204    {
20205        self._scopes
20206            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20207        self
20208    }
20209
20210    /// Removes all scopes, and no default scope will be used either.
20211    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20212    /// for details).
20213    pub fn clear_scopes(mut self) -> ProjectRegionClusterNodeGroupCreateCall<'a, C> {
20214        self._scopes.clear();
20215        self
20216    }
20217}
20218
20219/// Gets the resource representation for a node group in a cluster.
20220///
20221/// A builder for the *regions.clusters.nodeGroups.get* method supported by a *project* resource.
20222/// It is not used directly, but through a [`ProjectMethods`] instance.
20223///
20224/// # Example
20225///
20226/// Instantiate a resource method builder
20227///
20228/// ```test_harness,no_run
20229/// # extern crate hyper;
20230/// # extern crate hyper_rustls;
20231/// # extern crate google_dataproc1 as dataproc1;
20232/// # async fn dox() {
20233/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20234///
20235/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20236/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20237/// #     secret,
20238/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20239/// # ).build().await.unwrap();
20240///
20241/// # let client = hyper_util::client::legacy::Client::builder(
20242/// #     hyper_util::rt::TokioExecutor::new()
20243/// # )
20244/// # .build(
20245/// #     hyper_rustls::HttpsConnectorBuilder::new()
20246/// #         .with_native_roots()
20247/// #         .unwrap()
20248/// #         .https_or_http()
20249/// #         .enable_http1()
20250/// #         .build()
20251/// # );
20252/// # let mut hub = Dataproc::new(client, auth);
20253/// // You can configure optional parameters by calling the respective setters at will, and
20254/// // execute the final call using `doit()`.
20255/// // Values shown here are possibly random and not representative !
20256/// let result = hub.projects().regions_clusters_node_groups_get("name")
20257///              .doit().await;
20258/// # }
20259/// ```
20260pub struct ProjectRegionClusterNodeGroupGetCall<'a, C>
20261where
20262    C: 'a,
20263{
20264    hub: &'a Dataproc<C>,
20265    _name: String,
20266    _delegate: Option<&'a mut dyn common::Delegate>,
20267    _additional_params: HashMap<String, String>,
20268    _scopes: BTreeSet<String>,
20269}
20270
20271impl<'a, C> common::CallBuilder for ProjectRegionClusterNodeGroupGetCall<'a, C> {}
20272
20273impl<'a, C> ProjectRegionClusterNodeGroupGetCall<'a, C>
20274where
20275    C: common::Connector,
20276{
20277    /// Perform the operation you have build so far.
20278    pub async fn doit(mut self) -> common::Result<(common::Response, NodeGroup)> {
20279        use std::borrow::Cow;
20280        use std::io::{Read, Seek};
20281
20282        use common::{url::Params, ToParts};
20283        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20284
20285        let mut dd = common::DefaultDelegate;
20286        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20287        dlg.begin(common::MethodInfo {
20288            id: "dataproc.projects.regions.clusters.nodeGroups.get",
20289            http_method: hyper::Method::GET,
20290        });
20291
20292        for &field in ["alt", "name"].iter() {
20293            if self._additional_params.contains_key(field) {
20294                dlg.finished(false);
20295                return Err(common::Error::FieldClash(field));
20296            }
20297        }
20298
20299        let mut params = Params::with_capacity(3 + self._additional_params.len());
20300        params.push("name", self._name);
20301
20302        params.extend(self._additional_params.iter());
20303
20304        params.push("alt", "json");
20305        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20306        if self._scopes.is_empty() {
20307            self._scopes
20308                .insert(Scope::CloudPlatform.as_ref().to_string());
20309        }
20310
20311        #[allow(clippy::single_element_loop)]
20312        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20313            url = params.uri_replacement(url, param_name, find_this, true);
20314        }
20315        {
20316            let to_remove = ["name"];
20317            params.remove_params(&to_remove);
20318        }
20319
20320        let url = params.parse_with_url(&url);
20321
20322        loop {
20323            let token = match self
20324                .hub
20325                .auth
20326                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20327                .await
20328            {
20329                Ok(token) => token,
20330                Err(e) => match dlg.token(e) {
20331                    Ok(token) => token,
20332                    Err(e) => {
20333                        dlg.finished(false);
20334                        return Err(common::Error::MissingToken(e));
20335                    }
20336                },
20337            };
20338            let mut req_result = {
20339                let client = &self.hub.client;
20340                dlg.pre_request();
20341                let mut req_builder = hyper::Request::builder()
20342                    .method(hyper::Method::GET)
20343                    .uri(url.as_str())
20344                    .header(USER_AGENT, self.hub._user_agent.clone());
20345
20346                if let Some(token) = token.as_ref() {
20347                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20348                }
20349
20350                let request = req_builder
20351                    .header(CONTENT_LENGTH, 0_u64)
20352                    .body(common::to_body::<String>(None));
20353
20354                client.request(request.unwrap()).await
20355            };
20356
20357            match req_result {
20358                Err(err) => {
20359                    if let common::Retry::After(d) = dlg.http_error(&err) {
20360                        sleep(d).await;
20361                        continue;
20362                    }
20363                    dlg.finished(false);
20364                    return Err(common::Error::HttpError(err));
20365                }
20366                Ok(res) => {
20367                    let (mut parts, body) = res.into_parts();
20368                    let mut body = common::Body::new(body);
20369                    if !parts.status.is_success() {
20370                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20371                        let error = serde_json::from_str(&common::to_string(&bytes));
20372                        let response = common::to_response(parts, bytes.into());
20373
20374                        if let common::Retry::After(d) =
20375                            dlg.http_failure(&response, error.as_ref().ok())
20376                        {
20377                            sleep(d).await;
20378                            continue;
20379                        }
20380
20381                        dlg.finished(false);
20382
20383                        return Err(match error {
20384                            Ok(value) => common::Error::BadRequest(value),
20385                            _ => common::Error::Failure(response),
20386                        });
20387                    }
20388                    let response = {
20389                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20390                        let encoded = common::to_string(&bytes);
20391                        match serde_json::from_str(&encoded) {
20392                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20393                            Err(error) => {
20394                                dlg.response_json_decode_error(&encoded, &error);
20395                                return Err(common::Error::JsonDecodeError(
20396                                    encoded.to_string(),
20397                                    error,
20398                                ));
20399                            }
20400                        }
20401                    };
20402
20403                    dlg.finished(true);
20404                    return Ok(response);
20405                }
20406            }
20407        }
20408    }
20409
20410    /// Required. The name of the node group to retrieve. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
20411    ///
20412    /// Sets the *name* path property to the given value.
20413    ///
20414    /// Even though the property as already been set when instantiating this call,
20415    /// we provide this method for API completeness.
20416    pub fn name(mut self, new_value: &str) -> ProjectRegionClusterNodeGroupGetCall<'a, C> {
20417        self._name = new_value.to_string();
20418        self
20419    }
20420    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20421    /// while executing the actual API request.
20422    ///
20423    /// ````text
20424    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20425    /// ````
20426    ///
20427    /// Sets the *delegate* property to the given value.
20428    pub fn delegate(
20429        mut self,
20430        new_value: &'a mut dyn common::Delegate,
20431    ) -> ProjectRegionClusterNodeGroupGetCall<'a, C> {
20432        self._delegate = Some(new_value);
20433        self
20434    }
20435
20436    /// Set any additional parameter of the query string used in the request.
20437    /// It should be used to set parameters which are not yet available through their own
20438    /// setters.
20439    ///
20440    /// Please note that this method must not be used to set any of the known parameters
20441    /// which have their own setter method. If done anyway, the request will fail.
20442    ///
20443    /// # Additional Parameters
20444    ///
20445    /// * *$.xgafv* (query-string) - V1 error format.
20446    /// * *access_token* (query-string) - OAuth access token.
20447    /// * *alt* (query-string) - Data format for response.
20448    /// * *callback* (query-string) - JSONP
20449    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20450    /// * *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.
20451    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20452    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20453    /// * *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.
20454    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20455    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20456    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterNodeGroupGetCall<'a, C>
20457    where
20458        T: AsRef<str>,
20459    {
20460        self._additional_params
20461            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20462        self
20463    }
20464
20465    /// Identifies the authorization scope for the method you are building.
20466    ///
20467    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20468    /// [`Scope::CloudPlatform`].
20469    ///
20470    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20471    /// tokens for more than one scope.
20472    ///
20473    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20474    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20475    /// sufficient, a read-write scope will do as well.
20476    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterNodeGroupGetCall<'a, C>
20477    where
20478        St: AsRef<str>,
20479    {
20480        self._scopes.insert(String::from(scope.as_ref()));
20481        self
20482    }
20483    /// Identifies the authorization scope(s) for the method you are building.
20484    ///
20485    /// See [`Self::add_scope()`] for details.
20486    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterNodeGroupGetCall<'a, C>
20487    where
20488        I: IntoIterator<Item = St>,
20489        St: AsRef<str>,
20490    {
20491        self._scopes
20492            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20493        self
20494    }
20495
20496    /// Removes all scopes, and no default scope will be used either.
20497    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20498    /// for details).
20499    pub fn clear_scopes(mut self) -> ProjectRegionClusterNodeGroupGetCall<'a, C> {
20500        self._scopes.clear();
20501        self
20502    }
20503}
20504
20505/// Repair nodes in a node group.
20506///
20507/// A builder for the *regions.clusters.nodeGroups.repair* method supported by a *project* resource.
20508/// It is not used directly, but through a [`ProjectMethods`] instance.
20509///
20510/// # Example
20511///
20512/// Instantiate a resource method builder
20513///
20514/// ```test_harness,no_run
20515/// # extern crate hyper;
20516/// # extern crate hyper_rustls;
20517/// # extern crate google_dataproc1 as dataproc1;
20518/// use dataproc1::api::RepairNodeGroupRequest;
20519/// # async fn dox() {
20520/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20521///
20522/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20524/// #     secret,
20525/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20526/// # ).build().await.unwrap();
20527///
20528/// # let client = hyper_util::client::legacy::Client::builder(
20529/// #     hyper_util::rt::TokioExecutor::new()
20530/// # )
20531/// # .build(
20532/// #     hyper_rustls::HttpsConnectorBuilder::new()
20533/// #         .with_native_roots()
20534/// #         .unwrap()
20535/// #         .https_or_http()
20536/// #         .enable_http1()
20537/// #         .build()
20538/// # );
20539/// # let mut hub = Dataproc::new(client, auth);
20540/// // As the method needs a request, you would usually fill it with the desired information
20541/// // into the respective structure. Some of the parts shown here might not be applicable !
20542/// // Values shown here are possibly random and not representative !
20543/// let mut req = RepairNodeGroupRequest::default();
20544///
20545/// // You can configure optional parameters by calling the respective setters at will, and
20546/// // execute the final call using `doit()`.
20547/// // Values shown here are possibly random and not representative !
20548/// let result = hub.projects().regions_clusters_node_groups_repair(req, "name")
20549///              .doit().await;
20550/// # }
20551/// ```
20552pub struct ProjectRegionClusterNodeGroupRepairCall<'a, C>
20553where
20554    C: 'a,
20555{
20556    hub: &'a Dataproc<C>,
20557    _request: RepairNodeGroupRequest,
20558    _name: String,
20559    _delegate: Option<&'a mut dyn common::Delegate>,
20560    _additional_params: HashMap<String, String>,
20561    _scopes: BTreeSet<String>,
20562}
20563
20564impl<'a, C> common::CallBuilder for ProjectRegionClusterNodeGroupRepairCall<'a, C> {}
20565
20566impl<'a, C> ProjectRegionClusterNodeGroupRepairCall<'a, C>
20567where
20568    C: common::Connector,
20569{
20570    /// Perform the operation you have build so far.
20571    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20572        use std::borrow::Cow;
20573        use std::io::{Read, Seek};
20574
20575        use common::{url::Params, ToParts};
20576        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20577
20578        let mut dd = common::DefaultDelegate;
20579        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20580        dlg.begin(common::MethodInfo {
20581            id: "dataproc.projects.regions.clusters.nodeGroups.repair",
20582            http_method: hyper::Method::POST,
20583        });
20584
20585        for &field in ["alt", "name"].iter() {
20586            if self._additional_params.contains_key(field) {
20587                dlg.finished(false);
20588                return Err(common::Error::FieldClash(field));
20589            }
20590        }
20591
20592        let mut params = Params::with_capacity(4 + self._additional_params.len());
20593        params.push("name", self._name);
20594
20595        params.extend(self._additional_params.iter());
20596
20597        params.push("alt", "json");
20598        let mut url = self.hub._base_url.clone() + "v1/{+name}:repair";
20599        if self._scopes.is_empty() {
20600            self._scopes
20601                .insert(Scope::CloudPlatform.as_ref().to_string());
20602        }
20603
20604        #[allow(clippy::single_element_loop)]
20605        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20606            url = params.uri_replacement(url, param_name, find_this, true);
20607        }
20608        {
20609            let to_remove = ["name"];
20610            params.remove_params(&to_remove);
20611        }
20612
20613        let url = params.parse_with_url(&url);
20614
20615        let mut json_mime_type = mime::APPLICATION_JSON;
20616        let mut request_value_reader = {
20617            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20618            common::remove_json_null_values(&mut value);
20619            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20620            serde_json::to_writer(&mut dst, &value).unwrap();
20621            dst
20622        };
20623        let request_size = request_value_reader
20624            .seek(std::io::SeekFrom::End(0))
20625            .unwrap();
20626        request_value_reader
20627            .seek(std::io::SeekFrom::Start(0))
20628            .unwrap();
20629
20630        loop {
20631            let token = match self
20632                .hub
20633                .auth
20634                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20635                .await
20636            {
20637                Ok(token) => token,
20638                Err(e) => match dlg.token(e) {
20639                    Ok(token) => token,
20640                    Err(e) => {
20641                        dlg.finished(false);
20642                        return Err(common::Error::MissingToken(e));
20643                    }
20644                },
20645            };
20646            request_value_reader
20647                .seek(std::io::SeekFrom::Start(0))
20648                .unwrap();
20649            let mut req_result = {
20650                let client = &self.hub.client;
20651                dlg.pre_request();
20652                let mut req_builder = hyper::Request::builder()
20653                    .method(hyper::Method::POST)
20654                    .uri(url.as_str())
20655                    .header(USER_AGENT, self.hub._user_agent.clone());
20656
20657                if let Some(token) = token.as_ref() {
20658                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20659                }
20660
20661                let request = req_builder
20662                    .header(CONTENT_TYPE, json_mime_type.to_string())
20663                    .header(CONTENT_LENGTH, request_size as u64)
20664                    .body(common::to_body(
20665                        request_value_reader.get_ref().clone().into(),
20666                    ));
20667
20668                client.request(request.unwrap()).await
20669            };
20670
20671            match req_result {
20672                Err(err) => {
20673                    if let common::Retry::After(d) = dlg.http_error(&err) {
20674                        sleep(d).await;
20675                        continue;
20676                    }
20677                    dlg.finished(false);
20678                    return Err(common::Error::HttpError(err));
20679                }
20680                Ok(res) => {
20681                    let (mut parts, body) = res.into_parts();
20682                    let mut body = common::Body::new(body);
20683                    if !parts.status.is_success() {
20684                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20685                        let error = serde_json::from_str(&common::to_string(&bytes));
20686                        let response = common::to_response(parts, bytes.into());
20687
20688                        if let common::Retry::After(d) =
20689                            dlg.http_failure(&response, error.as_ref().ok())
20690                        {
20691                            sleep(d).await;
20692                            continue;
20693                        }
20694
20695                        dlg.finished(false);
20696
20697                        return Err(match error {
20698                            Ok(value) => common::Error::BadRequest(value),
20699                            _ => common::Error::Failure(response),
20700                        });
20701                    }
20702                    let response = {
20703                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20704                        let encoded = common::to_string(&bytes);
20705                        match serde_json::from_str(&encoded) {
20706                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20707                            Err(error) => {
20708                                dlg.response_json_decode_error(&encoded, &error);
20709                                return Err(common::Error::JsonDecodeError(
20710                                    encoded.to_string(),
20711                                    error,
20712                                ));
20713                            }
20714                        }
20715                    };
20716
20717                    dlg.finished(true);
20718                    return Ok(response);
20719                }
20720            }
20721        }
20722    }
20723
20724    ///
20725    /// Sets the *request* property to the given value.
20726    ///
20727    /// Even though the property as already been set when instantiating this call,
20728    /// we provide this method for API completeness.
20729    pub fn request(
20730        mut self,
20731        new_value: RepairNodeGroupRequest,
20732    ) -> ProjectRegionClusterNodeGroupRepairCall<'a, C> {
20733        self._request = new_value;
20734        self
20735    }
20736    /// Required. The name of the node group to resize. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
20737    ///
20738    /// Sets the *name* path property to the given value.
20739    ///
20740    /// Even though the property as already been set when instantiating this call,
20741    /// we provide this method for API completeness.
20742    pub fn name(mut self, new_value: &str) -> ProjectRegionClusterNodeGroupRepairCall<'a, C> {
20743        self._name = new_value.to_string();
20744        self
20745    }
20746    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20747    /// while executing the actual API request.
20748    ///
20749    /// ````text
20750    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20751    /// ````
20752    ///
20753    /// Sets the *delegate* property to the given value.
20754    pub fn delegate(
20755        mut self,
20756        new_value: &'a mut dyn common::Delegate,
20757    ) -> ProjectRegionClusterNodeGroupRepairCall<'a, C> {
20758        self._delegate = Some(new_value);
20759        self
20760    }
20761
20762    /// Set any additional parameter of the query string used in the request.
20763    /// It should be used to set parameters which are not yet available through their own
20764    /// setters.
20765    ///
20766    /// Please note that this method must not be used to set any of the known parameters
20767    /// which have their own setter method. If done anyway, the request will fail.
20768    ///
20769    /// # Additional Parameters
20770    ///
20771    /// * *$.xgafv* (query-string) - V1 error format.
20772    /// * *access_token* (query-string) - OAuth access token.
20773    /// * *alt* (query-string) - Data format for response.
20774    /// * *callback* (query-string) - JSONP
20775    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20776    /// * *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.
20777    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20778    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20779    /// * *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.
20780    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20781    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20782    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterNodeGroupRepairCall<'a, C>
20783    where
20784        T: AsRef<str>,
20785    {
20786        self._additional_params
20787            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20788        self
20789    }
20790
20791    /// Identifies the authorization scope for the method you are building.
20792    ///
20793    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20794    /// [`Scope::CloudPlatform`].
20795    ///
20796    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20797    /// tokens for more than one scope.
20798    ///
20799    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20800    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20801    /// sufficient, a read-write scope will do as well.
20802    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterNodeGroupRepairCall<'a, C>
20803    where
20804        St: AsRef<str>,
20805    {
20806        self._scopes.insert(String::from(scope.as_ref()));
20807        self
20808    }
20809    /// Identifies the authorization scope(s) for the method you are building.
20810    ///
20811    /// See [`Self::add_scope()`] for details.
20812    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterNodeGroupRepairCall<'a, C>
20813    where
20814        I: IntoIterator<Item = St>,
20815        St: AsRef<str>,
20816    {
20817        self._scopes
20818            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20819        self
20820    }
20821
20822    /// Removes all scopes, and no default scope will be used either.
20823    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20824    /// for details).
20825    pub fn clear_scopes(mut self) -> ProjectRegionClusterNodeGroupRepairCall<'a, C> {
20826        self._scopes.clear();
20827        self
20828    }
20829}
20830
20831/// Resizes a node group in a cluster. The returned Operation.metadata is NodeGroupOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
20832///
20833/// A builder for the *regions.clusters.nodeGroups.resize* method supported by a *project* resource.
20834/// It is not used directly, but through a [`ProjectMethods`] instance.
20835///
20836/// # Example
20837///
20838/// Instantiate a resource method builder
20839///
20840/// ```test_harness,no_run
20841/// # extern crate hyper;
20842/// # extern crate hyper_rustls;
20843/// # extern crate google_dataproc1 as dataproc1;
20844/// use dataproc1::api::ResizeNodeGroupRequest;
20845/// # async fn dox() {
20846/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20847///
20848/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20849/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20850/// #     secret,
20851/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20852/// # ).build().await.unwrap();
20853///
20854/// # let client = hyper_util::client::legacy::Client::builder(
20855/// #     hyper_util::rt::TokioExecutor::new()
20856/// # )
20857/// # .build(
20858/// #     hyper_rustls::HttpsConnectorBuilder::new()
20859/// #         .with_native_roots()
20860/// #         .unwrap()
20861/// #         .https_or_http()
20862/// #         .enable_http1()
20863/// #         .build()
20864/// # );
20865/// # let mut hub = Dataproc::new(client, auth);
20866/// // As the method needs a request, you would usually fill it with the desired information
20867/// // into the respective structure. Some of the parts shown here might not be applicable !
20868/// // Values shown here are possibly random and not representative !
20869/// let mut req = ResizeNodeGroupRequest::default();
20870///
20871/// // You can configure optional parameters by calling the respective setters at will, and
20872/// // execute the final call using `doit()`.
20873/// // Values shown here are possibly random and not representative !
20874/// let result = hub.projects().regions_clusters_node_groups_resize(req, "name")
20875///              .doit().await;
20876/// # }
20877/// ```
20878pub struct ProjectRegionClusterNodeGroupResizeCall<'a, C>
20879where
20880    C: 'a,
20881{
20882    hub: &'a Dataproc<C>,
20883    _request: ResizeNodeGroupRequest,
20884    _name: String,
20885    _delegate: Option<&'a mut dyn common::Delegate>,
20886    _additional_params: HashMap<String, String>,
20887    _scopes: BTreeSet<String>,
20888}
20889
20890impl<'a, C> common::CallBuilder for ProjectRegionClusterNodeGroupResizeCall<'a, C> {}
20891
20892impl<'a, C> ProjectRegionClusterNodeGroupResizeCall<'a, C>
20893where
20894    C: common::Connector,
20895{
20896    /// Perform the operation you have build so far.
20897    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20898        use std::borrow::Cow;
20899        use std::io::{Read, Seek};
20900
20901        use common::{url::Params, ToParts};
20902        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20903
20904        let mut dd = common::DefaultDelegate;
20905        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20906        dlg.begin(common::MethodInfo {
20907            id: "dataproc.projects.regions.clusters.nodeGroups.resize",
20908            http_method: hyper::Method::POST,
20909        });
20910
20911        for &field in ["alt", "name"].iter() {
20912            if self._additional_params.contains_key(field) {
20913                dlg.finished(false);
20914                return Err(common::Error::FieldClash(field));
20915            }
20916        }
20917
20918        let mut params = Params::with_capacity(4 + self._additional_params.len());
20919        params.push("name", self._name);
20920
20921        params.extend(self._additional_params.iter());
20922
20923        params.push("alt", "json");
20924        let mut url = self.hub._base_url.clone() + "v1/{+name}:resize";
20925        if self._scopes.is_empty() {
20926            self._scopes
20927                .insert(Scope::CloudPlatform.as_ref().to_string());
20928        }
20929
20930        #[allow(clippy::single_element_loop)]
20931        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20932            url = params.uri_replacement(url, param_name, find_this, true);
20933        }
20934        {
20935            let to_remove = ["name"];
20936            params.remove_params(&to_remove);
20937        }
20938
20939        let url = params.parse_with_url(&url);
20940
20941        let mut json_mime_type = mime::APPLICATION_JSON;
20942        let mut request_value_reader = {
20943            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20944            common::remove_json_null_values(&mut value);
20945            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20946            serde_json::to_writer(&mut dst, &value).unwrap();
20947            dst
20948        };
20949        let request_size = request_value_reader
20950            .seek(std::io::SeekFrom::End(0))
20951            .unwrap();
20952        request_value_reader
20953            .seek(std::io::SeekFrom::Start(0))
20954            .unwrap();
20955
20956        loop {
20957            let token = match self
20958                .hub
20959                .auth
20960                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20961                .await
20962            {
20963                Ok(token) => token,
20964                Err(e) => match dlg.token(e) {
20965                    Ok(token) => token,
20966                    Err(e) => {
20967                        dlg.finished(false);
20968                        return Err(common::Error::MissingToken(e));
20969                    }
20970                },
20971            };
20972            request_value_reader
20973                .seek(std::io::SeekFrom::Start(0))
20974                .unwrap();
20975            let mut req_result = {
20976                let client = &self.hub.client;
20977                dlg.pre_request();
20978                let mut req_builder = hyper::Request::builder()
20979                    .method(hyper::Method::POST)
20980                    .uri(url.as_str())
20981                    .header(USER_AGENT, self.hub._user_agent.clone());
20982
20983                if let Some(token) = token.as_ref() {
20984                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20985                }
20986
20987                let request = req_builder
20988                    .header(CONTENT_TYPE, json_mime_type.to_string())
20989                    .header(CONTENT_LENGTH, request_size as u64)
20990                    .body(common::to_body(
20991                        request_value_reader.get_ref().clone().into(),
20992                    ));
20993
20994                client.request(request.unwrap()).await
20995            };
20996
20997            match req_result {
20998                Err(err) => {
20999                    if let common::Retry::After(d) = dlg.http_error(&err) {
21000                        sleep(d).await;
21001                        continue;
21002                    }
21003                    dlg.finished(false);
21004                    return Err(common::Error::HttpError(err));
21005                }
21006                Ok(res) => {
21007                    let (mut parts, body) = res.into_parts();
21008                    let mut body = common::Body::new(body);
21009                    if !parts.status.is_success() {
21010                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21011                        let error = serde_json::from_str(&common::to_string(&bytes));
21012                        let response = common::to_response(parts, bytes.into());
21013
21014                        if let common::Retry::After(d) =
21015                            dlg.http_failure(&response, error.as_ref().ok())
21016                        {
21017                            sleep(d).await;
21018                            continue;
21019                        }
21020
21021                        dlg.finished(false);
21022
21023                        return Err(match error {
21024                            Ok(value) => common::Error::BadRequest(value),
21025                            _ => common::Error::Failure(response),
21026                        });
21027                    }
21028                    let response = {
21029                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21030                        let encoded = common::to_string(&bytes);
21031                        match serde_json::from_str(&encoded) {
21032                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21033                            Err(error) => {
21034                                dlg.response_json_decode_error(&encoded, &error);
21035                                return Err(common::Error::JsonDecodeError(
21036                                    encoded.to_string(),
21037                                    error,
21038                                ));
21039                            }
21040                        }
21041                    };
21042
21043                    dlg.finished(true);
21044                    return Ok(response);
21045                }
21046            }
21047        }
21048    }
21049
21050    ///
21051    /// Sets the *request* property to the given value.
21052    ///
21053    /// Even though the property as already been set when instantiating this call,
21054    /// we provide this method for API completeness.
21055    pub fn request(
21056        mut self,
21057        new_value: ResizeNodeGroupRequest,
21058    ) -> ProjectRegionClusterNodeGroupResizeCall<'a, C> {
21059        self._request = new_value;
21060        self
21061    }
21062    /// Required. The name of the node group to resize. Format: projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}
21063    ///
21064    /// Sets the *name* path property to the given value.
21065    ///
21066    /// Even though the property as already been set when instantiating this call,
21067    /// we provide this method for API completeness.
21068    pub fn name(mut self, new_value: &str) -> ProjectRegionClusterNodeGroupResizeCall<'a, C> {
21069        self._name = new_value.to_string();
21070        self
21071    }
21072    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21073    /// while executing the actual API request.
21074    ///
21075    /// ````text
21076    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21077    /// ````
21078    ///
21079    /// Sets the *delegate* property to the given value.
21080    pub fn delegate(
21081        mut self,
21082        new_value: &'a mut dyn common::Delegate,
21083    ) -> ProjectRegionClusterNodeGroupResizeCall<'a, C> {
21084        self._delegate = Some(new_value);
21085        self
21086    }
21087
21088    /// Set any additional parameter of the query string used in the request.
21089    /// It should be used to set parameters which are not yet available through their own
21090    /// setters.
21091    ///
21092    /// Please note that this method must not be used to set any of the known parameters
21093    /// which have their own setter method. If done anyway, the request will fail.
21094    ///
21095    /// # Additional Parameters
21096    ///
21097    /// * *$.xgafv* (query-string) - V1 error format.
21098    /// * *access_token* (query-string) - OAuth access token.
21099    /// * *alt* (query-string) - Data format for response.
21100    /// * *callback* (query-string) - JSONP
21101    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21102    /// * *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.
21103    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21104    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21105    /// * *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.
21106    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21107    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21108    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterNodeGroupResizeCall<'a, C>
21109    where
21110        T: AsRef<str>,
21111    {
21112        self._additional_params
21113            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21114        self
21115    }
21116
21117    /// Identifies the authorization scope for the method you are building.
21118    ///
21119    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21120    /// [`Scope::CloudPlatform`].
21121    ///
21122    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21123    /// tokens for more than one scope.
21124    ///
21125    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21126    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21127    /// sufficient, a read-write scope will do as well.
21128    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterNodeGroupResizeCall<'a, C>
21129    where
21130        St: AsRef<str>,
21131    {
21132        self._scopes.insert(String::from(scope.as_ref()));
21133        self
21134    }
21135    /// Identifies the authorization scope(s) for the method you are building.
21136    ///
21137    /// See [`Self::add_scope()`] for details.
21138    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterNodeGroupResizeCall<'a, C>
21139    where
21140        I: IntoIterator<Item = St>,
21141        St: AsRef<str>,
21142    {
21143        self._scopes
21144            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21145        self
21146    }
21147
21148    /// Removes all scopes, and no default scope will be used either.
21149    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21150    /// for details).
21151    pub fn clear_scopes(mut self) -> ProjectRegionClusterNodeGroupResizeCall<'a, C> {
21152        self._scopes.clear();
21153        self
21154    }
21155}
21156
21157/// Creates a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
21158///
21159/// A builder for the *regions.clusters.create* method supported by a *project* resource.
21160/// It is not used directly, but through a [`ProjectMethods`] instance.
21161///
21162/// # Example
21163///
21164/// Instantiate a resource method builder
21165///
21166/// ```test_harness,no_run
21167/// # extern crate hyper;
21168/// # extern crate hyper_rustls;
21169/// # extern crate google_dataproc1 as dataproc1;
21170/// use dataproc1::api::Cluster;
21171/// # async fn dox() {
21172/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21173///
21174/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21175/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21176/// #     secret,
21177/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21178/// # ).build().await.unwrap();
21179///
21180/// # let client = hyper_util::client::legacy::Client::builder(
21181/// #     hyper_util::rt::TokioExecutor::new()
21182/// # )
21183/// # .build(
21184/// #     hyper_rustls::HttpsConnectorBuilder::new()
21185/// #         .with_native_roots()
21186/// #         .unwrap()
21187/// #         .https_or_http()
21188/// #         .enable_http1()
21189/// #         .build()
21190/// # );
21191/// # let mut hub = Dataproc::new(client, auth);
21192/// // As the method needs a request, you would usually fill it with the desired information
21193/// // into the respective structure. Some of the parts shown here might not be applicable !
21194/// // Values shown here are possibly random and not representative !
21195/// let mut req = Cluster::default();
21196///
21197/// // You can configure optional parameters by calling the respective setters at will, and
21198/// // execute the final call using `doit()`.
21199/// // Values shown here are possibly random and not representative !
21200/// let result = hub.projects().regions_clusters_create(req, "projectId", "region")
21201///              .request_id("sadipscing")
21202///              .action_on_failed_primary_workers("Lorem")
21203///              .doit().await;
21204/// # }
21205/// ```
21206pub struct ProjectRegionClusterCreateCall<'a, C>
21207where
21208    C: 'a,
21209{
21210    hub: &'a Dataproc<C>,
21211    _request: Cluster,
21212    _project_id: String,
21213    _region: String,
21214    _request_id: Option<String>,
21215    _action_on_failed_primary_workers: Option<String>,
21216    _delegate: Option<&'a mut dyn common::Delegate>,
21217    _additional_params: HashMap<String, String>,
21218    _scopes: BTreeSet<String>,
21219}
21220
21221impl<'a, C> common::CallBuilder for ProjectRegionClusterCreateCall<'a, C> {}
21222
21223impl<'a, C> ProjectRegionClusterCreateCall<'a, C>
21224where
21225    C: common::Connector,
21226{
21227    /// Perform the operation you have build so far.
21228    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21229        use std::borrow::Cow;
21230        use std::io::{Read, Seek};
21231
21232        use common::{url::Params, ToParts};
21233        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21234
21235        let mut dd = common::DefaultDelegate;
21236        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21237        dlg.begin(common::MethodInfo {
21238            id: "dataproc.projects.regions.clusters.create",
21239            http_method: hyper::Method::POST,
21240        });
21241
21242        for &field in [
21243            "alt",
21244            "projectId",
21245            "region",
21246            "requestId",
21247            "actionOnFailedPrimaryWorkers",
21248        ]
21249        .iter()
21250        {
21251            if self._additional_params.contains_key(field) {
21252                dlg.finished(false);
21253                return Err(common::Error::FieldClash(field));
21254            }
21255        }
21256
21257        let mut params = Params::with_capacity(7 + self._additional_params.len());
21258        params.push("projectId", self._project_id);
21259        params.push("region", self._region);
21260        if let Some(value) = self._request_id.as_ref() {
21261            params.push("requestId", value);
21262        }
21263        if let Some(value) = self._action_on_failed_primary_workers.as_ref() {
21264            params.push("actionOnFailedPrimaryWorkers", value);
21265        }
21266
21267        params.extend(self._additional_params.iter());
21268
21269        params.push("alt", "json");
21270        let mut url =
21271            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/clusters";
21272        if self._scopes.is_empty() {
21273            self._scopes
21274                .insert(Scope::CloudPlatform.as_ref().to_string());
21275        }
21276
21277        #[allow(clippy::single_element_loop)]
21278        for &(find_this, param_name) in
21279            [("{projectId}", "projectId"), ("{region}", "region")].iter()
21280        {
21281            url = params.uri_replacement(url, param_name, find_this, false);
21282        }
21283        {
21284            let to_remove = ["region", "projectId"];
21285            params.remove_params(&to_remove);
21286        }
21287
21288        let url = params.parse_with_url(&url);
21289
21290        let mut json_mime_type = mime::APPLICATION_JSON;
21291        let mut request_value_reader = {
21292            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21293            common::remove_json_null_values(&mut value);
21294            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21295            serde_json::to_writer(&mut dst, &value).unwrap();
21296            dst
21297        };
21298        let request_size = request_value_reader
21299            .seek(std::io::SeekFrom::End(0))
21300            .unwrap();
21301        request_value_reader
21302            .seek(std::io::SeekFrom::Start(0))
21303            .unwrap();
21304
21305        loop {
21306            let token = match self
21307                .hub
21308                .auth
21309                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21310                .await
21311            {
21312                Ok(token) => token,
21313                Err(e) => match dlg.token(e) {
21314                    Ok(token) => token,
21315                    Err(e) => {
21316                        dlg.finished(false);
21317                        return Err(common::Error::MissingToken(e));
21318                    }
21319                },
21320            };
21321            request_value_reader
21322                .seek(std::io::SeekFrom::Start(0))
21323                .unwrap();
21324            let mut req_result = {
21325                let client = &self.hub.client;
21326                dlg.pre_request();
21327                let mut req_builder = hyper::Request::builder()
21328                    .method(hyper::Method::POST)
21329                    .uri(url.as_str())
21330                    .header(USER_AGENT, self.hub._user_agent.clone());
21331
21332                if let Some(token) = token.as_ref() {
21333                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21334                }
21335
21336                let request = req_builder
21337                    .header(CONTENT_TYPE, json_mime_type.to_string())
21338                    .header(CONTENT_LENGTH, request_size as u64)
21339                    .body(common::to_body(
21340                        request_value_reader.get_ref().clone().into(),
21341                    ));
21342
21343                client.request(request.unwrap()).await
21344            };
21345
21346            match req_result {
21347                Err(err) => {
21348                    if let common::Retry::After(d) = dlg.http_error(&err) {
21349                        sleep(d).await;
21350                        continue;
21351                    }
21352                    dlg.finished(false);
21353                    return Err(common::Error::HttpError(err));
21354                }
21355                Ok(res) => {
21356                    let (mut parts, body) = res.into_parts();
21357                    let mut body = common::Body::new(body);
21358                    if !parts.status.is_success() {
21359                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21360                        let error = serde_json::from_str(&common::to_string(&bytes));
21361                        let response = common::to_response(parts, bytes.into());
21362
21363                        if let common::Retry::After(d) =
21364                            dlg.http_failure(&response, error.as_ref().ok())
21365                        {
21366                            sleep(d).await;
21367                            continue;
21368                        }
21369
21370                        dlg.finished(false);
21371
21372                        return Err(match error {
21373                            Ok(value) => common::Error::BadRequest(value),
21374                            _ => common::Error::Failure(response),
21375                        });
21376                    }
21377                    let response = {
21378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21379                        let encoded = common::to_string(&bytes);
21380                        match serde_json::from_str(&encoded) {
21381                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21382                            Err(error) => {
21383                                dlg.response_json_decode_error(&encoded, &error);
21384                                return Err(common::Error::JsonDecodeError(
21385                                    encoded.to_string(),
21386                                    error,
21387                                ));
21388                            }
21389                        }
21390                    };
21391
21392                    dlg.finished(true);
21393                    return Ok(response);
21394                }
21395            }
21396        }
21397    }
21398
21399    ///
21400    /// Sets the *request* property to the given value.
21401    ///
21402    /// Even though the property as already been set when instantiating this call,
21403    /// we provide this method for API completeness.
21404    pub fn request(mut self, new_value: Cluster) -> ProjectRegionClusterCreateCall<'a, C> {
21405        self._request = new_value;
21406        self
21407    }
21408    /// Required. The ID of the Google Cloud Platform project that the cluster belongs to.
21409    ///
21410    /// Sets the *project id* path property to the given value.
21411    ///
21412    /// Even though the property as already been set when instantiating this call,
21413    /// we provide this method for API completeness.
21414    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterCreateCall<'a, C> {
21415        self._project_id = new_value.to_string();
21416        self
21417    }
21418    /// Required. The Dataproc region in which to handle the request.
21419    ///
21420    /// Sets the *region* path property to the given value.
21421    ///
21422    /// Even though the property as already been set when instantiating this call,
21423    /// we provide this method for API completeness.
21424    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterCreateCall<'a, C> {
21425        self._region = new_value.to_string();
21426        self
21427    }
21428    /// Optional. A unique ID used to identify the request. If the server receives two CreateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
21429    ///
21430    /// Sets the *request id* query property to the given value.
21431    pub fn request_id(mut self, new_value: &str) -> ProjectRegionClusterCreateCall<'a, C> {
21432        self._request_id = Some(new_value.to_string());
21433        self
21434    }
21435    /// Optional. Failure action when primary worker creation fails.
21436    ///
21437    /// Sets the *action on failed primary workers* query property to the given value.
21438    pub fn action_on_failed_primary_workers(
21439        mut self,
21440        new_value: &str,
21441    ) -> ProjectRegionClusterCreateCall<'a, C> {
21442        self._action_on_failed_primary_workers = Some(new_value.to_string());
21443        self
21444    }
21445    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21446    /// while executing the actual API request.
21447    ///
21448    /// ````text
21449    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21450    /// ````
21451    ///
21452    /// Sets the *delegate* property to the given value.
21453    pub fn delegate(
21454        mut self,
21455        new_value: &'a mut dyn common::Delegate,
21456    ) -> ProjectRegionClusterCreateCall<'a, C> {
21457        self._delegate = Some(new_value);
21458        self
21459    }
21460
21461    /// Set any additional parameter of the query string used in the request.
21462    /// It should be used to set parameters which are not yet available through their own
21463    /// setters.
21464    ///
21465    /// Please note that this method must not be used to set any of the known parameters
21466    /// which have their own setter method. If done anyway, the request will fail.
21467    ///
21468    /// # Additional Parameters
21469    ///
21470    /// * *$.xgafv* (query-string) - V1 error format.
21471    /// * *access_token* (query-string) - OAuth access token.
21472    /// * *alt* (query-string) - Data format for response.
21473    /// * *callback* (query-string) - JSONP
21474    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21475    /// * *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.
21476    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21477    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21478    /// * *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.
21479    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21480    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21481    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterCreateCall<'a, C>
21482    where
21483        T: AsRef<str>,
21484    {
21485        self._additional_params
21486            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21487        self
21488    }
21489
21490    /// Identifies the authorization scope for the method you are building.
21491    ///
21492    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21493    /// [`Scope::CloudPlatform`].
21494    ///
21495    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21496    /// tokens for more than one scope.
21497    ///
21498    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21499    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21500    /// sufficient, a read-write scope will do as well.
21501    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterCreateCall<'a, C>
21502    where
21503        St: AsRef<str>,
21504    {
21505        self._scopes.insert(String::from(scope.as_ref()));
21506        self
21507    }
21508    /// Identifies the authorization scope(s) for the method you are building.
21509    ///
21510    /// See [`Self::add_scope()`] for details.
21511    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterCreateCall<'a, C>
21512    where
21513        I: IntoIterator<Item = St>,
21514        St: AsRef<str>,
21515    {
21516        self._scopes
21517            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21518        self
21519    }
21520
21521    /// Removes all scopes, and no default scope will be used either.
21522    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21523    /// for details).
21524    pub fn clear_scopes(mut self) -> ProjectRegionClusterCreateCall<'a, C> {
21525        self._scopes.clear();
21526        self
21527    }
21528}
21529
21530/// Deletes a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
21531///
21532/// A builder for the *regions.clusters.delete* method supported by a *project* resource.
21533/// It is not used directly, but through a [`ProjectMethods`] instance.
21534///
21535/// # Example
21536///
21537/// Instantiate a resource method builder
21538///
21539/// ```test_harness,no_run
21540/// # extern crate hyper;
21541/// # extern crate hyper_rustls;
21542/// # extern crate google_dataproc1 as dataproc1;
21543/// # async fn dox() {
21544/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21545///
21546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21548/// #     secret,
21549/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21550/// # ).build().await.unwrap();
21551///
21552/// # let client = hyper_util::client::legacy::Client::builder(
21553/// #     hyper_util::rt::TokioExecutor::new()
21554/// # )
21555/// # .build(
21556/// #     hyper_rustls::HttpsConnectorBuilder::new()
21557/// #         .with_native_roots()
21558/// #         .unwrap()
21559/// #         .https_or_http()
21560/// #         .enable_http1()
21561/// #         .build()
21562/// # );
21563/// # let mut hub = Dataproc::new(client, auth);
21564/// // You can configure optional parameters by calling the respective setters at will, and
21565/// // execute the final call using `doit()`.
21566/// // Values shown here are possibly random and not representative !
21567/// let result = hub.projects().regions_clusters_delete("projectId", "region", "clusterName")
21568///              .request_id("At")
21569///              .graceful_termination_timeout(chrono::Duration::seconds(7636745))
21570///              .cluster_uuid("sit")
21571///              .doit().await;
21572/// # }
21573/// ```
21574pub struct ProjectRegionClusterDeleteCall<'a, C>
21575where
21576    C: 'a,
21577{
21578    hub: &'a Dataproc<C>,
21579    _project_id: String,
21580    _region: String,
21581    _cluster_name: String,
21582    _request_id: Option<String>,
21583    _graceful_termination_timeout: Option<chrono::Duration>,
21584    _cluster_uuid: Option<String>,
21585    _delegate: Option<&'a mut dyn common::Delegate>,
21586    _additional_params: HashMap<String, String>,
21587    _scopes: BTreeSet<String>,
21588}
21589
21590impl<'a, C> common::CallBuilder for ProjectRegionClusterDeleteCall<'a, C> {}
21591
21592impl<'a, C> ProjectRegionClusterDeleteCall<'a, C>
21593where
21594    C: common::Connector,
21595{
21596    /// Perform the operation you have build so far.
21597    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21598        use std::borrow::Cow;
21599        use std::io::{Read, Seek};
21600
21601        use common::{url::Params, ToParts};
21602        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21603
21604        let mut dd = common::DefaultDelegate;
21605        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21606        dlg.begin(common::MethodInfo {
21607            id: "dataproc.projects.regions.clusters.delete",
21608            http_method: hyper::Method::DELETE,
21609        });
21610
21611        for &field in [
21612            "alt",
21613            "projectId",
21614            "region",
21615            "clusterName",
21616            "requestId",
21617            "gracefulTerminationTimeout",
21618            "clusterUuid",
21619        ]
21620        .iter()
21621        {
21622            if self._additional_params.contains_key(field) {
21623                dlg.finished(false);
21624                return Err(common::Error::FieldClash(field));
21625            }
21626        }
21627
21628        let mut params = Params::with_capacity(8 + self._additional_params.len());
21629        params.push("projectId", self._project_id);
21630        params.push("region", self._region);
21631        params.push("clusterName", self._cluster_name);
21632        if let Some(value) = self._request_id.as_ref() {
21633            params.push("requestId", value);
21634        }
21635        if let Some(value) = self._graceful_termination_timeout.as_ref() {
21636            params.push(
21637                "gracefulTerminationTimeout",
21638                common::serde::duration::to_string(&value),
21639            );
21640        }
21641        if let Some(value) = self._cluster_uuid.as_ref() {
21642            params.push("clusterUuid", value);
21643        }
21644
21645        params.extend(self._additional_params.iter());
21646
21647        params.push("alt", "json");
21648        let mut url = self.hub._base_url.clone()
21649            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}";
21650        if self._scopes.is_empty() {
21651            self._scopes
21652                .insert(Scope::CloudPlatform.as_ref().to_string());
21653        }
21654
21655        #[allow(clippy::single_element_loop)]
21656        for &(find_this, param_name) in [
21657            ("{projectId}", "projectId"),
21658            ("{region}", "region"),
21659            ("{clusterName}", "clusterName"),
21660        ]
21661        .iter()
21662        {
21663            url = params.uri_replacement(url, param_name, find_this, false);
21664        }
21665        {
21666            let to_remove = ["clusterName", "region", "projectId"];
21667            params.remove_params(&to_remove);
21668        }
21669
21670        let url = params.parse_with_url(&url);
21671
21672        loop {
21673            let token = match self
21674                .hub
21675                .auth
21676                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21677                .await
21678            {
21679                Ok(token) => token,
21680                Err(e) => match dlg.token(e) {
21681                    Ok(token) => token,
21682                    Err(e) => {
21683                        dlg.finished(false);
21684                        return Err(common::Error::MissingToken(e));
21685                    }
21686                },
21687            };
21688            let mut req_result = {
21689                let client = &self.hub.client;
21690                dlg.pre_request();
21691                let mut req_builder = hyper::Request::builder()
21692                    .method(hyper::Method::DELETE)
21693                    .uri(url.as_str())
21694                    .header(USER_AGENT, self.hub._user_agent.clone());
21695
21696                if let Some(token) = token.as_ref() {
21697                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21698                }
21699
21700                let request = req_builder
21701                    .header(CONTENT_LENGTH, 0_u64)
21702                    .body(common::to_body::<String>(None));
21703
21704                client.request(request.unwrap()).await
21705            };
21706
21707            match req_result {
21708                Err(err) => {
21709                    if let common::Retry::After(d) = dlg.http_error(&err) {
21710                        sleep(d).await;
21711                        continue;
21712                    }
21713                    dlg.finished(false);
21714                    return Err(common::Error::HttpError(err));
21715                }
21716                Ok(res) => {
21717                    let (mut parts, body) = res.into_parts();
21718                    let mut body = common::Body::new(body);
21719                    if !parts.status.is_success() {
21720                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21721                        let error = serde_json::from_str(&common::to_string(&bytes));
21722                        let response = common::to_response(parts, bytes.into());
21723
21724                        if let common::Retry::After(d) =
21725                            dlg.http_failure(&response, error.as_ref().ok())
21726                        {
21727                            sleep(d).await;
21728                            continue;
21729                        }
21730
21731                        dlg.finished(false);
21732
21733                        return Err(match error {
21734                            Ok(value) => common::Error::BadRequest(value),
21735                            _ => common::Error::Failure(response),
21736                        });
21737                    }
21738                    let response = {
21739                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21740                        let encoded = common::to_string(&bytes);
21741                        match serde_json::from_str(&encoded) {
21742                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21743                            Err(error) => {
21744                                dlg.response_json_decode_error(&encoded, &error);
21745                                return Err(common::Error::JsonDecodeError(
21746                                    encoded.to_string(),
21747                                    error,
21748                                ));
21749                            }
21750                        }
21751                    };
21752
21753                    dlg.finished(true);
21754                    return Ok(response);
21755                }
21756            }
21757        }
21758    }
21759
21760    /// Required. The ID of the Google Cloud Platform project that the cluster belongs to.
21761    ///
21762    /// Sets the *project id* path property to the given value.
21763    ///
21764    /// Even though the property as already been set when instantiating this call,
21765    /// we provide this method for API completeness.
21766    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterDeleteCall<'a, C> {
21767        self._project_id = new_value.to_string();
21768        self
21769    }
21770    /// Required. The Dataproc region in which to handle the request.
21771    ///
21772    /// Sets the *region* path property to the given value.
21773    ///
21774    /// Even though the property as already been set when instantiating this call,
21775    /// we provide this method for API completeness.
21776    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterDeleteCall<'a, C> {
21777        self._region = new_value.to_string();
21778        self
21779    }
21780    /// Required. The cluster name.
21781    ///
21782    /// Sets the *cluster name* path property to the given value.
21783    ///
21784    /// Even though the property as already been set when instantiating this call,
21785    /// we provide this method for API completeness.
21786    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterDeleteCall<'a, C> {
21787        self._cluster_name = new_value.to_string();
21788        self
21789    }
21790    /// Optional. A unique ID used to identify the request. If the server receives two DeleteClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
21791    ///
21792    /// Sets the *request id* query property to the given value.
21793    pub fn request_id(mut self, new_value: &str) -> ProjectRegionClusterDeleteCall<'a, C> {
21794        self._request_id = Some(new_value.to_string());
21795        self
21796    }
21797    /// Optional. The graceful termination timeout for the deletion of the cluster. Indicate the time the request will wait to complete the running jobs on the cluster before its forceful deletion. Default value is 0 indicating that the user has not enabled the graceful termination. Value can be between 60 second and 6 Hours, in case the graceful termination is enabled. (There is no separate flag to check the enabling or disabling of graceful termination, it can be checked by the values in the field).
21798    ///
21799    /// Sets the *graceful termination timeout* query property to the given value.
21800    pub fn graceful_termination_timeout(
21801        mut self,
21802        new_value: chrono::Duration,
21803    ) -> ProjectRegionClusterDeleteCall<'a, C> {
21804        self._graceful_termination_timeout = Some(new_value);
21805        self
21806    }
21807    /// Optional. Specifying the cluster_uuid means the RPC should fail (with error NOT_FOUND) if cluster with specified UUID does not exist.
21808    ///
21809    /// Sets the *cluster uuid* query property to the given value.
21810    pub fn cluster_uuid(mut self, new_value: &str) -> ProjectRegionClusterDeleteCall<'a, C> {
21811        self._cluster_uuid = Some(new_value.to_string());
21812        self
21813    }
21814    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21815    /// while executing the actual API request.
21816    ///
21817    /// ````text
21818    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21819    /// ````
21820    ///
21821    /// Sets the *delegate* property to the given value.
21822    pub fn delegate(
21823        mut self,
21824        new_value: &'a mut dyn common::Delegate,
21825    ) -> ProjectRegionClusterDeleteCall<'a, C> {
21826        self._delegate = Some(new_value);
21827        self
21828    }
21829
21830    /// Set any additional parameter of the query string used in the request.
21831    /// It should be used to set parameters which are not yet available through their own
21832    /// setters.
21833    ///
21834    /// Please note that this method must not be used to set any of the known parameters
21835    /// which have their own setter method. If done anyway, the request will fail.
21836    ///
21837    /// # Additional Parameters
21838    ///
21839    /// * *$.xgafv* (query-string) - V1 error format.
21840    /// * *access_token* (query-string) - OAuth access token.
21841    /// * *alt* (query-string) - Data format for response.
21842    /// * *callback* (query-string) - JSONP
21843    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21844    /// * *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.
21845    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21846    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21847    /// * *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.
21848    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21849    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21850    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterDeleteCall<'a, C>
21851    where
21852        T: AsRef<str>,
21853    {
21854        self._additional_params
21855            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21856        self
21857    }
21858
21859    /// Identifies the authorization scope for the method you are building.
21860    ///
21861    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21862    /// [`Scope::CloudPlatform`].
21863    ///
21864    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21865    /// tokens for more than one scope.
21866    ///
21867    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21868    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21869    /// sufficient, a read-write scope will do as well.
21870    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterDeleteCall<'a, C>
21871    where
21872        St: AsRef<str>,
21873    {
21874        self._scopes.insert(String::from(scope.as_ref()));
21875        self
21876    }
21877    /// Identifies the authorization scope(s) for the method you are building.
21878    ///
21879    /// See [`Self::add_scope()`] for details.
21880    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterDeleteCall<'a, C>
21881    where
21882        I: IntoIterator<Item = St>,
21883        St: AsRef<str>,
21884    {
21885        self._scopes
21886            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21887        self
21888    }
21889
21890    /// Removes all scopes, and no default scope will be used either.
21891    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21892    /// for details).
21893    pub fn clear_scopes(mut self) -> ProjectRegionClusterDeleteCall<'a, C> {
21894        self._scopes.clear();
21895        self
21896    }
21897}
21898
21899/// Gets cluster diagnostic information. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). After the operation completes, Operation.response contains DiagnoseClusterResults (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
21900///
21901/// A builder for the *regions.clusters.diagnose* method supported by a *project* resource.
21902/// It is not used directly, but through a [`ProjectMethods`] instance.
21903///
21904/// # Example
21905///
21906/// Instantiate a resource method builder
21907///
21908/// ```test_harness,no_run
21909/// # extern crate hyper;
21910/// # extern crate hyper_rustls;
21911/// # extern crate google_dataproc1 as dataproc1;
21912/// use dataproc1::api::DiagnoseClusterRequest;
21913/// # async fn dox() {
21914/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21915///
21916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21918/// #     secret,
21919/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21920/// # ).build().await.unwrap();
21921///
21922/// # let client = hyper_util::client::legacy::Client::builder(
21923/// #     hyper_util::rt::TokioExecutor::new()
21924/// # )
21925/// # .build(
21926/// #     hyper_rustls::HttpsConnectorBuilder::new()
21927/// #         .with_native_roots()
21928/// #         .unwrap()
21929/// #         .https_or_http()
21930/// #         .enable_http1()
21931/// #         .build()
21932/// # );
21933/// # let mut hub = Dataproc::new(client, auth);
21934/// // As the method needs a request, you would usually fill it with the desired information
21935/// // into the respective structure. Some of the parts shown here might not be applicable !
21936/// // Values shown here are possibly random and not representative !
21937/// let mut req = DiagnoseClusterRequest::default();
21938///
21939/// // You can configure optional parameters by calling the respective setters at will, and
21940/// // execute the final call using `doit()`.
21941/// // Values shown here are possibly random and not representative !
21942/// let result = hub.projects().regions_clusters_diagnose(req, "projectId", "region", "clusterName")
21943///              .doit().await;
21944/// # }
21945/// ```
21946pub struct ProjectRegionClusterDiagnoseCall<'a, C>
21947where
21948    C: 'a,
21949{
21950    hub: &'a Dataproc<C>,
21951    _request: DiagnoseClusterRequest,
21952    _project_id: String,
21953    _region: String,
21954    _cluster_name: String,
21955    _delegate: Option<&'a mut dyn common::Delegate>,
21956    _additional_params: HashMap<String, String>,
21957    _scopes: BTreeSet<String>,
21958}
21959
21960impl<'a, C> common::CallBuilder for ProjectRegionClusterDiagnoseCall<'a, C> {}
21961
21962impl<'a, C> ProjectRegionClusterDiagnoseCall<'a, C>
21963where
21964    C: common::Connector,
21965{
21966    /// Perform the operation you have build so far.
21967    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21968        use std::borrow::Cow;
21969        use std::io::{Read, Seek};
21970
21971        use common::{url::Params, ToParts};
21972        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21973
21974        let mut dd = common::DefaultDelegate;
21975        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21976        dlg.begin(common::MethodInfo {
21977            id: "dataproc.projects.regions.clusters.diagnose",
21978            http_method: hyper::Method::POST,
21979        });
21980
21981        for &field in ["alt", "projectId", "region", "clusterName"].iter() {
21982            if self._additional_params.contains_key(field) {
21983                dlg.finished(false);
21984                return Err(common::Error::FieldClash(field));
21985            }
21986        }
21987
21988        let mut params = Params::with_capacity(6 + self._additional_params.len());
21989        params.push("projectId", self._project_id);
21990        params.push("region", self._region);
21991        params.push("clusterName", self._cluster_name);
21992
21993        params.extend(self._additional_params.iter());
21994
21995        params.push("alt", "json");
21996        let mut url = self.hub._base_url.clone()
21997            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}:diagnose";
21998        if self._scopes.is_empty() {
21999            self._scopes
22000                .insert(Scope::CloudPlatform.as_ref().to_string());
22001        }
22002
22003        #[allow(clippy::single_element_loop)]
22004        for &(find_this, param_name) in [
22005            ("{projectId}", "projectId"),
22006            ("{region}", "region"),
22007            ("{clusterName}", "clusterName"),
22008        ]
22009        .iter()
22010        {
22011            url = params.uri_replacement(url, param_name, find_this, false);
22012        }
22013        {
22014            let to_remove = ["clusterName", "region", "projectId"];
22015            params.remove_params(&to_remove);
22016        }
22017
22018        let url = params.parse_with_url(&url);
22019
22020        let mut json_mime_type = mime::APPLICATION_JSON;
22021        let mut request_value_reader = {
22022            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22023            common::remove_json_null_values(&mut value);
22024            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22025            serde_json::to_writer(&mut dst, &value).unwrap();
22026            dst
22027        };
22028        let request_size = request_value_reader
22029            .seek(std::io::SeekFrom::End(0))
22030            .unwrap();
22031        request_value_reader
22032            .seek(std::io::SeekFrom::Start(0))
22033            .unwrap();
22034
22035        loop {
22036            let token = match self
22037                .hub
22038                .auth
22039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22040                .await
22041            {
22042                Ok(token) => token,
22043                Err(e) => match dlg.token(e) {
22044                    Ok(token) => token,
22045                    Err(e) => {
22046                        dlg.finished(false);
22047                        return Err(common::Error::MissingToken(e));
22048                    }
22049                },
22050            };
22051            request_value_reader
22052                .seek(std::io::SeekFrom::Start(0))
22053                .unwrap();
22054            let mut req_result = {
22055                let client = &self.hub.client;
22056                dlg.pre_request();
22057                let mut req_builder = hyper::Request::builder()
22058                    .method(hyper::Method::POST)
22059                    .uri(url.as_str())
22060                    .header(USER_AGENT, self.hub._user_agent.clone());
22061
22062                if let Some(token) = token.as_ref() {
22063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22064                }
22065
22066                let request = req_builder
22067                    .header(CONTENT_TYPE, json_mime_type.to_string())
22068                    .header(CONTENT_LENGTH, request_size as u64)
22069                    .body(common::to_body(
22070                        request_value_reader.get_ref().clone().into(),
22071                    ));
22072
22073                client.request(request.unwrap()).await
22074            };
22075
22076            match req_result {
22077                Err(err) => {
22078                    if let common::Retry::After(d) = dlg.http_error(&err) {
22079                        sleep(d).await;
22080                        continue;
22081                    }
22082                    dlg.finished(false);
22083                    return Err(common::Error::HttpError(err));
22084                }
22085                Ok(res) => {
22086                    let (mut parts, body) = res.into_parts();
22087                    let mut body = common::Body::new(body);
22088                    if !parts.status.is_success() {
22089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22090                        let error = serde_json::from_str(&common::to_string(&bytes));
22091                        let response = common::to_response(parts, bytes.into());
22092
22093                        if let common::Retry::After(d) =
22094                            dlg.http_failure(&response, error.as_ref().ok())
22095                        {
22096                            sleep(d).await;
22097                            continue;
22098                        }
22099
22100                        dlg.finished(false);
22101
22102                        return Err(match error {
22103                            Ok(value) => common::Error::BadRequest(value),
22104                            _ => common::Error::Failure(response),
22105                        });
22106                    }
22107                    let response = {
22108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22109                        let encoded = common::to_string(&bytes);
22110                        match serde_json::from_str(&encoded) {
22111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22112                            Err(error) => {
22113                                dlg.response_json_decode_error(&encoded, &error);
22114                                return Err(common::Error::JsonDecodeError(
22115                                    encoded.to_string(),
22116                                    error,
22117                                ));
22118                            }
22119                        }
22120                    };
22121
22122                    dlg.finished(true);
22123                    return Ok(response);
22124                }
22125            }
22126        }
22127    }
22128
22129    ///
22130    /// Sets the *request* property to the given value.
22131    ///
22132    /// Even though the property as already been set when instantiating this call,
22133    /// we provide this method for API completeness.
22134    pub fn request(
22135        mut self,
22136        new_value: DiagnoseClusterRequest,
22137    ) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22138        self._request = new_value;
22139        self
22140    }
22141    /// Required. The ID of the Google Cloud Platform project that the cluster belongs to.
22142    ///
22143    /// Sets the *project id* path property to the given value.
22144    ///
22145    /// Even though the property as already been set when instantiating this call,
22146    /// we provide this method for API completeness.
22147    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22148        self._project_id = new_value.to_string();
22149        self
22150    }
22151    /// Required. The Dataproc region in which to handle the request.
22152    ///
22153    /// Sets the *region* path property to the given value.
22154    ///
22155    /// Even though the property as already been set when instantiating this call,
22156    /// we provide this method for API completeness.
22157    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22158        self._region = new_value.to_string();
22159        self
22160    }
22161    /// Required. The cluster name.
22162    ///
22163    /// Sets the *cluster name* path property to the given value.
22164    ///
22165    /// Even though the property as already been set when instantiating this call,
22166    /// we provide this method for API completeness.
22167    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22168        self._cluster_name = new_value.to_string();
22169        self
22170    }
22171    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22172    /// while executing the actual API request.
22173    ///
22174    /// ````text
22175    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22176    /// ````
22177    ///
22178    /// Sets the *delegate* property to the given value.
22179    pub fn delegate(
22180        mut self,
22181        new_value: &'a mut dyn common::Delegate,
22182    ) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22183        self._delegate = Some(new_value);
22184        self
22185    }
22186
22187    /// Set any additional parameter of the query string used in the request.
22188    /// It should be used to set parameters which are not yet available through their own
22189    /// setters.
22190    ///
22191    /// Please note that this method must not be used to set any of the known parameters
22192    /// which have their own setter method. If done anyway, the request will fail.
22193    ///
22194    /// # Additional Parameters
22195    ///
22196    /// * *$.xgafv* (query-string) - V1 error format.
22197    /// * *access_token* (query-string) - OAuth access token.
22198    /// * *alt* (query-string) - Data format for response.
22199    /// * *callback* (query-string) - JSONP
22200    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22201    /// * *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.
22202    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22203    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22204    /// * *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.
22205    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22206    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22207    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterDiagnoseCall<'a, C>
22208    where
22209        T: AsRef<str>,
22210    {
22211        self._additional_params
22212            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22213        self
22214    }
22215
22216    /// Identifies the authorization scope for the method you are building.
22217    ///
22218    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22219    /// [`Scope::CloudPlatform`].
22220    ///
22221    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22222    /// tokens for more than one scope.
22223    ///
22224    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22225    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22226    /// sufficient, a read-write scope will do as well.
22227    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterDiagnoseCall<'a, C>
22228    where
22229        St: AsRef<str>,
22230    {
22231        self._scopes.insert(String::from(scope.as_ref()));
22232        self
22233    }
22234    /// Identifies the authorization scope(s) for the method you are building.
22235    ///
22236    /// See [`Self::add_scope()`] for details.
22237    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterDiagnoseCall<'a, C>
22238    where
22239        I: IntoIterator<Item = St>,
22240        St: AsRef<str>,
22241    {
22242        self._scopes
22243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22244        self
22245    }
22246
22247    /// Removes all scopes, and no default scope will be used either.
22248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22249    /// for details).
22250    pub fn clear_scopes(mut self) -> ProjectRegionClusterDiagnoseCall<'a, C> {
22251        self._scopes.clear();
22252        self
22253    }
22254}
22255
22256/// Gets the resource representation for a cluster in a project.
22257///
22258/// A builder for the *regions.clusters.get* method supported by a *project* resource.
22259/// It is not used directly, but through a [`ProjectMethods`] instance.
22260///
22261/// # Example
22262///
22263/// Instantiate a resource method builder
22264///
22265/// ```test_harness,no_run
22266/// # extern crate hyper;
22267/// # extern crate hyper_rustls;
22268/// # extern crate google_dataproc1 as dataproc1;
22269/// # async fn dox() {
22270/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22271///
22272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22274/// #     secret,
22275/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22276/// # ).build().await.unwrap();
22277///
22278/// # let client = hyper_util::client::legacy::Client::builder(
22279/// #     hyper_util::rt::TokioExecutor::new()
22280/// # )
22281/// # .build(
22282/// #     hyper_rustls::HttpsConnectorBuilder::new()
22283/// #         .with_native_roots()
22284/// #         .unwrap()
22285/// #         .https_or_http()
22286/// #         .enable_http1()
22287/// #         .build()
22288/// # );
22289/// # let mut hub = Dataproc::new(client, auth);
22290/// // You can configure optional parameters by calling the respective setters at will, and
22291/// // execute the final call using `doit()`.
22292/// // Values shown here are possibly random and not representative !
22293/// let result = hub.projects().regions_clusters_get("projectId", "region", "clusterName")
22294///              .doit().await;
22295/// # }
22296/// ```
22297pub struct ProjectRegionClusterGetCall<'a, C>
22298where
22299    C: 'a,
22300{
22301    hub: &'a Dataproc<C>,
22302    _project_id: String,
22303    _region: String,
22304    _cluster_name: String,
22305    _delegate: Option<&'a mut dyn common::Delegate>,
22306    _additional_params: HashMap<String, String>,
22307    _scopes: BTreeSet<String>,
22308}
22309
22310impl<'a, C> common::CallBuilder for ProjectRegionClusterGetCall<'a, C> {}
22311
22312impl<'a, C> ProjectRegionClusterGetCall<'a, C>
22313where
22314    C: common::Connector,
22315{
22316    /// Perform the operation you have build so far.
22317    pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
22318        use std::borrow::Cow;
22319        use std::io::{Read, Seek};
22320
22321        use common::{url::Params, ToParts};
22322        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22323
22324        let mut dd = common::DefaultDelegate;
22325        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22326        dlg.begin(common::MethodInfo {
22327            id: "dataproc.projects.regions.clusters.get",
22328            http_method: hyper::Method::GET,
22329        });
22330
22331        for &field in ["alt", "projectId", "region", "clusterName"].iter() {
22332            if self._additional_params.contains_key(field) {
22333                dlg.finished(false);
22334                return Err(common::Error::FieldClash(field));
22335            }
22336        }
22337
22338        let mut params = Params::with_capacity(5 + self._additional_params.len());
22339        params.push("projectId", self._project_id);
22340        params.push("region", self._region);
22341        params.push("clusterName", self._cluster_name);
22342
22343        params.extend(self._additional_params.iter());
22344
22345        params.push("alt", "json");
22346        let mut url = self.hub._base_url.clone()
22347            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}";
22348        if self._scopes.is_empty() {
22349            self._scopes
22350                .insert(Scope::CloudPlatform.as_ref().to_string());
22351        }
22352
22353        #[allow(clippy::single_element_loop)]
22354        for &(find_this, param_name) in [
22355            ("{projectId}", "projectId"),
22356            ("{region}", "region"),
22357            ("{clusterName}", "clusterName"),
22358        ]
22359        .iter()
22360        {
22361            url = params.uri_replacement(url, param_name, find_this, false);
22362        }
22363        {
22364            let to_remove = ["clusterName", "region", "projectId"];
22365            params.remove_params(&to_remove);
22366        }
22367
22368        let url = params.parse_with_url(&url);
22369
22370        loop {
22371            let token = match self
22372                .hub
22373                .auth
22374                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22375                .await
22376            {
22377                Ok(token) => token,
22378                Err(e) => match dlg.token(e) {
22379                    Ok(token) => token,
22380                    Err(e) => {
22381                        dlg.finished(false);
22382                        return Err(common::Error::MissingToken(e));
22383                    }
22384                },
22385            };
22386            let mut req_result = {
22387                let client = &self.hub.client;
22388                dlg.pre_request();
22389                let mut req_builder = hyper::Request::builder()
22390                    .method(hyper::Method::GET)
22391                    .uri(url.as_str())
22392                    .header(USER_AGENT, self.hub._user_agent.clone());
22393
22394                if let Some(token) = token.as_ref() {
22395                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22396                }
22397
22398                let request = req_builder
22399                    .header(CONTENT_LENGTH, 0_u64)
22400                    .body(common::to_body::<String>(None));
22401
22402                client.request(request.unwrap()).await
22403            };
22404
22405            match req_result {
22406                Err(err) => {
22407                    if let common::Retry::After(d) = dlg.http_error(&err) {
22408                        sleep(d).await;
22409                        continue;
22410                    }
22411                    dlg.finished(false);
22412                    return Err(common::Error::HttpError(err));
22413                }
22414                Ok(res) => {
22415                    let (mut parts, body) = res.into_parts();
22416                    let mut body = common::Body::new(body);
22417                    if !parts.status.is_success() {
22418                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22419                        let error = serde_json::from_str(&common::to_string(&bytes));
22420                        let response = common::to_response(parts, bytes.into());
22421
22422                        if let common::Retry::After(d) =
22423                            dlg.http_failure(&response, error.as_ref().ok())
22424                        {
22425                            sleep(d).await;
22426                            continue;
22427                        }
22428
22429                        dlg.finished(false);
22430
22431                        return Err(match error {
22432                            Ok(value) => common::Error::BadRequest(value),
22433                            _ => common::Error::Failure(response),
22434                        });
22435                    }
22436                    let response = {
22437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22438                        let encoded = common::to_string(&bytes);
22439                        match serde_json::from_str(&encoded) {
22440                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22441                            Err(error) => {
22442                                dlg.response_json_decode_error(&encoded, &error);
22443                                return Err(common::Error::JsonDecodeError(
22444                                    encoded.to_string(),
22445                                    error,
22446                                ));
22447                            }
22448                        }
22449                    };
22450
22451                    dlg.finished(true);
22452                    return Ok(response);
22453                }
22454            }
22455        }
22456    }
22457
22458    /// Required. The ID of the Google Cloud Platform project that the cluster belongs to.
22459    ///
22460    /// Sets the *project id* path property to the given value.
22461    ///
22462    /// Even though the property as already been set when instantiating this call,
22463    /// we provide this method for API completeness.
22464    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterGetCall<'a, C> {
22465        self._project_id = new_value.to_string();
22466        self
22467    }
22468    /// Required. The Dataproc region in which to handle the request.
22469    ///
22470    /// Sets the *region* path property to the given value.
22471    ///
22472    /// Even though the property as already been set when instantiating this call,
22473    /// we provide this method for API completeness.
22474    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterGetCall<'a, C> {
22475        self._region = new_value.to_string();
22476        self
22477    }
22478    /// Required. The cluster name.
22479    ///
22480    /// Sets the *cluster name* path property to the given value.
22481    ///
22482    /// Even though the property as already been set when instantiating this call,
22483    /// we provide this method for API completeness.
22484    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterGetCall<'a, C> {
22485        self._cluster_name = new_value.to_string();
22486        self
22487    }
22488    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22489    /// while executing the actual API request.
22490    ///
22491    /// ````text
22492    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22493    /// ````
22494    ///
22495    /// Sets the *delegate* property to the given value.
22496    pub fn delegate(
22497        mut self,
22498        new_value: &'a mut dyn common::Delegate,
22499    ) -> ProjectRegionClusterGetCall<'a, C> {
22500        self._delegate = Some(new_value);
22501        self
22502    }
22503
22504    /// Set any additional parameter of the query string used in the request.
22505    /// It should be used to set parameters which are not yet available through their own
22506    /// setters.
22507    ///
22508    /// Please note that this method must not be used to set any of the known parameters
22509    /// which have their own setter method. If done anyway, the request will fail.
22510    ///
22511    /// # Additional Parameters
22512    ///
22513    /// * *$.xgafv* (query-string) - V1 error format.
22514    /// * *access_token* (query-string) - OAuth access token.
22515    /// * *alt* (query-string) - Data format for response.
22516    /// * *callback* (query-string) - JSONP
22517    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22518    /// * *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.
22519    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22520    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22521    /// * *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.
22522    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22523    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22524    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterGetCall<'a, C>
22525    where
22526        T: AsRef<str>,
22527    {
22528        self._additional_params
22529            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22530        self
22531    }
22532
22533    /// Identifies the authorization scope for the method you are building.
22534    ///
22535    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22536    /// [`Scope::CloudPlatform`].
22537    ///
22538    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22539    /// tokens for more than one scope.
22540    ///
22541    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22542    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22543    /// sufficient, a read-write scope will do as well.
22544    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterGetCall<'a, C>
22545    where
22546        St: AsRef<str>,
22547    {
22548        self._scopes.insert(String::from(scope.as_ref()));
22549        self
22550    }
22551    /// Identifies the authorization scope(s) for the method you are building.
22552    ///
22553    /// See [`Self::add_scope()`] for details.
22554    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterGetCall<'a, C>
22555    where
22556        I: IntoIterator<Item = St>,
22557        St: AsRef<str>,
22558    {
22559        self._scopes
22560            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22561        self
22562    }
22563
22564    /// Removes all scopes, and no default scope will be used either.
22565    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22566    /// for details).
22567    pub fn clear_scopes(mut self) -> ProjectRegionClusterGetCall<'a, C> {
22568        self._scopes.clear();
22569        self
22570    }
22571}
22572
22573/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
22574///
22575/// A builder for the *regions.clusters.getIamPolicy* method supported by a *project* resource.
22576/// It is not used directly, but through a [`ProjectMethods`] instance.
22577///
22578/// # Example
22579///
22580/// Instantiate a resource method builder
22581///
22582/// ```test_harness,no_run
22583/// # extern crate hyper;
22584/// # extern crate hyper_rustls;
22585/// # extern crate google_dataproc1 as dataproc1;
22586/// use dataproc1::api::GetIamPolicyRequest;
22587/// # async fn dox() {
22588/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22589///
22590/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22591/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22592/// #     secret,
22593/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22594/// # ).build().await.unwrap();
22595///
22596/// # let client = hyper_util::client::legacy::Client::builder(
22597/// #     hyper_util::rt::TokioExecutor::new()
22598/// # )
22599/// # .build(
22600/// #     hyper_rustls::HttpsConnectorBuilder::new()
22601/// #         .with_native_roots()
22602/// #         .unwrap()
22603/// #         .https_or_http()
22604/// #         .enable_http1()
22605/// #         .build()
22606/// # );
22607/// # let mut hub = Dataproc::new(client, auth);
22608/// // As the method needs a request, you would usually fill it with the desired information
22609/// // into the respective structure. Some of the parts shown here might not be applicable !
22610/// // Values shown here are possibly random and not representative !
22611/// let mut req = GetIamPolicyRequest::default();
22612///
22613/// // You can configure optional parameters by calling the respective setters at will, and
22614/// // execute the final call using `doit()`.
22615/// // Values shown here are possibly random and not representative !
22616/// let result = hub.projects().regions_clusters_get_iam_policy(req, "resource")
22617///              .doit().await;
22618/// # }
22619/// ```
22620pub struct ProjectRegionClusterGetIamPolicyCall<'a, C>
22621where
22622    C: 'a,
22623{
22624    hub: &'a Dataproc<C>,
22625    _request: GetIamPolicyRequest,
22626    _resource: String,
22627    _delegate: Option<&'a mut dyn common::Delegate>,
22628    _additional_params: HashMap<String, String>,
22629    _scopes: BTreeSet<String>,
22630}
22631
22632impl<'a, C> common::CallBuilder for ProjectRegionClusterGetIamPolicyCall<'a, C> {}
22633
22634impl<'a, C> ProjectRegionClusterGetIamPolicyCall<'a, C>
22635where
22636    C: common::Connector,
22637{
22638    /// Perform the operation you have build so far.
22639    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22640        use std::borrow::Cow;
22641        use std::io::{Read, Seek};
22642
22643        use common::{url::Params, ToParts};
22644        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22645
22646        let mut dd = common::DefaultDelegate;
22647        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22648        dlg.begin(common::MethodInfo {
22649            id: "dataproc.projects.regions.clusters.getIamPolicy",
22650            http_method: hyper::Method::POST,
22651        });
22652
22653        for &field in ["alt", "resource"].iter() {
22654            if self._additional_params.contains_key(field) {
22655                dlg.finished(false);
22656                return Err(common::Error::FieldClash(field));
22657            }
22658        }
22659
22660        let mut params = Params::with_capacity(4 + self._additional_params.len());
22661        params.push("resource", self._resource);
22662
22663        params.extend(self._additional_params.iter());
22664
22665        params.push("alt", "json");
22666        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
22667        if self._scopes.is_empty() {
22668            self._scopes
22669                .insert(Scope::CloudPlatform.as_ref().to_string());
22670        }
22671
22672        #[allow(clippy::single_element_loop)]
22673        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22674            url = params.uri_replacement(url, param_name, find_this, true);
22675        }
22676        {
22677            let to_remove = ["resource"];
22678            params.remove_params(&to_remove);
22679        }
22680
22681        let url = params.parse_with_url(&url);
22682
22683        let mut json_mime_type = mime::APPLICATION_JSON;
22684        let mut request_value_reader = {
22685            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22686            common::remove_json_null_values(&mut value);
22687            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22688            serde_json::to_writer(&mut dst, &value).unwrap();
22689            dst
22690        };
22691        let request_size = request_value_reader
22692            .seek(std::io::SeekFrom::End(0))
22693            .unwrap();
22694        request_value_reader
22695            .seek(std::io::SeekFrom::Start(0))
22696            .unwrap();
22697
22698        loop {
22699            let token = match self
22700                .hub
22701                .auth
22702                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22703                .await
22704            {
22705                Ok(token) => token,
22706                Err(e) => match dlg.token(e) {
22707                    Ok(token) => token,
22708                    Err(e) => {
22709                        dlg.finished(false);
22710                        return Err(common::Error::MissingToken(e));
22711                    }
22712                },
22713            };
22714            request_value_reader
22715                .seek(std::io::SeekFrom::Start(0))
22716                .unwrap();
22717            let mut req_result = {
22718                let client = &self.hub.client;
22719                dlg.pre_request();
22720                let mut req_builder = hyper::Request::builder()
22721                    .method(hyper::Method::POST)
22722                    .uri(url.as_str())
22723                    .header(USER_AGENT, self.hub._user_agent.clone());
22724
22725                if let Some(token) = token.as_ref() {
22726                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22727                }
22728
22729                let request = req_builder
22730                    .header(CONTENT_TYPE, json_mime_type.to_string())
22731                    .header(CONTENT_LENGTH, request_size as u64)
22732                    .body(common::to_body(
22733                        request_value_reader.get_ref().clone().into(),
22734                    ));
22735
22736                client.request(request.unwrap()).await
22737            };
22738
22739            match req_result {
22740                Err(err) => {
22741                    if let common::Retry::After(d) = dlg.http_error(&err) {
22742                        sleep(d).await;
22743                        continue;
22744                    }
22745                    dlg.finished(false);
22746                    return Err(common::Error::HttpError(err));
22747                }
22748                Ok(res) => {
22749                    let (mut parts, body) = res.into_parts();
22750                    let mut body = common::Body::new(body);
22751                    if !parts.status.is_success() {
22752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22753                        let error = serde_json::from_str(&common::to_string(&bytes));
22754                        let response = common::to_response(parts, bytes.into());
22755
22756                        if let common::Retry::After(d) =
22757                            dlg.http_failure(&response, error.as_ref().ok())
22758                        {
22759                            sleep(d).await;
22760                            continue;
22761                        }
22762
22763                        dlg.finished(false);
22764
22765                        return Err(match error {
22766                            Ok(value) => common::Error::BadRequest(value),
22767                            _ => common::Error::Failure(response),
22768                        });
22769                    }
22770                    let response = {
22771                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22772                        let encoded = common::to_string(&bytes);
22773                        match serde_json::from_str(&encoded) {
22774                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22775                            Err(error) => {
22776                                dlg.response_json_decode_error(&encoded, &error);
22777                                return Err(common::Error::JsonDecodeError(
22778                                    encoded.to_string(),
22779                                    error,
22780                                ));
22781                            }
22782                        }
22783                    };
22784
22785                    dlg.finished(true);
22786                    return Ok(response);
22787                }
22788            }
22789        }
22790    }
22791
22792    ///
22793    /// Sets the *request* property to the given value.
22794    ///
22795    /// Even though the property as already been set when instantiating this call,
22796    /// we provide this method for API completeness.
22797    pub fn request(
22798        mut self,
22799        new_value: GetIamPolicyRequest,
22800    ) -> ProjectRegionClusterGetIamPolicyCall<'a, C> {
22801        self._request = new_value;
22802        self
22803    }
22804    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
22805    ///
22806    /// Sets the *resource* path property to the given value.
22807    ///
22808    /// Even though the property as already been set when instantiating this call,
22809    /// we provide this method for API completeness.
22810    pub fn resource(mut self, new_value: &str) -> ProjectRegionClusterGetIamPolicyCall<'a, C> {
22811        self._resource = new_value.to_string();
22812        self
22813    }
22814    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22815    /// while executing the actual API request.
22816    ///
22817    /// ````text
22818    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22819    /// ````
22820    ///
22821    /// Sets the *delegate* property to the given value.
22822    pub fn delegate(
22823        mut self,
22824        new_value: &'a mut dyn common::Delegate,
22825    ) -> ProjectRegionClusterGetIamPolicyCall<'a, C> {
22826        self._delegate = Some(new_value);
22827        self
22828    }
22829
22830    /// Set any additional parameter of the query string used in the request.
22831    /// It should be used to set parameters which are not yet available through their own
22832    /// setters.
22833    ///
22834    /// Please note that this method must not be used to set any of the known parameters
22835    /// which have their own setter method. If done anyway, the request will fail.
22836    ///
22837    /// # Additional Parameters
22838    ///
22839    /// * *$.xgafv* (query-string) - V1 error format.
22840    /// * *access_token* (query-string) - OAuth access token.
22841    /// * *alt* (query-string) - Data format for response.
22842    /// * *callback* (query-string) - JSONP
22843    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22844    /// * *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.
22845    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22846    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22847    /// * *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.
22848    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22849    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22850    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterGetIamPolicyCall<'a, C>
22851    where
22852        T: AsRef<str>,
22853    {
22854        self._additional_params
22855            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22856        self
22857    }
22858
22859    /// Identifies the authorization scope for the method you are building.
22860    ///
22861    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22862    /// [`Scope::CloudPlatform`].
22863    ///
22864    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22865    /// tokens for more than one scope.
22866    ///
22867    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22868    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22869    /// sufficient, a read-write scope will do as well.
22870    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterGetIamPolicyCall<'a, C>
22871    where
22872        St: AsRef<str>,
22873    {
22874        self._scopes.insert(String::from(scope.as_ref()));
22875        self
22876    }
22877    /// Identifies the authorization scope(s) for the method you are building.
22878    ///
22879    /// See [`Self::add_scope()`] for details.
22880    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterGetIamPolicyCall<'a, C>
22881    where
22882        I: IntoIterator<Item = St>,
22883        St: AsRef<str>,
22884    {
22885        self._scopes
22886            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22887        self
22888    }
22889
22890    /// Removes all scopes, and no default scope will be used either.
22891    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22892    /// for details).
22893    pub fn clear_scopes(mut self) -> ProjectRegionClusterGetIamPolicyCall<'a, C> {
22894        self._scopes.clear();
22895        self
22896    }
22897}
22898
22899/// Inject encrypted credentials into all of the VMs in a cluster.The target cluster must be a personal auth cluster assigned to the user who is issuing the RPC.
22900///
22901/// A builder for the *regions.clusters.injectCredentials* method supported by a *project* resource.
22902/// It is not used directly, but through a [`ProjectMethods`] instance.
22903///
22904/// # Example
22905///
22906/// Instantiate a resource method builder
22907///
22908/// ```test_harness,no_run
22909/// # extern crate hyper;
22910/// # extern crate hyper_rustls;
22911/// # extern crate google_dataproc1 as dataproc1;
22912/// use dataproc1::api::InjectCredentialsRequest;
22913/// # async fn dox() {
22914/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22915///
22916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22918/// #     secret,
22919/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22920/// # ).build().await.unwrap();
22921///
22922/// # let client = hyper_util::client::legacy::Client::builder(
22923/// #     hyper_util::rt::TokioExecutor::new()
22924/// # )
22925/// # .build(
22926/// #     hyper_rustls::HttpsConnectorBuilder::new()
22927/// #         .with_native_roots()
22928/// #         .unwrap()
22929/// #         .https_or_http()
22930/// #         .enable_http1()
22931/// #         .build()
22932/// # );
22933/// # let mut hub = Dataproc::new(client, auth);
22934/// // As the method needs a request, you would usually fill it with the desired information
22935/// // into the respective structure. Some of the parts shown here might not be applicable !
22936/// // Values shown here are possibly random and not representative !
22937/// let mut req = InjectCredentialsRequest::default();
22938///
22939/// // You can configure optional parameters by calling the respective setters at will, and
22940/// // execute the final call using `doit()`.
22941/// // Values shown here are possibly random and not representative !
22942/// let result = hub.projects().regions_clusters_inject_credentials(req, "project", "region", "cluster")
22943///              .doit().await;
22944/// # }
22945/// ```
22946pub struct ProjectRegionClusterInjectCredentialCall<'a, C>
22947where
22948    C: 'a,
22949{
22950    hub: &'a Dataproc<C>,
22951    _request: InjectCredentialsRequest,
22952    _project: String,
22953    _region: String,
22954    _cluster: String,
22955    _delegate: Option<&'a mut dyn common::Delegate>,
22956    _additional_params: HashMap<String, String>,
22957    _scopes: BTreeSet<String>,
22958}
22959
22960impl<'a, C> common::CallBuilder for ProjectRegionClusterInjectCredentialCall<'a, C> {}
22961
22962impl<'a, C> ProjectRegionClusterInjectCredentialCall<'a, C>
22963where
22964    C: common::Connector,
22965{
22966    /// Perform the operation you have build so far.
22967    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22968        use std::borrow::Cow;
22969        use std::io::{Read, Seek};
22970
22971        use common::{url::Params, ToParts};
22972        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22973
22974        let mut dd = common::DefaultDelegate;
22975        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22976        dlg.begin(common::MethodInfo {
22977            id: "dataproc.projects.regions.clusters.injectCredentials",
22978            http_method: hyper::Method::POST,
22979        });
22980
22981        for &field in ["alt", "project", "region", "cluster"].iter() {
22982            if self._additional_params.contains_key(field) {
22983                dlg.finished(false);
22984                return Err(common::Error::FieldClash(field));
22985            }
22986        }
22987
22988        let mut params = Params::with_capacity(6 + self._additional_params.len());
22989        params.push("project", self._project);
22990        params.push("region", self._region);
22991        params.push("cluster", self._cluster);
22992
22993        params.extend(self._additional_params.iter());
22994
22995        params.push("alt", "json");
22996        let mut url =
22997            self.hub._base_url.clone() + "v1/{+project}/{+region}/{+cluster}:injectCredentials";
22998        if self._scopes.is_empty() {
22999            self._scopes
23000                .insert(Scope::CloudPlatform.as_ref().to_string());
23001        }
23002
23003        #[allow(clippy::single_element_loop)]
23004        for &(find_this, param_name) in [
23005            ("{+project}", "project"),
23006            ("{+region}", "region"),
23007            ("{+cluster}", "cluster"),
23008        ]
23009        .iter()
23010        {
23011            url = params.uri_replacement(url, param_name, find_this, true);
23012        }
23013        {
23014            let to_remove = ["cluster", "region", "project"];
23015            params.remove_params(&to_remove);
23016        }
23017
23018        let url = params.parse_with_url(&url);
23019
23020        let mut json_mime_type = mime::APPLICATION_JSON;
23021        let mut request_value_reader = {
23022            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23023            common::remove_json_null_values(&mut value);
23024            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23025            serde_json::to_writer(&mut dst, &value).unwrap();
23026            dst
23027        };
23028        let request_size = request_value_reader
23029            .seek(std::io::SeekFrom::End(0))
23030            .unwrap();
23031        request_value_reader
23032            .seek(std::io::SeekFrom::Start(0))
23033            .unwrap();
23034
23035        loop {
23036            let token = match self
23037                .hub
23038                .auth
23039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23040                .await
23041            {
23042                Ok(token) => token,
23043                Err(e) => match dlg.token(e) {
23044                    Ok(token) => token,
23045                    Err(e) => {
23046                        dlg.finished(false);
23047                        return Err(common::Error::MissingToken(e));
23048                    }
23049                },
23050            };
23051            request_value_reader
23052                .seek(std::io::SeekFrom::Start(0))
23053                .unwrap();
23054            let mut req_result = {
23055                let client = &self.hub.client;
23056                dlg.pre_request();
23057                let mut req_builder = hyper::Request::builder()
23058                    .method(hyper::Method::POST)
23059                    .uri(url.as_str())
23060                    .header(USER_AGENT, self.hub._user_agent.clone());
23061
23062                if let Some(token) = token.as_ref() {
23063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23064                }
23065
23066                let request = req_builder
23067                    .header(CONTENT_TYPE, json_mime_type.to_string())
23068                    .header(CONTENT_LENGTH, request_size as u64)
23069                    .body(common::to_body(
23070                        request_value_reader.get_ref().clone().into(),
23071                    ));
23072
23073                client.request(request.unwrap()).await
23074            };
23075
23076            match req_result {
23077                Err(err) => {
23078                    if let common::Retry::After(d) = dlg.http_error(&err) {
23079                        sleep(d).await;
23080                        continue;
23081                    }
23082                    dlg.finished(false);
23083                    return Err(common::Error::HttpError(err));
23084                }
23085                Ok(res) => {
23086                    let (mut parts, body) = res.into_parts();
23087                    let mut body = common::Body::new(body);
23088                    if !parts.status.is_success() {
23089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23090                        let error = serde_json::from_str(&common::to_string(&bytes));
23091                        let response = common::to_response(parts, bytes.into());
23092
23093                        if let common::Retry::After(d) =
23094                            dlg.http_failure(&response, error.as_ref().ok())
23095                        {
23096                            sleep(d).await;
23097                            continue;
23098                        }
23099
23100                        dlg.finished(false);
23101
23102                        return Err(match error {
23103                            Ok(value) => common::Error::BadRequest(value),
23104                            _ => common::Error::Failure(response),
23105                        });
23106                    }
23107                    let response = {
23108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23109                        let encoded = common::to_string(&bytes);
23110                        match serde_json::from_str(&encoded) {
23111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23112                            Err(error) => {
23113                                dlg.response_json_decode_error(&encoded, &error);
23114                                return Err(common::Error::JsonDecodeError(
23115                                    encoded.to_string(),
23116                                    error,
23117                                ));
23118                            }
23119                        }
23120                    };
23121
23122                    dlg.finished(true);
23123                    return Ok(response);
23124                }
23125            }
23126        }
23127    }
23128
23129    ///
23130    /// Sets the *request* property to the given value.
23131    ///
23132    /// Even though the property as already been set when instantiating this call,
23133    /// we provide this method for API completeness.
23134    pub fn request(
23135        mut self,
23136        new_value: InjectCredentialsRequest,
23137    ) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23138        self._request = new_value;
23139        self
23140    }
23141    /// Required. The ID of the Google Cloud Platform project the cluster belongs to, of the form projects/.
23142    ///
23143    /// Sets the *project* path property to the given value.
23144    ///
23145    /// Even though the property as already been set when instantiating this call,
23146    /// we provide this method for API completeness.
23147    pub fn project(mut self, new_value: &str) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23148        self._project = new_value.to_string();
23149        self
23150    }
23151    /// Required. The region containing the cluster, of the form regions/.
23152    ///
23153    /// Sets the *region* path property to the given value.
23154    ///
23155    /// Even though the property as already been set when instantiating this call,
23156    /// we provide this method for API completeness.
23157    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23158        self._region = new_value.to_string();
23159        self
23160    }
23161    /// Required. The cluster, in the form clusters/.
23162    ///
23163    /// Sets the *cluster* path property to the given value.
23164    ///
23165    /// Even though the property as already been set when instantiating this call,
23166    /// we provide this method for API completeness.
23167    pub fn cluster(mut self, new_value: &str) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23168        self._cluster = new_value.to_string();
23169        self
23170    }
23171    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23172    /// while executing the actual API request.
23173    ///
23174    /// ````text
23175    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23176    /// ````
23177    ///
23178    /// Sets the *delegate* property to the given value.
23179    pub fn delegate(
23180        mut self,
23181        new_value: &'a mut dyn common::Delegate,
23182    ) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23183        self._delegate = Some(new_value);
23184        self
23185    }
23186
23187    /// Set any additional parameter of the query string used in the request.
23188    /// It should be used to set parameters which are not yet available through their own
23189    /// setters.
23190    ///
23191    /// Please note that this method must not be used to set any of the known parameters
23192    /// which have their own setter method. If done anyway, the request will fail.
23193    ///
23194    /// # Additional Parameters
23195    ///
23196    /// * *$.xgafv* (query-string) - V1 error format.
23197    /// * *access_token* (query-string) - OAuth access token.
23198    /// * *alt* (query-string) - Data format for response.
23199    /// * *callback* (query-string) - JSONP
23200    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23201    /// * *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.
23202    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23203    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23204    /// * *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.
23205    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23206    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23207    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterInjectCredentialCall<'a, C>
23208    where
23209        T: AsRef<str>,
23210    {
23211        self._additional_params
23212            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23213        self
23214    }
23215
23216    /// Identifies the authorization scope for the method you are building.
23217    ///
23218    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23219    /// [`Scope::CloudPlatform`].
23220    ///
23221    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23222    /// tokens for more than one scope.
23223    ///
23224    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23225    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23226    /// sufficient, a read-write scope will do as well.
23227    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterInjectCredentialCall<'a, C>
23228    where
23229        St: AsRef<str>,
23230    {
23231        self._scopes.insert(String::from(scope.as_ref()));
23232        self
23233    }
23234    /// Identifies the authorization scope(s) for the method you are building.
23235    ///
23236    /// See [`Self::add_scope()`] for details.
23237    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterInjectCredentialCall<'a, C>
23238    where
23239        I: IntoIterator<Item = St>,
23240        St: AsRef<str>,
23241    {
23242        self._scopes
23243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23244        self
23245    }
23246
23247    /// Removes all scopes, and no default scope will be used either.
23248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23249    /// for details).
23250    pub fn clear_scopes(mut self) -> ProjectRegionClusterInjectCredentialCall<'a, C> {
23251        self._scopes.clear();
23252        self
23253    }
23254}
23255
23256/// Lists all regions/{region}/clusters in a project alphabetically.
23257///
23258/// A builder for the *regions.clusters.list* method supported by a *project* resource.
23259/// It is not used directly, but through a [`ProjectMethods`] instance.
23260///
23261/// # Example
23262///
23263/// Instantiate a resource method builder
23264///
23265/// ```test_harness,no_run
23266/// # extern crate hyper;
23267/// # extern crate hyper_rustls;
23268/// # extern crate google_dataproc1 as dataproc1;
23269/// # async fn dox() {
23270/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23271///
23272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23274/// #     secret,
23275/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23276/// # ).build().await.unwrap();
23277///
23278/// # let client = hyper_util::client::legacy::Client::builder(
23279/// #     hyper_util::rt::TokioExecutor::new()
23280/// # )
23281/// # .build(
23282/// #     hyper_rustls::HttpsConnectorBuilder::new()
23283/// #         .with_native_roots()
23284/// #         .unwrap()
23285/// #         .https_or_http()
23286/// #         .enable_http1()
23287/// #         .build()
23288/// # );
23289/// # let mut hub = Dataproc::new(client, auth);
23290/// // You can configure optional parameters by calling the respective setters at will, and
23291/// // execute the final call using `doit()`.
23292/// // Values shown here are possibly random and not representative !
23293/// let result = hub.projects().regions_clusters_list("projectId", "region")
23294///              .page_token("et")
23295///              .page_size(-93)
23296///              .filter("no")
23297///              .doit().await;
23298/// # }
23299/// ```
23300pub struct ProjectRegionClusterListCall<'a, C>
23301where
23302    C: 'a,
23303{
23304    hub: &'a Dataproc<C>,
23305    _project_id: String,
23306    _region: String,
23307    _page_token: Option<String>,
23308    _page_size: Option<i32>,
23309    _filter: Option<String>,
23310    _delegate: Option<&'a mut dyn common::Delegate>,
23311    _additional_params: HashMap<String, String>,
23312    _scopes: BTreeSet<String>,
23313}
23314
23315impl<'a, C> common::CallBuilder for ProjectRegionClusterListCall<'a, C> {}
23316
23317impl<'a, C> ProjectRegionClusterListCall<'a, C>
23318where
23319    C: common::Connector,
23320{
23321    /// Perform the operation you have build so far.
23322    pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
23323        use std::borrow::Cow;
23324        use std::io::{Read, Seek};
23325
23326        use common::{url::Params, ToParts};
23327        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23328
23329        let mut dd = common::DefaultDelegate;
23330        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23331        dlg.begin(common::MethodInfo {
23332            id: "dataproc.projects.regions.clusters.list",
23333            http_method: hyper::Method::GET,
23334        });
23335
23336        for &field in [
23337            "alt",
23338            "projectId",
23339            "region",
23340            "pageToken",
23341            "pageSize",
23342            "filter",
23343        ]
23344        .iter()
23345        {
23346            if self._additional_params.contains_key(field) {
23347                dlg.finished(false);
23348                return Err(common::Error::FieldClash(field));
23349            }
23350        }
23351
23352        let mut params = Params::with_capacity(7 + self._additional_params.len());
23353        params.push("projectId", self._project_id);
23354        params.push("region", self._region);
23355        if let Some(value) = self._page_token.as_ref() {
23356            params.push("pageToken", value);
23357        }
23358        if let Some(value) = self._page_size.as_ref() {
23359            params.push("pageSize", value.to_string());
23360        }
23361        if let Some(value) = self._filter.as_ref() {
23362            params.push("filter", value);
23363        }
23364
23365        params.extend(self._additional_params.iter());
23366
23367        params.push("alt", "json");
23368        let mut url =
23369            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/clusters";
23370        if self._scopes.is_empty() {
23371            self._scopes
23372                .insert(Scope::CloudPlatform.as_ref().to_string());
23373        }
23374
23375        #[allow(clippy::single_element_loop)]
23376        for &(find_this, param_name) in
23377            [("{projectId}", "projectId"), ("{region}", "region")].iter()
23378        {
23379            url = params.uri_replacement(url, param_name, find_this, false);
23380        }
23381        {
23382            let to_remove = ["region", "projectId"];
23383            params.remove_params(&to_remove);
23384        }
23385
23386        let url = params.parse_with_url(&url);
23387
23388        loop {
23389            let token = match self
23390                .hub
23391                .auth
23392                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23393                .await
23394            {
23395                Ok(token) => token,
23396                Err(e) => match dlg.token(e) {
23397                    Ok(token) => token,
23398                    Err(e) => {
23399                        dlg.finished(false);
23400                        return Err(common::Error::MissingToken(e));
23401                    }
23402                },
23403            };
23404            let mut req_result = {
23405                let client = &self.hub.client;
23406                dlg.pre_request();
23407                let mut req_builder = hyper::Request::builder()
23408                    .method(hyper::Method::GET)
23409                    .uri(url.as_str())
23410                    .header(USER_AGENT, self.hub._user_agent.clone());
23411
23412                if let Some(token) = token.as_ref() {
23413                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23414                }
23415
23416                let request = req_builder
23417                    .header(CONTENT_LENGTH, 0_u64)
23418                    .body(common::to_body::<String>(None));
23419
23420                client.request(request.unwrap()).await
23421            };
23422
23423            match req_result {
23424                Err(err) => {
23425                    if let common::Retry::After(d) = dlg.http_error(&err) {
23426                        sleep(d).await;
23427                        continue;
23428                    }
23429                    dlg.finished(false);
23430                    return Err(common::Error::HttpError(err));
23431                }
23432                Ok(res) => {
23433                    let (mut parts, body) = res.into_parts();
23434                    let mut body = common::Body::new(body);
23435                    if !parts.status.is_success() {
23436                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23437                        let error = serde_json::from_str(&common::to_string(&bytes));
23438                        let response = common::to_response(parts, bytes.into());
23439
23440                        if let common::Retry::After(d) =
23441                            dlg.http_failure(&response, error.as_ref().ok())
23442                        {
23443                            sleep(d).await;
23444                            continue;
23445                        }
23446
23447                        dlg.finished(false);
23448
23449                        return Err(match error {
23450                            Ok(value) => common::Error::BadRequest(value),
23451                            _ => common::Error::Failure(response),
23452                        });
23453                    }
23454                    let response = {
23455                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23456                        let encoded = common::to_string(&bytes);
23457                        match serde_json::from_str(&encoded) {
23458                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23459                            Err(error) => {
23460                                dlg.response_json_decode_error(&encoded, &error);
23461                                return Err(common::Error::JsonDecodeError(
23462                                    encoded.to_string(),
23463                                    error,
23464                                ));
23465                            }
23466                        }
23467                    };
23468
23469                    dlg.finished(true);
23470                    return Ok(response);
23471                }
23472            }
23473        }
23474    }
23475
23476    /// Required. The ID of the Google Cloud Platform project that the cluster belongs to.
23477    ///
23478    /// Sets the *project id* path property to the given value.
23479    ///
23480    /// Even though the property as already been set when instantiating this call,
23481    /// we provide this method for API completeness.
23482    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterListCall<'a, C> {
23483        self._project_id = new_value.to_string();
23484        self
23485    }
23486    /// Required. The Dataproc region in which to handle the request.
23487    ///
23488    /// Sets the *region* path property to the given value.
23489    ///
23490    /// Even though the property as already been set when instantiating this call,
23491    /// we provide this method for API completeness.
23492    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterListCall<'a, C> {
23493        self._region = new_value.to_string();
23494        self
23495    }
23496    /// Optional. The standard List page token.
23497    ///
23498    /// Sets the *page token* query property to the given value.
23499    pub fn page_token(mut self, new_value: &str) -> ProjectRegionClusterListCall<'a, C> {
23500        self._page_token = Some(new_value.to_string());
23501        self
23502    }
23503    /// Optional. The standard List page size.
23504    ///
23505    /// Sets the *page size* query property to the given value.
23506    pub fn page_size(mut self, new_value: i32) -> ProjectRegionClusterListCall<'a, C> {
23507        self._page_size = Some(new_value);
23508        self
23509    }
23510    /// Optional. A filter constraining the clusters to list. Filters are case-sensitive and have the following syntax:field = value AND field = value ...where field is one of status.state, clusterName, or labels.[KEY], and [KEY] is a label key. value can be * to match all values. status.state can be one of the following: ACTIVE, INACTIVE, CREATING, RUNNING, ERROR, DELETING, UPDATING, STOPPING, or STOPPED. ACTIVE contains the CREATING, UPDATING, and RUNNING states. INACTIVE contains the DELETING, ERROR, STOPPING, and STOPPED states. clusterName is the name of the cluster provided at creation time. Only the logical AND operator is supported; space-separated items are treated as having an implicit AND operator.Example filter:status.state = ACTIVE AND clusterName = mycluster AND labels.env = staging AND labels.starred = *
23511    ///
23512    /// Sets the *filter* query property to the given value.
23513    pub fn filter(mut self, new_value: &str) -> ProjectRegionClusterListCall<'a, C> {
23514        self._filter = Some(new_value.to_string());
23515        self
23516    }
23517    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23518    /// while executing the actual API request.
23519    ///
23520    /// ````text
23521    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23522    /// ````
23523    ///
23524    /// Sets the *delegate* property to the given value.
23525    pub fn delegate(
23526        mut self,
23527        new_value: &'a mut dyn common::Delegate,
23528    ) -> ProjectRegionClusterListCall<'a, C> {
23529        self._delegate = Some(new_value);
23530        self
23531    }
23532
23533    /// Set any additional parameter of the query string used in the request.
23534    /// It should be used to set parameters which are not yet available through their own
23535    /// setters.
23536    ///
23537    /// Please note that this method must not be used to set any of the known parameters
23538    /// which have their own setter method. If done anyway, the request will fail.
23539    ///
23540    /// # Additional Parameters
23541    ///
23542    /// * *$.xgafv* (query-string) - V1 error format.
23543    /// * *access_token* (query-string) - OAuth access token.
23544    /// * *alt* (query-string) - Data format for response.
23545    /// * *callback* (query-string) - JSONP
23546    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23547    /// * *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.
23548    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23549    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23550    /// * *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.
23551    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23552    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23553    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterListCall<'a, C>
23554    where
23555        T: AsRef<str>,
23556    {
23557        self._additional_params
23558            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23559        self
23560    }
23561
23562    /// Identifies the authorization scope for the method you are building.
23563    ///
23564    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23565    /// [`Scope::CloudPlatform`].
23566    ///
23567    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23568    /// tokens for more than one scope.
23569    ///
23570    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23571    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23572    /// sufficient, a read-write scope will do as well.
23573    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterListCall<'a, C>
23574    where
23575        St: AsRef<str>,
23576    {
23577        self._scopes.insert(String::from(scope.as_ref()));
23578        self
23579    }
23580    /// Identifies the authorization scope(s) for the method you are building.
23581    ///
23582    /// See [`Self::add_scope()`] for details.
23583    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterListCall<'a, C>
23584    where
23585        I: IntoIterator<Item = St>,
23586        St: AsRef<str>,
23587    {
23588        self._scopes
23589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23590        self
23591    }
23592
23593    /// Removes all scopes, and no default scope will be used either.
23594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23595    /// for details).
23596    pub fn clear_scopes(mut self) -> ProjectRegionClusterListCall<'a, C> {
23597        self._scopes.clear();
23598        self
23599    }
23600}
23601
23602/// Updates a cluster in a project. The returned Operation.metadata will be ClusterOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata). The cluster must be in a RUNNING state or an error is returned.
23603///
23604/// A builder for the *regions.clusters.patch* method supported by a *project* resource.
23605/// It is not used directly, but through a [`ProjectMethods`] instance.
23606///
23607/// # Example
23608///
23609/// Instantiate a resource method builder
23610///
23611/// ```test_harness,no_run
23612/// # extern crate hyper;
23613/// # extern crate hyper_rustls;
23614/// # extern crate google_dataproc1 as dataproc1;
23615/// use dataproc1::api::Cluster;
23616/// # async fn dox() {
23617/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23618///
23619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23620/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23621/// #     secret,
23622/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23623/// # ).build().await.unwrap();
23624///
23625/// # let client = hyper_util::client::legacy::Client::builder(
23626/// #     hyper_util::rt::TokioExecutor::new()
23627/// # )
23628/// # .build(
23629/// #     hyper_rustls::HttpsConnectorBuilder::new()
23630/// #         .with_native_roots()
23631/// #         .unwrap()
23632/// #         .https_or_http()
23633/// #         .enable_http1()
23634/// #         .build()
23635/// # );
23636/// # let mut hub = Dataproc::new(client, auth);
23637/// // As the method needs a request, you would usually fill it with the desired information
23638/// // into the respective structure. Some of the parts shown here might not be applicable !
23639/// // Values shown here are possibly random and not representative !
23640/// let mut req = Cluster::default();
23641///
23642/// // You can configure optional parameters by calling the respective setters at will, and
23643/// // execute the final call using `doit()`.
23644/// // Values shown here are possibly random and not representative !
23645/// let result = hub.projects().regions_clusters_patch(req, "projectId", "region", "clusterName")
23646///              .update_mask(FieldMask::new::<&str>(&[]))
23647///              .request_id("no")
23648///              .graceful_decommission_timeout(chrono::Duration::seconds(1315765))
23649///              .doit().await;
23650/// # }
23651/// ```
23652pub struct ProjectRegionClusterPatchCall<'a, C>
23653where
23654    C: 'a,
23655{
23656    hub: &'a Dataproc<C>,
23657    _request: Cluster,
23658    _project_id: String,
23659    _region: String,
23660    _cluster_name: String,
23661    _update_mask: Option<common::FieldMask>,
23662    _request_id: Option<String>,
23663    _graceful_decommission_timeout: Option<chrono::Duration>,
23664    _delegate: Option<&'a mut dyn common::Delegate>,
23665    _additional_params: HashMap<String, String>,
23666    _scopes: BTreeSet<String>,
23667}
23668
23669impl<'a, C> common::CallBuilder for ProjectRegionClusterPatchCall<'a, C> {}
23670
23671impl<'a, C> ProjectRegionClusterPatchCall<'a, C>
23672where
23673    C: common::Connector,
23674{
23675    /// Perform the operation you have build so far.
23676    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23677        use std::borrow::Cow;
23678        use std::io::{Read, Seek};
23679
23680        use common::{url::Params, ToParts};
23681        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23682
23683        let mut dd = common::DefaultDelegate;
23684        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23685        dlg.begin(common::MethodInfo {
23686            id: "dataproc.projects.regions.clusters.patch",
23687            http_method: hyper::Method::PATCH,
23688        });
23689
23690        for &field in [
23691            "alt",
23692            "projectId",
23693            "region",
23694            "clusterName",
23695            "updateMask",
23696            "requestId",
23697            "gracefulDecommissionTimeout",
23698        ]
23699        .iter()
23700        {
23701            if self._additional_params.contains_key(field) {
23702                dlg.finished(false);
23703                return Err(common::Error::FieldClash(field));
23704            }
23705        }
23706
23707        let mut params = Params::with_capacity(9 + self._additional_params.len());
23708        params.push("projectId", self._project_id);
23709        params.push("region", self._region);
23710        params.push("clusterName", self._cluster_name);
23711        if let Some(value) = self._update_mask.as_ref() {
23712            params.push("updateMask", value.to_string());
23713        }
23714        if let Some(value) = self._request_id.as_ref() {
23715            params.push("requestId", value);
23716        }
23717        if let Some(value) = self._graceful_decommission_timeout.as_ref() {
23718            params.push(
23719                "gracefulDecommissionTimeout",
23720                common::serde::duration::to_string(&value),
23721            );
23722        }
23723
23724        params.extend(self._additional_params.iter());
23725
23726        params.push("alt", "json");
23727        let mut url = self.hub._base_url.clone()
23728            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}";
23729        if self._scopes.is_empty() {
23730            self._scopes
23731                .insert(Scope::CloudPlatform.as_ref().to_string());
23732        }
23733
23734        #[allow(clippy::single_element_loop)]
23735        for &(find_this, param_name) in [
23736            ("{projectId}", "projectId"),
23737            ("{region}", "region"),
23738            ("{clusterName}", "clusterName"),
23739        ]
23740        .iter()
23741        {
23742            url = params.uri_replacement(url, param_name, find_this, false);
23743        }
23744        {
23745            let to_remove = ["clusterName", "region", "projectId"];
23746            params.remove_params(&to_remove);
23747        }
23748
23749        let url = params.parse_with_url(&url);
23750
23751        let mut json_mime_type = mime::APPLICATION_JSON;
23752        let mut request_value_reader = {
23753            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23754            common::remove_json_null_values(&mut value);
23755            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23756            serde_json::to_writer(&mut dst, &value).unwrap();
23757            dst
23758        };
23759        let request_size = request_value_reader
23760            .seek(std::io::SeekFrom::End(0))
23761            .unwrap();
23762        request_value_reader
23763            .seek(std::io::SeekFrom::Start(0))
23764            .unwrap();
23765
23766        loop {
23767            let token = match self
23768                .hub
23769                .auth
23770                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23771                .await
23772            {
23773                Ok(token) => token,
23774                Err(e) => match dlg.token(e) {
23775                    Ok(token) => token,
23776                    Err(e) => {
23777                        dlg.finished(false);
23778                        return Err(common::Error::MissingToken(e));
23779                    }
23780                },
23781            };
23782            request_value_reader
23783                .seek(std::io::SeekFrom::Start(0))
23784                .unwrap();
23785            let mut req_result = {
23786                let client = &self.hub.client;
23787                dlg.pre_request();
23788                let mut req_builder = hyper::Request::builder()
23789                    .method(hyper::Method::PATCH)
23790                    .uri(url.as_str())
23791                    .header(USER_AGENT, self.hub._user_agent.clone());
23792
23793                if let Some(token) = token.as_ref() {
23794                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23795                }
23796
23797                let request = req_builder
23798                    .header(CONTENT_TYPE, json_mime_type.to_string())
23799                    .header(CONTENT_LENGTH, request_size as u64)
23800                    .body(common::to_body(
23801                        request_value_reader.get_ref().clone().into(),
23802                    ));
23803
23804                client.request(request.unwrap()).await
23805            };
23806
23807            match req_result {
23808                Err(err) => {
23809                    if let common::Retry::After(d) = dlg.http_error(&err) {
23810                        sleep(d).await;
23811                        continue;
23812                    }
23813                    dlg.finished(false);
23814                    return Err(common::Error::HttpError(err));
23815                }
23816                Ok(res) => {
23817                    let (mut parts, body) = res.into_parts();
23818                    let mut body = common::Body::new(body);
23819                    if !parts.status.is_success() {
23820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23821                        let error = serde_json::from_str(&common::to_string(&bytes));
23822                        let response = common::to_response(parts, bytes.into());
23823
23824                        if let common::Retry::After(d) =
23825                            dlg.http_failure(&response, error.as_ref().ok())
23826                        {
23827                            sleep(d).await;
23828                            continue;
23829                        }
23830
23831                        dlg.finished(false);
23832
23833                        return Err(match error {
23834                            Ok(value) => common::Error::BadRequest(value),
23835                            _ => common::Error::Failure(response),
23836                        });
23837                    }
23838                    let response = {
23839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23840                        let encoded = common::to_string(&bytes);
23841                        match serde_json::from_str(&encoded) {
23842                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23843                            Err(error) => {
23844                                dlg.response_json_decode_error(&encoded, &error);
23845                                return Err(common::Error::JsonDecodeError(
23846                                    encoded.to_string(),
23847                                    error,
23848                                ));
23849                            }
23850                        }
23851                    };
23852
23853                    dlg.finished(true);
23854                    return Ok(response);
23855                }
23856            }
23857        }
23858    }
23859
23860    ///
23861    /// Sets the *request* property to the given value.
23862    ///
23863    /// Even though the property as already been set when instantiating this call,
23864    /// we provide this method for API completeness.
23865    pub fn request(mut self, new_value: Cluster) -> ProjectRegionClusterPatchCall<'a, C> {
23866        self._request = new_value;
23867        self
23868    }
23869    /// Required. The ID of the Google Cloud Platform project the cluster belongs to.
23870    ///
23871    /// Sets the *project id* path property to the given value.
23872    ///
23873    /// Even though the property as already been set when instantiating this call,
23874    /// we provide this method for API completeness.
23875    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterPatchCall<'a, C> {
23876        self._project_id = new_value.to_string();
23877        self
23878    }
23879    /// Required. The Dataproc region in which to handle the request.
23880    ///
23881    /// Sets the *region* path property to the given value.
23882    ///
23883    /// Even though the property as already been set when instantiating this call,
23884    /// we provide this method for API completeness.
23885    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterPatchCall<'a, C> {
23886        self._region = new_value.to_string();
23887        self
23888    }
23889    /// Required. The cluster name.
23890    ///
23891    /// Sets the *cluster name* path property to the given value.
23892    ///
23893    /// Even though the property as already been set when instantiating this call,
23894    /// we provide this method for API completeness.
23895    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterPatchCall<'a, C> {
23896        self._cluster_name = new_value.to_string();
23897        self
23898    }
23899    /// Required. Specifies the path, relative to Cluster, of the field to update. For example, to change the number of workers in a cluster to 5, the update_mask parameter would be specified as config.worker_config.num_instances, and the PATCH request body would specify the new value, as follows: { "config":{ "workerConfig":{ "numInstances":"5" } } } Similarly, to change the number of preemptible workers in a cluster to 5, the update_mask parameter would be config.secondary_worker_config.num_instances, and the PATCH request body would be set as follows: { "config":{ "secondaryWorkerConfig":{ "numInstances":"5" } } } *Note:* Currently, only the following fields can be updated: *Mask* *Purpose* *labels* Update labels *config.worker_config.num_instances* Resize primary worker group *config.secondary_worker_config.num_instances* Resize secondary worker group config.autoscaling_config.policy_uri Use, stop using, or change autoscaling policies
23900    ///
23901    /// Sets the *update mask* query property to the given value.
23902    pub fn update_mask(
23903        mut self,
23904        new_value: common::FieldMask,
23905    ) -> ProjectRegionClusterPatchCall<'a, C> {
23906        self._update_mask = Some(new_value);
23907        self
23908    }
23909    /// Optional. A unique ID used to identify the request. If the server receives two UpdateClusterRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s with the same id, then the second request will be ignored and the first google.longrunning.Operation created and stored in the backend is returned.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
23910    ///
23911    /// Sets the *request id* query property to the given value.
23912    pub fn request_id(mut self, new_value: &str) -> ProjectRegionClusterPatchCall<'a, C> {
23913        self._request_id = Some(new_value.to_string());
23914        self
23915    }
23916    /// Optional. Timeout for graceful YARN decommissioning. Graceful decommissioning allows removing nodes from the cluster without interrupting jobs in progress. Timeout specifies how long to wait for jobs in progress to finish before forcefully removing nodes (and potentially interrupting jobs). Default timeout is 0 (for forceful decommission), and the maximum allowed timeout is 1 day. (see JSON representation of Duration (https://developers.google.com/protocol-buffers/docs/proto3#json)).Only supported on Dataproc image versions 1.2 and higher.
23917    ///
23918    /// Sets the *graceful decommission timeout* query property to the given value.
23919    pub fn graceful_decommission_timeout(
23920        mut self,
23921        new_value: chrono::Duration,
23922    ) -> ProjectRegionClusterPatchCall<'a, C> {
23923        self._graceful_decommission_timeout = Some(new_value);
23924        self
23925    }
23926    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23927    /// while executing the actual API request.
23928    ///
23929    /// ````text
23930    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23931    /// ````
23932    ///
23933    /// Sets the *delegate* property to the given value.
23934    pub fn delegate(
23935        mut self,
23936        new_value: &'a mut dyn common::Delegate,
23937    ) -> ProjectRegionClusterPatchCall<'a, C> {
23938        self._delegate = Some(new_value);
23939        self
23940    }
23941
23942    /// Set any additional parameter of the query string used in the request.
23943    /// It should be used to set parameters which are not yet available through their own
23944    /// setters.
23945    ///
23946    /// Please note that this method must not be used to set any of the known parameters
23947    /// which have their own setter method. If done anyway, the request will fail.
23948    ///
23949    /// # Additional Parameters
23950    ///
23951    /// * *$.xgafv* (query-string) - V1 error format.
23952    /// * *access_token* (query-string) - OAuth access token.
23953    /// * *alt* (query-string) - Data format for response.
23954    /// * *callback* (query-string) - JSONP
23955    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23956    /// * *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.
23957    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23958    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23959    /// * *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.
23960    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23961    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23962    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterPatchCall<'a, C>
23963    where
23964        T: AsRef<str>,
23965    {
23966        self._additional_params
23967            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23968        self
23969    }
23970
23971    /// Identifies the authorization scope for the method you are building.
23972    ///
23973    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23974    /// [`Scope::CloudPlatform`].
23975    ///
23976    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23977    /// tokens for more than one scope.
23978    ///
23979    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23980    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23981    /// sufficient, a read-write scope will do as well.
23982    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterPatchCall<'a, C>
23983    where
23984        St: AsRef<str>,
23985    {
23986        self._scopes.insert(String::from(scope.as_ref()));
23987        self
23988    }
23989    /// Identifies the authorization scope(s) for the method you are building.
23990    ///
23991    /// See [`Self::add_scope()`] for details.
23992    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterPatchCall<'a, C>
23993    where
23994        I: IntoIterator<Item = St>,
23995        St: AsRef<str>,
23996    {
23997        self._scopes
23998            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23999        self
24000    }
24001
24002    /// Removes all scopes, and no default scope will be used either.
24003    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24004    /// for details).
24005    pub fn clear_scopes(mut self) -> ProjectRegionClusterPatchCall<'a, C> {
24006        self._scopes.clear();
24007        self
24008    }
24009}
24010
24011/// Repairs a cluster.
24012///
24013/// A builder for the *regions.clusters.repair* method supported by a *project* resource.
24014/// It is not used directly, but through a [`ProjectMethods`] instance.
24015///
24016/// # Example
24017///
24018/// Instantiate a resource method builder
24019///
24020/// ```test_harness,no_run
24021/// # extern crate hyper;
24022/// # extern crate hyper_rustls;
24023/// # extern crate google_dataproc1 as dataproc1;
24024/// use dataproc1::api::RepairClusterRequest;
24025/// # async fn dox() {
24026/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24027///
24028/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24030/// #     secret,
24031/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24032/// # ).build().await.unwrap();
24033///
24034/// # let client = hyper_util::client::legacy::Client::builder(
24035/// #     hyper_util::rt::TokioExecutor::new()
24036/// # )
24037/// # .build(
24038/// #     hyper_rustls::HttpsConnectorBuilder::new()
24039/// #         .with_native_roots()
24040/// #         .unwrap()
24041/// #         .https_or_http()
24042/// #         .enable_http1()
24043/// #         .build()
24044/// # );
24045/// # let mut hub = Dataproc::new(client, auth);
24046/// // As the method needs a request, you would usually fill it with the desired information
24047/// // into the respective structure. Some of the parts shown here might not be applicable !
24048/// // Values shown here are possibly random and not representative !
24049/// let mut req = RepairClusterRequest::default();
24050///
24051/// // You can configure optional parameters by calling the respective setters at will, and
24052/// // execute the final call using `doit()`.
24053/// // Values shown here are possibly random and not representative !
24054/// let result = hub.projects().regions_clusters_repair(req, "projectId", "region", "clusterName")
24055///              .doit().await;
24056/// # }
24057/// ```
24058pub struct ProjectRegionClusterRepairCall<'a, C>
24059where
24060    C: 'a,
24061{
24062    hub: &'a Dataproc<C>,
24063    _request: RepairClusterRequest,
24064    _project_id: String,
24065    _region: String,
24066    _cluster_name: String,
24067    _delegate: Option<&'a mut dyn common::Delegate>,
24068    _additional_params: HashMap<String, String>,
24069    _scopes: BTreeSet<String>,
24070}
24071
24072impl<'a, C> common::CallBuilder for ProjectRegionClusterRepairCall<'a, C> {}
24073
24074impl<'a, C> ProjectRegionClusterRepairCall<'a, C>
24075where
24076    C: common::Connector,
24077{
24078    /// Perform the operation you have build so far.
24079    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24080        use std::borrow::Cow;
24081        use std::io::{Read, Seek};
24082
24083        use common::{url::Params, ToParts};
24084        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24085
24086        let mut dd = common::DefaultDelegate;
24087        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24088        dlg.begin(common::MethodInfo {
24089            id: "dataproc.projects.regions.clusters.repair",
24090            http_method: hyper::Method::POST,
24091        });
24092
24093        for &field in ["alt", "projectId", "region", "clusterName"].iter() {
24094            if self._additional_params.contains_key(field) {
24095                dlg.finished(false);
24096                return Err(common::Error::FieldClash(field));
24097            }
24098        }
24099
24100        let mut params = Params::with_capacity(6 + self._additional_params.len());
24101        params.push("projectId", self._project_id);
24102        params.push("region", self._region);
24103        params.push("clusterName", self._cluster_name);
24104
24105        params.extend(self._additional_params.iter());
24106
24107        params.push("alt", "json");
24108        let mut url = self.hub._base_url.clone()
24109            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}:repair";
24110        if self._scopes.is_empty() {
24111            self._scopes
24112                .insert(Scope::CloudPlatform.as_ref().to_string());
24113        }
24114
24115        #[allow(clippy::single_element_loop)]
24116        for &(find_this, param_name) in [
24117            ("{projectId}", "projectId"),
24118            ("{region}", "region"),
24119            ("{clusterName}", "clusterName"),
24120        ]
24121        .iter()
24122        {
24123            url = params.uri_replacement(url, param_name, find_this, false);
24124        }
24125        {
24126            let to_remove = ["clusterName", "region", "projectId"];
24127            params.remove_params(&to_remove);
24128        }
24129
24130        let url = params.parse_with_url(&url);
24131
24132        let mut json_mime_type = mime::APPLICATION_JSON;
24133        let mut request_value_reader = {
24134            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24135            common::remove_json_null_values(&mut value);
24136            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24137            serde_json::to_writer(&mut dst, &value).unwrap();
24138            dst
24139        };
24140        let request_size = request_value_reader
24141            .seek(std::io::SeekFrom::End(0))
24142            .unwrap();
24143        request_value_reader
24144            .seek(std::io::SeekFrom::Start(0))
24145            .unwrap();
24146
24147        loop {
24148            let token = match self
24149                .hub
24150                .auth
24151                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24152                .await
24153            {
24154                Ok(token) => token,
24155                Err(e) => match dlg.token(e) {
24156                    Ok(token) => token,
24157                    Err(e) => {
24158                        dlg.finished(false);
24159                        return Err(common::Error::MissingToken(e));
24160                    }
24161                },
24162            };
24163            request_value_reader
24164                .seek(std::io::SeekFrom::Start(0))
24165                .unwrap();
24166            let mut req_result = {
24167                let client = &self.hub.client;
24168                dlg.pre_request();
24169                let mut req_builder = hyper::Request::builder()
24170                    .method(hyper::Method::POST)
24171                    .uri(url.as_str())
24172                    .header(USER_AGENT, self.hub._user_agent.clone());
24173
24174                if let Some(token) = token.as_ref() {
24175                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24176                }
24177
24178                let request = req_builder
24179                    .header(CONTENT_TYPE, json_mime_type.to_string())
24180                    .header(CONTENT_LENGTH, request_size as u64)
24181                    .body(common::to_body(
24182                        request_value_reader.get_ref().clone().into(),
24183                    ));
24184
24185                client.request(request.unwrap()).await
24186            };
24187
24188            match req_result {
24189                Err(err) => {
24190                    if let common::Retry::After(d) = dlg.http_error(&err) {
24191                        sleep(d).await;
24192                        continue;
24193                    }
24194                    dlg.finished(false);
24195                    return Err(common::Error::HttpError(err));
24196                }
24197                Ok(res) => {
24198                    let (mut parts, body) = res.into_parts();
24199                    let mut body = common::Body::new(body);
24200                    if !parts.status.is_success() {
24201                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24202                        let error = serde_json::from_str(&common::to_string(&bytes));
24203                        let response = common::to_response(parts, bytes.into());
24204
24205                        if let common::Retry::After(d) =
24206                            dlg.http_failure(&response, error.as_ref().ok())
24207                        {
24208                            sleep(d).await;
24209                            continue;
24210                        }
24211
24212                        dlg.finished(false);
24213
24214                        return Err(match error {
24215                            Ok(value) => common::Error::BadRequest(value),
24216                            _ => common::Error::Failure(response),
24217                        });
24218                    }
24219                    let response = {
24220                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24221                        let encoded = common::to_string(&bytes);
24222                        match serde_json::from_str(&encoded) {
24223                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24224                            Err(error) => {
24225                                dlg.response_json_decode_error(&encoded, &error);
24226                                return Err(common::Error::JsonDecodeError(
24227                                    encoded.to_string(),
24228                                    error,
24229                                ));
24230                            }
24231                        }
24232                    };
24233
24234                    dlg.finished(true);
24235                    return Ok(response);
24236                }
24237            }
24238        }
24239    }
24240
24241    ///
24242    /// Sets the *request* property to the given value.
24243    ///
24244    /// Even though the property as already been set when instantiating this call,
24245    /// we provide this method for API completeness.
24246    pub fn request(
24247        mut self,
24248        new_value: RepairClusterRequest,
24249    ) -> ProjectRegionClusterRepairCall<'a, C> {
24250        self._request = new_value;
24251        self
24252    }
24253    /// Required. The ID of the Google Cloud Platform project the cluster belongs to.
24254    ///
24255    /// Sets the *project id* path property to the given value.
24256    ///
24257    /// Even though the property as already been set when instantiating this call,
24258    /// we provide this method for API completeness.
24259    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterRepairCall<'a, C> {
24260        self._project_id = new_value.to_string();
24261        self
24262    }
24263    /// Required. The Dataproc region in which to handle the request.
24264    ///
24265    /// Sets the *region* path property to the given value.
24266    ///
24267    /// Even though the property as already been set when instantiating this call,
24268    /// we provide this method for API completeness.
24269    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterRepairCall<'a, C> {
24270        self._region = new_value.to_string();
24271        self
24272    }
24273    /// Required. The cluster name.
24274    ///
24275    /// Sets the *cluster name* path property to the given value.
24276    ///
24277    /// Even though the property as already been set when instantiating this call,
24278    /// we provide this method for API completeness.
24279    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterRepairCall<'a, C> {
24280        self._cluster_name = new_value.to_string();
24281        self
24282    }
24283    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24284    /// while executing the actual API request.
24285    ///
24286    /// ````text
24287    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24288    /// ````
24289    ///
24290    /// Sets the *delegate* property to the given value.
24291    pub fn delegate(
24292        mut self,
24293        new_value: &'a mut dyn common::Delegate,
24294    ) -> ProjectRegionClusterRepairCall<'a, C> {
24295        self._delegate = Some(new_value);
24296        self
24297    }
24298
24299    /// Set any additional parameter of the query string used in the request.
24300    /// It should be used to set parameters which are not yet available through their own
24301    /// setters.
24302    ///
24303    /// Please note that this method must not be used to set any of the known parameters
24304    /// which have their own setter method. If done anyway, the request will fail.
24305    ///
24306    /// # Additional Parameters
24307    ///
24308    /// * *$.xgafv* (query-string) - V1 error format.
24309    /// * *access_token* (query-string) - OAuth access token.
24310    /// * *alt* (query-string) - Data format for response.
24311    /// * *callback* (query-string) - JSONP
24312    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24313    /// * *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.
24314    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24315    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24316    /// * *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.
24317    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24318    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24319    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterRepairCall<'a, C>
24320    where
24321        T: AsRef<str>,
24322    {
24323        self._additional_params
24324            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24325        self
24326    }
24327
24328    /// Identifies the authorization scope for the method you are building.
24329    ///
24330    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24331    /// [`Scope::CloudPlatform`].
24332    ///
24333    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24334    /// tokens for more than one scope.
24335    ///
24336    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24337    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24338    /// sufficient, a read-write scope will do as well.
24339    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterRepairCall<'a, C>
24340    where
24341        St: AsRef<str>,
24342    {
24343        self._scopes.insert(String::from(scope.as_ref()));
24344        self
24345    }
24346    /// Identifies the authorization scope(s) for the method you are building.
24347    ///
24348    /// See [`Self::add_scope()`] for details.
24349    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterRepairCall<'a, C>
24350    where
24351        I: IntoIterator<Item = St>,
24352        St: AsRef<str>,
24353    {
24354        self._scopes
24355            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24356        self
24357    }
24358
24359    /// Removes all scopes, and no default scope will be used either.
24360    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24361    /// for details).
24362    pub fn clear_scopes(mut self) -> ProjectRegionClusterRepairCall<'a, C> {
24363        self._scopes.clear();
24364        self
24365    }
24366}
24367
24368/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
24369///
24370/// A builder for the *regions.clusters.setIamPolicy* method supported by a *project* resource.
24371/// It is not used directly, but through a [`ProjectMethods`] instance.
24372///
24373/// # Example
24374///
24375/// Instantiate a resource method builder
24376///
24377/// ```test_harness,no_run
24378/// # extern crate hyper;
24379/// # extern crate hyper_rustls;
24380/// # extern crate google_dataproc1 as dataproc1;
24381/// use dataproc1::api::SetIamPolicyRequest;
24382/// # async fn dox() {
24383/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24384///
24385/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24386/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24387/// #     secret,
24388/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24389/// # ).build().await.unwrap();
24390///
24391/// # let client = hyper_util::client::legacy::Client::builder(
24392/// #     hyper_util::rt::TokioExecutor::new()
24393/// # )
24394/// # .build(
24395/// #     hyper_rustls::HttpsConnectorBuilder::new()
24396/// #         .with_native_roots()
24397/// #         .unwrap()
24398/// #         .https_or_http()
24399/// #         .enable_http1()
24400/// #         .build()
24401/// # );
24402/// # let mut hub = Dataproc::new(client, auth);
24403/// // As the method needs a request, you would usually fill it with the desired information
24404/// // into the respective structure. Some of the parts shown here might not be applicable !
24405/// // Values shown here are possibly random and not representative !
24406/// let mut req = SetIamPolicyRequest::default();
24407///
24408/// // You can configure optional parameters by calling the respective setters at will, and
24409/// // execute the final call using `doit()`.
24410/// // Values shown here are possibly random and not representative !
24411/// let result = hub.projects().regions_clusters_set_iam_policy(req, "resource")
24412///              .doit().await;
24413/// # }
24414/// ```
24415pub struct ProjectRegionClusterSetIamPolicyCall<'a, C>
24416where
24417    C: 'a,
24418{
24419    hub: &'a Dataproc<C>,
24420    _request: SetIamPolicyRequest,
24421    _resource: String,
24422    _delegate: Option<&'a mut dyn common::Delegate>,
24423    _additional_params: HashMap<String, String>,
24424    _scopes: BTreeSet<String>,
24425}
24426
24427impl<'a, C> common::CallBuilder for ProjectRegionClusterSetIamPolicyCall<'a, C> {}
24428
24429impl<'a, C> ProjectRegionClusterSetIamPolicyCall<'a, C>
24430where
24431    C: common::Connector,
24432{
24433    /// Perform the operation you have build so far.
24434    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
24435        use std::borrow::Cow;
24436        use std::io::{Read, Seek};
24437
24438        use common::{url::Params, ToParts};
24439        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24440
24441        let mut dd = common::DefaultDelegate;
24442        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24443        dlg.begin(common::MethodInfo {
24444            id: "dataproc.projects.regions.clusters.setIamPolicy",
24445            http_method: hyper::Method::POST,
24446        });
24447
24448        for &field in ["alt", "resource"].iter() {
24449            if self._additional_params.contains_key(field) {
24450                dlg.finished(false);
24451                return Err(common::Error::FieldClash(field));
24452            }
24453        }
24454
24455        let mut params = Params::with_capacity(4 + self._additional_params.len());
24456        params.push("resource", self._resource);
24457
24458        params.extend(self._additional_params.iter());
24459
24460        params.push("alt", "json");
24461        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
24462        if self._scopes.is_empty() {
24463            self._scopes
24464                .insert(Scope::CloudPlatform.as_ref().to_string());
24465        }
24466
24467        #[allow(clippy::single_element_loop)]
24468        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24469            url = params.uri_replacement(url, param_name, find_this, true);
24470        }
24471        {
24472            let to_remove = ["resource"];
24473            params.remove_params(&to_remove);
24474        }
24475
24476        let url = params.parse_with_url(&url);
24477
24478        let mut json_mime_type = mime::APPLICATION_JSON;
24479        let mut request_value_reader = {
24480            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24481            common::remove_json_null_values(&mut value);
24482            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24483            serde_json::to_writer(&mut dst, &value).unwrap();
24484            dst
24485        };
24486        let request_size = request_value_reader
24487            .seek(std::io::SeekFrom::End(0))
24488            .unwrap();
24489        request_value_reader
24490            .seek(std::io::SeekFrom::Start(0))
24491            .unwrap();
24492
24493        loop {
24494            let token = match self
24495                .hub
24496                .auth
24497                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24498                .await
24499            {
24500                Ok(token) => token,
24501                Err(e) => match dlg.token(e) {
24502                    Ok(token) => token,
24503                    Err(e) => {
24504                        dlg.finished(false);
24505                        return Err(common::Error::MissingToken(e));
24506                    }
24507                },
24508            };
24509            request_value_reader
24510                .seek(std::io::SeekFrom::Start(0))
24511                .unwrap();
24512            let mut req_result = {
24513                let client = &self.hub.client;
24514                dlg.pre_request();
24515                let mut req_builder = hyper::Request::builder()
24516                    .method(hyper::Method::POST)
24517                    .uri(url.as_str())
24518                    .header(USER_AGENT, self.hub._user_agent.clone());
24519
24520                if let Some(token) = token.as_ref() {
24521                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24522                }
24523
24524                let request = req_builder
24525                    .header(CONTENT_TYPE, json_mime_type.to_string())
24526                    .header(CONTENT_LENGTH, request_size as u64)
24527                    .body(common::to_body(
24528                        request_value_reader.get_ref().clone().into(),
24529                    ));
24530
24531                client.request(request.unwrap()).await
24532            };
24533
24534            match req_result {
24535                Err(err) => {
24536                    if let common::Retry::After(d) = dlg.http_error(&err) {
24537                        sleep(d).await;
24538                        continue;
24539                    }
24540                    dlg.finished(false);
24541                    return Err(common::Error::HttpError(err));
24542                }
24543                Ok(res) => {
24544                    let (mut parts, body) = res.into_parts();
24545                    let mut body = common::Body::new(body);
24546                    if !parts.status.is_success() {
24547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24548                        let error = serde_json::from_str(&common::to_string(&bytes));
24549                        let response = common::to_response(parts, bytes.into());
24550
24551                        if let common::Retry::After(d) =
24552                            dlg.http_failure(&response, error.as_ref().ok())
24553                        {
24554                            sleep(d).await;
24555                            continue;
24556                        }
24557
24558                        dlg.finished(false);
24559
24560                        return Err(match error {
24561                            Ok(value) => common::Error::BadRequest(value),
24562                            _ => common::Error::Failure(response),
24563                        });
24564                    }
24565                    let response = {
24566                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24567                        let encoded = common::to_string(&bytes);
24568                        match serde_json::from_str(&encoded) {
24569                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24570                            Err(error) => {
24571                                dlg.response_json_decode_error(&encoded, &error);
24572                                return Err(common::Error::JsonDecodeError(
24573                                    encoded.to_string(),
24574                                    error,
24575                                ));
24576                            }
24577                        }
24578                    };
24579
24580                    dlg.finished(true);
24581                    return Ok(response);
24582                }
24583            }
24584        }
24585    }
24586
24587    ///
24588    /// Sets the *request* property to the given value.
24589    ///
24590    /// Even though the property as already been set when instantiating this call,
24591    /// we provide this method for API completeness.
24592    pub fn request(
24593        mut self,
24594        new_value: SetIamPolicyRequest,
24595    ) -> ProjectRegionClusterSetIamPolicyCall<'a, C> {
24596        self._request = new_value;
24597        self
24598    }
24599    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
24600    ///
24601    /// Sets the *resource* path property to the given value.
24602    ///
24603    /// Even though the property as already been set when instantiating this call,
24604    /// we provide this method for API completeness.
24605    pub fn resource(mut self, new_value: &str) -> ProjectRegionClusterSetIamPolicyCall<'a, C> {
24606        self._resource = new_value.to_string();
24607        self
24608    }
24609    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24610    /// while executing the actual API request.
24611    ///
24612    /// ````text
24613    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24614    /// ````
24615    ///
24616    /// Sets the *delegate* property to the given value.
24617    pub fn delegate(
24618        mut self,
24619        new_value: &'a mut dyn common::Delegate,
24620    ) -> ProjectRegionClusterSetIamPolicyCall<'a, C> {
24621        self._delegate = Some(new_value);
24622        self
24623    }
24624
24625    /// Set any additional parameter of the query string used in the request.
24626    /// It should be used to set parameters which are not yet available through their own
24627    /// setters.
24628    ///
24629    /// Please note that this method must not be used to set any of the known parameters
24630    /// which have their own setter method. If done anyway, the request will fail.
24631    ///
24632    /// # Additional Parameters
24633    ///
24634    /// * *$.xgafv* (query-string) - V1 error format.
24635    /// * *access_token* (query-string) - OAuth access token.
24636    /// * *alt* (query-string) - Data format for response.
24637    /// * *callback* (query-string) - JSONP
24638    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24639    /// * *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.
24640    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24641    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24642    /// * *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.
24643    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24644    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24645    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterSetIamPolicyCall<'a, C>
24646    where
24647        T: AsRef<str>,
24648    {
24649        self._additional_params
24650            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24651        self
24652    }
24653
24654    /// Identifies the authorization scope for the method you are building.
24655    ///
24656    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24657    /// [`Scope::CloudPlatform`].
24658    ///
24659    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24660    /// tokens for more than one scope.
24661    ///
24662    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24663    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24664    /// sufficient, a read-write scope will do as well.
24665    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterSetIamPolicyCall<'a, C>
24666    where
24667        St: AsRef<str>,
24668    {
24669        self._scopes.insert(String::from(scope.as_ref()));
24670        self
24671    }
24672    /// Identifies the authorization scope(s) for the method you are building.
24673    ///
24674    /// See [`Self::add_scope()`] for details.
24675    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterSetIamPolicyCall<'a, C>
24676    where
24677        I: IntoIterator<Item = St>,
24678        St: AsRef<str>,
24679    {
24680        self._scopes
24681            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24682        self
24683    }
24684
24685    /// Removes all scopes, and no default scope will be used either.
24686    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24687    /// for details).
24688    pub fn clear_scopes(mut self) -> ProjectRegionClusterSetIamPolicyCall<'a, C> {
24689        self._scopes.clear();
24690        self
24691    }
24692}
24693
24694/// Starts a cluster in a project.
24695///
24696/// A builder for the *regions.clusters.start* method supported by a *project* resource.
24697/// It is not used directly, but through a [`ProjectMethods`] instance.
24698///
24699/// # Example
24700///
24701/// Instantiate a resource method builder
24702///
24703/// ```test_harness,no_run
24704/// # extern crate hyper;
24705/// # extern crate hyper_rustls;
24706/// # extern crate google_dataproc1 as dataproc1;
24707/// use dataproc1::api::StartClusterRequest;
24708/// # async fn dox() {
24709/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24710///
24711/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24712/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24713/// #     secret,
24714/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24715/// # ).build().await.unwrap();
24716///
24717/// # let client = hyper_util::client::legacy::Client::builder(
24718/// #     hyper_util::rt::TokioExecutor::new()
24719/// # )
24720/// # .build(
24721/// #     hyper_rustls::HttpsConnectorBuilder::new()
24722/// #         .with_native_roots()
24723/// #         .unwrap()
24724/// #         .https_or_http()
24725/// #         .enable_http1()
24726/// #         .build()
24727/// # );
24728/// # let mut hub = Dataproc::new(client, auth);
24729/// // As the method needs a request, you would usually fill it with the desired information
24730/// // into the respective structure. Some of the parts shown here might not be applicable !
24731/// // Values shown here are possibly random and not representative !
24732/// let mut req = StartClusterRequest::default();
24733///
24734/// // You can configure optional parameters by calling the respective setters at will, and
24735/// // execute the final call using `doit()`.
24736/// // Values shown here are possibly random and not representative !
24737/// let result = hub.projects().regions_clusters_start(req, "projectId", "region", "clusterName")
24738///              .doit().await;
24739/// # }
24740/// ```
24741pub struct ProjectRegionClusterStartCall<'a, C>
24742where
24743    C: 'a,
24744{
24745    hub: &'a Dataproc<C>,
24746    _request: StartClusterRequest,
24747    _project_id: String,
24748    _region: String,
24749    _cluster_name: String,
24750    _delegate: Option<&'a mut dyn common::Delegate>,
24751    _additional_params: HashMap<String, String>,
24752    _scopes: BTreeSet<String>,
24753}
24754
24755impl<'a, C> common::CallBuilder for ProjectRegionClusterStartCall<'a, C> {}
24756
24757impl<'a, C> ProjectRegionClusterStartCall<'a, C>
24758where
24759    C: common::Connector,
24760{
24761    /// Perform the operation you have build so far.
24762    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24763        use std::borrow::Cow;
24764        use std::io::{Read, Seek};
24765
24766        use common::{url::Params, ToParts};
24767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24768
24769        let mut dd = common::DefaultDelegate;
24770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24771        dlg.begin(common::MethodInfo {
24772            id: "dataproc.projects.regions.clusters.start",
24773            http_method: hyper::Method::POST,
24774        });
24775
24776        for &field in ["alt", "projectId", "region", "clusterName"].iter() {
24777            if self._additional_params.contains_key(field) {
24778                dlg.finished(false);
24779                return Err(common::Error::FieldClash(field));
24780            }
24781        }
24782
24783        let mut params = Params::with_capacity(6 + self._additional_params.len());
24784        params.push("projectId", self._project_id);
24785        params.push("region", self._region);
24786        params.push("clusterName", self._cluster_name);
24787
24788        params.extend(self._additional_params.iter());
24789
24790        params.push("alt", "json");
24791        let mut url = self.hub._base_url.clone()
24792            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}:start";
24793        if self._scopes.is_empty() {
24794            self._scopes
24795                .insert(Scope::CloudPlatform.as_ref().to_string());
24796        }
24797
24798        #[allow(clippy::single_element_loop)]
24799        for &(find_this, param_name) in [
24800            ("{projectId}", "projectId"),
24801            ("{region}", "region"),
24802            ("{clusterName}", "clusterName"),
24803        ]
24804        .iter()
24805        {
24806            url = params.uri_replacement(url, param_name, find_this, false);
24807        }
24808        {
24809            let to_remove = ["clusterName", "region", "projectId"];
24810            params.remove_params(&to_remove);
24811        }
24812
24813        let url = params.parse_with_url(&url);
24814
24815        let mut json_mime_type = mime::APPLICATION_JSON;
24816        let mut request_value_reader = {
24817            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24818            common::remove_json_null_values(&mut value);
24819            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24820            serde_json::to_writer(&mut dst, &value).unwrap();
24821            dst
24822        };
24823        let request_size = request_value_reader
24824            .seek(std::io::SeekFrom::End(0))
24825            .unwrap();
24826        request_value_reader
24827            .seek(std::io::SeekFrom::Start(0))
24828            .unwrap();
24829
24830        loop {
24831            let token = match self
24832                .hub
24833                .auth
24834                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24835                .await
24836            {
24837                Ok(token) => token,
24838                Err(e) => match dlg.token(e) {
24839                    Ok(token) => token,
24840                    Err(e) => {
24841                        dlg.finished(false);
24842                        return Err(common::Error::MissingToken(e));
24843                    }
24844                },
24845            };
24846            request_value_reader
24847                .seek(std::io::SeekFrom::Start(0))
24848                .unwrap();
24849            let mut req_result = {
24850                let client = &self.hub.client;
24851                dlg.pre_request();
24852                let mut req_builder = hyper::Request::builder()
24853                    .method(hyper::Method::POST)
24854                    .uri(url.as_str())
24855                    .header(USER_AGENT, self.hub._user_agent.clone());
24856
24857                if let Some(token) = token.as_ref() {
24858                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24859                }
24860
24861                let request = req_builder
24862                    .header(CONTENT_TYPE, json_mime_type.to_string())
24863                    .header(CONTENT_LENGTH, request_size as u64)
24864                    .body(common::to_body(
24865                        request_value_reader.get_ref().clone().into(),
24866                    ));
24867
24868                client.request(request.unwrap()).await
24869            };
24870
24871            match req_result {
24872                Err(err) => {
24873                    if let common::Retry::After(d) = dlg.http_error(&err) {
24874                        sleep(d).await;
24875                        continue;
24876                    }
24877                    dlg.finished(false);
24878                    return Err(common::Error::HttpError(err));
24879                }
24880                Ok(res) => {
24881                    let (mut parts, body) = res.into_parts();
24882                    let mut body = common::Body::new(body);
24883                    if !parts.status.is_success() {
24884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24885                        let error = serde_json::from_str(&common::to_string(&bytes));
24886                        let response = common::to_response(parts, bytes.into());
24887
24888                        if let common::Retry::After(d) =
24889                            dlg.http_failure(&response, error.as_ref().ok())
24890                        {
24891                            sleep(d).await;
24892                            continue;
24893                        }
24894
24895                        dlg.finished(false);
24896
24897                        return Err(match error {
24898                            Ok(value) => common::Error::BadRequest(value),
24899                            _ => common::Error::Failure(response),
24900                        });
24901                    }
24902                    let response = {
24903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24904                        let encoded = common::to_string(&bytes);
24905                        match serde_json::from_str(&encoded) {
24906                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24907                            Err(error) => {
24908                                dlg.response_json_decode_error(&encoded, &error);
24909                                return Err(common::Error::JsonDecodeError(
24910                                    encoded.to_string(),
24911                                    error,
24912                                ));
24913                            }
24914                        }
24915                    };
24916
24917                    dlg.finished(true);
24918                    return Ok(response);
24919                }
24920            }
24921        }
24922    }
24923
24924    ///
24925    /// Sets the *request* property to the given value.
24926    ///
24927    /// Even though the property as already been set when instantiating this call,
24928    /// we provide this method for API completeness.
24929    pub fn request(
24930        mut self,
24931        new_value: StartClusterRequest,
24932    ) -> ProjectRegionClusterStartCall<'a, C> {
24933        self._request = new_value;
24934        self
24935    }
24936    /// Required. The ID of the Google Cloud Platform project the cluster belongs to.
24937    ///
24938    /// Sets the *project id* path property to the given value.
24939    ///
24940    /// Even though the property as already been set when instantiating this call,
24941    /// we provide this method for API completeness.
24942    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterStartCall<'a, C> {
24943        self._project_id = new_value.to_string();
24944        self
24945    }
24946    /// Required. The Dataproc region in which to handle the request.
24947    ///
24948    /// Sets the *region* path property to the given value.
24949    ///
24950    /// Even though the property as already been set when instantiating this call,
24951    /// we provide this method for API completeness.
24952    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterStartCall<'a, C> {
24953        self._region = new_value.to_string();
24954        self
24955    }
24956    /// Required. The cluster name.
24957    ///
24958    /// Sets the *cluster name* path property to the given value.
24959    ///
24960    /// Even though the property as already been set when instantiating this call,
24961    /// we provide this method for API completeness.
24962    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterStartCall<'a, C> {
24963        self._cluster_name = new_value.to_string();
24964        self
24965    }
24966    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24967    /// while executing the actual API request.
24968    ///
24969    /// ````text
24970    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24971    /// ````
24972    ///
24973    /// Sets the *delegate* property to the given value.
24974    pub fn delegate(
24975        mut self,
24976        new_value: &'a mut dyn common::Delegate,
24977    ) -> ProjectRegionClusterStartCall<'a, C> {
24978        self._delegate = Some(new_value);
24979        self
24980    }
24981
24982    /// Set any additional parameter of the query string used in the request.
24983    /// It should be used to set parameters which are not yet available through their own
24984    /// setters.
24985    ///
24986    /// Please note that this method must not be used to set any of the known parameters
24987    /// which have their own setter method. If done anyway, the request will fail.
24988    ///
24989    /// # Additional Parameters
24990    ///
24991    /// * *$.xgafv* (query-string) - V1 error format.
24992    /// * *access_token* (query-string) - OAuth access token.
24993    /// * *alt* (query-string) - Data format for response.
24994    /// * *callback* (query-string) - JSONP
24995    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24996    /// * *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.
24997    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24998    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24999    /// * *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.
25000    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25001    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25002    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterStartCall<'a, C>
25003    where
25004        T: AsRef<str>,
25005    {
25006        self._additional_params
25007            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25008        self
25009    }
25010
25011    /// Identifies the authorization scope for the method you are building.
25012    ///
25013    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25014    /// [`Scope::CloudPlatform`].
25015    ///
25016    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25017    /// tokens for more than one scope.
25018    ///
25019    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25020    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25021    /// sufficient, a read-write scope will do as well.
25022    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterStartCall<'a, C>
25023    where
25024        St: AsRef<str>,
25025    {
25026        self._scopes.insert(String::from(scope.as_ref()));
25027        self
25028    }
25029    /// Identifies the authorization scope(s) for the method you are building.
25030    ///
25031    /// See [`Self::add_scope()`] for details.
25032    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterStartCall<'a, C>
25033    where
25034        I: IntoIterator<Item = St>,
25035        St: AsRef<str>,
25036    {
25037        self._scopes
25038            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25039        self
25040    }
25041
25042    /// Removes all scopes, and no default scope will be used either.
25043    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25044    /// for details).
25045    pub fn clear_scopes(mut self) -> ProjectRegionClusterStartCall<'a, C> {
25046        self._scopes.clear();
25047        self
25048    }
25049}
25050
25051/// Stops a cluster in a project.
25052///
25053/// A builder for the *regions.clusters.stop* method supported by a *project* resource.
25054/// It is not used directly, but through a [`ProjectMethods`] instance.
25055///
25056/// # Example
25057///
25058/// Instantiate a resource method builder
25059///
25060/// ```test_harness,no_run
25061/// # extern crate hyper;
25062/// # extern crate hyper_rustls;
25063/// # extern crate google_dataproc1 as dataproc1;
25064/// use dataproc1::api::StopClusterRequest;
25065/// # async fn dox() {
25066/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25067///
25068/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25069/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25070/// #     secret,
25071/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25072/// # ).build().await.unwrap();
25073///
25074/// # let client = hyper_util::client::legacy::Client::builder(
25075/// #     hyper_util::rt::TokioExecutor::new()
25076/// # )
25077/// # .build(
25078/// #     hyper_rustls::HttpsConnectorBuilder::new()
25079/// #         .with_native_roots()
25080/// #         .unwrap()
25081/// #         .https_or_http()
25082/// #         .enable_http1()
25083/// #         .build()
25084/// # );
25085/// # let mut hub = Dataproc::new(client, auth);
25086/// // As the method needs a request, you would usually fill it with the desired information
25087/// // into the respective structure. Some of the parts shown here might not be applicable !
25088/// // Values shown here are possibly random and not representative !
25089/// let mut req = StopClusterRequest::default();
25090///
25091/// // You can configure optional parameters by calling the respective setters at will, and
25092/// // execute the final call using `doit()`.
25093/// // Values shown here are possibly random and not representative !
25094/// let result = hub.projects().regions_clusters_stop(req, "projectId", "region", "clusterName")
25095///              .doit().await;
25096/// # }
25097/// ```
25098pub struct ProjectRegionClusterStopCall<'a, C>
25099where
25100    C: 'a,
25101{
25102    hub: &'a Dataproc<C>,
25103    _request: StopClusterRequest,
25104    _project_id: String,
25105    _region: String,
25106    _cluster_name: String,
25107    _delegate: Option<&'a mut dyn common::Delegate>,
25108    _additional_params: HashMap<String, String>,
25109    _scopes: BTreeSet<String>,
25110}
25111
25112impl<'a, C> common::CallBuilder for ProjectRegionClusterStopCall<'a, C> {}
25113
25114impl<'a, C> ProjectRegionClusterStopCall<'a, C>
25115where
25116    C: common::Connector,
25117{
25118    /// Perform the operation you have build so far.
25119    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25120        use std::borrow::Cow;
25121        use std::io::{Read, Seek};
25122
25123        use common::{url::Params, ToParts};
25124        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25125
25126        let mut dd = common::DefaultDelegate;
25127        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25128        dlg.begin(common::MethodInfo {
25129            id: "dataproc.projects.regions.clusters.stop",
25130            http_method: hyper::Method::POST,
25131        });
25132
25133        for &field in ["alt", "projectId", "region", "clusterName"].iter() {
25134            if self._additional_params.contains_key(field) {
25135                dlg.finished(false);
25136                return Err(common::Error::FieldClash(field));
25137            }
25138        }
25139
25140        let mut params = Params::with_capacity(6 + self._additional_params.len());
25141        params.push("projectId", self._project_id);
25142        params.push("region", self._region);
25143        params.push("clusterName", self._cluster_name);
25144
25145        params.extend(self._additional_params.iter());
25146
25147        params.push("alt", "json");
25148        let mut url = self.hub._base_url.clone()
25149            + "v1/projects/{projectId}/regions/{region}/clusters/{clusterName}:stop";
25150        if self._scopes.is_empty() {
25151            self._scopes
25152                .insert(Scope::CloudPlatform.as_ref().to_string());
25153        }
25154
25155        #[allow(clippy::single_element_loop)]
25156        for &(find_this, param_name) in [
25157            ("{projectId}", "projectId"),
25158            ("{region}", "region"),
25159            ("{clusterName}", "clusterName"),
25160        ]
25161        .iter()
25162        {
25163            url = params.uri_replacement(url, param_name, find_this, false);
25164        }
25165        {
25166            let to_remove = ["clusterName", "region", "projectId"];
25167            params.remove_params(&to_remove);
25168        }
25169
25170        let url = params.parse_with_url(&url);
25171
25172        let mut json_mime_type = mime::APPLICATION_JSON;
25173        let mut request_value_reader = {
25174            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25175            common::remove_json_null_values(&mut value);
25176            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25177            serde_json::to_writer(&mut dst, &value).unwrap();
25178            dst
25179        };
25180        let request_size = request_value_reader
25181            .seek(std::io::SeekFrom::End(0))
25182            .unwrap();
25183        request_value_reader
25184            .seek(std::io::SeekFrom::Start(0))
25185            .unwrap();
25186
25187        loop {
25188            let token = match self
25189                .hub
25190                .auth
25191                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25192                .await
25193            {
25194                Ok(token) => token,
25195                Err(e) => match dlg.token(e) {
25196                    Ok(token) => token,
25197                    Err(e) => {
25198                        dlg.finished(false);
25199                        return Err(common::Error::MissingToken(e));
25200                    }
25201                },
25202            };
25203            request_value_reader
25204                .seek(std::io::SeekFrom::Start(0))
25205                .unwrap();
25206            let mut req_result = {
25207                let client = &self.hub.client;
25208                dlg.pre_request();
25209                let mut req_builder = hyper::Request::builder()
25210                    .method(hyper::Method::POST)
25211                    .uri(url.as_str())
25212                    .header(USER_AGENT, self.hub._user_agent.clone());
25213
25214                if let Some(token) = token.as_ref() {
25215                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25216                }
25217
25218                let request = req_builder
25219                    .header(CONTENT_TYPE, json_mime_type.to_string())
25220                    .header(CONTENT_LENGTH, request_size as u64)
25221                    .body(common::to_body(
25222                        request_value_reader.get_ref().clone().into(),
25223                    ));
25224
25225                client.request(request.unwrap()).await
25226            };
25227
25228            match req_result {
25229                Err(err) => {
25230                    if let common::Retry::After(d) = dlg.http_error(&err) {
25231                        sleep(d).await;
25232                        continue;
25233                    }
25234                    dlg.finished(false);
25235                    return Err(common::Error::HttpError(err));
25236                }
25237                Ok(res) => {
25238                    let (mut parts, body) = res.into_parts();
25239                    let mut body = common::Body::new(body);
25240                    if !parts.status.is_success() {
25241                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25242                        let error = serde_json::from_str(&common::to_string(&bytes));
25243                        let response = common::to_response(parts, bytes.into());
25244
25245                        if let common::Retry::After(d) =
25246                            dlg.http_failure(&response, error.as_ref().ok())
25247                        {
25248                            sleep(d).await;
25249                            continue;
25250                        }
25251
25252                        dlg.finished(false);
25253
25254                        return Err(match error {
25255                            Ok(value) => common::Error::BadRequest(value),
25256                            _ => common::Error::Failure(response),
25257                        });
25258                    }
25259                    let response = {
25260                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25261                        let encoded = common::to_string(&bytes);
25262                        match serde_json::from_str(&encoded) {
25263                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25264                            Err(error) => {
25265                                dlg.response_json_decode_error(&encoded, &error);
25266                                return Err(common::Error::JsonDecodeError(
25267                                    encoded.to_string(),
25268                                    error,
25269                                ));
25270                            }
25271                        }
25272                    };
25273
25274                    dlg.finished(true);
25275                    return Ok(response);
25276                }
25277            }
25278        }
25279    }
25280
25281    ///
25282    /// Sets the *request* property to the given value.
25283    ///
25284    /// Even though the property as already been set when instantiating this call,
25285    /// we provide this method for API completeness.
25286    pub fn request(mut self, new_value: StopClusterRequest) -> ProjectRegionClusterStopCall<'a, C> {
25287        self._request = new_value;
25288        self
25289    }
25290    /// Required. The ID of the Google Cloud Platform project the cluster belongs to.
25291    ///
25292    /// Sets the *project id* path property to the given value.
25293    ///
25294    /// Even though the property as already been set when instantiating this call,
25295    /// we provide this method for API completeness.
25296    pub fn project_id(mut self, new_value: &str) -> ProjectRegionClusterStopCall<'a, C> {
25297        self._project_id = new_value.to_string();
25298        self
25299    }
25300    /// Required. The Dataproc region in which to handle the request.
25301    ///
25302    /// Sets the *region* path property to the given value.
25303    ///
25304    /// Even though the property as already been set when instantiating this call,
25305    /// we provide this method for API completeness.
25306    pub fn region(mut self, new_value: &str) -> ProjectRegionClusterStopCall<'a, C> {
25307        self._region = new_value.to_string();
25308        self
25309    }
25310    /// Required. The cluster name.
25311    ///
25312    /// Sets the *cluster name* path property to the given value.
25313    ///
25314    /// Even though the property as already been set when instantiating this call,
25315    /// we provide this method for API completeness.
25316    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionClusterStopCall<'a, C> {
25317        self._cluster_name = new_value.to_string();
25318        self
25319    }
25320    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25321    /// while executing the actual API request.
25322    ///
25323    /// ````text
25324    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25325    /// ````
25326    ///
25327    /// Sets the *delegate* property to the given value.
25328    pub fn delegate(
25329        mut self,
25330        new_value: &'a mut dyn common::Delegate,
25331    ) -> ProjectRegionClusterStopCall<'a, C> {
25332        self._delegate = Some(new_value);
25333        self
25334    }
25335
25336    /// Set any additional parameter of the query string used in the request.
25337    /// It should be used to set parameters which are not yet available through their own
25338    /// setters.
25339    ///
25340    /// Please note that this method must not be used to set any of the known parameters
25341    /// which have their own setter method. If done anyway, the request will fail.
25342    ///
25343    /// # Additional Parameters
25344    ///
25345    /// * *$.xgafv* (query-string) - V1 error format.
25346    /// * *access_token* (query-string) - OAuth access token.
25347    /// * *alt* (query-string) - Data format for response.
25348    /// * *callback* (query-string) - JSONP
25349    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25350    /// * *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.
25351    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25352    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25353    /// * *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.
25354    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25355    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25356    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterStopCall<'a, C>
25357    where
25358        T: AsRef<str>,
25359    {
25360        self._additional_params
25361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25362        self
25363    }
25364
25365    /// Identifies the authorization scope for the method you are building.
25366    ///
25367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25368    /// [`Scope::CloudPlatform`].
25369    ///
25370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25371    /// tokens for more than one scope.
25372    ///
25373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25375    /// sufficient, a read-write scope will do as well.
25376    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterStopCall<'a, C>
25377    where
25378        St: AsRef<str>,
25379    {
25380        self._scopes.insert(String::from(scope.as_ref()));
25381        self
25382    }
25383    /// Identifies the authorization scope(s) for the method you are building.
25384    ///
25385    /// See [`Self::add_scope()`] for details.
25386    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionClusterStopCall<'a, C>
25387    where
25388        I: IntoIterator<Item = St>,
25389        St: AsRef<str>,
25390    {
25391        self._scopes
25392            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25393        self
25394    }
25395
25396    /// Removes all scopes, and no default scope will be used either.
25397    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25398    /// for details).
25399    pub fn clear_scopes(mut self) -> ProjectRegionClusterStopCall<'a, C> {
25400        self._scopes.clear();
25401        self
25402    }
25403}
25404
25405/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
25406///
25407/// A builder for the *regions.clusters.testIamPermissions* method supported by a *project* resource.
25408/// It is not used directly, but through a [`ProjectMethods`] instance.
25409///
25410/// # Example
25411///
25412/// Instantiate a resource method builder
25413///
25414/// ```test_harness,no_run
25415/// # extern crate hyper;
25416/// # extern crate hyper_rustls;
25417/// # extern crate google_dataproc1 as dataproc1;
25418/// use dataproc1::api::TestIamPermissionsRequest;
25419/// # async fn dox() {
25420/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25421///
25422/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25423/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25424/// #     secret,
25425/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25426/// # ).build().await.unwrap();
25427///
25428/// # let client = hyper_util::client::legacy::Client::builder(
25429/// #     hyper_util::rt::TokioExecutor::new()
25430/// # )
25431/// # .build(
25432/// #     hyper_rustls::HttpsConnectorBuilder::new()
25433/// #         .with_native_roots()
25434/// #         .unwrap()
25435/// #         .https_or_http()
25436/// #         .enable_http1()
25437/// #         .build()
25438/// # );
25439/// # let mut hub = Dataproc::new(client, auth);
25440/// // As the method needs a request, you would usually fill it with the desired information
25441/// // into the respective structure. Some of the parts shown here might not be applicable !
25442/// // Values shown here are possibly random and not representative !
25443/// let mut req = TestIamPermissionsRequest::default();
25444///
25445/// // You can configure optional parameters by calling the respective setters at will, and
25446/// // execute the final call using `doit()`.
25447/// // Values shown here are possibly random and not representative !
25448/// let result = hub.projects().regions_clusters_test_iam_permissions(req, "resource")
25449///              .doit().await;
25450/// # }
25451/// ```
25452pub struct ProjectRegionClusterTestIamPermissionCall<'a, C>
25453where
25454    C: 'a,
25455{
25456    hub: &'a Dataproc<C>,
25457    _request: TestIamPermissionsRequest,
25458    _resource: String,
25459    _delegate: Option<&'a mut dyn common::Delegate>,
25460    _additional_params: HashMap<String, String>,
25461    _scopes: BTreeSet<String>,
25462}
25463
25464impl<'a, C> common::CallBuilder for ProjectRegionClusterTestIamPermissionCall<'a, C> {}
25465
25466impl<'a, C> ProjectRegionClusterTestIamPermissionCall<'a, C>
25467where
25468    C: common::Connector,
25469{
25470    /// Perform the operation you have build so far.
25471    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
25472        use std::borrow::Cow;
25473        use std::io::{Read, Seek};
25474
25475        use common::{url::Params, ToParts};
25476        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25477
25478        let mut dd = common::DefaultDelegate;
25479        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25480        dlg.begin(common::MethodInfo {
25481            id: "dataproc.projects.regions.clusters.testIamPermissions",
25482            http_method: hyper::Method::POST,
25483        });
25484
25485        for &field in ["alt", "resource"].iter() {
25486            if self._additional_params.contains_key(field) {
25487                dlg.finished(false);
25488                return Err(common::Error::FieldClash(field));
25489            }
25490        }
25491
25492        let mut params = Params::with_capacity(4 + self._additional_params.len());
25493        params.push("resource", self._resource);
25494
25495        params.extend(self._additional_params.iter());
25496
25497        params.push("alt", "json");
25498        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
25499        if self._scopes.is_empty() {
25500            self._scopes
25501                .insert(Scope::CloudPlatform.as_ref().to_string());
25502        }
25503
25504        #[allow(clippy::single_element_loop)]
25505        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25506            url = params.uri_replacement(url, param_name, find_this, true);
25507        }
25508        {
25509            let to_remove = ["resource"];
25510            params.remove_params(&to_remove);
25511        }
25512
25513        let url = params.parse_with_url(&url);
25514
25515        let mut json_mime_type = mime::APPLICATION_JSON;
25516        let mut request_value_reader = {
25517            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25518            common::remove_json_null_values(&mut value);
25519            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25520            serde_json::to_writer(&mut dst, &value).unwrap();
25521            dst
25522        };
25523        let request_size = request_value_reader
25524            .seek(std::io::SeekFrom::End(0))
25525            .unwrap();
25526        request_value_reader
25527            .seek(std::io::SeekFrom::Start(0))
25528            .unwrap();
25529
25530        loop {
25531            let token = match self
25532                .hub
25533                .auth
25534                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25535                .await
25536            {
25537                Ok(token) => token,
25538                Err(e) => match dlg.token(e) {
25539                    Ok(token) => token,
25540                    Err(e) => {
25541                        dlg.finished(false);
25542                        return Err(common::Error::MissingToken(e));
25543                    }
25544                },
25545            };
25546            request_value_reader
25547                .seek(std::io::SeekFrom::Start(0))
25548                .unwrap();
25549            let mut req_result = {
25550                let client = &self.hub.client;
25551                dlg.pre_request();
25552                let mut req_builder = hyper::Request::builder()
25553                    .method(hyper::Method::POST)
25554                    .uri(url.as_str())
25555                    .header(USER_AGENT, self.hub._user_agent.clone());
25556
25557                if let Some(token) = token.as_ref() {
25558                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25559                }
25560
25561                let request = req_builder
25562                    .header(CONTENT_TYPE, json_mime_type.to_string())
25563                    .header(CONTENT_LENGTH, request_size as u64)
25564                    .body(common::to_body(
25565                        request_value_reader.get_ref().clone().into(),
25566                    ));
25567
25568                client.request(request.unwrap()).await
25569            };
25570
25571            match req_result {
25572                Err(err) => {
25573                    if let common::Retry::After(d) = dlg.http_error(&err) {
25574                        sleep(d).await;
25575                        continue;
25576                    }
25577                    dlg.finished(false);
25578                    return Err(common::Error::HttpError(err));
25579                }
25580                Ok(res) => {
25581                    let (mut parts, body) = res.into_parts();
25582                    let mut body = common::Body::new(body);
25583                    if !parts.status.is_success() {
25584                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25585                        let error = serde_json::from_str(&common::to_string(&bytes));
25586                        let response = common::to_response(parts, bytes.into());
25587
25588                        if let common::Retry::After(d) =
25589                            dlg.http_failure(&response, error.as_ref().ok())
25590                        {
25591                            sleep(d).await;
25592                            continue;
25593                        }
25594
25595                        dlg.finished(false);
25596
25597                        return Err(match error {
25598                            Ok(value) => common::Error::BadRequest(value),
25599                            _ => common::Error::Failure(response),
25600                        });
25601                    }
25602                    let response = {
25603                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25604                        let encoded = common::to_string(&bytes);
25605                        match serde_json::from_str(&encoded) {
25606                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25607                            Err(error) => {
25608                                dlg.response_json_decode_error(&encoded, &error);
25609                                return Err(common::Error::JsonDecodeError(
25610                                    encoded.to_string(),
25611                                    error,
25612                                ));
25613                            }
25614                        }
25615                    };
25616
25617                    dlg.finished(true);
25618                    return Ok(response);
25619                }
25620            }
25621        }
25622    }
25623
25624    ///
25625    /// Sets the *request* property to the given value.
25626    ///
25627    /// Even though the property as already been set when instantiating this call,
25628    /// we provide this method for API completeness.
25629    pub fn request(
25630        mut self,
25631        new_value: TestIamPermissionsRequest,
25632    ) -> ProjectRegionClusterTestIamPermissionCall<'a, C> {
25633        self._request = new_value;
25634        self
25635    }
25636    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
25637    ///
25638    /// Sets the *resource* path property to the given value.
25639    ///
25640    /// Even though the property as already been set when instantiating this call,
25641    /// we provide this method for API completeness.
25642    pub fn resource(mut self, new_value: &str) -> ProjectRegionClusterTestIamPermissionCall<'a, C> {
25643        self._resource = new_value.to_string();
25644        self
25645    }
25646    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25647    /// while executing the actual API request.
25648    ///
25649    /// ````text
25650    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25651    /// ````
25652    ///
25653    /// Sets the *delegate* property to the given value.
25654    pub fn delegate(
25655        mut self,
25656        new_value: &'a mut dyn common::Delegate,
25657    ) -> ProjectRegionClusterTestIamPermissionCall<'a, C> {
25658        self._delegate = Some(new_value);
25659        self
25660    }
25661
25662    /// Set any additional parameter of the query string used in the request.
25663    /// It should be used to set parameters which are not yet available through their own
25664    /// setters.
25665    ///
25666    /// Please note that this method must not be used to set any of the known parameters
25667    /// which have their own setter method. If done anyway, the request will fail.
25668    ///
25669    /// # Additional Parameters
25670    ///
25671    /// * *$.xgafv* (query-string) - V1 error format.
25672    /// * *access_token* (query-string) - OAuth access token.
25673    /// * *alt* (query-string) - Data format for response.
25674    /// * *callback* (query-string) - JSONP
25675    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25676    /// * *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.
25677    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25678    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25679    /// * *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.
25680    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25681    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25682    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionClusterTestIamPermissionCall<'a, C>
25683    where
25684        T: AsRef<str>,
25685    {
25686        self._additional_params
25687            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25688        self
25689    }
25690
25691    /// Identifies the authorization scope for the method you are building.
25692    ///
25693    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25694    /// [`Scope::CloudPlatform`].
25695    ///
25696    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25697    /// tokens for more than one scope.
25698    ///
25699    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25700    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25701    /// sufficient, a read-write scope will do as well.
25702    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionClusterTestIamPermissionCall<'a, C>
25703    where
25704        St: AsRef<str>,
25705    {
25706        self._scopes.insert(String::from(scope.as_ref()));
25707        self
25708    }
25709    /// Identifies the authorization scope(s) for the method you are building.
25710    ///
25711    /// See [`Self::add_scope()`] for details.
25712    pub fn add_scopes<I, St>(
25713        mut self,
25714        scopes: I,
25715    ) -> ProjectRegionClusterTestIamPermissionCall<'a, C>
25716    where
25717        I: IntoIterator<Item = St>,
25718        St: AsRef<str>,
25719    {
25720        self._scopes
25721            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25722        self
25723    }
25724
25725    /// Removes all scopes, and no default scope will be used either.
25726    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25727    /// for details).
25728    pub fn clear_scopes(mut self) -> ProjectRegionClusterTestIamPermissionCall<'a, C> {
25729        self._scopes.clear();
25730        self
25731    }
25732}
25733
25734/// Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or regions/{region}/jobs.get (https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).
25735///
25736/// A builder for the *regions.jobs.cancel* method supported by a *project* resource.
25737/// It is not used directly, but through a [`ProjectMethods`] instance.
25738///
25739/// # Example
25740///
25741/// Instantiate a resource method builder
25742///
25743/// ```test_harness,no_run
25744/// # extern crate hyper;
25745/// # extern crate hyper_rustls;
25746/// # extern crate google_dataproc1 as dataproc1;
25747/// use dataproc1::api::CancelJobRequest;
25748/// # async fn dox() {
25749/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25750///
25751/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25752/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25753/// #     secret,
25754/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25755/// # ).build().await.unwrap();
25756///
25757/// # let client = hyper_util::client::legacy::Client::builder(
25758/// #     hyper_util::rt::TokioExecutor::new()
25759/// # )
25760/// # .build(
25761/// #     hyper_rustls::HttpsConnectorBuilder::new()
25762/// #         .with_native_roots()
25763/// #         .unwrap()
25764/// #         .https_or_http()
25765/// #         .enable_http1()
25766/// #         .build()
25767/// # );
25768/// # let mut hub = Dataproc::new(client, auth);
25769/// // As the method needs a request, you would usually fill it with the desired information
25770/// // into the respective structure. Some of the parts shown here might not be applicable !
25771/// // Values shown here are possibly random and not representative !
25772/// let mut req = CancelJobRequest::default();
25773///
25774/// // You can configure optional parameters by calling the respective setters at will, and
25775/// // execute the final call using `doit()`.
25776/// // Values shown here are possibly random and not representative !
25777/// let result = hub.projects().regions_jobs_cancel(req, "projectId", "region", "jobId")
25778///              .doit().await;
25779/// # }
25780/// ```
25781pub struct ProjectRegionJobCancelCall<'a, C>
25782where
25783    C: 'a,
25784{
25785    hub: &'a Dataproc<C>,
25786    _request: CancelJobRequest,
25787    _project_id: String,
25788    _region: String,
25789    _job_id: String,
25790    _delegate: Option<&'a mut dyn common::Delegate>,
25791    _additional_params: HashMap<String, String>,
25792    _scopes: BTreeSet<String>,
25793}
25794
25795impl<'a, C> common::CallBuilder for ProjectRegionJobCancelCall<'a, C> {}
25796
25797impl<'a, C> ProjectRegionJobCancelCall<'a, C>
25798where
25799    C: common::Connector,
25800{
25801    /// Perform the operation you have build so far.
25802    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
25803        use std::borrow::Cow;
25804        use std::io::{Read, Seek};
25805
25806        use common::{url::Params, ToParts};
25807        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25808
25809        let mut dd = common::DefaultDelegate;
25810        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25811        dlg.begin(common::MethodInfo {
25812            id: "dataproc.projects.regions.jobs.cancel",
25813            http_method: hyper::Method::POST,
25814        });
25815
25816        for &field in ["alt", "projectId", "region", "jobId"].iter() {
25817            if self._additional_params.contains_key(field) {
25818                dlg.finished(false);
25819                return Err(common::Error::FieldClash(field));
25820            }
25821        }
25822
25823        let mut params = Params::with_capacity(6 + self._additional_params.len());
25824        params.push("projectId", self._project_id);
25825        params.push("region", self._region);
25826        params.push("jobId", self._job_id);
25827
25828        params.extend(self._additional_params.iter());
25829
25830        params.push("alt", "json");
25831        let mut url = self.hub._base_url.clone()
25832            + "v1/projects/{projectId}/regions/{region}/jobs/{jobId}:cancel";
25833        if self._scopes.is_empty() {
25834            self._scopes
25835                .insert(Scope::CloudPlatform.as_ref().to_string());
25836        }
25837
25838        #[allow(clippy::single_element_loop)]
25839        for &(find_this, param_name) in [
25840            ("{projectId}", "projectId"),
25841            ("{region}", "region"),
25842            ("{jobId}", "jobId"),
25843        ]
25844        .iter()
25845        {
25846            url = params.uri_replacement(url, param_name, find_this, false);
25847        }
25848        {
25849            let to_remove = ["jobId", "region", "projectId"];
25850            params.remove_params(&to_remove);
25851        }
25852
25853        let url = params.parse_with_url(&url);
25854
25855        let mut json_mime_type = mime::APPLICATION_JSON;
25856        let mut request_value_reader = {
25857            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25858            common::remove_json_null_values(&mut value);
25859            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25860            serde_json::to_writer(&mut dst, &value).unwrap();
25861            dst
25862        };
25863        let request_size = request_value_reader
25864            .seek(std::io::SeekFrom::End(0))
25865            .unwrap();
25866        request_value_reader
25867            .seek(std::io::SeekFrom::Start(0))
25868            .unwrap();
25869
25870        loop {
25871            let token = match self
25872                .hub
25873                .auth
25874                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25875                .await
25876            {
25877                Ok(token) => token,
25878                Err(e) => match dlg.token(e) {
25879                    Ok(token) => token,
25880                    Err(e) => {
25881                        dlg.finished(false);
25882                        return Err(common::Error::MissingToken(e));
25883                    }
25884                },
25885            };
25886            request_value_reader
25887                .seek(std::io::SeekFrom::Start(0))
25888                .unwrap();
25889            let mut req_result = {
25890                let client = &self.hub.client;
25891                dlg.pre_request();
25892                let mut req_builder = hyper::Request::builder()
25893                    .method(hyper::Method::POST)
25894                    .uri(url.as_str())
25895                    .header(USER_AGENT, self.hub._user_agent.clone());
25896
25897                if let Some(token) = token.as_ref() {
25898                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25899                }
25900
25901                let request = req_builder
25902                    .header(CONTENT_TYPE, json_mime_type.to_string())
25903                    .header(CONTENT_LENGTH, request_size as u64)
25904                    .body(common::to_body(
25905                        request_value_reader.get_ref().clone().into(),
25906                    ));
25907
25908                client.request(request.unwrap()).await
25909            };
25910
25911            match req_result {
25912                Err(err) => {
25913                    if let common::Retry::After(d) = dlg.http_error(&err) {
25914                        sleep(d).await;
25915                        continue;
25916                    }
25917                    dlg.finished(false);
25918                    return Err(common::Error::HttpError(err));
25919                }
25920                Ok(res) => {
25921                    let (mut parts, body) = res.into_parts();
25922                    let mut body = common::Body::new(body);
25923                    if !parts.status.is_success() {
25924                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25925                        let error = serde_json::from_str(&common::to_string(&bytes));
25926                        let response = common::to_response(parts, bytes.into());
25927
25928                        if let common::Retry::After(d) =
25929                            dlg.http_failure(&response, error.as_ref().ok())
25930                        {
25931                            sleep(d).await;
25932                            continue;
25933                        }
25934
25935                        dlg.finished(false);
25936
25937                        return Err(match error {
25938                            Ok(value) => common::Error::BadRequest(value),
25939                            _ => common::Error::Failure(response),
25940                        });
25941                    }
25942                    let response = {
25943                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25944                        let encoded = common::to_string(&bytes);
25945                        match serde_json::from_str(&encoded) {
25946                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25947                            Err(error) => {
25948                                dlg.response_json_decode_error(&encoded, &error);
25949                                return Err(common::Error::JsonDecodeError(
25950                                    encoded.to_string(),
25951                                    error,
25952                                ));
25953                            }
25954                        }
25955                    };
25956
25957                    dlg.finished(true);
25958                    return Ok(response);
25959                }
25960            }
25961        }
25962    }
25963
25964    ///
25965    /// Sets the *request* property to the given value.
25966    ///
25967    /// Even though the property as already been set when instantiating this call,
25968    /// we provide this method for API completeness.
25969    pub fn request(mut self, new_value: CancelJobRequest) -> ProjectRegionJobCancelCall<'a, C> {
25970        self._request = new_value;
25971        self
25972    }
25973    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
25974    ///
25975    /// Sets the *project id* path property to the given value.
25976    ///
25977    /// Even though the property as already been set when instantiating this call,
25978    /// we provide this method for API completeness.
25979    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobCancelCall<'a, C> {
25980        self._project_id = new_value.to_string();
25981        self
25982    }
25983    /// Required. The Dataproc region in which to handle the request.
25984    ///
25985    /// Sets the *region* path property to the given value.
25986    ///
25987    /// Even though the property as already been set when instantiating this call,
25988    /// we provide this method for API completeness.
25989    pub fn region(mut self, new_value: &str) -> ProjectRegionJobCancelCall<'a, C> {
25990        self._region = new_value.to_string();
25991        self
25992    }
25993    /// Required. The job ID.
25994    ///
25995    /// Sets the *job id* path property to the given value.
25996    ///
25997    /// Even though the property as already been set when instantiating this call,
25998    /// we provide this method for API completeness.
25999    pub fn job_id(mut self, new_value: &str) -> ProjectRegionJobCancelCall<'a, C> {
26000        self._job_id = new_value.to_string();
26001        self
26002    }
26003    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26004    /// while executing the actual API request.
26005    ///
26006    /// ````text
26007    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26008    /// ````
26009    ///
26010    /// Sets the *delegate* property to the given value.
26011    pub fn delegate(
26012        mut self,
26013        new_value: &'a mut dyn common::Delegate,
26014    ) -> ProjectRegionJobCancelCall<'a, C> {
26015        self._delegate = Some(new_value);
26016        self
26017    }
26018
26019    /// Set any additional parameter of the query string used in the request.
26020    /// It should be used to set parameters which are not yet available through their own
26021    /// setters.
26022    ///
26023    /// Please note that this method must not be used to set any of the known parameters
26024    /// which have their own setter method. If done anyway, the request will fail.
26025    ///
26026    /// # Additional Parameters
26027    ///
26028    /// * *$.xgafv* (query-string) - V1 error format.
26029    /// * *access_token* (query-string) - OAuth access token.
26030    /// * *alt* (query-string) - Data format for response.
26031    /// * *callback* (query-string) - JSONP
26032    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26033    /// * *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.
26034    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26035    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26036    /// * *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.
26037    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26038    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26039    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobCancelCall<'a, C>
26040    where
26041        T: AsRef<str>,
26042    {
26043        self._additional_params
26044            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26045        self
26046    }
26047
26048    /// Identifies the authorization scope for the method you are building.
26049    ///
26050    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26051    /// [`Scope::CloudPlatform`].
26052    ///
26053    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26054    /// tokens for more than one scope.
26055    ///
26056    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26057    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26058    /// sufficient, a read-write scope will do as well.
26059    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobCancelCall<'a, C>
26060    where
26061        St: AsRef<str>,
26062    {
26063        self._scopes.insert(String::from(scope.as_ref()));
26064        self
26065    }
26066    /// Identifies the authorization scope(s) for the method you are building.
26067    ///
26068    /// See [`Self::add_scope()`] for details.
26069    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobCancelCall<'a, C>
26070    where
26071        I: IntoIterator<Item = St>,
26072        St: AsRef<str>,
26073    {
26074        self._scopes
26075            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26076        self
26077    }
26078
26079    /// Removes all scopes, and no default scope will be used either.
26080    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26081    /// for details).
26082    pub fn clear_scopes(mut self) -> ProjectRegionJobCancelCall<'a, C> {
26083        self._scopes.clear();
26084        self
26085    }
26086}
26087
26088/// Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.
26089///
26090/// A builder for the *regions.jobs.delete* method supported by a *project* resource.
26091/// It is not used directly, but through a [`ProjectMethods`] instance.
26092///
26093/// # Example
26094///
26095/// Instantiate a resource method builder
26096///
26097/// ```test_harness,no_run
26098/// # extern crate hyper;
26099/// # extern crate hyper_rustls;
26100/// # extern crate google_dataproc1 as dataproc1;
26101/// # async fn dox() {
26102/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26103///
26104/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26105/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26106/// #     secret,
26107/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26108/// # ).build().await.unwrap();
26109///
26110/// # let client = hyper_util::client::legacy::Client::builder(
26111/// #     hyper_util::rt::TokioExecutor::new()
26112/// # )
26113/// # .build(
26114/// #     hyper_rustls::HttpsConnectorBuilder::new()
26115/// #         .with_native_roots()
26116/// #         .unwrap()
26117/// #         .https_or_http()
26118/// #         .enable_http1()
26119/// #         .build()
26120/// # );
26121/// # let mut hub = Dataproc::new(client, auth);
26122/// // You can configure optional parameters by calling the respective setters at will, and
26123/// // execute the final call using `doit()`.
26124/// // Values shown here are possibly random and not representative !
26125/// let result = hub.projects().regions_jobs_delete("projectId", "region", "jobId")
26126///              .doit().await;
26127/// # }
26128/// ```
26129pub struct ProjectRegionJobDeleteCall<'a, C>
26130where
26131    C: 'a,
26132{
26133    hub: &'a Dataproc<C>,
26134    _project_id: String,
26135    _region: String,
26136    _job_id: String,
26137    _delegate: Option<&'a mut dyn common::Delegate>,
26138    _additional_params: HashMap<String, String>,
26139    _scopes: BTreeSet<String>,
26140}
26141
26142impl<'a, C> common::CallBuilder for ProjectRegionJobDeleteCall<'a, C> {}
26143
26144impl<'a, C> ProjectRegionJobDeleteCall<'a, C>
26145where
26146    C: common::Connector,
26147{
26148    /// Perform the operation you have build so far.
26149    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
26150        use std::borrow::Cow;
26151        use std::io::{Read, Seek};
26152
26153        use common::{url::Params, ToParts};
26154        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26155
26156        let mut dd = common::DefaultDelegate;
26157        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26158        dlg.begin(common::MethodInfo {
26159            id: "dataproc.projects.regions.jobs.delete",
26160            http_method: hyper::Method::DELETE,
26161        });
26162
26163        for &field in ["alt", "projectId", "region", "jobId"].iter() {
26164            if self._additional_params.contains_key(field) {
26165                dlg.finished(false);
26166                return Err(common::Error::FieldClash(field));
26167            }
26168        }
26169
26170        let mut params = Params::with_capacity(5 + self._additional_params.len());
26171        params.push("projectId", self._project_id);
26172        params.push("region", self._region);
26173        params.push("jobId", self._job_id);
26174
26175        params.extend(self._additional_params.iter());
26176
26177        params.push("alt", "json");
26178        let mut url =
26179            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/jobs/{jobId}";
26180        if self._scopes.is_empty() {
26181            self._scopes
26182                .insert(Scope::CloudPlatform.as_ref().to_string());
26183        }
26184
26185        #[allow(clippy::single_element_loop)]
26186        for &(find_this, param_name) in [
26187            ("{projectId}", "projectId"),
26188            ("{region}", "region"),
26189            ("{jobId}", "jobId"),
26190        ]
26191        .iter()
26192        {
26193            url = params.uri_replacement(url, param_name, find_this, false);
26194        }
26195        {
26196            let to_remove = ["jobId", "region", "projectId"];
26197            params.remove_params(&to_remove);
26198        }
26199
26200        let url = params.parse_with_url(&url);
26201
26202        loop {
26203            let token = match self
26204                .hub
26205                .auth
26206                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26207                .await
26208            {
26209                Ok(token) => token,
26210                Err(e) => match dlg.token(e) {
26211                    Ok(token) => token,
26212                    Err(e) => {
26213                        dlg.finished(false);
26214                        return Err(common::Error::MissingToken(e));
26215                    }
26216                },
26217            };
26218            let mut req_result = {
26219                let client = &self.hub.client;
26220                dlg.pre_request();
26221                let mut req_builder = hyper::Request::builder()
26222                    .method(hyper::Method::DELETE)
26223                    .uri(url.as_str())
26224                    .header(USER_AGENT, self.hub._user_agent.clone());
26225
26226                if let Some(token) = token.as_ref() {
26227                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26228                }
26229
26230                let request = req_builder
26231                    .header(CONTENT_LENGTH, 0_u64)
26232                    .body(common::to_body::<String>(None));
26233
26234                client.request(request.unwrap()).await
26235            };
26236
26237            match req_result {
26238                Err(err) => {
26239                    if let common::Retry::After(d) = dlg.http_error(&err) {
26240                        sleep(d).await;
26241                        continue;
26242                    }
26243                    dlg.finished(false);
26244                    return Err(common::Error::HttpError(err));
26245                }
26246                Ok(res) => {
26247                    let (mut parts, body) = res.into_parts();
26248                    let mut body = common::Body::new(body);
26249                    if !parts.status.is_success() {
26250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26251                        let error = serde_json::from_str(&common::to_string(&bytes));
26252                        let response = common::to_response(parts, bytes.into());
26253
26254                        if let common::Retry::After(d) =
26255                            dlg.http_failure(&response, error.as_ref().ok())
26256                        {
26257                            sleep(d).await;
26258                            continue;
26259                        }
26260
26261                        dlg.finished(false);
26262
26263                        return Err(match error {
26264                            Ok(value) => common::Error::BadRequest(value),
26265                            _ => common::Error::Failure(response),
26266                        });
26267                    }
26268                    let response = {
26269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26270                        let encoded = common::to_string(&bytes);
26271                        match serde_json::from_str(&encoded) {
26272                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26273                            Err(error) => {
26274                                dlg.response_json_decode_error(&encoded, &error);
26275                                return Err(common::Error::JsonDecodeError(
26276                                    encoded.to_string(),
26277                                    error,
26278                                ));
26279                            }
26280                        }
26281                    };
26282
26283                    dlg.finished(true);
26284                    return Ok(response);
26285                }
26286            }
26287        }
26288    }
26289
26290    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
26291    ///
26292    /// Sets the *project id* path property to the given value.
26293    ///
26294    /// Even though the property as already been set when instantiating this call,
26295    /// we provide this method for API completeness.
26296    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobDeleteCall<'a, C> {
26297        self._project_id = new_value.to_string();
26298        self
26299    }
26300    /// Required. The Dataproc region in which to handle the request.
26301    ///
26302    /// Sets the *region* path property to the given value.
26303    ///
26304    /// Even though the property as already been set when instantiating this call,
26305    /// we provide this method for API completeness.
26306    pub fn region(mut self, new_value: &str) -> ProjectRegionJobDeleteCall<'a, C> {
26307        self._region = new_value.to_string();
26308        self
26309    }
26310    /// Required. The job ID.
26311    ///
26312    /// Sets the *job id* path property to the given value.
26313    ///
26314    /// Even though the property as already been set when instantiating this call,
26315    /// we provide this method for API completeness.
26316    pub fn job_id(mut self, new_value: &str) -> ProjectRegionJobDeleteCall<'a, C> {
26317        self._job_id = new_value.to_string();
26318        self
26319    }
26320    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26321    /// while executing the actual API request.
26322    ///
26323    /// ````text
26324    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26325    /// ````
26326    ///
26327    /// Sets the *delegate* property to the given value.
26328    pub fn delegate(
26329        mut self,
26330        new_value: &'a mut dyn common::Delegate,
26331    ) -> ProjectRegionJobDeleteCall<'a, C> {
26332        self._delegate = Some(new_value);
26333        self
26334    }
26335
26336    /// Set any additional parameter of the query string used in the request.
26337    /// It should be used to set parameters which are not yet available through their own
26338    /// setters.
26339    ///
26340    /// Please note that this method must not be used to set any of the known parameters
26341    /// which have their own setter method. If done anyway, the request will fail.
26342    ///
26343    /// # Additional Parameters
26344    ///
26345    /// * *$.xgafv* (query-string) - V1 error format.
26346    /// * *access_token* (query-string) - OAuth access token.
26347    /// * *alt* (query-string) - Data format for response.
26348    /// * *callback* (query-string) - JSONP
26349    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26350    /// * *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.
26351    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26352    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26353    /// * *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.
26354    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26355    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26356    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobDeleteCall<'a, C>
26357    where
26358        T: AsRef<str>,
26359    {
26360        self._additional_params
26361            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26362        self
26363    }
26364
26365    /// Identifies the authorization scope for the method you are building.
26366    ///
26367    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26368    /// [`Scope::CloudPlatform`].
26369    ///
26370    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26371    /// tokens for more than one scope.
26372    ///
26373    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26374    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26375    /// sufficient, a read-write scope will do as well.
26376    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobDeleteCall<'a, C>
26377    where
26378        St: AsRef<str>,
26379    {
26380        self._scopes.insert(String::from(scope.as_ref()));
26381        self
26382    }
26383    /// Identifies the authorization scope(s) for the method you are building.
26384    ///
26385    /// See [`Self::add_scope()`] for details.
26386    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobDeleteCall<'a, C>
26387    where
26388        I: IntoIterator<Item = St>,
26389        St: AsRef<str>,
26390    {
26391        self._scopes
26392            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26393        self
26394    }
26395
26396    /// Removes all scopes, and no default scope will be used either.
26397    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26398    /// for details).
26399    pub fn clear_scopes(mut self) -> ProjectRegionJobDeleteCall<'a, C> {
26400        self._scopes.clear();
26401        self
26402    }
26403}
26404
26405/// Gets the resource representation for a job in a project.
26406///
26407/// A builder for the *regions.jobs.get* method supported by a *project* resource.
26408/// It is not used directly, but through a [`ProjectMethods`] instance.
26409///
26410/// # Example
26411///
26412/// Instantiate a resource method builder
26413///
26414/// ```test_harness,no_run
26415/// # extern crate hyper;
26416/// # extern crate hyper_rustls;
26417/// # extern crate google_dataproc1 as dataproc1;
26418/// # async fn dox() {
26419/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26420///
26421/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26422/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26423/// #     secret,
26424/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26425/// # ).build().await.unwrap();
26426///
26427/// # let client = hyper_util::client::legacy::Client::builder(
26428/// #     hyper_util::rt::TokioExecutor::new()
26429/// # )
26430/// # .build(
26431/// #     hyper_rustls::HttpsConnectorBuilder::new()
26432/// #         .with_native_roots()
26433/// #         .unwrap()
26434/// #         .https_or_http()
26435/// #         .enable_http1()
26436/// #         .build()
26437/// # );
26438/// # let mut hub = Dataproc::new(client, auth);
26439/// // You can configure optional parameters by calling the respective setters at will, and
26440/// // execute the final call using `doit()`.
26441/// // Values shown here are possibly random and not representative !
26442/// let result = hub.projects().regions_jobs_get("projectId", "region", "jobId")
26443///              .doit().await;
26444/// # }
26445/// ```
26446pub struct ProjectRegionJobGetCall<'a, C>
26447where
26448    C: 'a,
26449{
26450    hub: &'a Dataproc<C>,
26451    _project_id: String,
26452    _region: String,
26453    _job_id: String,
26454    _delegate: Option<&'a mut dyn common::Delegate>,
26455    _additional_params: HashMap<String, String>,
26456    _scopes: BTreeSet<String>,
26457}
26458
26459impl<'a, C> common::CallBuilder for ProjectRegionJobGetCall<'a, C> {}
26460
26461impl<'a, C> ProjectRegionJobGetCall<'a, C>
26462where
26463    C: common::Connector,
26464{
26465    /// Perform the operation you have build so far.
26466    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
26467        use std::borrow::Cow;
26468        use std::io::{Read, Seek};
26469
26470        use common::{url::Params, ToParts};
26471        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26472
26473        let mut dd = common::DefaultDelegate;
26474        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26475        dlg.begin(common::MethodInfo {
26476            id: "dataproc.projects.regions.jobs.get",
26477            http_method: hyper::Method::GET,
26478        });
26479
26480        for &field in ["alt", "projectId", "region", "jobId"].iter() {
26481            if self._additional_params.contains_key(field) {
26482                dlg.finished(false);
26483                return Err(common::Error::FieldClash(field));
26484            }
26485        }
26486
26487        let mut params = Params::with_capacity(5 + self._additional_params.len());
26488        params.push("projectId", self._project_id);
26489        params.push("region", self._region);
26490        params.push("jobId", self._job_id);
26491
26492        params.extend(self._additional_params.iter());
26493
26494        params.push("alt", "json");
26495        let mut url =
26496            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/jobs/{jobId}";
26497        if self._scopes.is_empty() {
26498            self._scopes
26499                .insert(Scope::CloudPlatform.as_ref().to_string());
26500        }
26501
26502        #[allow(clippy::single_element_loop)]
26503        for &(find_this, param_name) in [
26504            ("{projectId}", "projectId"),
26505            ("{region}", "region"),
26506            ("{jobId}", "jobId"),
26507        ]
26508        .iter()
26509        {
26510            url = params.uri_replacement(url, param_name, find_this, false);
26511        }
26512        {
26513            let to_remove = ["jobId", "region", "projectId"];
26514            params.remove_params(&to_remove);
26515        }
26516
26517        let url = params.parse_with_url(&url);
26518
26519        loop {
26520            let token = match self
26521                .hub
26522                .auth
26523                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26524                .await
26525            {
26526                Ok(token) => token,
26527                Err(e) => match dlg.token(e) {
26528                    Ok(token) => token,
26529                    Err(e) => {
26530                        dlg.finished(false);
26531                        return Err(common::Error::MissingToken(e));
26532                    }
26533                },
26534            };
26535            let mut req_result = {
26536                let client = &self.hub.client;
26537                dlg.pre_request();
26538                let mut req_builder = hyper::Request::builder()
26539                    .method(hyper::Method::GET)
26540                    .uri(url.as_str())
26541                    .header(USER_AGENT, self.hub._user_agent.clone());
26542
26543                if let Some(token) = token.as_ref() {
26544                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26545                }
26546
26547                let request = req_builder
26548                    .header(CONTENT_LENGTH, 0_u64)
26549                    .body(common::to_body::<String>(None));
26550
26551                client.request(request.unwrap()).await
26552            };
26553
26554            match req_result {
26555                Err(err) => {
26556                    if let common::Retry::After(d) = dlg.http_error(&err) {
26557                        sleep(d).await;
26558                        continue;
26559                    }
26560                    dlg.finished(false);
26561                    return Err(common::Error::HttpError(err));
26562                }
26563                Ok(res) => {
26564                    let (mut parts, body) = res.into_parts();
26565                    let mut body = common::Body::new(body);
26566                    if !parts.status.is_success() {
26567                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26568                        let error = serde_json::from_str(&common::to_string(&bytes));
26569                        let response = common::to_response(parts, bytes.into());
26570
26571                        if let common::Retry::After(d) =
26572                            dlg.http_failure(&response, error.as_ref().ok())
26573                        {
26574                            sleep(d).await;
26575                            continue;
26576                        }
26577
26578                        dlg.finished(false);
26579
26580                        return Err(match error {
26581                            Ok(value) => common::Error::BadRequest(value),
26582                            _ => common::Error::Failure(response),
26583                        });
26584                    }
26585                    let response = {
26586                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26587                        let encoded = common::to_string(&bytes);
26588                        match serde_json::from_str(&encoded) {
26589                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26590                            Err(error) => {
26591                                dlg.response_json_decode_error(&encoded, &error);
26592                                return Err(common::Error::JsonDecodeError(
26593                                    encoded.to_string(),
26594                                    error,
26595                                ));
26596                            }
26597                        }
26598                    };
26599
26600                    dlg.finished(true);
26601                    return Ok(response);
26602                }
26603            }
26604        }
26605    }
26606
26607    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
26608    ///
26609    /// Sets the *project id* path property to the given value.
26610    ///
26611    /// Even though the property as already been set when instantiating this call,
26612    /// we provide this method for API completeness.
26613    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobGetCall<'a, C> {
26614        self._project_id = new_value.to_string();
26615        self
26616    }
26617    /// Required. The Dataproc region in which to handle the request.
26618    ///
26619    /// Sets the *region* path property to the given value.
26620    ///
26621    /// Even though the property as already been set when instantiating this call,
26622    /// we provide this method for API completeness.
26623    pub fn region(mut self, new_value: &str) -> ProjectRegionJobGetCall<'a, C> {
26624        self._region = new_value.to_string();
26625        self
26626    }
26627    /// Required. The job ID.
26628    ///
26629    /// Sets the *job id* path property to the given value.
26630    ///
26631    /// Even though the property as already been set when instantiating this call,
26632    /// we provide this method for API completeness.
26633    pub fn job_id(mut self, new_value: &str) -> ProjectRegionJobGetCall<'a, C> {
26634        self._job_id = new_value.to_string();
26635        self
26636    }
26637    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26638    /// while executing the actual API request.
26639    ///
26640    /// ````text
26641    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26642    /// ````
26643    ///
26644    /// Sets the *delegate* property to the given value.
26645    pub fn delegate(
26646        mut self,
26647        new_value: &'a mut dyn common::Delegate,
26648    ) -> ProjectRegionJobGetCall<'a, C> {
26649        self._delegate = Some(new_value);
26650        self
26651    }
26652
26653    /// Set any additional parameter of the query string used in the request.
26654    /// It should be used to set parameters which are not yet available through their own
26655    /// setters.
26656    ///
26657    /// Please note that this method must not be used to set any of the known parameters
26658    /// which have their own setter method. If done anyway, the request will fail.
26659    ///
26660    /// # Additional Parameters
26661    ///
26662    /// * *$.xgafv* (query-string) - V1 error format.
26663    /// * *access_token* (query-string) - OAuth access token.
26664    /// * *alt* (query-string) - Data format for response.
26665    /// * *callback* (query-string) - JSONP
26666    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26667    /// * *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.
26668    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26669    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26670    /// * *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.
26671    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26672    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26673    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobGetCall<'a, C>
26674    where
26675        T: AsRef<str>,
26676    {
26677        self._additional_params
26678            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26679        self
26680    }
26681
26682    /// Identifies the authorization scope for the method you are building.
26683    ///
26684    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26685    /// [`Scope::CloudPlatform`].
26686    ///
26687    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26688    /// tokens for more than one scope.
26689    ///
26690    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26691    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26692    /// sufficient, a read-write scope will do as well.
26693    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobGetCall<'a, C>
26694    where
26695        St: AsRef<str>,
26696    {
26697        self._scopes.insert(String::from(scope.as_ref()));
26698        self
26699    }
26700    /// Identifies the authorization scope(s) for the method you are building.
26701    ///
26702    /// See [`Self::add_scope()`] for details.
26703    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobGetCall<'a, C>
26704    where
26705        I: IntoIterator<Item = St>,
26706        St: AsRef<str>,
26707    {
26708        self._scopes
26709            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26710        self
26711    }
26712
26713    /// Removes all scopes, and no default scope will be used either.
26714    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26715    /// for details).
26716    pub fn clear_scopes(mut self) -> ProjectRegionJobGetCall<'a, C> {
26717        self._scopes.clear();
26718        self
26719    }
26720}
26721
26722/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
26723///
26724/// A builder for the *regions.jobs.getIamPolicy* method supported by a *project* resource.
26725/// It is not used directly, but through a [`ProjectMethods`] instance.
26726///
26727/// # Example
26728///
26729/// Instantiate a resource method builder
26730///
26731/// ```test_harness,no_run
26732/// # extern crate hyper;
26733/// # extern crate hyper_rustls;
26734/// # extern crate google_dataproc1 as dataproc1;
26735/// use dataproc1::api::GetIamPolicyRequest;
26736/// # async fn dox() {
26737/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26738///
26739/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26740/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26741/// #     secret,
26742/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26743/// # ).build().await.unwrap();
26744///
26745/// # let client = hyper_util::client::legacy::Client::builder(
26746/// #     hyper_util::rt::TokioExecutor::new()
26747/// # )
26748/// # .build(
26749/// #     hyper_rustls::HttpsConnectorBuilder::new()
26750/// #         .with_native_roots()
26751/// #         .unwrap()
26752/// #         .https_or_http()
26753/// #         .enable_http1()
26754/// #         .build()
26755/// # );
26756/// # let mut hub = Dataproc::new(client, auth);
26757/// // As the method needs a request, you would usually fill it with the desired information
26758/// // into the respective structure. Some of the parts shown here might not be applicable !
26759/// // Values shown here are possibly random and not representative !
26760/// let mut req = GetIamPolicyRequest::default();
26761///
26762/// // You can configure optional parameters by calling the respective setters at will, and
26763/// // execute the final call using `doit()`.
26764/// // Values shown here are possibly random and not representative !
26765/// let result = hub.projects().regions_jobs_get_iam_policy(req, "resource")
26766///              .doit().await;
26767/// # }
26768/// ```
26769pub struct ProjectRegionJobGetIamPolicyCall<'a, C>
26770where
26771    C: 'a,
26772{
26773    hub: &'a Dataproc<C>,
26774    _request: GetIamPolicyRequest,
26775    _resource: String,
26776    _delegate: Option<&'a mut dyn common::Delegate>,
26777    _additional_params: HashMap<String, String>,
26778    _scopes: BTreeSet<String>,
26779}
26780
26781impl<'a, C> common::CallBuilder for ProjectRegionJobGetIamPolicyCall<'a, C> {}
26782
26783impl<'a, C> ProjectRegionJobGetIamPolicyCall<'a, C>
26784where
26785    C: common::Connector,
26786{
26787    /// Perform the operation you have build so far.
26788    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26789        use std::borrow::Cow;
26790        use std::io::{Read, Seek};
26791
26792        use common::{url::Params, ToParts};
26793        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26794
26795        let mut dd = common::DefaultDelegate;
26796        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26797        dlg.begin(common::MethodInfo {
26798            id: "dataproc.projects.regions.jobs.getIamPolicy",
26799            http_method: hyper::Method::POST,
26800        });
26801
26802        for &field in ["alt", "resource"].iter() {
26803            if self._additional_params.contains_key(field) {
26804                dlg.finished(false);
26805                return Err(common::Error::FieldClash(field));
26806            }
26807        }
26808
26809        let mut params = Params::with_capacity(4 + self._additional_params.len());
26810        params.push("resource", self._resource);
26811
26812        params.extend(self._additional_params.iter());
26813
26814        params.push("alt", "json");
26815        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
26816        if self._scopes.is_empty() {
26817            self._scopes
26818                .insert(Scope::CloudPlatform.as_ref().to_string());
26819        }
26820
26821        #[allow(clippy::single_element_loop)]
26822        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26823            url = params.uri_replacement(url, param_name, find_this, true);
26824        }
26825        {
26826            let to_remove = ["resource"];
26827            params.remove_params(&to_remove);
26828        }
26829
26830        let url = params.parse_with_url(&url);
26831
26832        let mut json_mime_type = mime::APPLICATION_JSON;
26833        let mut request_value_reader = {
26834            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26835            common::remove_json_null_values(&mut value);
26836            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26837            serde_json::to_writer(&mut dst, &value).unwrap();
26838            dst
26839        };
26840        let request_size = request_value_reader
26841            .seek(std::io::SeekFrom::End(0))
26842            .unwrap();
26843        request_value_reader
26844            .seek(std::io::SeekFrom::Start(0))
26845            .unwrap();
26846
26847        loop {
26848            let token = match self
26849                .hub
26850                .auth
26851                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26852                .await
26853            {
26854                Ok(token) => token,
26855                Err(e) => match dlg.token(e) {
26856                    Ok(token) => token,
26857                    Err(e) => {
26858                        dlg.finished(false);
26859                        return Err(common::Error::MissingToken(e));
26860                    }
26861                },
26862            };
26863            request_value_reader
26864                .seek(std::io::SeekFrom::Start(0))
26865                .unwrap();
26866            let mut req_result = {
26867                let client = &self.hub.client;
26868                dlg.pre_request();
26869                let mut req_builder = hyper::Request::builder()
26870                    .method(hyper::Method::POST)
26871                    .uri(url.as_str())
26872                    .header(USER_AGENT, self.hub._user_agent.clone());
26873
26874                if let Some(token) = token.as_ref() {
26875                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26876                }
26877
26878                let request = req_builder
26879                    .header(CONTENT_TYPE, json_mime_type.to_string())
26880                    .header(CONTENT_LENGTH, request_size as u64)
26881                    .body(common::to_body(
26882                        request_value_reader.get_ref().clone().into(),
26883                    ));
26884
26885                client.request(request.unwrap()).await
26886            };
26887
26888            match req_result {
26889                Err(err) => {
26890                    if let common::Retry::After(d) = dlg.http_error(&err) {
26891                        sleep(d).await;
26892                        continue;
26893                    }
26894                    dlg.finished(false);
26895                    return Err(common::Error::HttpError(err));
26896                }
26897                Ok(res) => {
26898                    let (mut parts, body) = res.into_parts();
26899                    let mut body = common::Body::new(body);
26900                    if !parts.status.is_success() {
26901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26902                        let error = serde_json::from_str(&common::to_string(&bytes));
26903                        let response = common::to_response(parts, bytes.into());
26904
26905                        if let common::Retry::After(d) =
26906                            dlg.http_failure(&response, error.as_ref().ok())
26907                        {
26908                            sleep(d).await;
26909                            continue;
26910                        }
26911
26912                        dlg.finished(false);
26913
26914                        return Err(match error {
26915                            Ok(value) => common::Error::BadRequest(value),
26916                            _ => common::Error::Failure(response),
26917                        });
26918                    }
26919                    let response = {
26920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26921                        let encoded = common::to_string(&bytes);
26922                        match serde_json::from_str(&encoded) {
26923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26924                            Err(error) => {
26925                                dlg.response_json_decode_error(&encoded, &error);
26926                                return Err(common::Error::JsonDecodeError(
26927                                    encoded.to_string(),
26928                                    error,
26929                                ));
26930                            }
26931                        }
26932                    };
26933
26934                    dlg.finished(true);
26935                    return Ok(response);
26936                }
26937            }
26938        }
26939    }
26940
26941    ///
26942    /// Sets the *request* property to the given value.
26943    ///
26944    /// Even though the property as already been set when instantiating this call,
26945    /// we provide this method for API completeness.
26946    pub fn request(
26947        mut self,
26948        new_value: GetIamPolicyRequest,
26949    ) -> ProjectRegionJobGetIamPolicyCall<'a, C> {
26950        self._request = new_value;
26951        self
26952    }
26953    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
26954    ///
26955    /// Sets the *resource* path property to the given value.
26956    ///
26957    /// Even though the property as already been set when instantiating this call,
26958    /// we provide this method for API completeness.
26959    pub fn resource(mut self, new_value: &str) -> ProjectRegionJobGetIamPolicyCall<'a, C> {
26960        self._resource = new_value.to_string();
26961        self
26962    }
26963    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26964    /// while executing the actual API request.
26965    ///
26966    /// ````text
26967    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26968    /// ````
26969    ///
26970    /// Sets the *delegate* property to the given value.
26971    pub fn delegate(
26972        mut self,
26973        new_value: &'a mut dyn common::Delegate,
26974    ) -> ProjectRegionJobGetIamPolicyCall<'a, C> {
26975        self._delegate = Some(new_value);
26976        self
26977    }
26978
26979    /// Set any additional parameter of the query string used in the request.
26980    /// It should be used to set parameters which are not yet available through their own
26981    /// setters.
26982    ///
26983    /// Please note that this method must not be used to set any of the known parameters
26984    /// which have their own setter method. If done anyway, the request will fail.
26985    ///
26986    /// # Additional Parameters
26987    ///
26988    /// * *$.xgafv* (query-string) - V1 error format.
26989    /// * *access_token* (query-string) - OAuth access token.
26990    /// * *alt* (query-string) - Data format for response.
26991    /// * *callback* (query-string) - JSONP
26992    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26993    /// * *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.
26994    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26995    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26996    /// * *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.
26997    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26998    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26999    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobGetIamPolicyCall<'a, C>
27000    where
27001        T: AsRef<str>,
27002    {
27003        self._additional_params
27004            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27005        self
27006    }
27007
27008    /// Identifies the authorization scope for the method you are building.
27009    ///
27010    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27011    /// [`Scope::CloudPlatform`].
27012    ///
27013    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27014    /// tokens for more than one scope.
27015    ///
27016    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27017    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27018    /// sufficient, a read-write scope will do as well.
27019    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobGetIamPolicyCall<'a, C>
27020    where
27021        St: AsRef<str>,
27022    {
27023        self._scopes.insert(String::from(scope.as_ref()));
27024        self
27025    }
27026    /// Identifies the authorization scope(s) for the method you are building.
27027    ///
27028    /// See [`Self::add_scope()`] for details.
27029    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobGetIamPolicyCall<'a, C>
27030    where
27031        I: IntoIterator<Item = St>,
27032        St: AsRef<str>,
27033    {
27034        self._scopes
27035            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27036        self
27037    }
27038
27039    /// Removes all scopes, and no default scope will be used either.
27040    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27041    /// for details).
27042    pub fn clear_scopes(mut self) -> ProjectRegionJobGetIamPolicyCall<'a, C> {
27043        self._scopes.clear();
27044        self
27045    }
27046}
27047
27048/// Lists regions/{region}/jobs in a project.
27049///
27050/// A builder for the *regions.jobs.list* method supported by a *project* resource.
27051/// It is not used directly, but through a [`ProjectMethods`] instance.
27052///
27053/// # Example
27054///
27055/// Instantiate a resource method builder
27056///
27057/// ```test_harness,no_run
27058/// # extern crate hyper;
27059/// # extern crate hyper_rustls;
27060/// # extern crate google_dataproc1 as dataproc1;
27061/// # async fn dox() {
27062/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27063///
27064/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27066/// #     secret,
27067/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27068/// # ).build().await.unwrap();
27069///
27070/// # let client = hyper_util::client::legacy::Client::builder(
27071/// #     hyper_util::rt::TokioExecutor::new()
27072/// # )
27073/// # .build(
27074/// #     hyper_rustls::HttpsConnectorBuilder::new()
27075/// #         .with_native_roots()
27076/// #         .unwrap()
27077/// #         .https_or_http()
27078/// #         .enable_http1()
27079/// #         .build()
27080/// # );
27081/// # let mut hub = Dataproc::new(client, auth);
27082/// // You can configure optional parameters by calling the respective setters at will, and
27083/// // execute the final call using `doit()`.
27084/// // Values shown here are possibly random and not representative !
27085/// let result = hub.projects().regions_jobs_list("projectId", "region")
27086///              .page_token("Lorem")
27087///              .page_size(-17)
27088///              .job_state_matcher("Stet")
27089///              .filter("dolores")
27090///              .cluster_name("eos")
27091///              .doit().await;
27092/// # }
27093/// ```
27094pub struct ProjectRegionJobListCall<'a, C>
27095where
27096    C: 'a,
27097{
27098    hub: &'a Dataproc<C>,
27099    _project_id: String,
27100    _region: String,
27101    _page_token: Option<String>,
27102    _page_size: Option<i32>,
27103    _job_state_matcher: Option<String>,
27104    _filter: Option<String>,
27105    _cluster_name: Option<String>,
27106    _delegate: Option<&'a mut dyn common::Delegate>,
27107    _additional_params: HashMap<String, String>,
27108    _scopes: BTreeSet<String>,
27109}
27110
27111impl<'a, C> common::CallBuilder for ProjectRegionJobListCall<'a, C> {}
27112
27113impl<'a, C> ProjectRegionJobListCall<'a, C>
27114where
27115    C: common::Connector,
27116{
27117    /// Perform the operation you have build so far.
27118    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
27119        use std::borrow::Cow;
27120        use std::io::{Read, Seek};
27121
27122        use common::{url::Params, ToParts};
27123        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27124
27125        let mut dd = common::DefaultDelegate;
27126        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27127        dlg.begin(common::MethodInfo {
27128            id: "dataproc.projects.regions.jobs.list",
27129            http_method: hyper::Method::GET,
27130        });
27131
27132        for &field in [
27133            "alt",
27134            "projectId",
27135            "region",
27136            "pageToken",
27137            "pageSize",
27138            "jobStateMatcher",
27139            "filter",
27140            "clusterName",
27141        ]
27142        .iter()
27143        {
27144            if self._additional_params.contains_key(field) {
27145                dlg.finished(false);
27146                return Err(common::Error::FieldClash(field));
27147            }
27148        }
27149
27150        let mut params = Params::with_capacity(9 + self._additional_params.len());
27151        params.push("projectId", self._project_id);
27152        params.push("region", self._region);
27153        if let Some(value) = self._page_token.as_ref() {
27154            params.push("pageToken", value);
27155        }
27156        if let Some(value) = self._page_size.as_ref() {
27157            params.push("pageSize", value.to_string());
27158        }
27159        if let Some(value) = self._job_state_matcher.as_ref() {
27160            params.push("jobStateMatcher", value);
27161        }
27162        if let Some(value) = self._filter.as_ref() {
27163            params.push("filter", value);
27164        }
27165        if let Some(value) = self._cluster_name.as_ref() {
27166            params.push("clusterName", value);
27167        }
27168
27169        params.extend(self._additional_params.iter());
27170
27171        params.push("alt", "json");
27172        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/jobs";
27173        if self._scopes.is_empty() {
27174            self._scopes
27175                .insert(Scope::CloudPlatform.as_ref().to_string());
27176        }
27177
27178        #[allow(clippy::single_element_loop)]
27179        for &(find_this, param_name) in
27180            [("{projectId}", "projectId"), ("{region}", "region")].iter()
27181        {
27182            url = params.uri_replacement(url, param_name, find_this, false);
27183        }
27184        {
27185            let to_remove = ["region", "projectId"];
27186            params.remove_params(&to_remove);
27187        }
27188
27189        let url = params.parse_with_url(&url);
27190
27191        loop {
27192            let token = match self
27193                .hub
27194                .auth
27195                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27196                .await
27197            {
27198                Ok(token) => token,
27199                Err(e) => match dlg.token(e) {
27200                    Ok(token) => token,
27201                    Err(e) => {
27202                        dlg.finished(false);
27203                        return Err(common::Error::MissingToken(e));
27204                    }
27205                },
27206            };
27207            let mut req_result = {
27208                let client = &self.hub.client;
27209                dlg.pre_request();
27210                let mut req_builder = hyper::Request::builder()
27211                    .method(hyper::Method::GET)
27212                    .uri(url.as_str())
27213                    .header(USER_AGENT, self.hub._user_agent.clone());
27214
27215                if let Some(token) = token.as_ref() {
27216                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27217                }
27218
27219                let request = req_builder
27220                    .header(CONTENT_LENGTH, 0_u64)
27221                    .body(common::to_body::<String>(None));
27222
27223                client.request(request.unwrap()).await
27224            };
27225
27226            match req_result {
27227                Err(err) => {
27228                    if let common::Retry::After(d) = dlg.http_error(&err) {
27229                        sleep(d).await;
27230                        continue;
27231                    }
27232                    dlg.finished(false);
27233                    return Err(common::Error::HttpError(err));
27234                }
27235                Ok(res) => {
27236                    let (mut parts, body) = res.into_parts();
27237                    let mut body = common::Body::new(body);
27238                    if !parts.status.is_success() {
27239                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27240                        let error = serde_json::from_str(&common::to_string(&bytes));
27241                        let response = common::to_response(parts, bytes.into());
27242
27243                        if let common::Retry::After(d) =
27244                            dlg.http_failure(&response, error.as_ref().ok())
27245                        {
27246                            sleep(d).await;
27247                            continue;
27248                        }
27249
27250                        dlg.finished(false);
27251
27252                        return Err(match error {
27253                            Ok(value) => common::Error::BadRequest(value),
27254                            _ => common::Error::Failure(response),
27255                        });
27256                    }
27257                    let response = {
27258                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27259                        let encoded = common::to_string(&bytes);
27260                        match serde_json::from_str(&encoded) {
27261                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27262                            Err(error) => {
27263                                dlg.response_json_decode_error(&encoded, &error);
27264                                return Err(common::Error::JsonDecodeError(
27265                                    encoded.to_string(),
27266                                    error,
27267                                ));
27268                            }
27269                        }
27270                    };
27271
27272                    dlg.finished(true);
27273                    return Ok(response);
27274                }
27275            }
27276        }
27277    }
27278
27279    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
27280    ///
27281    /// Sets the *project id* path property to the given value.
27282    ///
27283    /// Even though the property as already been set when instantiating this call,
27284    /// we provide this method for API completeness.
27285    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27286        self._project_id = new_value.to_string();
27287        self
27288    }
27289    /// Required. The Dataproc region in which to handle the request.
27290    ///
27291    /// Sets the *region* path property to the given value.
27292    ///
27293    /// Even though the property as already been set when instantiating this call,
27294    /// we provide this method for API completeness.
27295    pub fn region(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27296        self._region = new_value.to_string();
27297        self
27298    }
27299    /// Optional. The page token, returned by a previous call, to request the next page of results.
27300    ///
27301    /// Sets the *page token* query property to the given value.
27302    pub fn page_token(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27303        self._page_token = Some(new_value.to_string());
27304        self
27305    }
27306    /// Optional. The number of results to return in each response.
27307    ///
27308    /// Sets the *page size* query property to the given value.
27309    pub fn page_size(mut self, new_value: i32) -> ProjectRegionJobListCall<'a, C> {
27310        self._page_size = Some(new_value);
27311        self
27312    }
27313    /// Optional. Specifies enumerated categories of jobs to list. (default = match ALL jobs).If filter is provided, jobStateMatcher will be ignored.
27314    ///
27315    /// Sets the *job state matcher* query property to the given value.
27316    pub fn job_state_matcher(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27317        self._job_state_matcher = Some(new_value.to_string());
27318        self
27319    }
27320    /// Optional. A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax:field = value AND field = value ...where field is status.state or labels.[KEY], and [KEY] is a label key. value can be * to match all values. status.state can be either ACTIVE or NON_ACTIVE. Only the logical AND operator is supported; space-separated items are treated as having an implicit AND operator.Example filter:status.state = ACTIVE AND labels.env = staging AND labels.starred = *
27321    ///
27322    /// Sets the *filter* query property to the given value.
27323    pub fn filter(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27324        self._filter = Some(new_value.to_string());
27325        self
27326    }
27327    /// Optional. If set, the returned jobs list includes only jobs that were submitted to the named cluster.
27328    ///
27329    /// Sets the *cluster name* query property to the given value.
27330    pub fn cluster_name(mut self, new_value: &str) -> ProjectRegionJobListCall<'a, C> {
27331        self._cluster_name = Some(new_value.to_string());
27332        self
27333    }
27334    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27335    /// while executing the actual API request.
27336    ///
27337    /// ````text
27338    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27339    /// ````
27340    ///
27341    /// Sets the *delegate* property to the given value.
27342    pub fn delegate(
27343        mut self,
27344        new_value: &'a mut dyn common::Delegate,
27345    ) -> ProjectRegionJobListCall<'a, C> {
27346        self._delegate = Some(new_value);
27347        self
27348    }
27349
27350    /// Set any additional parameter of the query string used in the request.
27351    /// It should be used to set parameters which are not yet available through their own
27352    /// setters.
27353    ///
27354    /// Please note that this method must not be used to set any of the known parameters
27355    /// which have their own setter method. If done anyway, the request will fail.
27356    ///
27357    /// # Additional Parameters
27358    ///
27359    /// * *$.xgafv* (query-string) - V1 error format.
27360    /// * *access_token* (query-string) - OAuth access token.
27361    /// * *alt* (query-string) - Data format for response.
27362    /// * *callback* (query-string) - JSONP
27363    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27364    /// * *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.
27365    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27366    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27367    /// * *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.
27368    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27369    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27370    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobListCall<'a, C>
27371    where
27372        T: AsRef<str>,
27373    {
27374        self._additional_params
27375            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27376        self
27377    }
27378
27379    /// Identifies the authorization scope for the method you are building.
27380    ///
27381    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27382    /// [`Scope::CloudPlatform`].
27383    ///
27384    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27385    /// tokens for more than one scope.
27386    ///
27387    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27388    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27389    /// sufficient, a read-write scope will do as well.
27390    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobListCall<'a, C>
27391    where
27392        St: AsRef<str>,
27393    {
27394        self._scopes.insert(String::from(scope.as_ref()));
27395        self
27396    }
27397    /// Identifies the authorization scope(s) for the method you are building.
27398    ///
27399    /// See [`Self::add_scope()`] for details.
27400    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobListCall<'a, C>
27401    where
27402        I: IntoIterator<Item = St>,
27403        St: AsRef<str>,
27404    {
27405        self._scopes
27406            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27407        self
27408    }
27409
27410    /// Removes all scopes, and no default scope will be used either.
27411    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27412    /// for details).
27413    pub fn clear_scopes(mut self) -> ProjectRegionJobListCall<'a, C> {
27414        self._scopes.clear();
27415        self
27416    }
27417}
27418
27419/// Updates a job in a project.
27420///
27421/// A builder for the *regions.jobs.patch* method supported by a *project* resource.
27422/// It is not used directly, but through a [`ProjectMethods`] instance.
27423///
27424/// # Example
27425///
27426/// Instantiate a resource method builder
27427///
27428/// ```test_harness,no_run
27429/// # extern crate hyper;
27430/// # extern crate hyper_rustls;
27431/// # extern crate google_dataproc1 as dataproc1;
27432/// use dataproc1::api::Job;
27433/// # async fn dox() {
27434/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27435///
27436/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27438/// #     secret,
27439/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27440/// # ).build().await.unwrap();
27441///
27442/// # let client = hyper_util::client::legacy::Client::builder(
27443/// #     hyper_util::rt::TokioExecutor::new()
27444/// # )
27445/// # .build(
27446/// #     hyper_rustls::HttpsConnectorBuilder::new()
27447/// #         .with_native_roots()
27448/// #         .unwrap()
27449/// #         .https_or_http()
27450/// #         .enable_http1()
27451/// #         .build()
27452/// # );
27453/// # let mut hub = Dataproc::new(client, auth);
27454/// // As the method needs a request, you would usually fill it with the desired information
27455/// // into the respective structure. Some of the parts shown here might not be applicable !
27456/// // Values shown here are possibly random and not representative !
27457/// let mut req = Job::default();
27458///
27459/// // You can configure optional parameters by calling the respective setters at will, and
27460/// // execute the final call using `doit()`.
27461/// // Values shown here are possibly random and not representative !
27462/// let result = hub.projects().regions_jobs_patch(req, "projectId", "region", "jobId")
27463///              .update_mask(FieldMask::new::<&str>(&[]))
27464///              .doit().await;
27465/// # }
27466/// ```
27467pub struct ProjectRegionJobPatchCall<'a, C>
27468where
27469    C: 'a,
27470{
27471    hub: &'a Dataproc<C>,
27472    _request: Job,
27473    _project_id: String,
27474    _region: String,
27475    _job_id: String,
27476    _update_mask: Option<common::FieldMask>,
27477    _delegate: Option<&'a mut dyn common::Delegate>,
27478    _additional_params: HashMap<String, String>,
27479    _scopes: BTreeSet<String>,
27480}
27481
27482impl<'a, C> common::CallBuilder for ProjectRegionJobPatchCall<'a, C> {}
27483
27484impl<'a, C> ProjectRegionJobPatchCall<'a, C>
27485where
27486    C: common::Connector,
27487{
27488    /// Perform the operation you have build so far.
27489    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
27490        use std::borrow::Cow;
27491        use std::io::{Read, Seek};
27492
27493        use common::{url::Params, ToParts};
27494        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27495
27496        let mut dd = common::DefaultDelegate;
27497        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27498        dlg.begin(common::MethodInfo {
27499            id: "dataproc.projects.regions.jobs.patch",
27500            http_method: hyper::Method::PATCH,
27501        });
27502
27503        for &field in ["alt", "projectId", "region", "jobId", "updateMask"].iter() {
27504            if self._additional_params.contains_key(field) {
27505                dlg.finished(false);
27506                return Err(common::Error::FieldClash(field));
27507            }
27508        }
27509
27510        let mut params = Params::with_capacity(7 + self._additional_params.len());
27511        params.push("projectId", self._project_id);
27512        params.push("region", self._region);
27513        params.push("jobId", self._job_id);
27514        if let Some(value) = self._update_mask.as_ref() {
27515            params.push("updateMask", value.to_string());
27516        }
27517
27518        params.extend(self._additional_params.iter());
27519
27520        params.push("alt", "json");
27521        let mut url =
27522            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/jobs/{jobId}";
27523        if self._scopes.is_empty() {
27524            self._scopes
27525                .insert(Scope::CloudPlatform.as_ref().to_string());
27526        }
27527
27528        #[allow(clippy::single_element_loop)]
27529        for &(find_this, param_name) in [
27530            ("{projectId}", "projectId"),
27531            ("{region}", "region"),
27532            ("{jobId}", "jobId"),
27533        ]
27534        .iter()
27535        {
27536            url = params.uri_replacement(url, param_name, find_this, false);
27537        }
27538        {
27539            let to_remove = ["jobId", "region", "projectId"];
27540            params.remove_params(&to_remove);
27541        }
27542
27543        let url = params.parse_with_url(&url);
27544
27545        let mut json_mime_type = mime::APPLICATION_JSON;
27546        let mut request_value_reader = {
27547            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27548            common::remove_json_null_values(&mut value);
27549            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27550            serde_json::to_writer(&mut dst, &value).unwrap();
27551            dst
27552        };
27553        let request_size = request_value_reader
27554            .seek(std::io::SeekFrom::End(0))
27555            .unwrap();
27556        request_value_reader
27557            .seek(std::io::SeekFrom::Start(0))
27558            .unwrap();
27559
27560        loop {
27561            let token = match self
27562                .hub
27563                .auth
27564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27565                .await
27566            {
27567                Ok(token) => token,
27568                Err(e) => match dlg.token(e) {
27569                    Ok(token) => token,
27570                    Err(e) => {
27571                        dlg.finished(false);
27572                        return Err(common::Error::MissingToken(e));
27573                    }
27574                },
27575            };
27576            request_value_reader
27577                .seek(std::io::SeekFrom::Start(0))
27578                .unwrap();
27579            let mut req_result = {
27580                let client = &self.hub.client;
27581                dlg.pre_request();
27582                let mut req_builder = hyper::Request::builder()
27583                    .method(hyper::Method::PATCH)
27584                    .uri(url.as_str())
27585                    .header(USER_AGENT, self.hub._user_agent.clone());
27586
27587                if let Some(token) = token.as_ref() {
27588                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27589                }
27590
27591                let request = req_builder
27592                    .header(CONTENT_TYPE, json_mime_type.to_string())
27593                    .header(CONTENT_LENGTH, request_size as u64)
27594                    .body(common::to_body(
27595                        request_value_reader.get_ref().clone().into(),
27596                    ));
27597
27598                client.request(request.unwrap()).await
27599            };
27600
27601            match req_result {
27602                Err(err) => {
27603                    if let common::Retry::After(d) = dlg.http_error(&err) {
27604                        sleep(d).await;
27605                        continue;
27606                    }
27607                    dlg.finished(false);
27608                    return Err(common::Error::HttpError(err));
27609                }
27610                Ok(res) => {
27611                    let (mut parts, body) = res.into_parts();
27612                    let mut body = common::Body::new(body);
27613                    if !parts.status.is_success() {
27614                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27615                        let error = serde_json::from_str(&common::to_string(&bytes));
27616                        let response = common::to_response(parts, bytes.into());
27617
27618                        if let common::Retry::After(d) =
27619                            dlg.http_failure(&response, error.as_ref().ok())
27620                        {
27621                            sleep(d).await;
27622                            continue;
27623                        }
27624
27625                        dlg.finished(false);
27626
27627                        return Err(match error {
27628                            Ok(value) => common::Error::BadRequest(value),
27629                            _ => common::Error::Failure(response),
27630                        });
27631                    }
27632                    let response = {
27633                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27634                        let encoded = common::to_string(&bytes);
27635                        match serde_json::from_str(&encoded) {
27636                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27637                            Err(error) => {
27638                                dlg.response_json_decode_error(&encoded, &error);
27639                                return Err(common::Error::JsonDecodeError(
27640                                    encoded.to_string(),
27641                                    error,
27642                                ));
27643                            }
27644                        }
27645                    };
27646
27647                    dlg.finished(true);
27648                    return Ok(response);
27649                }
27650            }
27651        }
27652    }
27653
27654    ///
27655    /// Sets the *request* property to the given value.
27656    ///
27657    /// Even though the property as already been set when instantiating this call,
27658    /// we provide this method for API completeness.
27659    pub fn request(mut self, new_value: Job) -> ProjectRegionJobPatchCall<'a, C> {
27660        self._request = new_value;
27661        self
27662    }
27663    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
27664    ///
27665    /// Sets the *project id* path property to the given value.
27666    ///
27667    /// Even though the property as already been set when instantiating this call,
27668    /// we provide this method for API completeness.
27669    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobPatchCall<'a, C> {
27670        self._project_id = new_value.to_string();
27671        self
27672    }
27673    /// Required. The Dataproc region in which to handle the request.
27674    ///
27675    /// Sets the *region* path property to the given value.
27676    ///
27677    /// Even though the property as already been set when instantiating this call,
27678    /// we provide this method for API completeness.
27679    pub fn region(mut self, new_value: &str) -> ProjectRegionJobPatchCall<'a, C> {
27680        self._region = new_value.to_string();
27681        self
27682    }
27683    /// Required. The job ID.
27684    ///
27685    /// Sets the *job id* path property to the given value.
27686    ///
27687    /// Even though the property as already been set when instantiating this call,
27688    /// we provide this method for API completeness.
27689    pub fn job_id(mut self, new_value: &str) -> ProjectRegionJobPatchCall<'a, C> {
27690        self._job_id = new_value.to_string();
27691        self
27692    }
27693    /// Required. Specifies the path, relative to Job, of the field to update. For example, to update the labels of a Job the update_mask parameter would be specified as labels, and the PATCH request body would specify the new value. *Note:* Currently, labels is the only field that can be updated.
27694    ///
27695    /// Sets the *update mask* query property to the given value.
27696    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectRegionJobPatchCall<'a, C> {
27697        self._update_mask = Some(new_value);
27698        self
27699    }
27700    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27701    /// while executing the actual API request.
27702    ///
27703    /// ````text
27704    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27705    /// ````
27706    ///
27707    /// Sets the *delegate* property to the given value.
27708    pub fn delegate(
27709        mut self,
27710        new_value: &'a mut dyn common::Delegate,
27711    ) -> ProjectRegionJobPatchCall<'a, C> {
27712        self._delegate = Some(new_value);
27713        self
27714    }
27715
27716    /// Set any additional parameter of the query string used in the request.
27717    /// It should be used to set parameters which are not yet available through their own
27718    /// setters.
27719    ///
27720    /// Please note that this method must not be used to set any of the known parameters
27721    /// which have their own setter method. If done anyway, the request will fail.
27722    ///
27723    /// # Additional Parameters
27724    ///
27725    /// * *$.xgafv* (query-string) - V1 error format.
27726    /// * *access_token* (query-string) - OAuth access token.
27727    /// * *alt* (query-string) - Data format for response.
27728    /// * *callback* (query-string) - JSONP
27729    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27730    /// * *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.
27731    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27732    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27733    /// * *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.
27734    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27735    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27736    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobPatchCall<'a, C>
27737    where
27738        T: AsRef<str>,
27739    {
27740        self._additional_params
27741            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27742        self
27743    }
27744
27745    /// Identifies the authorization scope for the method you are building.
27746    ///
27747    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27748    /// [`Scope::CloudPlatform`].
27749    ///
27750    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27751    /// tokens for more than one scope.
27752    ///
27753    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27754    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27755    /// sufficient, a read-write scope will do as well.
27756    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobPatchCall<'a, C>
27757    where
27758        St: AsRef<str>,
27759    {
27760        self._scopes.insert(String::from(scope.as_ref()));
27761        self
27762    }
27763    /// Identifies the authorization scope(s) for the method you are building.
27764    ///
27765    /// See [`Self::add_scope()`] for details.
27766    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobPatchCall<'a, C>
27767    where
27768        I: IntoIterator<Item = St>,
27769        St: AsRef<str>,
27770    {
27771        self._scopes
27772            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27773        self
27774    }
27775
27776    /// Removes all scopes, and no default scope will be used either.
27777    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27778    /// for details).
27779    pub fn clear_scopes(mut self) -> ProjectRegionJobPatchCall<'a, C> {
27780        self._scopes.clear();
27781        self
27782    }
27783}
27784
27785/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
27786///
27787/// A builder for the *regions.jobs.setIamPolicy* method supported by a *project* resource.
27788/// It is not used directly, but through a [`ProjectMethods`] instance.
27789///
27790/// # Example
27791///
27792/// Instantiate a resource method builder
27793///
27794/// ```test_harness,no_run
27795/// # extern crate hyper;
27796/// # extern crate hyper_rustls;
27797/// # extern crate google_dataproc1 as dataproc1;
27798/// use dataproc1::api::SetIamPolicyRequest;
27799/// # async fn dox() {
27800/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27801///
27802/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27803/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27804/// #     secret,
27805/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27806/// # ).build().await.unwrap();
27807///
27808/// # let client = hyper_util::client::legacy::Client::builder(
27809/// #     hyper_util::rt::TokioExecutor::new()
27810/// # )
27811/// # .build(
27812/// #     hyper_rustls::HttpsConnectorBuilder::new()
27813/// #         .with_native_roots()
27814/// #         .unwrap()
27815/// #         .https_or_http()
27816/// #         .enable_http1()
27817/// #         .build()
27818/// # );
27819/// # let mut hub = Dataproc::new(client, auth);
27820/// // As the method needs a request, you would usually fill it with the desired information
27821/// // into the respective structure. Some of the parts shown here might not be applicable !
27822/// // Values shown here are possibly random and not representative !
27823/// let mut req = SetIamPolicyRequest::default();
27824///
27825/// // You can configure optional parameters by calling the respective setters at will, and
27826/// // execute the final call using `doit()`.
27827/// // Values shown here are possibly random and not representative !
27828/// let result = hub.projects().regions_jobs_set_iam_policy(req, "resource")
27829///              .doit().await;
27830/// # }
27831/// ```
27832pub struct ProjectRegionJobSetIamPolicyCall<'a, C>
27833where
27834    C: 'a,
27835{
27836    hub: &'a Dataproc<C>,
27837    _request: SetIamPolicyRequest,
27838    _resource: String,
27839    _delegate: Option<&'a mut dyn common::Delegate>,
27840    _additional_params: HashMap<String, String>,
27841    _scopes: BTreeSet<String>,
27842}
27843
27844impl<'a, C> common::CallBuilder for ProjectRegionJobSetIamPolicyCall<'a, C> {}
27845
27846impl<'a, C> ProjectRegionJobSetIamPolicyCall<'a, C>
27847where
27848    C: common::Connector,
27849{
27850    /// Perform the operation you have build so far.
27851    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
27852        use std::borrow::Cow;
27853        use std::io::{Read, Seek};
27854
27855        use common::{url::Params, ToParts};
27856        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27857
27858        let mut dd = common::DefaultDelegate;
27859        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27860        dlg.begin(common::MethodInfo {
27861            id: "dataproc.projects.regions.jobs.setIamPolicy",
27862            http_method: hyper::Method::POST,
27863        });
27864
27865        for &field in ["alt", "resource"].iter() {
27866            if self._additional_params.contains_key(field) {
27867                dlg.finished(false);
27868                return Err(common::Error::FieldClash(field));
27869            }
27870        }
27871
27872        let mut params = Params::with_capacity(4 + self._additional_params.len());
27873        params.push("resource", self._resource);
27874
27875        params.extend(self._additional_params.iter());
27876
27877        params.push("alt", "json");
27878        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
27879        if self._scopes.is_empty() {
27880            self._scopes
27881                .insert(Scope::CloudPlatform.as_ref().to_string());
27882        }
27883
27884        #[allow(clippy::single_element_loop)]
27885        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
27886            url = params.uri_replacement(url, param_name, find_this, true);
27887        }
27888        {
27889            let to_remove = ["resource"];
27890            params.remove_params(&to_remove);
27891        }
27892
27893        let url = params.parse_with_url(&url);
27894
27895        let mut json_mime_type = mime::APPLICATION_JSON;
27896        let mut request_value_reader = {
27897            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27898            common::remove_json_null_values(&mut value);
27899            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27900            serde_json::to_writer(&mut dst, &value).unwrap();
27901            dst
27902        };
27903        let request_size = request_value_reader
27904            .seek(std::io::SeekFrom::End(0))
27905            .unwrap();
27906        request_value_reader
27907            .seek(std::io::SeekFrom::Start(0))
27908            .unwrap();
27909
27910        loop {
27911            let token = match self
27912                .hub
27913                .auth
27914                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27915                .await
27916            {
27917                Ok(token) => token,
27918                Err(e) => match dlg.token(e) {
27919                    Ok(token) => token,
27920                    Err(e) => {
27921                        dlg.finished(false);
27922                        return Err(common::Error::MissingToken(e));
27923                    }
27924                },
27925            };
27926            request_value_reader
27927                .seek(std::io::SeekFrom::Start(0))
27928                .unwrap();
27929            let mut req_result = {
27930                let client = &self.hub.client;
27931                dlg.pre_request();
27932                let mut req_builder = hyper::Request::builder()
27933                    .method(hyper::Method::POST)
27934                    .uri(url.as_str())
27935                    .header(USER_AGENT, self.hub._user_agent.clone());
27936
27937                if let Some(token) = token.as_ref() {
27938                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27939                }
27940
27941                let request = req_builder
27942                    .header(CONTENT_TYPE, json_mime_type.to_string())
27943                    .header(CONTENT_LENGTH, request_size as u64)
27944                    .body(common::to_body(
27945                        request_value_reader.get_ref().clone().into(),
27946                    ));
27947
27948                client.request(request.unwrap()).await
27949            };
27950
27951            match req_result {
27952                Err(err) => {
27953                    if let common::Retry::After(d) = dlg.http_error(&err) {
27954                        sleep(d).await;
27955                        continue;
27956                    }
27957                    dlg.finished(false);
27958                    return Err(common::Error::HttpError(err));
27959                }
27960                Ok(res) => {
27961                    let (mut parts, body) = res.into_parts();
27962                    let mut body = common::Body::new(body);
27963                    if !parts.status.is_success() {
27964                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27965                        let error = serde_json::from_str(&common::to_string(&bytes));
27966                        let response = common::to_response(parts, bytes.into());
27967
27968                        if let common::Retry::After(d) =
27969                            dlg.http_failure(&response, error.as_ref().ok())
27970                        {
27971                            sleep(d).await;
27972                            continue;
27973                        }
27974
27975                        dlg.finished(false);
27976
27977                        return Err(match error {
27978                            Ok(value) => common::Error::BadRequest(value),
27979                            _ => common::Error::Failure(response),
27980                        });
27981                    }
27982                    let response = {
27983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27984                        let encoded = common::to_string(&bytes);
27985                        match serde_json::from_str(&encoded) {
27986                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27987                            Err(error) => {
27988                                dlg.response_json_decode_error(&encoded, &error);
27989                                return Err(common::Error::JsonDecodeError(
27990                                    encoded.to_string(),
27991                                    error,
27992                                ));
27993                            }
27994                        }
27995                    };
27996
27997                    dlg.finished(true);
27998                    return Ok(response);
27999                }
28000            }
28001        }
28002    }
28003
28004    ///
28005    /// Sets the *request* property to the given value.
28006    ///
28007    /// Even though the property as already been set when instantiating this call,
28008    /// we provide this method for API completeness.
28009    pub fn request(
28010        mut self,
28011        new_value: SetIamPolicyRequest,
28012    ) -> ProjectRegionJobSetIamPolicyCall<'a, C> {
28013        self._request = new_value;
28014        self
28015    }
28016    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
28017    ///
28018    /// Sets the *resource* path property to the given value.
28019    ///
28020    /// Even though the property as already been set when instantiating this call,
28021    /// we provide this method for API completeness.
28022    pub fn resource(mut self, new_value: &str) -> ProjectRegionJobSetIamPolicyCall<'a, C> {
28023        self._resource = new_value.to_string();
28024        self
28025    }
28026    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28027    /// while executing the actual API request.
28028    ///
28029    /// ````text
28030    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28031    /// ````
28032    ///
28033    /// Sets the *delegate* property to the given value.
28034    pub fn delegate(
28035        mut self,
28036        new_value: &'a mut dyn common::Delegate,
28037    ) -> ProjectRegionJobSetIamPolicyCall<'a, C> {
28038        self._delegate = Some(new_value);
28039        self
28040    }
28041
28042    /// Set any additional parameter of the query string used in the request.
28043    /// It should be used to set parameters which are not yet available through their own
28044    /// setters.
28045    ///
28046    /// Please note that this method must not be used to set any of the known parameters
28047    /// which have their own setter method. If done anyway, the request will fail.
28048    ///
28049    /// # Additional Parameters
28050    ///
28051    /// * *$.xgafv* (query-string) - V1 error format.
28052    /// * *access_token* (query-string) - OAuth access token.
28053    /// * *alt* (query-string) - Data format for response.
28054    /// * *callback* (query-string) - JSONP
28055    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28056    /// * *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.
28057    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28058    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28059    /// * *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.
28060    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28061    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28062    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobSetIamPolicyCall<'a, C>
28063    where
28064        T: AsRef<str>,
28065    {
28066        self._additional_params
28067            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28068        self
28069    }
28070
28071    /// Identifies the authorization scope for the method you are building.
28072    ///
28073    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28074    /// [`Scope::CloudPlatform`].
28075    ///
28076    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28077    /// tokens for more than one scope.
28078    ///
28079    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28080    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28081    /// sufficient, a read-write scope will do as well.
28082    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobSetIamPolicyCall<'a, C>
28083    where
28084        St: AsRef<str>,
28085    {
28086        self._scopes.insert(String::from(scope.as_ref()));
28087        self
28088    }
28089    /// Identifies the authorization scope(s) for the method you are building.
28090    ///
28091    /// See [`Self::add_scope()`] for details.
28092    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobSetIamPolicyCall<'a, C>
28093    where
28094        I: IntoIterator<Item = St>,
28095        St: AsRef<str>,
28096    {
28097        self._scopes
28098            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28099        self
28100    }
28101
28102    /// Removes all scopes, and no default scope will be used either.
28103    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28104    /// for details).
28105    pub fn clear_scopes(mut self) -> ProjectRegionJobSetIamPolicyCall<'a, C> {
28106        self._scopes.clear();
28107        self
28108    }
28109}
28110
28111/// Submits a job to a cluster.
28112///
28113/// A builder for the *regions.jobs.submit* method supported by a *project* resource.
28114/// It is not used directly, but through a [`ProjectMethods`] instance.
28115///
28116/// # Example
28117///
28118/// Instantiate a resource method builder
28119///
28120/// ```test_harness,no_run
28121/// # extern crate hyper;
28122/// # extern crate hyper_rustls;
28123/// # extern crate google_dataproc1 as dataproc1;
28124/// use dataproc1::api::SubmitJobRequest;
28125/// # async fn dox() {
28126/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28127///
28128/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28129/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28130/// #     secret,
28131/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28132/// # ).build().await.unwrap();
28133///
28134/// # let client = hyper_util::client::legacy::Client::builder(
28135/// #     hyper_util::rt::TokioExecutor::new()
28136/// # )
28137/// # .build(
28138/// #     hyper_rustls::HttpsConnectorBuilder::new()
28139/// #         .with_native_roots()
28140/// #         .unwrap()
28141/// #         .https_or_http()
28142/// #         .enable_http1()
28143/// #         .build()
28144/// # );
28145/// # let mut hub = Dataproc::new(client, auth);
28146/// // As the method needs a request, you would usually fill it with the desired information
28147/// // into the respective structure. Some of the parts shown here might not be applicable !
28148/// // Values shown here are possibly random and not representative !
28149/// let mut req = SubmitJobRequest::default();
28150///
28151/// // You can configure optional parameters by calling the respective setters at will, and
28152/// // execute the final call using `doit()`.
28153/// // Values shown here are possibly random and not representative !
28154/// let result = hub.projects().regions_jobs_submit(req, "projectId", "region")
28155///              .doit().await;
28156/// # }
28157/// ```
28158pub struct ProjectRegionJobSubmitCall<'a, C>
28159where
28160    C: 'a,
28161{
28162    hub: &'a Dataproc<C>,
28163    _request: SubmitJobRequest,
28164    _project_id: String,
28165    _region: String,
28166    _delegate: Option<&'a mut dyn common::Delegate>,
28167    _additional_params: HashMap<String, String>,
28168    _scopes: BTreeSet<String>,
28169}
28170
28171impl<'a, C> common::CallBuilder for ProjectRegionJobSubmitCall<'a, C> {}
28172
28173impl<'a, C> ProjectRegionJobSubmitCall<'a, C>
28174where
28175    C: common::Connector,
28176{
28177    /// Perform the operation you have build so far.
28178    pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
28179        use std::borrow::Cow;
28180        use std::io::{Read, Seek};
28181
28182        use common::{url::Params, ToParts};
28183        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28184
28185        let mut dd = common::DefaultDelegate;
28186        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28187        dlg.begin(common::MethodInfo {
28188            id: "dataproc.projects.regions.jobs.submit",
28189            http_method: hyper::Method::POST,
28190        });
28191
28192        for &field in ["alt", "projectId", "region"].iter() {
28193            if self._additional_params.contains_key(field) {
28194                dlg.finished(false);
28195                return Err(common::Error::FieldClash(field));
28196            }
28197        }
28198
28199        let mut params = Params::with_capacity(5 + self._additional_params.len());
28200        params.push("projectId", self._project_id);
28201        params.push("region", self._region);
28202
28203        params.extend(self._additional_params.iter());
28204
28205        params.push("alt", "json");
28206        let mut url =
28207            self.hub._base_url.clone() + "v1/projects/{projectId}/regions/{region}/jobs:submit";
28208        if self._scopes.is_empty() {
28209            self._scopes
28210                .insert(Scope::CloudPlatform.as_ref().to_string());
28211        }
28212
28213        #[allow(clippy::single_element_loop)]
28214        for &(find_this, param_name) in
28215            [("{projectId}", "projectId"), ("{region}", "region")].iter()
28216        {
28217            url = params.uri_replacement(url, param_name, find_this, false);
28218        }
28219        {
28220            let to_remove = ["region", "projectId"];
28221            params.remove_params(&to_remove);
28222        }
28223
28224        let url = params.parse_with_url(&url);
28225
28226        let mut json_mime_type = mime::APPLICATION_JSON;
28227        let mut request_value_reader = {
28228            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28229            common::remove_json_null_values(&mut value);
28230            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28231            serde_json::to_writer(&mut dst, &value).unwrap();
28232            dst
28233        };
28234        let request_size = request_value_reader
28235            .seek(std::io::SeekFrom::End(0))
28236            .unwrap();
28237        request_value_reader
28238            .seek(std::io::SeekFrom::Start(0))
28239            .unwrap();
28240
28241        loop {
28242            let token = match self
28243                .hub
28244                .auth
28245                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28246                .await
28247            {
28248                Ok(token) => token,
28249                Err(e) => match dlg.token(e) {
28250                    Ok(token) => token,
28251                    Err(e) => {
28252                        dlg.finished(false);
28253                        return Err(common::Error::MissingToken(e));
28254                    }
28255                },
28256            };
28257            request_value_reader
28258                .seek(std::io::SeekFrom::Start(0))
28259                .unwrap();
28260            let mut req_result = {
28261                let client = &self.hub.client;
28262                dlg.pre_request();
28263                let mut req_builder = hyper::Request::builder()
28264                    .method(hyper::Method::POST)
28265                    .uri(url.as_str())
28266                    .header(USER_AGENT, self.hub._user_agent.clone());
28267
28268                if let Some(token) = token.as_ref() {
28269                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28270                }
28271
28272                let request = req_builder
28273                    .header(CONTENT_TYPE, json_mime_type.to_string())
28274                    .header(CONTENT_LENGTH, request_size as u64)
28275                    .body(common::to_body(
28276                        request_value_reader.get_ref().clone().into(),
28277                    ));
28278
28279                client.request(request.unwrap()).await
28280            };
28281
28282            match req_result {
28283                Err(err) => {
28284                    if let common::Retry::After(d) = dlg.http_error(&err) {
28285                        sleep(d).await;
28286                        continue;
28287                    }
28288                    dlg.finished(false);
28289                    return Err(common::Error::HttpError(err));
28290                }
28291                Ok(res) => {
28292                    let (mut parts, body) = res.into_parts();
28293                    let mut body = common::Body::new(body);
28294                    if !parts.status.is_success() {
28295                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28296                        let error = serde_json::from_str(&common::to_string(&bytes));
28297                        let response = common::to_response(parts, bytes.into());
28298
28299                        if let common::Retry::After(d) =
28300                            dlg.http_failure(&response, error.as_ref().ok())
28301                        {
28302                            sleep(d).await;
28303                            continue;
28304                        }
28305
28306                        dlg.finished(false);
28307
28308                        return Err(match error {
28309                            Ok(value) => common::Error::BadRequest(value),
28310                            _ => common::Error::Failure(response),
28311                        });
28312                    }
28313                    let response = {
28314                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28315                        let encoded = common::to_string(&bytes);
28316                        match serde_json::from_str(&encoded) {
28317                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28318                            Err(error) => {
28319                                dlg.response_json_decode_error(&encoded, &error);
28320                                return Err(common::Error::JsonDecodeError(
28321                                    encoded.to_string(),
28322                                    error,
28323                                ));
28324                            }
28325                        }
28326                    };
28327
28328                    dlg.finished(true);
28329                    return Ok(response);
28330                }
28331            }
28332        }
28333    }
28334
28335    ///
28336    /// Sets the *request* property to the given value.
28337    ///
28338    /// Even though the property as already been set when instantiating this call,
28339    /// we provide this method for API completeness.
28340    pub fn request(mut self, new_value: SubmitJobRequest) -> ProjectRegionJobSubmitCall<'a, C> {
28341        self._request = new_value;
28342        self
28343    }
28344    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
28345    ///
28346    /// Sets the *project id* path property to the given value.
28347    ///
28348    /// Even though the property as already been set when instantiating this call,
28349    /// we provide this method for API completeness.
28350    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobSubmitCall<'a, C> {
28351        self._project_id = new_value.to_string();
28352        self
28353    }
28354    /// Required. The Dataproc region in which to handle the request.
28355    ///
28356    /// Sets the *region* path property to the given value.
28357    ///
28358    /// Even though the property as already been set when instantiating this call,
28359    /// we provide this method for API completeness.
28360    pub fn region(mut self, new_value: &str) -> ProjectRegionJobSubmitCall<'a, C> {
28361        self._region = new_value.to_string();
28362        self
28363    }
28364    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28365    /// while executing the actual API request.
28366    ///
28367    /// ````text
28368    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28369    /// ````
28370    ///
28371    /// Sets the *delegate* property to the given value.
28372    pub fn delegate(
28373        mut self,
28374        new_value: &'a mut dyn common::Delegate,
28375    ) -> ProjectRegionJobSubmitCall<'a, C> {
28376        self._delegate = Some(new_value);
28377        self
28378    }
28379
28380    /// Set any additional parameter of the query string used in the request.
28381    /// It should be used to set parameters which are not yet available through their own
28382    /// setters.
28383    ///
28384    /// Please note that this method must not be used to set any of the known parameters
28385    /// which have their own setter method. If done anyway, the request will fail.
28386    ///
28387    /// # Additional Parameters
28388    ///
28389    /// * *$.xgafv* (query-string) - V1 error format.
28390    /// * *access_token* (query-string) - OAuth access token.
28391    /// * *alt* (query-string) - Data format for response.
28392    /// * *callback* (query-string) - JSONP
28393    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28394    /// * *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.
28395    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28396    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28397    /// * *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.
28398    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28399    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28400    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobSubmitCall<'a, C>
28401    where
28402        T: AsRef<str>,
28403    {
28404        self._additional_params
28405            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28406        self
28407    }
28408
28409    /// Identifies the authorization scope for the method you are building.
28410    ///
28411    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28412    /// [`Scope::CloudPlatform`].
28413    ///
28414    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28415    /// tokens for more than one scope.
28416    ///
28417    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28418    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28419    /// sufficient, a read-write scope will do as well.
28420    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobSubmitCall<'a, C>
28421    where
28422        St: AsRef<str>,
28423    {
28424        self._scopes.insert(String::from(scope.as_ref()));
28425        self
28426    }
28427    /// Identifies the authorization scope(s) for the method you are building.
28428    ///
28429    /// See [`Self::add_scope()`] for details.
28430    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobSubmitCall<'a, C>
28431    where
28432        I: IntoIterator<Item = St>,
28433        St: AsRef<str>,
28434    {
28435        self._scopes
28436            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28437        self
28438    }
28439
28440    /// Removes all scopes, and no default scope will be used either.
28441    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28442    /// for details).
28443    pub fn clear_scopes(mut self) -> ProjectRegionJobSubmitCall<'a, C> {
28444        self._scopes.clear();
28445        self
28446    }
28447}
28448
28449/// Submits job to a cluster.
28450///
28451/// A builder for the *regions.jobs.submitAsOperation* method supported by a *project* resource.
28452/// It is not used directly, but through a [`ProjectMethods`] instance.
28453///
28454/// # Example
28455///
28456/// Instantiate a resource method builder
28457///
28458/// ```test_harness,no_run
28459/// # extern crate hyper;
28460/// # extern crate hyper_rustls;
28461/// # extern crate google_dataproc1 as dataproc1;
28462/// use dataproc1::api::SubmitJobRequest;
28463/// # async fn dox() {
28464/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28465///
28466/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28467/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28468/// #     secret,
28469/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28470/// # ).build().await.unwrap();
28471///
28472/// # let client = hyper_util::client::legacy::Client::builder(
28473/// #     hyper_util::rt::TokioExecutor::new()
28474/// # )
28475/// # .build(
28476/// #     hyper_rustls::HttpsConnectorBuilder::new()
28477/// #         .with_native_roots()
28478/// #         .unwrap()
28479/// #         .https_or_http()
28480/// #         .enable_http1()
28481/// #         .build()
28482/// # );
28483/// # let mut hub = Dataproc::new(client, auth);
28484/// // As the method needs a request, you would usually fill it with the desired information
28485/// // into the respective structure. Some of the parts shown here might not be applicable !
28486/// // Values shown here are possibly random and not representative !
28487/// let mut req = SubmitJobRequest::default();
28488///
28489/// // You can configure optional parameters by calling the respective setters at will, and
28490/// // execute the final call using `doit()`.
28491/// // Values shown here are possibly random and not representative !
28492/// let result = hub.projects().regions_jobs_submit_as_operation(req, "projectId", "region")
28493///              .doit().await;
28494/// # }
28495/// ```
28496pub struct ProjectRegionJobSubmitAsOperationCall<'a, C>
28497where
28498    C: 'a,
28499{
28500    hub: &'a Dataproc<C>,
28501    _request: SubmitJobRequest,
28502    _project_id: String,
28503    _region: String,
28504    _delegate: Option<&'a mut dyn common::Delegate>,
28505    _additional_params: HashMap<String, String>,
28506    _scopes: BTreeSet<String>,
28507}
28508
28509impl<'a, C> common::CallBuilder for ProjectRegionJobSubmitAsOperationCall<'a, C> {}
28510
28511impl<'a, C> ProjectRegionJobSubmitAsOperationCall<'a, C>
28512where
28513    C: common::Connector,
28514{
28515    /// Perform the operation you have build so far.
28516    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
28517        use std::borrow::Cow;
28518        use std::io::{Read, Seek};
28519
28520        use common::{url::Params, ToParts};
28521        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28522
28523        let mut dd = common::DefaultDelegate;
28524        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28525        dlg.begin(common::MethodInfo {
28526            id: "dataproc.projects.regions.jobs.submitAsOperation",
28527            http_method: hyper::Method::POST,
28528        });
28529
28530        for &field in ["alt", "projectId", "region"].iter() {
28531            if self._additional_params.contains_key(field) {
28532                dlg.finished(false);
28533                return Err(common::Error::FieldClash(field));
28534            }
28535        }
28536
28537        let mut params = Params::with_capacity(5 + self._additional_params.len());
28538        params.push("projectId", self._project_id);
28539        params.push("region", self._region);
28540
28541        params.extend(self._additional_params.iter());
28542
28543        params.push("alt", "json");
28544        let mut url = self.hub._base_url.clone()
28545            + "v1/projects/{projectId}/regions/{region}/jobs:submitAsOperation";
28546        if self._scopes.is_empty() {
28547            self._scopes
28548                .insert(Scope::CloudPlatform.as_ref().to_string());
28549        }
28550
28551        #[allow(clippy::single_element_loop)]
28552        for &(find_this, param_name) in
28553            [("{projectId}", "projectId"), ("{region}", "region")].iter()
28554        {
28555            url = params.uri_replacement(url, param_name, find_this, false);
28556        }
28557        {
28558            let to_remove = ["region", "projectId"];
28559            params.remove_params(&to_remove);
28560        }
28561
28562        let url = params.parse_with_url(&url);
28563
28564        let mut json_mime_type = mime::APPLICATION_JSON;
28565        let mut request_value_reader = {
28566            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28567            common::remove_json_null_values(&mut value);
28568            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28569            serde_json::to_writer(&mut dst, &value).unwrap();
28570            dst
28571        };
28572        let request_size = request_value_reader
28573            .seek(std::io::SeekFrom::End(0))
28574            .unwrap();
28575        request_value_reader
28576            .seek(std::io::SeekFrom::Start(0))
28577            .unwrap();
28578
28579        loop {
28580            let token = match self
28581                .hub
28582                .auth
28583                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28584                .await
28585            {
28586                Ok(token) => token,
28587                Err(e) => match dlg.token(e) {
28588                    Ok(token) => token,
28589                    Err(e) => {
28590                        dlg.finished(false);
28591                        return Err(common::Error::MissingToken(e));
28592                    }
28593                },
28594            };
28595            request_value_reader
28596                .seek(std::io::SeekFrom::Start(0))
28597                .unwrap();
28598            let mut req_result = {
28599                let client = &self.hub.client;
28600                dlg.pre_request();
28601                let mut req_builder = hyper::Request::builder()
28602                    .method(hyper::Method::POST)
28603                    .uri(url.as_str())
28604                    .header(USER_AGENT, self.hub._user_agent.clone());
28605
28606                if let Some(token) = token.as_ref() {
28607                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28608                }
28609
28610                let request = req_builder
28611                    .header(CONTENT_TYPE, json_mime_type.to_string())
28612                    .header(CONTENT_LENGTH, request_size as u64)
28613                    .body(common::to_body(
28614                        request_value_reader.get_ref().clone().into(),
28615                    ));
28616
28617                client.request(request.unwrap()).await
28618            };
28619
28620            match req_result {
28621                Err(err) => {
28622                    if let common::Retry::After(d) = dlg.http_error(&err) {
28623                        sleep(d).await;
28624                        continue;
28625                    }
28626                    dlg.finished(false);
28627                    return Err(common::Error::HttpError(err));
28628                }
28629                Ok(res) => {
28630                    let (mut parts, body) = res.into_parts();
28631                    let mut body = common::Body::new(body);
28632                    if !parts.status.is_success() {
28633                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28634                        let error = serde_json::from_str(&common::to_string(&bytes));
28635                        let response = common::to_response(parts, bytes.into());
28636
28637                        if let common::Retry::After(d) =
28638                            dlg.http_failure(&response, error.as_ref().ok())
28639                        {
28640                            sleep(d).await;
28641                            continue;
28642                        }
28643
28644                        dlg.finished(false);
28645
28646                        return Err(match error {
28647                            Ok(value) => common::Error::BadRequest(value),
28648                            _ => common::Error::Failure(response),
28649                        });
28650                    }
28651                    let response = {
28652                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28653                        let encoded = common::to_string(&bytes);
28654                        match serde_json::from_str(&encoded) {
28655                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28656                            Err(error) => {
28657                                dlg.response_json_decode_error(&encoded, &error);
28658                                return Err(common::Error::JsonDecodeError(
28659                                    encoded.to_string(),
28660                                    error,
28661                                ));
28662                            }
28663                        }
28664                    };
28665
28666                    dlg.finished(true);
28667                    return Ok(response);
28668                }
28669            }
28670        }
28671    }
28672
28673    ///
28674    /// Sets the *request* property to the given value.
28675    ///
28676    /// Even though the property as already been set when instantiating this call,
28677    /// we provide this method for API completeness.
28678    pub fn request(
28679        mut self,
28680        new_value: SubmitJobRequest,
28681    ) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
28682        self._request = new_value;
28683        self
28684    }
28685    /// Required. The ID of the Google Cloud Platform project that the job belongs to.
28686    ///
28687    /// Sets the *project id* path property to the given value.
28688    ///
28689    /// Even though the property as already been set when instantiating this call,
28690    /// we provide this method for API completeness.
28691    pub fn project_id(mut self, new_value: &str) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
28692        self._project_id = new_value.to_string();
28693        self
28694    }
28695    /// Required. The Dataproc region in which to handle the request.
28696    ///
28697    /// Sets the *region* path property to the given value.
28698    ///
28699    /// Even though the property as already been set when instantiating this call,
28700    /// we provide this method for API completeness.
28701    pub fn region(mut self, new_value: &str) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
28702        self._region = new_value.to_string();
28703        self
28704    }
28705    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28706    /// while executing the actual API request.
28707    ///
28708    /// ````text
28709    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28710    /// ````
28711    ///
28712    /// Sets the *delegate* property to the given value.
28713    pub fn delegate(
28714        mut self,
28715        new_value: &'a mut dyn common::Delegate,
28716    ) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
28717        self._delegate = Some(new_value);
28718        self
28719    }
28720
28721    /// Set any additional parameter of the query string used in the request.
28722    /// It should be used to set parameters which are not yet available through their own
28723    /// setters.
28724    ///
28725    /// Please note that this method must not be used to set any of the known parameters
28726    /// which have their own setter method. If done anyway, the request will fail.
28727    ///
28728    /// # Additional Parameters
28729    ///
28730    /// * *$.xgafv* (query-string) - V1 error format.
28731    /// * *access_token* (query-string) - OAuth access token.
28732    /// * *alt* (query-string) - Data format for response.
28733    /// * *callback* (query-string) - JSONP
28734    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28735    /// * *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.
28736    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28737    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28738    /// * *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.
28739    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28740    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28741    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobSubmitAsOperationCall<'a, C>
28742    where
28743        T: AsRef<str>,
28744    {
28745        self._additional_params
28746            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28747        self
28748    }
28749
28750    /// Identifies the authorization scope for the method you are building.
28751    ///
28752    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28753    /// [`Scope::CloudPlatform`].
28754    ///
28755    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28756    /// tokens for more than one scope.
28757    ///
28758    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28759    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28760    /// sufficient, a read-write scope will do as well.
28761    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobSubmitAsOperationCall<'a, C>
28762    where
28763        St: AsRef<str>,
28764    {
28765        self._scopes.insert(String::from(scope.as_ref()));
28766        self
28767    }
28768    /// Identifies the authorization scope(s) for the method you are building.
28769    ///
28770    /// See [`Self::add_scope()`] for details.
28771    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobSubmitAsOperationCall<'a, C>
28772    where
28773        I: IntoIterator<Item = St>,
28774        St: AsRef<str>,
28775    {
28776        self._scopes
28777            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28778        self
28779    }
28780
28781    /// Removes all scopes, and no default scope will be used either.
28782    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28783    /// for details).
28784    pub fn clear_scopes(mut self) -> ProjectRegionJobSubmitAsOperationCall<'a, C> {
28785        self._scopes.clear();
28786        self
28787    }
28788}
28789
28790/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
28791///
28792/// A builder for the *regions.jobs.testIamPermissions* method supported by a *project* resource.
28793/// It is not used directly, but through a [`ProjectMethods`] instance.
28794///
28795/// # Example
28796///
28797/// Instantiate a resource method builder
28798///
28799/// ```test_harness,no_run
28800/// # extern crate hyper;
28801/// # extern crate hyper_rustls;
28802/// # extern crate google_dataproc1 as dataproc1;
28803/// use dataproc1::api::TestIamPermissionsRequest;
28804/// # async fn dox() {
28805/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28806///
28807/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
28809/// #     secret,
28810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28811/// # ).build().await.unwrap();
28812///
28813/// # let client = hyper_util::client::legacy::Client::builder(
28814/// #     hyper_util::rt::TokioExecutor::new()
28815/// # )
28816/// # .build(
28817/// #     hyper_rustls::HttpsConnectorBuilder::new()
28818/// #         .with_native_roots()
28819/// #         .unwrap()
28820/// #         .https_or_http()
28821/// #         .enable_http1()
28822/// #         .build()
28823/// # );
28824/// # let mut hub = Dataproc::new(client, auth);
28825/// // As the method needs a request, you would usually fill it with the desired information
28826/// // into the respective structure. Some of the parts shown here might not be applicable !
28827/// // Values shown here are possibly random and not representative !
28828/// let mut req = TestIamPermissionsRequest::default();
28829///
28830/// // You can configure optional parameters by calling the respective setters at will, and
28831/// // execute the final call using `doit()`.
28832/// // Values shown here are possibly random and not representative !
28833/// let result = hub.projects().regions_jobs_test_iam_permissions(req, "resource")
28834///              .doit().await;
28835/// # }
28836/// ```
28837pub struct ProjectRegionJobTestIamPermissionCall<'a, C>
28838where
28839    C: 'a,
28840{
28841    hub: &'a Dataproc<C>,
28842    _request: TestIamPermissionsRequest,
28843    _resource: String,
28844    _delegate: Option<&'a mut dyn common::Delegate>,
28845    _additional_params: HashMap<String, String>,
28846    _scopes: BTreeSet<String>,
28847}
28848
28849impl<'a, C> common::CallBuilder for ProjectRegionJobTestIamPermissionCall<'a, C> {}
28850
28851impl<'a, C> ProjectRegionJobTestIamPermissionCall<'a, C>
28852where
28853    C: common::Connector,
28854{
28855    /// Perform the operation you have build so far.
28856    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
28857        use std::borrow::Cow;
28858        use std::io::{Read, Seek};
28859
28860        use common::{url::Params, ToParts};
28861        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28862
28863        let mut dd = common::DefaultDelegate;
28864        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28865        dlg.begin(common::MethodInfo {
28866            id: "dataproc.projects.regions.jobs.testIamPermissions",
28867            http_method: hyper::Method::POST,
28868        });
28869
28870        for &field in ["alt", "resource"].iter() {
28871            if self._additional_params.contains_key(field) {
28872                dlg.finished(false);
28873                return Err(common::Error::FieldClash(field));
28874            }
28875        }
28876
28877        let mut params = Params::with_capacity(4 + self._additional_params.len());
28878        params.push("resource", self._resource);
28879
28880        params.extend(self._additional_params.iter());
28881
28882        params.push("alt", "json");
28883        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
28884        if self._scopes.is_empty() {
28885            self._scopes
28886                .insert(Scope::CloudPlatform.as_ref().to_string());
28887        }
28888
28889        #[allow(clippy::single_element_loop)]
28890        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
28891            url = params.uri_replacement(url, param_name, find_this, true);
28892        }
28893        {
28894            let to_remove = ["resource"];
28895            params.remove_params(&to_remove);
28896        }
28897
28898        let url = params.parse_with_url(&url);
28899
28900        let mut json_mime_type = mime::APPLICATION_JSON;
28901        let mut request_value_reader = {
28902            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28903            common::remove_json_null_values(&mut value);
28904            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28905            serde_json::to_writer(&mut dst, &value).unwrap();
28906            dst
28907        };
28908        let request_size = request_value_reader
28909            .seek(std::io::SeekFrom::End(0))
28910            .unwrap();
28911        request_value_reader
28912            .seek(std::io::SeekFrom::Start(0))
28913            .unwrap();
28914
28915        loop {
28916            let token = match self
28917                .hub
28918                .auth
28919                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28920                .await
28921            {
28922                Ok(token) => token,
28923                Err(e) => match dlg.token(e) {
28924                    Ok(token) => token,
28925                    Err(e) => {
28926                        dlg.finished(false);
28927                        return Err(common::Error::MissingToken(e));
28928                    }
28929                },
28930            };
28931            request_value_reader
28932                .seek(std::io::SeekFrom::Start(0))
28933                .unwrap();
28934            let mut req_result = {
28935                let client = &self.hub.client;
28936                dlg.pre_request();
28937                let mut req_builder = hyper::Request::builder()
28938                    .method(hyper::Method::POST)
28939                    .uri(url.as_str())
28940                    .header(USER_AGENT, self.hub._user_agent.clone());
28941
28942                if let Some(token) = token.as_ref() {
28943                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28944                }
28945
28946                let request = req_builder
28947                    .header(CONTENT_TYPE, json_mime_type.to_string())
28948                    .header(CONTENT_LENGTH, request_size as u64)
28949                    .body(common::to_body(
28950                        request_value_reader.get_ref().clone().into(),
28951                    ));
28952
28953                client.request(request.unwrap()).await
28954            };
28955
28956            match req_result {
28957                Err(err) => {
28958                    if let common::Retry::After(d) = dlg.http_error(&err) {
28959                        sleep(d).await;
28960                        continue;
28961                    }
28962                    dlg.finished(false);
28963                    return Err(common::Error::HttpError(err));
28964                }
28965                Ok(res) => {
28966                    let (mut parts, body) = res.into_parts();
28967                    let mut body = common::Body::new(body);
28968                    if !parts.status.is_success() {
28969                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28970                        let error = serde_json::from_str(&common::to_string(&bytes));
28971                        let response = common::to_response(parts, bytes.into());
28972
28973                        if let common::Retry::After(d) =
28974                            dlg.http_failure(&response, error.as_ref().ok())
28975                        {
28976                            sleep(d).await;
28977                            continue;
28978                        }
28979
28980                        dlg.finished(false);
28981
28982                        return Err(match error {
28983                            Ok(value) => common::Error::BadRequest(value),
28984                            _ => common::Error::Failure(response),
28985                        });
28986                    }
28987                    let response = {
28988                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28989                        let encoded = common::to_string(&bytes);
28990                        match serde_json::from_str(&encoded) {
28991                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28992                            Err(error) => {
28993                                dlg.response_json_decode_error(&encoded, &error);
28994                                return Err(common::Error::JsonDecodeError(
28995                                    encoded.to_string(),
28996                                    error,
28997                                ));
28998                            }
28999                        }
29000                    };
29001
29002                    dlg.finished(true);
29003                    return Ok(response);
29004                }
29005            }
29006        }
29007    }
29008
29009    ///
29010    /// Sets the *request* property to the given value.
29011    ///
29012    /// Even though the property as already been set when instantiating this call,
29013    /// we provide this method for API completeness.
29014    pub fn request(
29015        mut self,
29016        new_value: TestIamPermissionsRequest,
29017    ) -> ProjectRegionJobTestIamPermissionCall<'a, C> {
29018        self._request = new_value;
29019        self
29020    }
29021    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
29022    ///
29023    /// Sets the *resource* path property to the given value.
29024    ///
29025    /// Even though the property as already been set when instantiating this call,
29026    /// we provide this method for API completeness.
29027    pub fn resource(mut self, new_value: &str) -> ProjectRegionJobTestIamPermissionCall<'a, C> {
29028        self._resource = new_value.to_string();
29029        self
29030    }
29031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29032    /// while executing the actual API request.
29033    ///
29034    /// ````text
29035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29036    /// ````
29037    ///
29038    /// Sets the *delegate* property to the given value.
29039    pub fn delegate(
29040        mut self,
29041        new_value: &'a mut dyn common::Delegate,
29042    ) -> ProjectRegionJobTestIamPermissionCall<'a, C> {
29043        self._delegate = Some(new_value);
29044        self
29045    }
29046
29047    /// Set any additional parameter of the query string used in the request.
29048    /// It should be used to set parameters which are not yet available through their own
29049    /// setters.
29050    ///
29051    /// Please note that this method must not be used to set any of the known parameters
29052    /// which have their own setter method. If done anyway, the request will fail.
29053    ///
29054    /// # Additional Parameters
29055    ///
29056    /// * *$.xgafv* (query-string) - V1 error format.
29057    /// * *access_token* (query-string) - OAuth access token.
29058    /// * *alt* (query-string) - Data format for response.
29059    /// * *callback* (query-string) - JSONP
29060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29061    /// * *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.
29062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29064    /// * *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.
29065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29067    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionJobTestIamPermissionCall<'a, C>
29068    where
29069        T: AsRef<str>,
29070    {
29071        self._additional_params
29072            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29073        self
29074    }
29075
29076    /// Identifies the authorization scope for the method you are building.
29077    ///
29078    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29079    /// [`Scope::CloudPlatform`].
29080    ///
29081    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29082    /// tokens for more than one scope.
29083    ///
29084    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29085    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29086    /// sufficient, a read-write scope will do as well.
29087    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionJobTestIamPermissionCall<'a, C>
29088    where
29089        St: AsRef<str>,
29090    {
29091        self._scopes.insert(String::from(scope.as_ref()));
29092        self
29093    }
29094    /// Identifies the authorization scope(s) for the method you are building.
29095    ///
29096    /// See [`Self::add_scope()`] for details.
29097    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionJobTestIamPermissionCall<'a, C>
29098    where
29099        I: IntoIterator<Item = St>,
29100        St: AsRef<str>,
29101    {
29102        self._scopes
29103            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29104        self
29105    }
29106
29107    /// Removes all scopes, and no default scope will be used either.
29108    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29109    /// for details).
29110    pub fn clear_scopes(mut self) -> ProjectRegionJobTestIamPermissionCall<'a, C> {
29111        self._scopes.clear();
29112        self
29113    }
29114}
29115
29116/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
29117///
29118/// A builder for the *regions.operations.cancel* method supported by a *project* resource.
29119/// It is not used directly, but through a [`ProjectMethods`] instance.
29120///
29121/// # Example
29122///
29123/// Instantiate a resource method builder
29124///
29125/// ```test_harness,no_run
29126/// # extern crate hyper;
29127/// # extern crate hyper_rustls;
29128/// # extern crate google_dataproc1 as dataproc1;
29129/// # async fn dox() {
29130/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29131///
29132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29134/// #     secret,
29135/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29136/// # ).build().await.unwrap();
29137///
29138/// # let client = hyper_util::client::legacy::Client::builder(
29139/// #     hyper_util::rt::TokioExecutor::new()
29140/// # )
29141/// # .build(
29142/// #     hyper_rustls::HttpsConnectorBuilder::new()
29143/// #         .with_native_roots()
29144/// #         .unwrap()
29145/// #         .https_or_http()
29146/// #         .enable_http1()
29147/// #         .build()
29148/// # );
29149/// # let mut hub = Dataproc::new(client, auth);
29150/// // You can configure optional parameters by calling the respective setters at will, and
29151/// // execute the final call using `doit()`.
29152/// // Values shown here are possibly random and not representative !
29153/// let result = hub.projects().regions_operations_cancel("name")
29154///              .doit().await;
29155/// # }
29156/// ```
29157pub struct ProjectRegionOperationCancelCall<'a, C>
29158where
29159    C: 'a,
29160{
29161    hub: &'a Dataproc<C>,
29162    _name: String,
29163    _delegate: Option<&'a mut dyn common::Delegate>,
29164    _additional_params: HashMap<String, String>,
29165    _scopes: BTreeSet<String>,
29166}
29167
29168impl<'a, C> common::CallBuilder for ProjectRegionOperationCancelCall<'a, C> {}
29169
29170impl<'a, C> ProjectRegionOperationCancelCall<'a, C>
29171where
29172    C: common::Connector,
29173{
29174    /// Perform the operation you have build so far.
29175    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
29176        use std::borrow::Cow;
29177        use std::io::{Read, Seek};
29178
29179        use common::{url::Params, ToParts};
29180        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29181
29182        let mut dd = common::DefaultDelegate;
29183        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29184        dlg.begin(common::MethodInfo {
29185            id: "dataproc.projects.regions.operations.cancel",
29186            http_method: hyper::Method::POST,
29187        });
29188
29189        for &field in ["alt", "name"].iter() {
29190            if self._additional_params.contains_key(field) {
29191                dlg.finished(false);
29192                return Err(common::Error::FieldClash(field));
29193            }
29194        }
29195
29196        let mut params = Params::with_capacity(3 + self._additional_params.len());
29197        params.push("name", self._name);
29198
29199        params.extend(self._additional_params.iter());
29200
29201        params.push("alt", "json");
29202        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
29203        if self._scopes.is_empty() {
29204            self._scopes
29205                .insert(Scope::CloudPlatform.as_ref().to_string());
29206        }
29207
29208        #[allow(clippy::single_element_loop)]
29209        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29210            url = params.uri_replacement(url, param_name, find_this, true);
29211        }
29212        {
29213            let to_remove = ["name"];
29214            params.remove_params(&to_remove);
29215        }
29216
29217        let url = params.parse_with_url(&url);
29218
29219        loop {
29220            let token = match self
29221                .hub
29222                .auth
29223                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29224                .await
29225            {
29226                Ok(token) => token,
29227                Err(e) => match dlg.token(e) {
29228                    Ok(token) => token,
29229                    Err(e) => {
29230                        dlg.finished(false);
29231                        return Err(common::Error::MissingToken(e));
29232                    }
29233                },
29234            };
29235            let mut req_result = {
29236                let client = &self.hub.client;
29237                dlg.pre_request();
29238                let mut req_builder = hyper::Request::builder()
29239                    .method(hyper::Method::POST)
29240                    .uri(url.as_str())
29241                    .header(USER_AGENT, self.hub._user_agent.clone());
29242
29243                if let Some(token) = token.as_ref() {
29244                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29245                }
29246
29247                let request = req_builder
29248                    .header(CONTENT_LENGTH, 0_u64)
29249                    .body(common::to_body::<String>(None));
29250
29251                client.request(request.unwrap()).await
29252            };
29253
29254            match req_result {
29255                Err(err) => {
29256                    if let common::Retry::After(d) = dlg.http_error(&err) {
29257                        sleep(d).await;
29258                        continue;
29259                    }
29260                    dlg.finished(false);
29261                    return Err(common::Error::HttpError(err));
29262                }
29263                Ok(res) => {
29264                    let (mut parts, body) = res.into_parts();
29265                    let mut body = common::Body::new(body);
29266                    if !parts.status.is_success() {
29267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29268                        let error = serde_json::from_str(&common::to_string(&bytes));
29269                        let response = common::to_response(parts, bytes.into());
29270
29271                        if let common::Retry::After(d) =
29272                            dlg.http_failure(&response, error.as_ref().ok())
29273                        {
29274                            sleep(d).await;
29275                            continue;
29276                        }
29277
29278                        dlg.finished(false);
29279
29280                        return Err(match error {
29281                            Ok(value) => common::Error::BadRequest(value),
29282                            _ => common::Error::Failure(response),
29283                        });
29284                    }
29285                    let response = {
29286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29287                        let encoded = common::to_string(&bytes);
29288                        match serde_json::from_str(&encoded) {
29289                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29290                            Err(error) => {
29291                                dlg.response_json_decode_error(&encoded, &error);
29292                                return Err(common::Error::JsonDecodeError(
29293                                    encoded.to_string(),
29294                                    error,
29295                                ));
29296                            }
29297                        }
29298                    };
29299
29300                    dlg.finished(true);
29301                    return Ok(response);
29302                }
29303            }
29304        }
29305    }
29306
29307    /// The name of the operation resource to be cancelled.
29308    ///
29309    /// Sets the *name* path property to the given value.
29310    ///
29311    /// Even though the property as already been set when instantiating this call,
29312    /// we provide this method for API completeness.
29313    pub fn name(mut self, new_value: &str) -> ProjectRegionOperationCancelCall<'a, C> {
29314        self._name = new_value.to_string();
29315        self
29316    }
29317    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29318    /// while executing the actual API request.
29319    ///
29320    /// ````text
29321    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29322    /// ````
29323    ///
29324    /// Sets the *delegate* property to the given value.
29325    pub fn delegate(
29326        mut self,
29327        new_value: &'a mut dyn common::Delegate,
29328    ) -> ProjectRegionOperationCancelCall<'a, C> {
29329        self._delegate = Some(new_value);
29330        self
29331    }
29332
29333    /// Set any additional parameter of the query string used in the request.
29334    /// It should be used to set parameters which are not yet available through their own
29335    /// setters.
29336    ///
29337    /// Please note that this method must not be used to set any of the known parameters
29338    /// which have their own setter method. If done anyway, the request will fail.
29339    ///
29340    /// # Additional Parameters
29341    ///
29342    /// * *$.xgafv* (query-string) - V1 error format.
29343    /// * *access_token* (query-string) - OAuth access token.
29344    /// * *alt* (query-string) - Data format for response.
29345    /// * *callback* (query-string) - JSONP
29346    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29347    /// * *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.
29348    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29349    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29350    /// * *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.
29351    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29352    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29353    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationCancelCall<'a, C>
29354    where
29355        T: AsRef<str>,
29356    {
29357        self._additional_params
29358            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29359        self
29360    }
29361
29362    /// Identifies the authorization scope for the method you are building.
29363    ///
29364    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29365    /// [`Scope::CloudPlatform`].
29366    ///
29367    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29368    /// tokens for more than one scope.
29369    ///
29370    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29371    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29372    /// sufficient, a read-write scope will do as well.
29373    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationCancelCall<'a, C>
29374    where
29375        St: AsRef<str>,
29376    {
29377        self._scopes.insert(String::from(scope.as_ref()));
29378        self
29379    }
29380    /// Identifies the authorization scope(s) for the method you are building.
29381    ///
29382    /// See [`Self::add_scope()`] for details.
29383    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationCancelCall<'a, C>
29384    where
29385        I: IntoIterator<Item = St>,
29386        St: AsRef<str>,
29387    {
29388        self._scopes
29389            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29390        self
29391    }
29392
29393    /// Removes all scopes, and no default scope will be used either.
29394    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29395    /// for details).
29396    pub fn clear_scopes(mut self) -> ProjectRegionOperationCancelCall<'a, C> {
29397        self._scopes.clear();
29398        self
29399    }
29400}
29401
29402/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.
29403///
29404/// A builder for the *regions.operations.delete* method supported by a *project* resource.
29405/// It is not used directly, but through a [`ProjectMethods`] instance.
29406///
29407/// # Example
29408///
29409/// Instantiate a resource method builder
29410///
29411/// ```test_harness,no_run
29412/// # extern crate hyper;
29413/// # extern crate hyper_rustls;
29414/// # extern crate google_dataproc1 as dataproc1;
29415/// # async fn dox() {
29416/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29417///
29418/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29419/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29420/// #     secret,
29421/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29422/// # ).build().await.unwrap();
29423///
29424/// # let client = hyper_util::client::legacy::Client::builder(
29425/// #     hyper_util::rt::TokioExecutor::new()
29426/// # )
29427/// # .build(
29428/// #     hyper_rustls::HttpsConnectorBuilder::new()
29429/// #         .with_native_roots()
29430/// #         .unwrap()
29431/// #         .https_or_http()
29432/// #         .enable_http1()
29433/// #         .build()
29434/// # );
29435/// # let mut hub = Dataproc::new(client, auth);
29436/// // You can configure optional parameters by calling the respective setters at will, and
29437/// // execute the final call using `doit()`.
29438/// // Values shown here are possibly random and not representative !
29439/// let result = hub.projects().regions_operations_delete("name")
29440///              .doit().await;
29441/// # }
29442/// ```
29443pub struct ProjectRegionOperationDeleteCall<'a, C>
29444where
29445    C: 'a,
29446{
29447    hub: &'a Dataproc<C>,
29448    _name: String,
29449    _delegate: Option<&'a mut dyn common::Delegate>,
29450    _additional_params: HashMap<String, String>,
29451    _scopes: BTreeSet<String>,
29452}
29453
29454impl<'a, C> common::CallBuilder for ProjectRegionOperationDeleteCall<'a, C> {}
29455
29456impl<'a, C> ProjectRegionOperationDeleteCall<'a, C>
29457where
29458    C: common::Connector,
29459{
29460    /// Perform the operation you have build so far.
29461    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
29462        use std::borrow::Cow;
29463        use std::io::{Read, Seek};
29464
29465        use common::{url::Params, ToParts};
29466        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29467
29468        let mut dd = common::DefaultDelegate;
29469        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29470        dlg.begin(common::MethodInfo {
29471            id: "dataproc.projects.regions.operations.delete",
29472            http_method: hyper::Method::DELETE,
29473        });
29474
29475        for &field in ["alt", "name"].iter() {
29476            if self._additional_params.contains_key(field) {
29477                dlg.finished(false);
29478                return Err(common::Error::FieldClash(field));
29479            }
29480        }
29481
29482        let mut params = Params::with_capacity(3 + self._additional_params.len());
29483        params.push("name", self._name);
29484
29485        params.extend(self._additional_params.iter());
29486
29487        params.push("alt", "json");
29488        let mut url = self.hub._base_url.clone() + "v1/{+name}";
29489        if self._scopes.is_empty() {
29490            self._scopes
29491                .insert(Scope::CloudPlatform.as_ref().to_string());
29492        }
29493
29494        #[allow(clippy::single_element_loop)]
29495        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29496            url = params.uri_replacement(url, param_name, find_this, true);
29497        }
29498        {
29499            let to_remove = ["name"];
29500            params.remove_params(&to_remove);
29501        }
29502
29503        let url = params.parse_with_url(&url);
29504
29505        loop {
29506            let token = match self
29507                .hub
29508                .auth
29509                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29510                .await
29511            {
29512                Ok(token) => token,
29513                Err(e) => match dlg.token(e) {
29514                    Ok(token) => token,
29515                    Err(e) => {
29516                        dlg.finished(false);
29517                        return Err(common::Error::MissingToken(e));
29518                    }
29519                },
29520            };
29521            let mut req_result = {
29522                let client = &self.hub.client;
29523                dlg.pre_request();
29524                let mut req_builder = hyper::Request::builder()
29525                    .method(hyper::Method::DELETE)
29526                    .uri(url.as_str())
29527                    .header(USER_AGENT, self.hub._user_agent.clone());
29528
29529                if let Some(token) = token.as_ref() {
29530                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29531                }
29532
29533                let request = req_builder
29534                    .header(CONTENT_LENGTH, 0_u64)
29535                    .body(common::to_body::<String>(None));
29536
29537                client.request(request.unwrap()).await
29538            };
29539
29540            match req_result {
29541                Err(err) => {
29542                    if let common::Retry::After(d) = dlg.http_error(&err) {
29543                        sleep(d).await;
29544                        continue;
29545                    }
29546                    dlg.finished(false);
29547                    return Err(common::Error::HttpError(err));
29548                }
29549                Ok(res) => {
29550                    let (mut parts, body) = res.into_parts();
29551                    let mut body = common::Body::new(body);
29552                    if !parts.status.is_success() {
29553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29554                        let error = serde_json::from_str(&common::to_string(&bytes));
29555                        let response = common::to_response(parts, bytes.into());
29556
29557                        if let common::Retry::After(d) =
29558                            dlg.http_failure(&response, error.as_ref().ok())
29559                        {
29560                            sleep(d).await;
29561                            continue;
29562                        }
29563
29564                        dlg.finished(false);
29565
29566                        return Err(match error {
29567                            Ok(value) => common::Error::BadRequest(value),
29568                            _ => common::Error::Failure(response),
29569                        });
29570                    }
29571                    let response = {
29572                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29573                        let encoded = common::to_string(&bytes);
29574                        match serde_json::from_str(&encoded) {
29575                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29576                            Err(error) => {
29577                                dlg.response_json_decode_error(&encoded, &error);
29578                                return Err(common::Error::JsonDecodeError(
29579                                    encoded.to_string(),
29580                                    error,
29581                                ));
29582                            }
29583                        }
29584                    };
29585
29586                    dlg.finished(true);
29587                    return Ok(response);
29588                }
29589            }
29590        }
29591    }
29592
29593    /// The name of the operation resource to be deleted.
29594    ///
29595    /// Sets the *name* path property to the given value.
29596    ///
29597    /// Even though the property as already been set when instantiating this call,
29598    /// we provide this method for API completeness.
29599    pub fn name(mut self, new_value: &str) -> ProjectRegionOperationDeleteCall<'a, C> {
29600        self._name = new_value.to_string();
29601        self
29602    }
29603    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29604    /// while executing the actual API request.
29605    ///
29606    /// ````text
29607    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29608    /// ````
29609    ///
29610    /// Sets the *delegate* property to the given value.
29611    pub fn delegate(
29612        mut self,
29613        new_value: &'a mut dyn common::Delegate,
29614    ) -> ProjectRegionOperationDeleteCall<'a, C> {
29615        self._delegate = Some(new_value);
29616        self
29617    }
29618
29619    /// Set any additional parameter of the query string used in the request.
29620    /// It should be used to set parameters which are not yet available through their own
29621    /// setters.
29622    ///
29623    /// Please note that this method must not be used to set any of the known parameters
29624    /// which have their own setter method. If done anyway, the request will fail.
29625    ///
29626    /// # Additional Parameters
29627    ///
29628    /// * *$.xgafv* (query-string) - V1 error format.
29629    /// * *access_token* (query-string) - OAuth access token.
29630    /// * *alt* (query-string) - Data format for response.
29631    /// * *callback* (query-string) - JSONP
29632    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29633    /// * *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.
29634    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29635    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29636    /// * *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.
29637    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29638    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29639    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationDeleteCall<'a, C>
29640    where
29641        T: AsRef<str>,
29642    {
29643        self._additional_params
29644            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29645        self
29646    }
29647
29648    /// Identifies the authorization scope for the method you are building.
29649    ///
29650    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29651    /// [`Scope::CloudPlatform`].
29652    ///
29653    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29654    /// tokens for more than one scope.
29655    ///
29656    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29657    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29658    /// sufficient, a read-write scope will do as well.
29659    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationDeleteCall<'a, C>
29660    where
29661        St: AsRef<str>,
29662    {
29663        self._scopes.insert(String::from(scope.as_ref()));
29664        self
29665    }
29666    /// Identifies the authorization scope(s) for the method you are building.
29667    ///
29668    /// See [`Self::add_scope()`] for details.
29669    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationDeleteCall<'a, C>
29670    where
29671        I: IntoIterator<Item = St>,
29672        St: AsRef<str>,
29673    {
29674        self._scopes
29675            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29676        self
29677    }
29678
29679    /// Removes all scopes, and no default scope will be used either.
29680    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29681    /// for details).
29682    pub fn clear_scopes(mut self) -> ProjectRegionOperationDeleteCall<'a, C> {
29683        self._scopes.clear();
29684        self
29685    }
29686}
29687
29688/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
29689///
29690/// A builder for the *regions.operations.get* method supported by a *project* resource.
29691/// It is not used directly, but through a [`ProjectMethods`] instance.
29692///
29693/// # Example
29694///
29695/// Instantiate a resource method builder
29696///
29697/// ```test_harness,no_run
29698/// # extern crate hyper;
29699/// # extern crate hyper_rustls;
29700/// # extern crate google_dataproc1 as dataproc1;
29701/// # async fn dox() {
29702/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29703///
29704/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29705/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29706/// #     secret,
29707/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29708/// # ).build().await.unwrap();
29709///
29710/// # let client = hyper_util::client::legacy::Client::builder(
29711/// #     hyper_util::rt::TokioExecutor::new()
29712/// # )
29713/// # .build(
29714/// #     hyper_rustls::HttpsConnectorBuilder::new()
29715/// #         .with_native_roots()
29716/// #         .unwrap()
29717/// #         .https_or_http()
29718/// #         .enable_http1()
29719/// #         .build()
29720/// # );
29721/// # let mut hub = Dataproc::new(client, auth);
29722/// // You can configure optional parameters by calling the respective setters at will, and
29723/// // execute the final call using `doit()`.
29724/// // Values shown here are possibly random and not representative !
29725/// let result = hub.projects().regions_operations_get("name")
29726///              .doit().await;
29727/// # }
29728/// ```
29729pub struct ProjectRegionOperationGetCall<'a, C>
29730where
29731    C: 'a,
29732{
29733    hub: &'a Dataproc<C>,
29734    _name: String,
29735    _delegate: Option<&'a mut dyn common::Delegate>,
29736    _additional_params: HashMap<String, String>,
29737    _scopes: BTreeSet<String>,
29738}
29739
29740impl<'a, C> common::CallBuilder for ProjectRegionOperationGetCall<'a, C> {}
29741
29742impl<'a, C> ProjectRegionOperationGetCall<'a, C>
29743where
29744    C: common::Connector,
29745{
29746    /// Perform the operation you have build so far.
29747    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
29748        use std::borrow::Cow;
29749        use std::io::{Read, Seek};
29750
29751        use common::{url::Params, ToParts};
29752        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29753
29754        let mut dd = common::DefaultDelegate;
29755        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29756        dlg.begin(common::MethodInfo {
29757            id: "dataproc.projects.regions.operations.get",
29758            http_method: hyper::Method::GET,
29759        });
29760
29761        for &field in ["alt", "name"].iter() {
29762            if self._additional_params.contains_key(field) {
29763                dlg.finished(false);
29764                return Err(common::Error::FieldClash(field));
29765            }
29766        }
29767
29768        let mut params = Params::with_capacity(3 + self._additional_params.len());
29769        params.push("name", self._name);
29770
29771        params.extend(self._additional_params.iter());
29772
29773        params.push("alt", "json");
29774        let mut url = self.hub._base_url.clone() + "v1/{+name}";
29775        if self._scopes.is_empty() {
29776            self._scopes
29777                .insert(Scope::CloudPlatform.as_ref().to_string());
29778        }
29779
29780        #[allow(clippy::single_element_loop)]
29781        for &(find_this, param_name) in [("{+name}", "name")].iter() {
29782            url = params.uri_replacement(url, param_name, find_this, true);
29783        }
29784        {
29785            let to_remove = ["name"];
29786            params.remove_params(&to_remove);
29787        }
29788
29789        let url = params.parse_with_url(&url);
29790
29791        loop {
29792            let token = match self
29793                .hub
29794                .auth
29795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29796                .await
29797            {
29798                Ok(token) => token,
29799                Err(e) => match dlg.token(e) {
29800                    Ok(token) => token,
29801                    Err(e) => {
29802                        dlg.finished(false);
29803                        return Err(common::Error::MissingToken(e));
29804                    }
29805                },
29806            };
29807            let mut req_result = {
29808                let client = &self.hub.client;
29809                dlg.pre_request();
29810                let mut req_builder = hyper::Request::builder()
29811                    .method(hyper::Method::GET)
29812                    .uri(url.as_str())
29813                    .header(USER_AGENT, self.hub._user_agent.clone());
29814
29815                if let Some(token) = token.as_ref() {
29816                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29817                }
29818
29819                let request = req_builder
29820                    .header(CONTENT_LENGTH, 0_u64)
29821                    .body(common::to_body::<String>(None));
29822
29823                client.request(request.unwrap()).await
29824            };
29825
29826            match req_result {
29827                Err(err) => {
29828                    if let common::Retry::After(d) = dlg.http_error(&err) {
29829                        sleep(d).await;
29830                        continue;
29831                    }
29832                    dlg.finished(false);
29833                    return Err(common::Error::HttpError(err));
29834                }
29835                Ok(res) => {
29836                    let (mut parts, body) = res.into_parts();
29837                    let mut body = common::Body::new(body);
29838                    if !parts.status.is_success() {
29839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29840                        let error = serde_json::from_str(&common::to_string(&bytes));
29841                        let response = common::to_response(parts, bytes.into());
29842
29843                        if let common::Retry::After(d) =
29844                            dlg.http_failure(&response, error.as_ref().ok())
29845                        {
29846                            sleep(d).await;
29847                            continue;
29848                        }
29849
29850                        dlg.finished(false);
29851
29852                        return Err(match error {
29853                            Ok(value) => common::Error::BadRequest(value),
29854                            _ => common::Error::Failure(response),
29855                        });
29856                    }
29857                    let response = {
29858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29859                        let encoded = common::to_string(&bytes);
29860                        match serde_json::from_str(&encoded) {
29861                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29862                            Err(error) => {
29863                                dlg.response_json_decode_error(&encoded, &error);
29864                                return Err(common::Error::JsonDecodeError(
29865                                    encoded.to_string(),
29866                                    error,
29867                                ));
29868                            }
29869                        }
29870                    };
29871
29872                    dlg.finished(true);
29873                    return Ok(response);
29874                }
29875            }
29876        }
29877    }
29878
29879    /// The name of the operation resource.
29880    ///
29881    /// Sets the *name* path property to the given value.
29882    ///
29883    /// Even though the property as already been set when instantiating this call,
29884    /// we provide this method for API completeness.
29885    pub fn name(mut self, new_value: &str) -> ProjectRegionOperationGetCall<'a, C> {
29886        self._name = new_value.to_string();
29887        self
29888    }
29889    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29890    /// while executing the actual API request.
29891    ///
29892    /// ````text
29893    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29894    /// ````
29895    ///
29896    /// Sets the *delegate* property to the given value.
29897    pub fn delegate(
29898        mut self,
29899        new_value: &'a mut dyn common::Delegate,
29900    ) -> ProjectRegionOperationGetCall<'a, C> {
29901        self._delegate = Some(new_value);
29902        self
29903    }
29904
29905    /// Set any additional parameter of the query string used in the request.
29906    /// It should be used to set parameters which are not yet available through their own
29907    /// setters.
29908    ///
29909    /// Please note that this method must not be used to set any of the known parameters
29910    /// which have their own setter method. If done anyway, the request will fail.
29911    ///
29912    /// # Additional Parameters
29913    ///
29914    /// * *$.xgafv* (query-string) - V1 error format.
29915    /// * *access_token* (query-string) - OAuth access token.
29916    /// * *alt* (query-string) - Data format for response.
29917    /// * *callback* (query-string) - JSONP
29918    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29919    /// * *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.
29920    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29921    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29922    /// * *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.
29923    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29924    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29925    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationGetCall<'a, C>
29926    where
29927        T: AsRef<str>,
29928    {
29929        self._additional_params
29930            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29931        self
29932    }
29933
29934    /// Identifies the authorization scope for the method you are building.
29935    ///
29936    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29937    /// [`Scope::CloudPlatform`].
29938    ///
29939    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29940    /// tokens for more than one scope.
29941    ///
29942    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29943    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29944    /// sufficient, a read-write scope will do as well.
29945    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationGetCall<'a, C>
29946    where
29947        St: AsRef<str>,
29948    {
29949        self._scopes.insert(String::from(scope.as_ref()));
29950        self
29951    }
29952    /// Identifies the authorization scope(s) for the method you are building.
29953    ///
29954    /// See [`Self::add_scope()`] for details.
29955    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationGetCall<'a, C>
29956    where
29957        I: IntoIterator<Item = St>,
29958        St: AsRef<str>,
29959    {
29960        self._scopes
29961            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29962        self
29963    }
29964
29965    /// Removes all scopes, and no default scope will be used either.
29966    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29967    /// for details).
29968    pub fn clear_scopes(mut self) -> ProjectRegionOperationGetCall<'a, C> {
29969        self._scopes.clear();
29970        self
29971    }
29972}
29973
29974/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
29975///
29976/// A builder for the *regions.operations.getIamPolicy* method supported by a *project* resource.
29977/// It is not used directly, but through a [`ProjectMethods`] instance.
29978///
29979/// # Example
29980///
29981/// Instantiate a resource method builder
29982///
29983/// ```test_harness,no_run
29984/// # extern crate hyper;
29985/// # extern crate hyper_rustls;
29986/// # extern crate google_dataproc1 as dataproc1;
29987/// use dataproc1::api::GetIamPolicyRequest;
29988/// # async fn dox() {
29989/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29990///
29991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29992/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
29993/// #     secret,
29994/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29995/// # ).build().await.unwrap();
29996///
29997/// # let client = hyper_util::client::legacy::Client::builder(
29998/// #     hyper_util::rt::TokioExecutor::new()
29999/// # )
30000/// # .build(
30001/// #     hyper_rustls::HttpsConnectorBuilder::new()
30002/// #         .with_native_roots()
30003/// #         .unwrap()
30004/// #         .https_or_http()
30005/// #         .enable_http1()
30006/// #         .build()
30007/// # );
30008/// # let mut hub = Dataproc::new(client, auth);
30009/// // As the method needs a request, you would usually fill it with the desired information
30010/// // into the respective structure. Some of the parts shown here might not be applicable !
30011/// // Values shown here are possibly random and not representative !
30012/// let mut req = GetIamPolicyRequest::default();
30013///
30014/// // You can configure optional parameters by calling the respective setters at will, and
30015/// // execute the final call using `doit()`.
30016/// // Values shown here are possibly random and not representative !
30017/// let result = hub.projects().regions_operations_get_iam_policy(req, "resource")
30018///              .doit().await;
30019/// # }
30020/// ```
30021pub struct ProjectRegionOperationGetIamPolicyCall<'a, C>
30022where
30023    C: 'a,
30024{
30025    hub: &'a Dataproc<C>,
30026    _request: GetIamPolicyRequest,
30027    _resource: String,
30028    _delegate: Option<&'a mut dyn common::Delegate>,
30029    _additional_params: HashMap<String, String>,
30030    _scopes: BTreeSet<String>,
30031}
30032
30033impl<'a, C> common::CallBuilder for ProjectRegionOperationGetIamPolicyCall<'a, C> {}
30034
30035impl<'a, C> ProjectRegionOperationGetIamPolicyCall<'a, C>
30036where
30037    C: common::Connector,
30038{
30039    /// Perform the operation you have build so far.
30040    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
30041        use std::borrow::Cow;
30042        use std::io::{Read, Seek};
30043
30044        use common::{url::Params, ToParts};
30045        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30046
30047        let mut dd = common::DefaultDelegate;
30048        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30049        dlg.begin(common::MethodInfo {
30050            id: "dataproc.projects.regions.operations.getIamPolicy",
30051            http_method: hyper::Method::POST,
30052        });
30053
30054        for &field in ["alt", "resource"].iter() {
30055            if self._additional_params.contains_key(field) {
30056                dlg.finished(false);
30057                return Err(common::Error::FieldClash(field));
30058            }
30059        }
30060
30061        let mut params = Params::with_capacity(4 + self._additional_params.len());
30062        params.push("resource", self._resource);
30063
30064        params.extend(self._additional_params.iter());
30065
30066        params.push("alt", "json");
30067        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
30068        if self._scopes.is_empty() {
30069            self._scopes
30070                .insert(Scope::CloudPlatform.as_ref().to_string());
30071        }
30072
30073        #[allow(clippy::single_element_loop)]
30074        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
30075            url = params.uri_replacement(url, param_name, find_this, true);
30076        }
30077        {
30078            let to_remove = ["resource"];
30079            params.remove_params(&to_remove);
30080        }
30081
30082        let url = params.parse_with_url(&url);
30083
30084        let mut json_mime_type = mime::APPLICATION_JSON;
30085        let mut request_value_reader = {
30086            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30087            common::remove_json_null_values(&mut value);
30088            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30089            serde_json::to_writer(&mut dst, &value).unwrap();
30090            dst
30091        };
30092        let request_size = request_value_reader
30093            .seek(std::io::SeekFrom::End(0))
30094            .unwrap();
30095        request_value_reader
30096            .seek(std::io::SeekFrom::Start(0))
30097            .unwrap();
30098
30099        loop {
30100            let token = match self
30101                .hub
30102                .auth
30103                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30104                .await
30105            {
30106                Ok(token) => token,
30107                Err(e) => match dlg.token(e) {
30108                    Ok(token) => token,
30109                    Err(e) => {
30110                        dlg.finished(false);
30111                        return Err(common::Error::MissingToken(e));
30112                    }
30113                },
30114            };
30115            request_value_reader
30116                .seek(std::io::SeekFrom::Start(0))
30117                .unwrap();
30118            let mut req_result = {
30119                let client = &self.hub.client;
30120                dlg.pre_request();
30121                let mut req_builder = hyper::Request::builder()
30122                    .method(hyper::Method::POST)
30123                    .uri(url.as_str())
30124                    .header(USER_AGENT, self.hub._user_agent.clone());
30125
30126                if let Some(token) = token.as_ref() {
30127                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30128                }
30129
30130                let request = req_builder
30131                    .header(CONTENT_TYPE, json_mime_type.to_string())
30132                    .header(CONTENT_LENGTH, request_size as u64)
30133                    .body(common::to_body(
30134                        request_value_reader.get_ref().clone().into(),
30135                    ));
30136
30137                client.request(request.unwrap()).await
30138            };
30139
30140            match req_result {
30141                Err(err) => {
30142                    if let common::Retry::After(d) = dlg.http_error(&err) {
30143                        sleep(d).await;
30144                        continue;
30145                    }
30146                    dlg.finished(false);
30147                    return Err(common::Error::HttpError(err));
30148                }
30149                Ok(res) => {
30150                    let (mut parts, body) = res.into_parts();
30151                    let mut body = common::Body::new(body);
30152                    if !parts.status.is_success() {
30153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30154                        let error = serde_json::from_str(&common::to_string(&bytes));
30155                        let response = common::to_response(parts, bytes.into());
30156
30157                        if let common::Retry::After(d) =
30158                            dlg.http_failure(&response, error.as_ref().ok())
30159                        {
30160                            sleep(d).await;
30161                            continue;
30162                        }
30163
30164                        dlg.finished(false);
30165
30166                        return Err(match error {
30167                            Ok(value) => common::Error::BadRequest(value),
30168                            _ => common::Error::Failure(response),
30169                        });
30170                    }
30171                    let response = {
30172                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30173                        let encoded = common::to_string(&bytes);
30174                        match serde_json::from_str(&encoded) {
30175                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30176                            Err(error) => {
30177                                dlg.response_json_decode_error(&encoded, &error);
30178                                return Err(common::Error::JsonDecodeError(
30179                                    encoded.to_string(),
30180                                    error,
30181                                ));
30182                            }
30183                        }
30184                    };
30185
30186                    dlg.finished(true);
30187                    return Ok(response);
30188                }
30189            }
30190        }
30191    }
30192
30193    ///
30194    /// Sets the *request* property to the given value.
30195    ///
30196    /// Even though the property as already been set when instantiating this call,
30197    /// we provide this method for API completeness.
30198    pub fn request(
30199        mut self,
30200        new_value: GetIamPolicyRequest,
30201    ) -> ProjectRegionOperationGetIamPolicyCall<'a, C> {
30202        self._request = new_value;
30203        self
30204    }
30205    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
30206    ///
30207    /// Sets the *resource* path property to the given value.
30208    ///
30209    /// Even though the property as already been set when instantiating this call,
30210    /// we provide this method for API completeness.
30211    pub fn resource(mut self, new_value: &str) -> ProjectRegionOperationGetIamPolicyCall<'a, C> {
30212        self._resource = new_value.to_string();
30213        self
30214    }
30215    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30216    /// while executing the actual API request.
30217    ///
30218    /// ````text
30219    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30220    /// ````
30221    ///
30222    /// Sets the *delegate* property to the given value.
30223    pub fn delegate(
30224        mut self,
30225        new_value: &'a mut dyn common::Delegate,
30226    ) -> ProjectRegionOperationGetIamPolicyCall<'a, C> {
30227        self._delegate = Some(new_value);
30228        self
30229    }
30230
30231    /// Set any additional parameter of the query string used in the request.
30232    /// It should be used to set parameters which are not yet available through their own
30233    /// setters.
30234    ///
30235    /// Please note that this method must not be used to set any of the known parameters
30236    /// which have their own setter method. If done anyway, the request will fail.
30237    ///
30238    /// # Additional Parameters
30239    ///
30240    /// * *$.xgafv* (query-string) - V1 error format.
30241    /// * *access_token* (query-string) - OAuth access token.
30242    /// * *alt* (query-string) - Data format for response.
30243    /// * *callback* (query-string) - JSONP
30244    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30245    /// * *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.
30246    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30247    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30248    /// * *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.
30249    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30250    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30251    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationGetIamPolicyCall<'a, C>
30252    where
30253        T: AsRef<str>,
30254    {
30255        self._additional_params
30256            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30257        self
30258    }
30259
30260    /// Identifies the authorization scope for the method you are building.
30261    ///
30262    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30263    /// [`Scope::CloudPlatform`].
30264    ///
30265    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30266    /// tokens for more than one scope.
30267    ///
30268    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30269    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30270    /// sufficient, a read-write scope will do as well.
30271    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationGetIamPolicyCall<'a, C>
30272    where
30273        St: AsRef<str>,
30274    {
30275        self._scopes.insert(String::from(scope.as_ref()));
30276        self
30277    }
30278    /// Identifies the authorization scope(s) for the method you are building.
30279    ///
30280    /// See [`Self::add_scope()`] for details.
30281    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationGetIamPolicyCall<'a, C>
30282    where
30283        I: IntoIterator<Item = St>,
30284        St: AsRef<str>,
30285    {
30286        self._scopes
30287            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30288        self
30289    }
30290
30291    /// Removes all scopes, and no default scope will be used either.
30292    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30293    /// for details).
30294    pub fn clear_scopes(mut self) -> ProjectRegionOperationGetIamPolicyCall<'a, C> {
30295        self._scopes.clear();
30296        self
30297    }
30298}
30299
30300/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
30301///
30302/// A builder for the *regions.operations.list* method supported by a *project* resource.
30303/// It is not used directly, but through a [`ProjectMethods`] instance.
30304///
30305/// # Example
30306///
30307/// Instantiate a resource method builder
30308///
30309/// ```test_harness,no_run
30310/// # extern crate hyper;
30311/// # extern crate hyper_rustls;
30312/// # extern crate google_dataproc1 as dataproc1;
30313/// # async fn dox() {
30314/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30315///
30316/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30317/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30318/// #     secret,
30319/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30320/// # ).build().await.unwrap();
30321///
30322/// # let client = hyper_util::client::legacy::Client::builder(
30323/// #     hyper_util::rt::TokioExecutor::new()
30324/// # )
30325/// # .build(
30326/// #     hyper_rustls::HttpsConnectorBuilder::new()
30327/// #         .with_native_roots()
30328/// #         .unwrap()
30329/// #         .https_or_http()
30330/// #         .enable_http1()
30331/// #         .build()
30332/// # );
30333/// # let mut hub = Dataproc::new(client, auth);
30334/// // You can configure optional parameters by calling the respective setters at will, and
30335/// // execute the final call using `doit()`.
30336/// // Values shown here are possibly random and not representative !
30337/// let result = hub.projects().regions_operations_list("name")
30338///              .page_token("takimata")
30339///              .page_size(-51)
30340///              .filter("et")
30341///              .doit().await;
30342/// # }
30343/// ```
30344pub struct ProjectRegionOperationListCall<'a, C>
30345where
30346    C: 'a,
30347{
30348    hub: &'a Dataproc<C>,
30349    _name: String,
30350    _page_token: Option<String>,
30351    _page_size: Option<i32>,
30352    _filter: Option<String>,
30353    _delegate: Option<&'a mut dyn common::Delegate>,
30354    _additional_params: HashMap<String, String>,
30355    _scopes: BTreeSet<String>,
30356}
30357
30358impl<'a, C> common::CallBuilder for ProjectRegionOperationListCall<'a, C> {}
30359
30360impl<'a, C> ProjectRegionOperationListCall<'a, C>
30361where
30362    C: common::Connector,
30363{
30364    /// Perform the operation you have build so far.
30365    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
30366        use std::borrow::Cow;
30367        use std::io::{Read, Seek};
30368
30369        use common::{url::Params, ToParts};
30370        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30371
30372        let mut dd = common::DefaultDelegate;
30373        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30374        dlg.begin(common::MethodInfo {
30375            id: "dataproc.projects.regions.operations.list",
30376            http_method: hyper::Method::GET,
30377        });
30378
30379        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
30380            if self._additional_params.contains_key(field) {
30381                dlg.finished(false);
30382                return Err(common::Error::FieldClash(field));
30383            }
30384        }
30385
30386        let mut params = Params::with_capacity(6 + self._additional_params.len());
30387        params.push("name", self._name);
30388        if let Some(value) = self._page_token.as_ref() {
30389            params.push("pageToken", value);
30390        }
30391        if let Some(value) = self._page_size.as_ref() {
30392            params.push("pageSize", value.to_string());
30393        }
30394        if let Some(value) = self._filter.as_ref() {
30395            params.push("filter", value);
30396        }
30397
30398        params.extend(self._additional_params.iter());
30399
30400        params.push("alt", "json");
30401        let mut url = self.hub._base_url.clone() + "v1/{+name}";
30402        if self._scopes.is_empty() {
30403            self._scopes
30404                .insert(Scope::CloudPlatform.as_ref().to_string());
30405        }
30406
30407        #[allow(clippy::single_element_loop)]
30408        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30409            url = params.uri_replacement(url, param_name, find_this, true);
30410        }
30411        {
30412            let to_remove = ["name"];
30413            params.remove_params(&to_remove);
30414        }
30415
30416        let url = params.parse_with_url(&url);
30417
30418        loop {
30419            let token = match self
30420                .hub
30421                .auth
30422                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30423                .await
30424            {
30425                Ok(token) => token,
30426                Err(e) => match dlg.token(e) {
30427                    Ok(token) => token,
30428                    Err(e) => {
30429                        dlg.finished(false);
30430                        return Err(common::Error::MissingToken(e));
30431                    }
30432                },
30433            };
30434            let mut req_result = {
30435                let client = &self.hub.client;
30436                dlg.pre_request();
30437                let mut req_builder = hyper::Request::builder()
30438                    .method(hyper::Method::GET)
30439                    .uri(url.as_str())
30440                    .header(USER_AGENT, self.hub._user_agent.clone());
30441
30442                if let Some(token) = token.as_ref() {
30443                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30444                }
30445
30446                let request = req_builder
30447                    .header(CONTENT_LENGTH, 0_u64)
30448                    .body(common::to_body::<String>(None));
30449
30450                client.request(request.unwrap()).await
30451            };
30452
30453            match req_result {
30454                Err(err) => {
30455                    if let common::Retry::After(d) = dlg.http_error(&err) {
30456                        sleep(d).await;
30457                        continue;
30458                    }
30459                    dlg.finished(false);
30460                    return Err(common::Error::HttpError(err));
30461                }
30462                Ok(res) => {
30463                    let (mut parts, body) = res.into_parts();
30464                    let mut body = common::Body::new(body);
30465                    if !parts.status.is_success() {
30466                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30467                        let error = serde_json::from_str(&common::to_string(&bytes));
30468                        let response = common::to_response(parts, bytes.into());
30469
30470                        if let common::Retry::After(d) =
30471                            dlg.http_failure(&response, error.as_ref().ok())
30472                        {
30473                            sleep(d).await;
30474                            continue;
30475                        }
30476
30477                        dlg.finished(false);
30478
30479                        return Err(match error {
30480                            Ok(value) => common::Error::BadRequest(value),
30481                            _ => common::Error::Failure(response),
30482                        });
30483                    }
30484                    let response = {
30485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30486                        let encoded = common::to_string(&bytes);
30487                        match serde_json::from_str(&encoded) {
30488                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30489                            Err(error) => {
30490                                dlg.response_json_decode_error(&encoded, &error);
30491                                return Err(common::Error::JsonDecodeError(
30492                                    encoded.to_string(),
30493                                    error,
30494                                ));
30495                            }
30496                        }
30497                    };
30498
30499                    dlg.finished(true);
30500                    return Ok(response);
30501                }
30502            }
30503        }
30504    }
30505
30506    /// The name of the operation's parent resource.
30507    ///
30508    /// Sets the *name* path property to the given value.
30509    ///
30510    /// Even though the property as already been set when instantiating this call,
30511    /// we provide this method for API completeness.
30512    pub fn name(mut self, new_value: &str) -> ProjectRegionOperationListCall<'a, C> {
30513        self._name = new_value.to_string();
30514        self
30515    }
30516    /// The standard list page token.
30517    ///
30518    /// Sets the *page token* query property to the given value.
30519    pub fn page_token(mut self, new_value: &str) -> ProjectRegionOperationListCall<'a, C> {
30520        self._page_token = Some(new_value.to_string());
30521        self
30522    }
30523    /// The standard list page size.
30524    ///
30525    /// Sets the *page size* query property to the given value.
30526    pub fn page_size(mut self, new_value: i32) -> ProjectRegionOperationListCall<'a, C> {
30527        self._page_size = Some(new_value);
30528        self
30529    }
30530    /// The standard list filter.
30531    ///
30532    /// Sets the *filter* query property to the given value.
30533    pub fn filter(mut self, new_value: &str) -> ProjectRegionOperationListCall<'a, C> {
30534        self._filter = Some(new_value.to_string());
30535        self
30536    }
30537    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30538    /// while executing the actual API request.
30539    ///
30540    /// ````text
30541    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30542    /// ````
30543    ///
30544    /// Sets the *delegate* property to the given value.
30545    pub fn delegate(
30546        mut self,
30547        new_value: &'a mut dyn common::Delegate,
30548    ) -> ProjectRegionOperationListCall<'a, C> {
30549        self._delegate = Some(new_value);
30550        self
30551    }
30552
30553    /// Set any additional parameter of the query string used in the request.
30554    /// It should be used to set parameters which are not yet available through their own
30555    /// setters.
30556    ///
30557    /// Please note that this method must not be used to set any of the known parameters
30558    /// which have their own setter method. If done anyway, the request will fail.
30559    ///
30560    /// # Additional Parameters
30561    ///
30562    /// * *$.xgafv* (query-string) - V1 error format.
30563    /// * *access_token* (query-string) - OAuth access token.
30564    /// * *alt* (query-string) - Data format for response.
30565    /// * *callback* (query-string) - JSONP
30566    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30567    /// * *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.
30568    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30569    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30570    /// * *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.
30571    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30572    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30573    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationListCall<'a, C>
30574    where
30575        T: AsRef<str>,
30576    {
30577        self._additional_params
30578            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30579        self
30580    }
30581
30582    /// Identifies the authorization scope for the method you are building.
30583    ///
30584    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30585    /// [`Scope::CloudPlatform`].
30586    ///
30587    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30588    /// tokens for more than one scope.
30589    ///
30590    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30591    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30592    /// sufficient, a read-write scope will do as well.
30593    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationListCall<'a, C>
30594    where
30595        St: AsRef<str>,
30596    {
30597        self._scopes.insert(String::from(scope.as_ref()));
30598        self
30599    }
30600    /// Identifies the authorization scope(s) for the method you are building.
30601    ///
30602    /// See [`Self::add_scope()`] for details.
30603    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationListCall<'a, C>
30604    where
30605        I: IntoIterator<Item = St>,
30606        St: AsRef<str>,
30607    {
30608        self._scopes
30609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30610        self
30611    }
30612
30613    /// Removes all scopes, and no default scope will be used either.
30614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30615    /// for details).
30616    pub fn clear_scopes(mut self) -> ProjectRegionOperationListCall<'a, C> {
30617        self._scopes.clear();
30618        self
30619    }
30620}
30621
30622/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
30623///
30624/// A builder for the *regions.operations.setIamPolicy* method supported by a *project* resource.
30625/// It is not used directly, but through a [`ProjectMethods`] instance.
30626///
30627/// # Example
30628///
30629/// Instantiate a resource method builder
30630///
30631/// ```test_harness,no_run
30632/// # extern crate hyper;
30633/// # extern crate hyper_rustls;
30634/// # extern crate google_dataproc1 as dataproc1;
30635/// use dataproc1::api::SetIamPolicyRequest;
30636/// # async fn dox() {
30637/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30638///
30639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30640/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30641/// #     secret,
30642/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30643/// # ).build().await.unwrap();
30644///
30645/// # let client = hyper_util::client::legacy::Client::builder(
30646/// #     hyper_util::rt::TokioExecutor::new()
30647/// # )
30648/// # .build(
30649/// #     hyper_rustls::HttpsConnectorBuilder::new()
30650/// #         .with_native_roots()
30651/// #         .unwrap()
30652/// #         .https_or_http()
30653/// #         .enable_http1()
30654/// #         .build()
30655/// # );
30656/// # let mut hub = Dataproc::new(client, auth);
30657/// // As the method needs a request, you would usually fill it with the desired information
30658/// // into the respective structure. Some of the parts shown here might not be applicable !
30659/// // Values shown here are possibly random and not representative !
30660/// let mut req = SetIamPolicyRequest::default();
30661///
30662/// // You can configure optional parameters by calling the respective setters at will, and
30663/// // execute the final call using `doit()`.
30664/// // Values shown here are possibly random and not representative !
30665/// let result = hub.projects().regions_operations_set_iam_policy(req, "resource")
30666///              .doit().await;
30667/// # }
30668/// ```
30669pub struct ProjectRegionOperationSetIamPolicyCall<'a, C>
30670where
30671    C: 'a,
30672{
30673    hub: &'a Dataproc<C>,
30674    _request: SetIamPolicyRequest,
30675    _resource: String,
30676    _delegate: Option<&'a mut dyn common::Delegate>,
30677    _additional_params: HashMap<String, String>,
30678    _scopes: BTreeSet<String>,
30679}
30680
30681impl<'a, C> common::CallBuilder for ProjectRegionOperationSetIamPolicyCall<'a, C> {}
30682
30683impl<'a, C> ProjectRegionOperationSetIamPolicyCall<'a, C>
30684where
30685    C: common::Connector,
30686{
30687    /// Perform the operation you have build so far.
30688    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
30689        use std::borrow::Cow;
30690        use std::io::{Read, Seek};
30691
30692        use common::{url::Params, ToParts};
30693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30694
30695        let mut dd = common::DefaultDelegate;
30696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30697        dlg.begin(common::MethodInfo {
30698            id: "dataproc.projects.regions.operations.setIamPolicy",
30699            http_method: hyper::Method::POST,
30700        });
30701
30702        for &field in ["alt", "resource"].iter() {
30703            if self._additional_params.contains_key(field) {
30704                dlg.finished(false);
30705                return Err(common::Error::FieldClash(field));
30706            }
30707        }
30708
30709        let mut params = Params::with_capacity(4 + self._additional_params.len());
30710        params.push("resource", self._resource);
30711
30712        params.extend(self._additional_params.iter());
30713
30714        params.push("alt", "json");
30715        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
30716        if self._scopes.is_empty() {
30717            self._scopes
30718                .insert(Scope::CloudPlatform.as_ref().to_string());
30719        }
30720
30721        #[allow(clippy::single_element_loop)]
30722        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
30723            url = params.uri_replacement(url, param_name, find_this, true);
30724        }
30725        {
30726            let to_remove = ["resource"];
30727            params.remove_params(&to_remove);
30728        }
30729
30730        let url = params.parse_with_url(&url);
30731
30732        let mut json_mime_type = mime::APPLICATION_JSON;
30733        let mut request_value_reader = {
30734            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
30735            common::remove_json_null_values(&mut value);
30736            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
30737            serde_json::to_writer(&mut dst, &value).unwrap();
30738            dst
30739        };
30740        let request_size = request_value_reader
30741            .seek(std::io::SeekFrom::End(0))
30742            .unwrap();
30743        request_value_reader
30744            .seek(std::io::SeekFrom::Start(0))
30745            .unwrap();
30746
30747        loop {
30748            let token = match self
30749                .hub
30750                .auth
30751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30752                .await
30753            {
30754                Ok(token) => token,
30755                Err(e) => match dlg.token(e) {
30756                    Ok(token) => token,
30757                    Err(e) => {
30758                        dlg.finished(false);
30759                        return Err(common::Error::MissingToken(e));
30760                    }
30761                },
30762            };
30763            request_value_reader
30764                .seek(std::io::SeekFrom::Start(0))
30765                .unwrap();
30766            let mut req_result = {
30767                let client = &self.hub.client;
30768                dlg.pre_request();
30769                let mut req_builder = hyper::Request::builder()
30770                    .method(hyper::Method::POST)
30771                    .uri(url.as_str())
30772                    .header(USER_AGENT, self.hub._user_agent.clone());
30773
30774                if let Some(token) = token.as_ref() {
30775                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30776                }
30777
30778                let request = req_builder
30779                    .header(CONTENT_TYPE, json_mime_type.to_string())
30780                    .header(CONTENT_LENGTH, request_size as u64)
30781                    .body(common::to_body(
30782                        request_value_reader.get_ref().clone().into(),
30783                    ));
30784
30785                client.request(request.unwrap()).await
30786            };
30787
30788            match req_result {
30789                Err(err) => {
30790                    if let common::Retry::After(d) = dlg.http_error(&err) {
30791                        sleep(d).await;
30792                        continue;
30793                    }
30794                    dlg.finished(false);
30795                    return Err(common::Error::HttpError(err));
30796                }
30797                Ok(res) => {
30798                    let (mut parts, body) = res.into_parts();
30799                    let mut body = common::Body::new(body);
30800                    if !parts.status.is_success() {
30801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30802                        let error = serde_json::from_str(&common::to_string(&bytes));
30803                        let response = common::to_response(parts, bytes.into());
30804
30805                        if let common::Retry::After(d) =
30806                            dlg.http_failure(&response, error.as_ref().ok())
30807                        {
30808                            sleep(d).await;
30809                            continue;
30810                        }
30811
30812                        dlg.finished(false);
30813
30814                        return Err(match error {
30815                            Ok(value) => common::Error::BadRequest(value),
30816                            _ => common::Error::Failure(response),
30817                        });
30818                    }
30819                    let response = {
30820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30821                        let encoded = common::to_string(&bytes);
30822                        match serde_json::from_str(&encoded) {
30823                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30824                            Err(error) => {
30825                                dlg.response_json_decode_error(&encoded, &error);
30826                                return Err(common::Error::JsonDecodeError(
30827                                    encoded.to_string(),
30828                                    error,
30829                                ));
30830                            }
30831                        }
30832                    };
30833
30834                    dlg.finished(true);
30835                    return Ok(response);
30836                }
30837            }
30838        }
30839    }
30840
30841    ///
30842    /// Sets the *request* property to the given value.
30843    ///
30844    /// Even though the property as already been set when instantiating this call,
30845    /// we provide this method for API completeness.
30846    pub fn request(
30847        mut self,
30848        new_value: SetIamPolicyRequest,
30849    ) -> ProjectRegionOperationSetIamPolicyCall<'a, C> {
30850        self._request = new_value;
30851        self
30852    }
30853    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
30854    ///
30855    /// Sets the *resource* path property to the given value.
30856    ///
30857    /// Even though the property as already been set when instantiating this call,
30858    /// we provide this method for API completeness.
30859    pub fn resource(mut self, new_value: &str) -> ProjectRegionOperationSetIamPolicyCall<'a, C> {
30860        self._resource = new_value.to_string();
30861        self
30862    }
30863    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30864    /// while executing the actual API request.
30865    ///
30866    /// ````text
30867    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30868    /// ````
30869    ///
30870    /// Sets the *delegate* property to the given value.
30871    pub fn delegate(
30872        mut self,
30873        new_value: &'a mut dyn common::Delegate,
30874    ) -> ProjectRegionOperationSetIamPolicyCall<'a, C> {
30875        self._delegate = Some(new_value);
30876        self
30877    }
30878
30879    /// Set any additional parameter of the query string used in the request.
30880    /// It should be used to set parameters which are not yet available through their own
30881    /// setters.
30882    ///
30883    /// Please note that this method must not be used to set any of the known parameters
30884    /// which have their own setter method. If done anyway, the request will fail.
30885    ///
30886    /// # Additional Parameters
30887    ///
30888    /// * *$.xgafv* (query-string) - V1 error format.
30889    /// * *access_token* (query-string) - OAuth access token.
30890    /// * *alt* (query-string) - Data format for response.
30891    /// * *callback* (query-string) - JSONP
30892    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30893    /// * *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.
30894    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30895    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30896    /// * *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.
30897    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30898    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30899    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionOperationSetIamPolicyCall<'a, C>
30900    where
30901        T: AsRef<str>,
30902    {
30903        self._additional_params
30904            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30905        self
30906    }
30907
30908    /// Identifies the authorization scope for the method you are building.
30909    ///
30910    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30911    /// [`Scope::CloudPlatform`].
30912    ///
30913    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30914    /// tokens for more than one scope.
30915    ///
30916    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30917    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30918    /// sufficient, a read-write scope will do as well.
30919    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationSetIamPolicyCall<'a, C>
30920    where
30921        St: AsRef<str>,
30922    {
30923        self._scopes.insert(String::from(scope.as_ref()));
30924        self
30925    }
30926    /// Identifies the authorization scope(s) for the method you are building.
30927    ///
30928    /// See [`Self::add_scope()`] for details.
30929    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionOperationSetIamPolicyCall<'a, C>
30930    where
30931        I: IntoIterator<Item = St>,
30932        St: AsRef<str>,
30933    {
30934        self._scopes
30935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30936        self
30937    }
30938
30939    /// Removes all scopes, and no default scope will be used either.
30940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30941    /// for details).
30942    pub fn clear_scopes(mut self) -> ProjectRegionOperationSetIamPolicyCall<'a, C> {
30943        self._scopes.clear();
30944        self
30945    }
30946}
30947
30948/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
30949///
30950/// A builder for the *regions.operations.testIamPermissions* method supported by a *project* resource.
30951/// It is not used directly, but through a [`ProjectMethods`] instance.
30952///
30953/// # Example
30954///
30955/// Instantiate a resource method builder
30956///
30957/// ```test_harness,no_run
30958/// # extern crate hyper;
30959/// # extern crate hyper_rustls;
30960/// # extern crate google_dataproc1 as dataproc1;
30961/// use dataproc1::api::TestIamPermissionsRequest;
30962/// # async fn dox() {
30963/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30964///
30965/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30966/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
30967/// #     secret,
30968/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30969/// # ).build().await.unwrap();
30970///
30971/// # let client = hyper_util::client::legacy::Client::builder(
30972/// #     hyper_util::rt::TokioExecutor::new()
30973/// # )
30974/// # .build(
30975/// #     hyper_rustls::HttpsConnectorBuilder::new()
30976/// #         .with_native_roots()
30977/// #         .unwrap()
30978/// #         .https_or_http()
30979/// #         .enable_http1()
30980/// #         .build()
30981/// # );
30982/// # let mut hub = Dataproc::new(client, auth);
30983/// // As the method needs a request, you would usually fill it with the desired information
30984/// // into the respective structure. Some of the parts shown here might not be applicable !
30985/// // Values shown here are possibly random and not representative !
30986/// let mut req = TestIamPermissionsRequest::default();
30987///
30988/// // You can configure optional parameters by calling the respective setters at will, and
30989/// // execute the final call using `doit()`.
30990/// // Values shown here are possibly random and not representative !
30991/// let result = hub.projects().regions_operations_test_iam_permissions(req, "resource")
30992///              .doit().await;
30993/// # }
30994/// ```
30995pub struct ProjectRegionOperationTestIamPermissionCall<'a, C>
30996where
30997    C: 'a,
30998{
30999    hub: &'a Dataproc<C>,
31000    _request: TestIamPermissionsRequest,
31001    _resource: String,
31002    _delegate: Option<&'a mut dyn common::Delegate>,
31003    _additional_params: HashMap<String, String>,
31004    _scopes: BTreeSet<String>,
31005}
31006
31007impl<'a, C> common::CallBuilder for ProjectRegionOperationTestIamPermissionCall<'a, C> {}
31008
31009impl<'a, C> ProjectRegionOperationTestIamPermissionCall<'a, C>
31010where
31011    C: common::Connector,
31012{
31013    /// Perform the operation you have build so far.
31014    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
31015        use std::borrow::Cow;
31016        use std::io::{Read, Seek};
31017
31018        use common::{url::Params, ToParts};
31019        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31020
31021        let mut dd = common::DefaultDelegate;
31022        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31023        dlg.begin(common::MethodInfo {
31024            id: "dataproc.projects.regions.operations.testIamPermissions",
31025            http_method: hyper::Method::POST,
31026        });
31027
31028        for &field in ["alt", "resource"].iter() {
31029            if self._additional_params.contains_key(field) {
31030                dlg.finished(false);
31031                return Err(common::Error::FieldClash(field));
31032            }
31033        }
31034
31035        let mut params = Params::with_capacity(4 + self._additional_params.len());
31036        params.push("resource", self._resource);
31037
31038        params.extend(self._additional_params.iter());
31039
31040        params.push("alt", "json");
31041        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
31042        if self._scopes.is_empty() {
31043            self._scopes
31044                .insert(Scope::CloudPlatform.as_ref().to_string());
31045        }
31046
31047        #[allow(clippy::single_element_loop)]
31048        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
31049            url = params.uri_replacement(url, param_name, find_this, true);
31050        }
31051        {
31052            let to_remove = ["resource"];
31053            params.remove_params(&to_remove);
31054        }
31055
31056        let url = params.parse_with_url(&url);
31057
31058        let mut json_mime_type = mime::APPLICATION_JSON;
31059        let mut request_value_reader = {
31060            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31061            common::remove_json_null_values(&mut value);
31062            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31063            serde_json::to_writer(&mut dst, &value).unwrap();
31064            dst
31065        };
31066        let request_size = request_value_reader
31067            .seek(std::io::SeekFrom::End(0))
31068            .unwrap();
31069        request_value_reader
31070            .seek(std::io::SeekFrom::Start(0))
31071            .unwrap();
31072
31073        loop {
31074            let token = match self
31075                .hub
31076                .auth
31077                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31078                .await
31079            {
31080                Ok(token) => token,
31081                Err(e) => match dlg.token(e) {
31082                    Ok(token) => token,
31083                    Err(e) => {
31084                        dlg.finished(false);
31085                        return Err(common::Error::MissingToken(e));
31086                    }
31087                },
31088            };
31089            request_value_reader
31090                .seek(std::io::SeekFrom::Start(0))
31091                .unwrap();
31092            let mut req_result = {
31093                let client = &self.hub.client;
31094                dlg.pre_request();
31095                let mut req_builder = hyper::Request::builder()
31096                    .method(hyper::Method::POST)
31097                    .uri(url.as_str())
31098                    .header(USER_AGENT, self.hub._user_agent.clone());
31099
31100                if let Some(token) = token.as_ref() {
31101                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31102                }
31103
31104                let request = req_builder
31105                    .header(CONTENT_TYPE, json_mime_type.to_string())
31106                    .header(CONTENT_LENGTH, request_size as u64)
31107                    .body(common::to_body(
31108                        request_value_reader.get_ref().clone().into(),
31109                    ));
31110
31111                client.request(request.unwrap()).await
31112            };
31113
31114            match req_result {
31115                Err(err) => {
31116                    if let common::Retry::After(d) = dlg.http_error(&err) {
31117                        sleep(d).await;
31118                        continue;
31119                    }
31120                    dlg.finished(false);
31121                    return Err(common::Error::HttpError(err));
31122                }
31123                Ok(res) => {
31124                    let (mut parts, body) = res.into_parts();
31125                    let mut body = common::Body::new(body);
31126                    if !parts.status.is_success() {
31127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31128                        let error = serde_json::from_str(&common::to_string(&bytes));
31129                        let response = common::to_response(parts, bytes.into());
31130
31131                        if let common::Retry::After(d) =
31132                            dlg.http_failure(&response, error.as_ref().ok())
31133                        {
31134                            sleep(d).await;
31135                            continue;
31136                        }
31137
31138                        dlg.finished(false);
31139
31140                        return Err(match error {
31141                            Ok(value) => common::Error::BadRequest(value),
31142                            _ => common::Error::Failure(response),
31143                        });
31144                    }
31145                    let response = {
31146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31147                        let encoded = common::to_string(&bytes);
31148                        match serde_json::from_str(&encoded) {
31149                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31150                            Err(error) => {
31151                                dlg.response_json_decode_error(&encoded, &error);
31152                                return Err(common::Error::JsonDecodeError(
31153                                    encoded.to_string(),
31154                                    error,
31155                                ));
31156                            }
31157                        }
31158                    };
31159
31160                    dlg.finished(true);
31161                    return Ok(response);
31162                }
31163            }
31164        }
31165    }
31166
31167    ///
31168    /// Sets the *request* property to the given value.
31169    ///
31170    /// Even though the property as already been set when instantiating this call,
31171    /// we provide this method for API completeness.
31172    pub fn request(
31173        mut self,
31174        new_value: TestIamPermissionsRequest,
31175    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C> {
31176        self._request = new_value;
31177        self
31178    }
31179    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
31180    ///
31181    /// Sets the *resource* path property to the given value.
31182    ///
31183    /// Even though the property as already been set when instantiating this call,
31184    /// we provide this method for API completeness.
31185    pub fn resource(
31186        mut self,
31187        new_value: &str,
31188    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C> {
31189        self._resource = new_value.to_string();
31190        self
31191    }
31192    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31193    /// while executing the actual API request.
31194    ///
31195    /// ````text
31196    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31197    /// ````
31198    ///
31199    /// Sets the *delegate* property to the given value.
31200    pub fn delegate(
31201        mut self,
31202        new_value: &'a mut dyn common::Delegate,
31203    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C> {
31204        self._delegate = Some(new_value);
31205        self
31206    }
31207
31208    /// Set any additional parameter of the query string used in the request.
31209    /// It should be used to set parameters which are not yet available through their own
31210    /// setters.
31211    ///
31212    /// Please note that this method must not be used to set any of the known parameters
31213    /// which have their own setter method. If done anyway, the request will fail.
31214    ///
31215    /// # Additional Parameters
31216    ///
31217    /// * *$.xgafv* (query-string) - V1 error format.
31218    /// * *access_token* (query-string) - OAuth access token.
31219    /// * *alt* (query-string) - Data format for response.
31220    /// * *callback* (query-string) - JSONP
31221    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31222    /// * *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.
31223    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31224    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31225    /// * *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.
31226    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31227    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31228    pub fn param<T>(
31229        mut self,
31230        name: T,
31231        value: T,
31232    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C>
31233    where
31234        T: AsRef<str>,
31235    {
31236        self._additional_params
31237            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31238        self
31239    }
31240
31241    /// Identifies the authorization scope for the method you are building.
31242    ///
31243    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31244    /// [`Scope::CloudPlatform`].
31245    ///
31246    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31247    /// tokens for more than one scope.
31248    ///
31249    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31250    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31251    /// sufficient, a read-write scope will do as well.
31252    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionOperationTestIamPermissionCall<'a, C>
31253    where
31254        St: AsRef<str>,
31255    {
31256        self._scopes.insert(String::from(scope.as_ref()));
31257        self
31258    }
31259    /// Identifies the authorization scope(s) for the method you are building.
31260    ///
31261    /// See [`Self::add_scope()`] for details.
31262    pub fn add_scopes<I, St>(
31263        mut self,
31264        scopes: I,
31265    ) -> ProjectRegionOperationTestIamPermissionCall<'a, C>
31266    where
31267        I: IntoIterator<Item = St>,
31268        St: AsRef<str>,
31269    {
31270        self._scopes
31271            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31272        self
31273    }
31274
31275    /// Removes all scopes, and no default scope will be used either.
31276    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31277    /// for details).
31278    pub fn clear_scopes(mut self) -> ProjectRegionOperationTestIamPermissionCall<'a, C> {
31279        self._scopes.clear();
31280        self
31281    }
31282}
31283
31284/// Creates new workflow template.
31285///
31286/// A builder for the *regions.workflowTemplates.create* method supported by a *project* resource.
31287/// It is not used directly, but through a [`ProjectMethods`] instance.
31288///
31289/// # Example
31290///
31291/// Instantiate a resource method builder
31292///
31293/// ```test_harness,no_run
31294/// # extern crate hyper;
31295/// # extern crate hyper_rustls;
31296/// # extern crate google_dataproc1 as dataproc1;
31297/// use dataproc1::api::WorkflowTemplate;
31298/// # async fn dox() {
31299/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31300///
31301/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31302/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31303/// #     secret,
31304/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31305/// # ).build().await.unwrap();
31306///
31307/// # let client = hyper_util::client::legacy::Client::builder(
31308/// #     hyper_util::rt::TokioExecutor::new()
31309/// # )
31310/// # .build(
31311/// #     hyper_rustls::HttpsConnectorBuilder::new()
31312/// #         .with_native_roots()
31313/// #         .unwrap()
31314/// #         .https_or_http()
31315/// #         .enable_http1()
31316/// #         .build()
31317/// # );
31318/// # let mut hub = Dataproc::new(client, auth);
31319/// // As the method needs a request, you would usually fill it with the desired information
31320/// // into the respective structure. Some of the parts shown here might not be applicable !
31321/// // Values shown here are possibly random and not representative !
31322/// let mut req = WorkflowTemplate::default();
31323///
31324/// // You can configure optional parameters by calling the respective setters at will, and
31325/// // execute the final call using `doit()`.
31326/// // Values shown here are possibly random and not representative !
31327/// let result = hub.projects().regions_workflow_templates_create(req, "parent")
31328///              .doit().await;
31329/// # }
31330/// ```
31331pub struct ProjectRegionWorkflowTemplateCreateCall<'a, C>
31332where
31333    C: 'a,
31334{
31335    hub: &'a Dataproc<C>,
31336    _request: WorkflowTemplate,
31337    _parent: String,
31338    _delegate: Option<&'a mut dyn common::Delegate>,
31339    _additional_params: HashMap<String, String>,
31340    _scopes: BTreeSet<String>,
31341}
31342
31343impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateCreateCall<'a, C> {}
31344
31345impl<'a, C> ProjectRegionWorkflowTemplateCreateCall<'a, C>
31346where
31347    C: common::Connector,
31348{
31349    /// Perform the operation you have build so far.
31350    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
31351        use std::borrow::Cow;
31352        use std::io::{Read, Seek};
31353
31354        use common::{url::Params, ToParts};
31355        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31356
31357        let mut dd = common::DefaultDelegate;
31358        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31359        dlg.begin(common::MethodInfo {
31360            id: "dataproc.projects.regions.workflowTemplates.create",
31361            http_method: hyper::Method::POST,
31362        });
31363
31364        for &field in ["alt", "parent"].iter() {
31365            if self._additional_params.contains_key(field) {
31366                dlg.finished(false);
31367                return Err(common::Error::FieldClash(field));
31368            }
31369        }
31370
31371        let mut params = Params::with_capacity(4 + self._additional_params.len());
31372        params.push("parent", self._parent);
31373
31374        params.extend(self._additional_params.iter());
31375
31376        params.push("alt", "json");
31377        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates";
31378        if self._scopes.is_empty() {
31379            self._scopes
31380                .insert(Scope::CloudPlatform.as_ref().to_string());
31381        }
31382
31383        #[allow(clippy::single_element_loop)]
31384        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
31385            url = params.uri_replacement(url, param_name, find_this, true);
31386        }
31387        {
31388            let to_remove = ["parent"];
31389            params.remove_params(&to_remove);
31390        }
31391
31392        let url = params.parse_with_url(&url);
31393
31394        let mut json_mime_type = mime::APPLICATION_JSON;
31395        let mut request_value_reader = {
31396            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31397            common::remove_json_null_values(&mut value);
31398            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31399            serde_json::to_writer(&mut dst, &value).unwrap();
31400            dst
31401        };
31402        let request_size = request_value_reader
31403            .seek(std::io::SeekFrom::End(0))
31404            .unwrap();
31405        request_value_reader
31406            .seek(std::io::SeekFrom::Start(0))
31407            .unwrap();
31408
31409        loop {
31410            let token = match self
31411                .hub
31412                .auth
31413                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31414                .await
31415            {
31416                Ok(token) => token,
31417                Err(e) => match dlg.token(e) {
31418                    Ok(token) => token,
31419                    Err(e) => {
31420                        dlg.finished(false);
31421                        return Err(common::Error::MissingToken(e));
31422                    }
31423                },
31424            };
31425            request_value_reader
31426                .seek(std::io::SeekFrom::Start(0))
31427                .unwrap();
31428            let mut req_result = {
31429                let client = &self.hub.client;
31430                dlg.pre_request();
31431                let mut req_builder = hyper::Request::builder()
31432                    .method(hyper::Method::POST)
31433                    .uri(url.as_str())
31434                    .header(USER_AGENT, self.hub._user_agent.clone());
31435
31436                if let Some(token) = token.as_ref() {
31437                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31438                }
31439
31440                let request = req_builder
31441                    .header(CONTENT_TYPE, json_mime_type.to_string())
31442                    .header(CONTENT_LENGTH, request_size as u64)
31443                    .body(common::to_body(
31444                        request_value_reader.get_ref().clone().into(),
31445                    ));
31446
31447                client.request(request.unwrap()).await
31448            };
31449
31450            match req_result {
31451                Err(err) => {
31452                    if let common::Retry::After(d) = dlg.http_error(&err) {
31453                        sleep(d).await;
31454                        continue;
31455                    }
31456                    dlg.finished(false);
31457                    return Err(common::Error::HttpError(err));
31458                }
31459                Ok(res) => {
31460                    let (mut parts, body) = res.into_parts();
31461                    let mut body = common::Body::new(body);
31462                    if !parts.status.is_success() {
31463                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31464                        let error = serde_json::from_str(&common::to_string(&bytes));
31465                        let response = common::to_response(parts, bytes.into());
31466
31467                        if let common::Retry::After(d) =
31468                            dlg.http_failure(&response, error.as_ref().ok())
31469                        {
31470                            sleep(d).await;
31471                            continue;
31472                        }
31473
31474                        dlg.finished(false);
31475
31476                        return Err(match error {
31477                            Ok(value) => common::Error::BadRequest(value),
31478                            _ => common::Error::Failure(response),
31479                        });
31480                    }
31481                    let response = {
31482                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31483                        let encoded = common::to_string(&bytes);
31484                        match serde_json::from_str(&encoded) {
31485                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31486                            Err(error) => {
31487                                dlg.response_json_decode_error(&encoded, &error);
31488                                return Err(common::Error::JsonDecodeError(
31489                                    encoded.to_string(),
31490                                    error,
31491                                ));
31492                            }
31493                        }
31494                    };
31495
31496                    dlg.finished(true);
31497                    return Ok(response);
31498                }
31499            }
31500        }
31501    }
31502
31503    ///
31504    /// Sets the *request* property to the given value.
31505    ///
31506    /// Even though the property as already been set when instantiating this call,
31507    /// we provide this method for API completeness.
31508    pub fn request(
31509        mut self,
31510        new_value: WorkflowTemplate,
31511    ) -> ProjectRegionWorkflowTemplateCreateCall<'a, C> {
31512        self._request = new_value;
31513        self
31514    }
31515    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.create, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}
31516    ///
31517    /// Sets the *parent* path property to the given value.
31518    ///
31519    /// Even though the property as already been set when instantiating this call,
31520    /// we provide this method for API completeness.
31521    pub fn parent(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateCreateCall<'a, C> {
31522        self._parent = new_value.to_string();
31523        self
31524    }
31525    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31526    /// while executing the actual API request.
31527    ///
31528    /// ````text
31529    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31530    /// ````
31531    ///
31532    /// Sets the *delegate* property to the given value.
31533    pub fn delegate(
31534        mut self,
31535        new_value: &'a mut dyn common::Delegate,
31536    ) -> ProjectRegionWorkflowTemplateCreateCall<'a, C> {
31537        self._delegate = Some(new_value);
31538        self
31539    }
31540
31541    /// Set any additional parameter of the query string used in the request.
31542    /// It should be used to set parameters which are not yet available through their own
31543    /// setters.
31544    ///
31545    /// Please note that this method must not be used to set any of the known parameters
31546    /// which have their own setter method. If done anyway, the request will fail.
31547    ///
31548    /// # Additional Parameters
31549    ///
31550    /// * *$.xgafv* (query-string) - V1 error format.
31551    /// * *access_token* (query-string) - OAuth access token.
31552    /// * *alt* (query-string) - Data format for response.
31553    /// * *callback* (query-string) - JSONP
31554    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31555    /// * *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.
31556    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31557    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31558    /// * *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.
31559    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31560    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31561    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateCreateCall<'a, C>
31562    where
31563        T: AsRef<str>,
31564    {
31565        self._additional_params
31566            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31567        self
31568    }
31569
31570    /// Identifies the authorization scope for the method you are building.
31571    ///
31572    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31573    /// [`Scope::CloudPlatform`].
31574    ///
31575    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31576    /// tokens for more than one scope.
31577    ///
31578    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31579    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31580    /// sufficient, a read-write scope will do as well.
31581    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateCreateCall<'a, C>
31582    where
31583        St: AsRef<str>,
31584    {
31585        self._scopes.insert(String::from(scope.as_ref()));
31586        self
31587    }
31588    /// Identifies the authorization scope(s) for the method you are building.
31589    ///
31590    /// See [`Self::add_scope()`] for details.
31591    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionWorkflowTemplateCreateCall<'a, C>
31592    where
31593        I: IntoIterator<Item = St>,
31594        St: AsRef<str>,
31595    {
31596        self._scopes
31597            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31598        self
31599    }
31600
31601    /// Removes all scopes, and no default scope will be used either.
31602    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31603    /// for details).
31604    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateCreateCall<'a, C> {
31605        self._scopes.clear();
31606        self
31607    }
31608}
31609
31610/// Deletes a workflow template. It does not cancel in-progress workflows.
31611///
31612/// A builder for the *regions.workflowTemplates.delete* method supported by a *project* resource.
31613/// It is not used directly, but through a [`ProjectMethods`] instance.
31614///
31615/// # Example
31616///
31617/// Instantiate a resource method builder
31618///
31619/// ```test_harness,no_run
31620/// # extern crate hyper;
31621/// # extern crate hyper_rustls;
31622/// # extern crate google_dataproc1 as dataproc1;
31623/// # async fn dox() {
31624/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31625///
31626/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31628/// #     secret,
31629/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31630/// # ).build().await.unwrap();
31631///
31632/// # let client = hyper_util::client::legacy::Client::builder(
31633/// #     hyper_util::rt::TokioExecutor::new()
31634/// # )
31635/// # .build(
31636/// #     hyper_rustls::HttpsConnectorBuilder::new()
31637/// #         .with_native_roots()
31638/// #         .unwrap()
31639/// #         .https_or_http()
31640/// #         .enable_http1()
31641/// #         .build()
31642/// # );
31643/// # let mut hub = Dataproc::new(client, auth);
31644/// // You can configure optional parameters by calling the respective setters at will, and
31645/// // execute the final call using `doit()`.
31646/// // Values shown here are possibly random and not representative !
31647/// let result = hub.projects().regions_workflow_templates_delete("name")
31648///              .version(-81)
31649///              .doit().await;
31650/// # }
31651/// ```
31652pub struct ProjectRegionWorkflowTemplateDeleteCall<'a, C>
31653where
31654    C: 'a,
31655{
31656    hub: &'a Dataproc<C>,
31657    _name: String,
31658    _version: Option<i32>,
31659    _delegate: Option<&'a mut dyn common::Delegate>,
31660    _additional_params: HashMap<String, String>,
31661    _scopes: BTreeSet<String>,
31662}
31663
31664impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateDeleteCall<'a, C> {}
31665
31666impl<'a, C> ProjectRegionWorkflowTemplateDeleteCall<'a, C>
31667where
31668    C: common::Connector,
31669{
31670    /// Perform the operation you have build so far.
31671    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
31672        use std::borrow::Cow;
31673        use std::io::{Read, Seek};
31674
31675        use common::{url::Params, ToParts};
31676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31677
31678        let mut dd = common::DefaultDelegate;
31679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31680        dlg.begin(common::MethodInfo {
31681            id: "dataproc.projects.regions.workflowTemplates.delete",
31682            http_method: hyper::Method::DELETE,
31683        });
31684
31685        for &field in ["alt", "name", "version"].iter() {
31686            if self._additional_params.contains_key(field) {
31687                dlg.finished(false);
31688                return Err(common::Error::FieldClash(field));
31689            }
31690        }
31691
31692        let mut params = Params::with_capacity(4 + self._additional_params.len());
31693        params.push("name", self._name);
31694        if let Some(value) = self._version.as_ref() {
31695            params.push("version", value.to_string());
31696        }
31697
31698        params.extend(self._additional_params.iter());
31699
31700        params.push("alt", "json");
31701        let mut url = self.hub._base_url.clone() + "v1/{+name}";
31702        if self._scopes.is_empty() {
31703            self._scopes
31704                .insert(Scope::CloudPlatform.as_ref().to_string());
31705        }
31706
31707        #[allow(clippy::single_element_loop)]
31708        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31709            url = params.uri_replacement(url, param_name, find_this, true);
31710        }
31711        {
31712            let to_remove = ["name"];
31713            params.remove_params(&to_remove);
31714        }
31715
31716        let url = params.parse_with_url(&url);
31717
31718        loop {
31719            let token = match self
31720                .hub
31721                .auth
31722                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31723                .await
31724            {
31725                Ok(token) => token,
31726                Err(e) => match dlg.token(e) {
31727                    Ok(token) => token,
31728                    Err(e) => {
31729                        dlg.finished(false);
31730                        return Err(common::Error::MissingToken(e));
31731                    }
31732                },
31733            };
31734            let mut req_result = {
31735                let client = &self.hub.client;
31736                dlg.pre_request();
31737                let mut req_builder = hyper::Request::builder()
31738                    .method(hyper::Method::DELETE)
31739                    .uri(url.as_str())
31740                    .header(USER_AGENT, self.hub._user_agent.clone());
31741
31742                if let Some(token) = token.as_ref() {
31743                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31744                }
31745
31746                let request = req_builder
31747                    .header(CONTENT_LENGTH, 0_u64)
31748                    .body(common::to_body::<String>(None));
31749
31750                client.request(request.unwrap()).await
31751            };
31752
31753            match req_result {
31754                Err(err) => {
31755                    if let common::Retry::After(d) = dlg.http_error(&err) {
31756                        sleep(d).await;
31757                        continue;
31758                    }
31759                    dlg.finished(false);
31760                    return Err(common::Error::HttpError(err));
31761                }
31762                Ok(res) => {
31763                    let (mut parts, body) = res.into_parts();
31764                    let mut body = common::Body::new(body);
31765                    if !parts.status.is_success() {
31766                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31767                        let error = serde_json::from_str(&common::to_string(&bytes));
31768                        let response = common::to_response(parts, bytes.into());
31769
31770                        if let common::Retry::After(d) =
31771                            dlg.http_failure(&response, error.as_ref().ok())
31772                        {
31773                            sleep(d).await;
31774                            continue;
31775                        }
31776
31777                        dlg.finished(false);
31778
31779                        return Err(match error {
31780                            Ok(value) => common::Error::BadRequest(value),
31781                            _ => common::Error::Failure(response),
31782                        });
31783                    }
31784                    let response = {
31785                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31786                        let encoded = common::to_string(&bytes);
31787                        match serde_json::from_str(&encoded) {
31788                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31789                            Err(error) => {
31790                                dlg.response_json_decode_error(&encoded, &error);
31791                                return Err(common::Error::JsonDecodeError(
31792                                    encoded.to_string(),
31793                                    error,
31794                                ));
31795                            }
31796                        }
31797                    };
31798
31799                    dlg.finished(true);
31800                    return Ok(response);
31801                }
31802            }
31803        }
31804    }
31805
31806    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
31807    ///
31808    /// Sets the *name* path property to the given value.
31809    ///
31810    /// Even though the property as already been set when instantiating this call,
31811    /// we provide this method for API completeness.
31812    pub fn name(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C> {
31813        self._name = new_value.to_string();
31814        self
31815    }
31816    /// Optional. The version of workflow template to delete. If specified, will only delete the template if the current server version matches specified version.
31817    ///
31818    /// Sets the *version* query property to the given value.
31819    pub fn version(mut self, new_value: i32) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C> {
31820        self._version = Some(new_value);
31821        self
31822    }
31823    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31824    /// while executing the actual API request.
31825    ///
31826    /// ````text
31827    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31828    /// ````
31829    ///
31830    /// Sets the *delegate* property to the given value.
31831    pub fn delegate(
31832        mut self,
31833        new_value: &'a mut dyn common::Delegate,
31834    ) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C> {
31835        self._delegate = Some(new_value);
31836        self
31837    }
31838
31839    /// Set any additional parameter of the query string used in the request.
31840    /// It should be used to set parameters which are not yet available through their own
31841    /// setters.
31842    ///
31843    /// Please note that this method must not be used to set any of the known parameters
31844    /// which have their own setter method. If done anyway, the request will fail.
31845    ///
31846    /// # Additional Parameters
31847    ///
31848    /// * *$.xgafv* (query-string) - V1 error format.
31849    /// * *access_token* (query-string) - OAuth access token.
31850    /// * *alt* (query-string) - Data format for response.
31851    /// * *callback* (query-string) - JSONP
31852    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31853    /// * *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.
31854    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31855    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31856    /// * *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.
31857    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31858    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31859    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C>
31860    where
31861        T: AsRef<str>,
31862    {
31863        self._additional_params
31864            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31865        self
31866    }
31867
31868    /// Identifies the authorization scope for the method you are building.
31869    ///
31870    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31871    /// [`Scope::CloudPlatform`].
31872    ///
31873    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31874    /// tokens for more than one scope.
31875    ///
31876    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31877    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31878    /// sufficient, a read-write scope will do as well.
31879    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C>
31880    where
31881        St: AsRef<str>,
31882    {
31883        self._scopes.insert(String::from(scope.as_ref()));
31884        self
31885    }
31886    /// Identifies the authorization scope(s) for the method you are building.
31887    ///
31888    /// See [`Self::add_scope()`] for details.
31889    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C>
31890    where
31891        I: IntoIterator<Item = St>,
31892        St: AsRef<str>,
31893    {
31894        self._scopes
31895            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31896        self
31897    }
31898
31899    /// Removes all scopes, and no default scope will be used either.
31900    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31901    /// for details).
31902    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateDeleteCall<'a, C> {
31903        self._scopes.clear();
31904        self
31905    }
31906}
31907
31908/// Retrieves the latest workflow template.Can retrieve previously instantiated template by specifying optional version parameter.
31909///
31910/// A builder for the *regions.workflowTemplates.get* method supported by a *project* resource.
31911/// It is not used directly, but through a [`ProjectMethods`] instance.
31912///
31913/// # Example
31914///
31915/// Instantiate a resource method builder
31916///
31917/// ```test_harness,no_run
31918/// # extern crate hyper;
31919/// # extern crate hyper_rustls;
31920/// # extern crate google_dataproc1 as dataproc1;
31921/// # async fn dox() {
31922/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31923///
31924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
31926/// #     secret,
31927/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31928/// # ).build().await.unwrap();
31929///
31930/// # let client = hyper_util::client::legacy::Client::builder(
31931/// #     hyper_util::rt::TokioExecutor::new()
31932/// # )
31933/// # .build(
31934/// #     hyper_rustls::HttpsConnectorBuilder::new()
31935/// #         .with_native_roots()
31936/// #         .unwrap()
31937/// #         .https_or_http()
31938/// #         .enable_http1()
31939/// #         .build()
31940/// # );
31941/// # let mut hub = Dataproc::new(client, auth);
31942/// // You can configure optional parameters by calling the respective setters at will, and
31943/// // execute the final call using `doit()`.
31944/// // Values shown here are possibly random and not representative !
31945/// let result = hub.projects().regions_workflow_templates_get("name")
31946///              .version(-41)
31947///              .doit().await;
31948/// # }
31949/// ```
31950pub struct ProjectRegionWorkflowTemplateGetCall<'a, C>
31951where
31952    C: 'a,
31953{
31954    hub: &'a Dataproc<C>,
31955    _name: String,
31956    _version: Option<i32>,
31957    _delegate: Option<&'a mut dyn common::Delegate>,
31958    _additional_params: HashMap<String, String>,
31959    _scopes: BTreeSet<String>,
31960}
31961
31962impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateGetCall<'a, C> {}
31963
31964impl<'a, C> ProjectRegionWorkflowTemplateGetCall<'a, C>
31965where
31966    C: common::Connector,
31967{
31968    /// Perform the operation you have build so far.
31969    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
31970        use std::borrow::Cow;
31971        use std::io::{Read, Seek};
31972
31973        use common::{url::Params, ToParts};
31974        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31975
31976        let mut dd = common::DefaultDelegate;
31977        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31978        dlg.begin(common::MethodInfo {
31979            id: "dataproc.projects.regions.workflowTemplates.get",
31980            http_method: hyper::Method::GET,
31981        });
31982
31983        for &field in ["alt", "name", "version"].iter() {
31984            if self._additional_params.contains_key(field) {
31985                dlg.finished(false);
31986                return Err(common::Error::FieldClash(field));
31987            }
31988        }
31989
31990        let mut params = Params::with_capacity(4 + self._additional_params.len());
31991        params.push("name", self._name);
31992        if let Some(value) = self._version.as_ref() {
31993            params.push("version", value.to_string());
31994        }
31995
31996        params.extend(self._additional_params.iter());
31997
31998        params.push("alt", "json");
31999        let mut url = self.hub._base_url.clone() + "v1/{+name}";
32000        if self._scopes.is_empty() {
32001            self._scopes
32002                .insert(Scope::CloudPlatform.as_ref().to_string());
32003        }
32004
32005        #[allow(clippy::single_element_loop)]
32006        for &(find_this, param_name) in [("{+name}", "name")].iter() {
32007            url = params.uri_replacement(url, param_name, find_this, true);
32008        }
32009        {
32010            let to_remove = ["name"];
32011            params.remove_params(&to_remove);
32012        }
32013
32014        let url = params.parse_with_url(&url);
32015
32016        loop {
32017            let token = match self
32018                .hub
32019                .auth
32020                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32021                .await
32022            {
32023                Ok(token) => token,
32024                Err(e) => match dlg.token(e) {
32025                    Ok(token) => token,
32026                    Err(e) => {
32027                        dlg.finished(false);
32028                        return Err(common::Error::MissingToken(e));
32029                    }
32030                },
32031            };
32032            let mut req_result = {
32033                let client = &self.hub.client;
32034                dlg.pre_request();
32035                let mut req_builder = hyper::Request::builder()
32036                    .method(hyper::Method::GET)
32037                    .uri(url.as_str())
32038                    .header(USER_AGENT, self.hub._user_agent.clone());
32039
32040                if let Some(token) = token.as_ref() {
32041                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32042                }
32043
32044                let request = req_builder
32045                    .header(CONTENT_LENGTH, 0_u64)
32046                    .body(common::to_body::<String>(None));
32047
32048                client.request(request.unwrap()).await
32049            };
32050
32051            match req_result {
32052                Err(err) => {
32053                    if let common::Retry::After(d) = dlg.http_error(&err) {
32054                        sleep(d).await;
32055                        continue;
32056                    }
32057                    dlg.finished(false);
32058                    return Err(common::Error::HttpError(err));
32059                }
32060                Ok(res) => {
32061                    let (mut parts, body) = res.into_parts();
32062                    let mut body = common::Body::new(body);
32063                    if !parts.status.is_success() {
32064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32065                        let error = serde_json::from_str(&common::to_string(&bytes));
32066                        let response = common::to_response(parts, bytes.into());
32067
32068                        if let common::Retry::After(d) =
32069                            dlg.http_failure(&response, error.as_ref().ok())
32070                        {
32071                            sleep(d).await;
32072                            continue;
32073                        }
32074
32075                        dlg.finished(false);
32076
32077                        return Err(match error {
32078                            Ok(value) => common::Error::BadRequest(value),
32079                            _ => common::Error::Failure(response),
32080                        });
32081                    }
32082                    let response = {
32083                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32084                        let encoded = common::to_string(&bytes);
32085                        match serde_json::from_str(&encoded) {
32086                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32087                            Err(error) => {
32088                                dlg.response_json_decode_error(&encoded, &error);
32089                                return Err(common::Error::JsonDecodeError(
32090                                    encoded.to_string(),
32091                                    error,
32092                                ));
32093                            }
32094                        }
32095                    };
32096
32097                    dlg.finished(true);
32098                    return Ok(response);
32099                }
32100            }
32101        }
32102    }
32103
32104    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
32105    ///
32106    /// Sets the *name* path property to the given value.
32107    ///
32108    /// Even though the property as already been set when instantiating this call,
32109    /// we provide this method for API completeness.
32110    pub fn name(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateGetCall<'a, C> {
32111        self._name = new_value.to_string();
32112        self
32113    }
32114    /// Optional. The version of workflow template to retrieve. Only previously instantiated versions can be retrieved.If unspecified, retrieves the current version.
32115    ///
32116    /// Sets the *version* query property to the given value.
32117    pub fn version(mut self, new_value: i32) -> ProjectRegionWorkflowTemplateGetCall<'a, C> {
32118        self._version = Some(new_value);
32119        self
32120    }
32121    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32122    /// while executing the actual API request.
32123    ///
32124    /// ````text
32125    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32126    /// ````
32127    ///
32128    /// Sets the *delegate* property to the given value.
32129    pub fn delegate(
32130        mut self,
32131        new_value: &'a mut dyn common::Delegate,
32132    ) -> ProjectRegionWorkflowTemplateGetCall<'a, C> {
32133        self._delegate = Some(new_value);
32134        self
32135    }
32136
32137    /// Set any additional parameter of the query string used in the request.
32138    /// It should be used to set parameters which are not yet available through their own
32139    /// setters.
32140    ///
32141    /// Please note that this method must not be used to set any of the known parameters
32142    /// which have their own setter method. If done anyway, the request will fail.
32143    ///
32144    /// # Additional Parameters
32145    ///
32146    /// * *$.xgafv* (query-string) - V1 error format.
32147    /// * *access_token* (query-string) - OAuth access token.
32148    /// * *alt* (query-string) - Data format for response.
32149    /// * *callback* (query-string) - JSONP
32150    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32151    /// * *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.
32152    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32153    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32154    /// * *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.
32155    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32156    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32157    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateGetCall<'a, C>
32158    where
32159        T: AsRef<str>,
32160    {
32161        self._additional_params
32162            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32163        self
32164    }
32165
32166    /// Identifies the authorization scope for the method you are building.
32167    ///
32168    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32169    /// [`Scope::CloudPlatform`].
32170    ///
32171    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32172    /// tokens for more than one scope.
32173    ///
32174    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32175    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32176    /// sufficient, a read-write scope will do as well.
32177    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateGetCall<'a, C>
32178    where
32179        St: AsRef<str>,
32180    {
32181        self._scopes.insert(String::from(scope.as_ref()));
32182        self
32183    }
32184    /// Identifies the authorization scope(s) for the method you are building.
32185    ///
32186    /// See [`Self::add_scope()`] for details.
32187    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionWorkflowTemplateGetCall<'a, C>
32188    where
32189        I: IntoIterator<Item = St>,
32190        St: AsRef<str>,
32191    {
32192        self._scopes
32193            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32194        self
32195    }
32196
32197    /// Removes all scopes, and no default scope will be used either.
32198    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32199    /// for details).
32200    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateGetCall<'a, C> {
32201        self._scopes.clear();
32202        self
32203    }
32204}
32205
32206/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
32207///
32208/// A builder for the *regions.workflowTemplates.getIamPolicy* method supported by a *project* resource.
32209/// It is not used directly, but through a [`ProjectMethods`] instance.
32210///
32211/// # Example
32212///
32213/// Instantiate a resource method builder
32214///
32215/// ```test_harness,no_run
32216/// # extern crate hyper;
32217/// # extern crate hyper_rustls;
32218/// # extern crate google_dataproc1 as dataproc1;
32219/// use dataproc1::api::GetIamPolicyRequest;
32220/// # async fn dox() {
32221/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32222///
32223/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32224/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32225/// #     secret,
32226/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32227/// # ).build().await.unwrap();
32228///
32229/// # let client = hyper_util::client::legacy::Client::builder(
32230/// #     hyper_util::rt::TokioExecutor::new()
32231/// # )
32232/// # .build(
32233/// #     hyper_rustls::HttpsConnectorBuilder::new()
32234/// #         .with_native_roots()
32235/// #         .unwrap()
32236/// #         .https_or_http()
32237/// #         .enable_http1()
32238/// #         .build()
32239/// # );
32240/// # let mut hub = Dataproc::new(client, auth);
32241/// // As the method needs a request, you would usually fill it with the desired information
32242/// // into the respective structure. Some of the parts shown here might not be applicable !
32243/// // Values shown here are possibly random and not representative !
32244/// let mut req = GetIamPolicyRequest::default();
32245///
32246/// // You can configure optional parameters by calling the respective setters at will, and
32247/// // execute the final call using `doit()`.
32248/// // Values shown here are possibly random and not representative !
32249/// let result = hub.projects().regions_workflow_templates_get_iam_policy(req, "resource")
32250///              .doit().await;
32251/// # }
32252/// ```
32253pub struct ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C>
32254where
32255    C: 'a,
32256{
32257    hub: &'a Dataproc<C>,
32258    _request: GetIamPolicyRequest,
32259    _resource: String,
32260    _delegate: Option<&'a mut dyn common::Delegate>,
32261    _additional_params: HashMap<String, String>,
32262    _scopes: BTreeSet<String>,
32263}
32264
32265impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {}
32266
32267impl<'a, C> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C>
32268where
32269    C: common::Connector,
32270{
32271    /// Perform the operation you have build so far.
32272    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
32273        use std::borrow::Cow;
32274        use std::io::{Read, Seek};
32275
32276        use common::{url::Params, ToParts};
32277        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32278
32279        let mut dd = common::DefaultDelegate;
32280        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32281        dlg.begin(common::MethodInfo {
32282            id: "dataproc.projects.regions.workflowTemplates.getIamPolicy",
32283            http_method: hyper::Method::POST,
32284        });
32285
32286        for &field in ["alt", "resource"].iter() {
32287            if self._additional_params.contains_key(field) {
32288                dlg.finished(false);
32289                return Err(common::Error::FieldClash(field));
32290            }
32291        }
32292
32293        let mut params = Params::with_capacity(4 + self._additional_params.len());
32294        params.push("resource", self._resource);
32295
32296        params.extend(self._additional_params.iter());
32297
32298        params.push("alt", "json");
32299        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
32300        if self._scopes.is_empty() {
32301            self._scopes
32302                .insert(Scope::CloudPlatform.as_ref().to_string());
32303        }
32304
32305        #[allow(clippy::single_element_loop)]
32306        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
32307            url = params.uri_replacement(url, param_name, find_this, true);
32308        }
32309        {
32310            let to_remove = ["resource"];
32311            params.remove_params(&to_remove);
32312        }
32313
32314        let url = params.parse_with_url(&url);
32315
32316        let mut json_mime_type = mime::APPLICATION_JSON;
32317        let mut request_value_reader = {
32318            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32319            common::remove_json_null_values(&mut value);
32320            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32321            serde_json::to_writer(&mut dst, &value).unwrap();
32322            dst
32323        };
32324        let request_size = request_value_reader
32325            .seek(std::io::SeekFrom::End(0))
32326            .unwrap();
32327        request_value_reader
32328            .seek(std::io::SeekFrom::Start(0))
32329            .unwrap();
32330
32331        loop {
32332            let token = match self
32333                .hub
32334                .auth
32335                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32336                .await
32337            {
32338                Ok(token) => token,
32339                Err(e) => match dlg.token(e) {
32340                    Ok(token) => token,
32341                    Err(e) => {
32342                        dlg.finished(false);
32343                        return Err(common::Error::MissingToken(e));
32344                    }
32345                },
32346            };
32347            request_value_reader
32348                .seek(std::io::SeekFrom::Start(0))
32349                .unwrap();
32350            let mut req_result = {
32351                let client = &self.hub.client;
32352                dlg.pre_request();
32353                let mut req_builder = hyper::Request::builder()
32354                    .method(hyper::Method::POST)
32355                    .uri(url.as_str())
32356                    .header(USER_AGENT, self.hub._user_agent.clone());
32357
32358                if let Some(token) = token.as_ref() {
32359                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32360                }
32361
32362                let request = req_builder
32363                    .header(CONTENT_TYPE, json_mime_type.to_string())
32364                    .header(CONTENT_LENGTH, request_size as u64)
32365                    .body(common::to_body(
32366                        request_value_reader.get_ref().clone().into(),
32367                    ));
32368
32369                client.request(request.unwrap()).await
32370            };
32371
32372            match req_result {
32373                Err(err) => {
32374                    if let common::Retry::After(d) = dlg.http_error(&err) {
32375                        sleep(d).await;
32376                        continue;
32377                    }
32378                    dlg.finished(false);
32379                    return Err(common::Error::HttpError(err));
32380                }
32381                Ok(res) => {
32382                    let (mut parts, body) = res.into_parts();
32383                    let mut body = common::Body::new(body);
32384                    if !parts.status.is_success() {
32385                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32386                        let error = serde_json::from_str(&common::to_string(&bytes));
32387                        let response = common::to_response(parts, bytes.into());
32388
32389                        if let common::Retry::After(d) =
32390                            dlg.http_failure(&response, error.as_ref().ok())
32391                        {
32392                            sleep(d).await;
32393                            continue;
32394                        }
32395
32396                        dlg.finished(false);
32397
32398                        return Err(match error {
32399                            Ok(value) => common::Error::BadRequest(value),
32400                            _ => common::Error::Failure(response),
32401                        });
32402                    }
32403                    let response = {
32404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32405                        let encoded = common::to_string(&bytes);
32406                        match serde_json::from_str(&encoded) {
32407                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32408                            Err(error) => {
32409                                dlg.response_json_decode_error(&encoded, &error);
32410                                return Err(common::Error::JsonDecodeError(
32411                                    encoded.to_string(),
32412                                    error,
32413                                ));
32414                            }
32415                        }
32416                    };
32417
32418                    dlg.finished(true);
32419                    return Ok(response);
32420                }
32421            }
32422        }
32423    }
32424
32425    ///
32426    /// Sets the *request* property to the given value.
32427    ///
32428    /// Even though the property as already been set when instantiating this call,
32429    /// we provide this method for API completeness.
32430    pub fn request(
32431        mut self,
32432        new_value: GetIamPolicyRequest,
32433    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {
32434        self._request = new_value;
32435        self
32436    }
32437    /// REQUIRED: The resource for which the policy is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
32438    ///
32439    /// Sets the *resource* path property to the given value.
32440    ///
32441    /// Even though the property as already been set when instantiating this call,
32442    /// we provide this method for API completeness.
32443    pub fn resource(
32444        mut self,
32445        new_value: &str,
32446    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {
32447        self._resource = new_value.to_string();
32448        self
32449    }
32450    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32451    /// while executing the actual API request.
32452    ///
32453    /// ````text
32454    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32455    /// ````
32456    ///
32457    /// Sets the *delegate* property to the given value.
32458    pub fn delegate(
32459        mut self,
32460        new_value: &'a mut dyn common::Delegate,
32461    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {
32462        self._delegate = Some(new_value);
32463        self
32464    }
32465
32466    /// Set any additional parameter of the query string used in the request.
32467    /// It should be used to set parameters which are not yet available through their own
32468    /// setters.
32469    ///
32470    /// Please note that this method must not be used to set any of the known parameters
32471    /// which have their own setter method. If done anyway, the request will fail.
32472    ///
32473    /// # Additional Parameters
32474    ///
32475    /// * *$.xgafv* (query-string) - V1 error format.
32476    /// * *access_token* (query-string) - OAuth access token.
32477    /// * *alt* (query-string) - Data format for response.
32478    /// * *callback* (query-string) - JSONP
32479    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32480    /// * *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.
32481    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32482    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32483    /// * *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.
32484    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32485    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32486    pub fn param<T>(
32487        mut self,
32488        name: T,
32489        value: T,
32490    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C>
32491    where
32492        T: AsRef<str>,
32493    {
32494        self._additional_params
32495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32496        self
32497    }
32498
32499    /// Identifies the authorization scope for the method you are building.
32500    ///
32501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32502    /// [`Scope::CloudPlatform`].
32503    ///
32504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32505    /// tokens for more than one scope.
32506    ///
32507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32509    /// sufficient, a read-write scope will do as well.
32510    pub fn add_scope<St>(
32511        mut self,
32512        scope: St,
32513    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C>
32514    where
32515        St: AsRef<str>,
32516    {
32517        self._scopes.insert(String::from(scope.as_ref()));
32518        self
32519    }
32520    /// Identifies the authorization scope(s) for the method you are building.
32521    ///
32522    /// See [`Self::add_scope()`] for details.
32523    pub fn add_scopes<I, St>(
32524        mut self,
32525        scopes: I,
32526    ) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C>
32527    where
32528        I: IntoIterator<Item = St>,
32529        St: AsRef<str>,
32530    {
32531        self._scopes
32532            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32533        self
32534    }
32535
32536    /// Removes all scopes, and no default scope will be used either.
32537    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32538    /// for details).
32539    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateGetIamPolicyCall<'a, C> {
32540        self._scopes.clear();
32541        self
32542    }
32543}
32544
32545/// Instantiates a template and begins execution.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
32546///
32547/// A builder for the *regions.workflowTemplates.instantiate* method supported by a *project* resource.
32548/// It is not used directly, but through a [`ProjectMethods`] instance.
32549///
32550/// # Example
32551///
32552/// Instantiate a resource method builder
32553///
32554/// ```test_harness,no_run
32555/// # extern crate hyper;
32556/// # extern crate hyper_rustls;
32557/// # extern crate google_dataproc1 as dataproc1;
32558/// use dataproc1::api::InstantiateWorkflowTemplateRequest;
32559/// # async fn dox() {
32560/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32561///
32562/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32564/// #     secret,
32565/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32566/// # ).build().await.unwrap();
32567///
32568/// # let client = hyper_util::client::legacy::Client::builder(
32569/// #     hyper_util::rt::TokioExecutor::new()
32570/// # )
32571/// # .build(
32572/// #     hyper_rustls::HttpsConnectorBuilder::new()
32573/// #         .with_native_roots()
32574/// #         .unwrap()
32575/// #         .https_or_http()
32576/// #         .enable_http1()
32577/// #         .build()
32578/// # );
32579/// # let mut hub = Dataproc::new(client, auth);
32580/// // As the method needs a request, you would usually fill it with the desired information
32581/// // into the respective structure. Some of the parts shown here might not be applicable !
32582/// // Values shown here are possibly random and not representative !
32583/// let mut req = InstantiateWorkflowTemplateRequest::default();
32584///
32585/// // You can configure optional parameters by calling the respective setters at will, and
32586/// // execute the final call using `doit()`.
32587/// // Values shown here are possibly random and not representative !
32588/// let result = hub.projects().regions_workflow_templates_instantiate(req, "name")
32589///              .doit().await;
32590/// # }
32591/// ```
32592pub struct ProjectRegionWorkflowTemplateInstantiateCall<'a, C>
32593where
32594    C: 'a,
32595{
32596    hub: &'a Dataproc<C>,
32597    _request: InstantiateWorkflowTemplateRequest,
32598    _name: String,
32599    _delegate: Option<&'a mut dyn common::Delegate>,
32600    _additional_params: HashMap<String, String>,
32601    _scopes: BTreeSet<String>,
32602}
32603
32604impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {}
32605
32606impl<'a, C> ProjectRegionWorkflowTemplateInstantiateCall<'a, C>
32607where
32608    C: common::Connector,
32609{
32610    /// Perform the operation you have build so far.
32611    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
32612        use std::borrow::Cow;
32613        use std::io::{Read, Seek};
32614
32615        use common::{url::Params, ToParts};
32616        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32617
32618        let mut dd = common::DefaultDelegate;
32619        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32620        dlg.begin(common::MethodInfo {
32621            id: "dataproc.projects.regions.workflowTemplates.instantiate",
32622            http_method: hyper::Method::POST,
32623        });
32624
32625        for &field in ["alt", "name"].iter() {
32626            if self._additional_params.contains_key(field) {
32627                dlg.finished(false);
32628                return Err(common::Error::FieldClash(field));
32629            }
32630        }
32631
32632        let mut params = Params::with_capacity(4 + self._additional_params.len());
32633        params.push("name", self._name);
32634
32635        params.extend(self._additional_params.iter());
32636
32637        params.push("alt", "json");
32638        let mut url = self.hub._base_url.clone() + "v1/{+name}:instantiate";
32639        if self._scopes.is_empty() {
32640            self._scopes
32641                .insert(Scope::CloudPlatform.as_ref().to_string());
32642        }
32643
32644        #[allow(clippy::single_element_loop)]
32645        for &(find_this, param_name) in [("{+name}", "name")].iter() {
32646            url = params.uri_replacement(url, param_name, find_this, true);
32647        }
32648        {
32649            let to_remove = ["name"];
32650            params.remove_params(&to_remove);
32651        }
32652
32653        let url = params.parse_with_url(&url);
32654
32655        let mut json_mime_type = mime::APPLICATION_JSON;
32656        let mut request_value_reader = {
32657            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32658            common::remove_json_null_values(&mut value);
32659            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32660            serde_json::to_writer(&mut dst, &value).unwrap();
32661            dst
32662        };
32663        let request_size = request_value_reader
32664            .seek(std::io::SeekFrom::End(0))
32665            .unwrap();
32666        request_value_reader
32667            .seek(std::io::SeekFrom::Start(0))
32668            .unwrap();
32669
32670        loop {
32671            let token = match self
32672                .hub
32673                .auth
32674                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
32675                .await
32676            {
32677                Ok(token) => token,
32678                Err(e) => match dlg.token(e) {
32679                    Ok(token) => token,
32680                    Err(e) => {
32681                        dlg.finished(false);
32682                        return Err(common::Error::MissingToken(e));
32683                    }
32684                },
32685            };
32686            request_value_reader
32687                .seek(std::io::SeekFrom::Start(0))
32688                .unwrap();
32689            let mut req_result = {
32690                let client = &self.hub.client;
32691                dlg.pre_request();
32692                let mut req_builder = hyper::Request::builder()
32693                    .method(hyper::Method::POST)
32694                    .uri(url.as_str())
32695                    .header(USER_AGENT, self.hub._user_agent.clone());
32696
32697                if let Some(token) = token.as_ref() {
32698                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
32699                }
32700
32701                let request = req_builder
32702                    .header(CONTENT_TYPE, json_mime_type.to_string())
32703                    .header(CONTENT_LENGTH, request_size as u64)
32704                    .body(common::to_body(
32705                        request_value_reader.get_ref().clone().into(),
32706                    ));
32707
32708                client.request(request.unwrap()).await
32709            };
32710
32711            match req_result {
32712                Err(err) => {
32713                    if let common::Retry::After(d) = dlg.http_error(&err) {
32714                        sleep(d).await;
32715                        continue;
32716                    }
32717                    dlg.finished(false);
32718                    return Err(common::Error::HttpError(err));
32719                }
32720                Ok(res) => {
32721                    let (mut parts, body) = res.into_parts();
32722                    let mut body = common::Body::new(body);
32723                    if !parts.status.is_success() {
32724                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32725                        let error = serde_json::from_str(&common::to_string(&bytes));
32726                        let response = common::to_response(parts, bytes.into());
32727
32728                        if let common::Retry::After(d) =
32729                            dlg.http_failure(&response, error.as_ref().ok())
32730                        {
32731                            sleep(d).await;
32732                            continue;
32733                        }
32734
32735                        dlg.finished(false);
32736
32737                        return Err(match error {
32738                            Ok(value) => common::Error::BadRequest(value),
32739                            _ => common::Error::Failure(response),
32740                        });
32741                    }
32742                    let response = {
32743                        let bytes = common::to_bytes(body).await.unwrap_or_default();
32744                        let encoded = common::to_string(&bytes);
32745                        match serde_json::from_str(&encoded) {
32746                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
32747                            Err(error) => {
32748                                dlg.response_json_decode_error(&encoded, &error);
32749                                return Err(common::Error::JsonDecodeError(
32750                                    encoded.to_string(),
32751                                    error,
32752                                ));
32753                            }
32754                        }
32755                    };
32756
32757                    dlg.finished(true);
32758                    return Ok(response);
32759                }
32760            }
32761        }
32762    }
32763
32764    ///
32765    /// Sets the *request* property to the given value.
32766    ///
32767    /// Even though the property as already been set when instantiating this call,
32768    /// we provide this method for API completeness.
32769    pub fn request(
32770        mut self,
32771        new_value: InstantiateWorkflowTemplateRequest,
32772    ) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {
32773        self._request = new_value;
32774        self
32775    }
32776    /// Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
32777    ///
32778    /// Sets the *name* path property to the given value.
32779    ///
32780    /// Even though the property as already been set when instantiating this call,
32781    /// we provide this method for API completeness.
32782    pub fn name(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {
32783        self._name = new_value.to_string();
32784        self
32785    }
32786    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
32787    /// while executing the actual API request.
32788    ///
32789    /// ````text
32790    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
32791    /// ````
32792    ///
32793    /// Sets the *delegate* property to the given value.
32794    pub fn delegate(
32795        mut self,
32796        new_value: &'a mut dyn common::Delegate,
32797    ) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {
32798        self._delegate = Some(new_value);
32799        self
32800    }
32801
32802    /// Set any additional parameter of the query string used in the request.
32803    /// It should be used to set parameters which are not yet available through their own
32804    /// setters.
32805    ///
32806    /// Please note that this method must not be used to set any of the known parameters
32807    /// which have their own setter method. If done anyway, the request will fail.
32808    ///
32809    /// # Additional Parameters
32810    ///
32811    /// * *$.xgafv* (query-string) - V1 error format.
32812    /// * *access_token* (query-string) - OAuth access token.
32813    /// * *alt* (query-string) - Data format for response.
32814    /// * *callback* (query-string) - JSONP
32815    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
32816    /// * *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.
32817    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
32818    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
32819    /// * *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.
32820    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
32821    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
32822    pub fn param<T>(
32823        mut self,
32824        name: T,
32825        value: T,
32826    ) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C>
32827    where
32828        T: AsRef<str>,
32829    {
32830        self._additional_params
32831            .insert(name.as_ref().to_string(), value.as_ref().to_string());
32832        self
32833    }
32834
32835    /// Identifies the authorization scope for the method you are building.
32836    ///
32837    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
32838    /// [`Scope::CloudPlatform`].
32839    ///
32840    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
32841    /// tokens for more than one scope.
32842    ///
32843    /// Usually there is more than one suitable scope to authorize an operation, some of which may
32844    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
32845    /// sufficient, a read-write scope will do as well.
32846    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C>
32847    where
32848        St: AsRef<str>,
32849    {
32850        self._scopes.insert(String::from(scope.as_ref()));
32851        self
32852    }
32853    /// Identifies the authorization scope(s) for the method you are building.
32854    ///
32855    /// See [`Self::add_scope()`] for details.
32856    pub fn add_scopes<I, St>(
32857        mut self,
32858        scopes: I,
32859    ) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C>
32860    where
32861        I: IntoIterator<Item = St>,
32862        St: AsRef<str>,
32863    {
32864        self._scopes
32865            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
32866        self
32867    }
32868
32869    /// Removes all scopes, and no default scope will be used either.
32870    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
32871    /// for details).
32872    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateInstantiateCall<'a, C> {
32873        self._scopes.clear();
32874        self
32875    }
32876}
32877
32878/// Instantiates a template and begins execution.This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.The Operation.metadata will be WorkflowMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). Also see Using WorkflowMetadata (https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata).On successful completion, Operation.response will be Empty.
32879///
32880/// A builder for the *regions.workflowTemplates.instantiateInline* method supported by a *project* resource.
32881/// It is not used directly, but through a [`ProjectMethods`] instance.
32882///
32883/// # Example
32884///
32885/// Instantiate a resource method builder
32886///
32887/// ```test_harness,no_run
32888/// # extern crate hyper;
32889/// # extern crate hyper_rustls;
32890/// # extern crate google_dataproc1 as dataproc1;
32891/// use dataproc1::api::WorkflowTemplate;
32892/// # async fn dox() {
32893/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
32894///
32895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
32896/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
32897/// #     secret,
32898/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
32899/// # ).build().await.unwrap();
32900///
32901/// # let client = hyper_util::client::legacy::Client::builder(
32902/// #     hyper_util::rt::TokioExecutor::new()
32903/// # )
32904/// # .build(
32905/// #     hyper_rustls::HttpsConnectorBuilder::new()
32906/// #         .with_native_roots()
32907/// #         .unwrap()
32908/// #         .https_or_http()
32909/// #         .enable_http1()
32910/// #         .build()
32911/// # );
32912/// # let mut hub = Dataproc::new(client, auth);
32913/// // As the method needs a request, you would usually fill it with the desired information
32914/// // into the respective structure. Some of the parts shown here might not be applicable !
32915/// // Values shown here are possibly random and not representative !
32916/// let mut req = WorkflowTemplate::default();
32917///
32918/// // You can configure optional parameters by calling the respective setters at will, and
32919/// // execute the final call using `doit()`.
32920/// // Values shown here are possibly random and not representative !
32921/// let result = hub.projects().regions_workflow_templates_instantiate_inline(req, "parent")
32922///              .request_id("sea")
32923///              .doit().await;
32924/// # }
32925/// ```
32926pub struct ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C>
32927where
32928    C: 'a,
32929{
32930    hub: &'a Dataproc<C>,
32931    _request: WorkflowTemplate,
32932    _parent: String,
32933    _request_id: Option<String>,
32934    _delegate: Option<&'a mut dyn common::Delegate>,
32935    _additional_params: HashMap<String, String>,
32936    _scopes: BTreeSet<String>,
32937}
32938
32939impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {}
32940
32941impl<'a, C> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C>
32942where
32943    C: common::Connector,
32944{
32945    /// Perform the operation you have build so far.
32946    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
32947        use std::borrow::Cow;
32948        use std::io::{Read, Seek};
32949
32950        use common::{url::Params, ToParts};
32951        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
32952
32953        let mut dd = common::DefaultDelegate;
32954        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
32955        dlg.begin(common::MethodInfo {
32956            id: "dataproc.projects.regions.workflowTemplates.instantiateInline",
32957            http_method: hyper::Method::POST,
32958        });
32959
32960        for &field in ["alt", "parent", "requestId"].iter() {
32961            if self._additional_params.contains_key(field) {
32962                dlg.finished(false);
32963                return Err(common::Error::FieldClash(field));
32964            }
32965        }
32966
32967        let mut params = Params::with_capacity(5 + self._additional_params.len());
32968        params.push("parent", self._parent);
32969        if let Some(value) = self._request_id.as_ref() {
32970            params.push("requestId", value);
32971        }
32972
32973        params.extend(self._additional_params.iter());
32974
32975        params.push("alt", "json");
32976        let mut url =
32977            self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates:instantiateInline";
32978        if self._scopes.is_empty() {
32979            self._scopes
32980                .insert(Scope::CloudPlatform.as_ref().to_string());
32981        }
32982
32983        #[allow(clippy::single_element_loop)]
32984        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
32985            url = params.uri_replacement(url, param_name, find_this, true);
32986        }
32987        {
32988            let to_remove = ["parent"];
32989            params.remove_params(&to_remove);
32990        }
32991
32992        let url = params.parse_with_url(&url);
32993
32994        let mut json_mime_type = mime::APPLICATION_JSON;
32995        let mut request_value_reader = {
32996            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
32997            common::remove_json_null_values(&mut value);
32998            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
32999            serde_json::to_writer(&mut dst, &value).unwrap();
33000            dst
33001        };
33002        let request_size = request_value_reader
33003            .seek(std::io::SeekFrom::End(0))
33004            .unwrap();
33005        request_value_reader
33006            .seek(std::io::SeekFrom::Start(0))
33007            .unwrap();
33008
33009        loop {
33010            let token = match self
33011                .hub
33012                .auth
33013                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33014                .await
33015            {
33016                Ok(token) => token,
33017                Err(e) => match dlg.token(e) {
33018                    Ok(token) => token,
33019                    Err(e) => {
33020                        dlg.finished(false);
33021                        return Err(common::Error::MissingToken(e));
33022                    }
33023                },
33024            };
33025            request_value_reader
33026                .seek(std::io::SeekFrom::Start(0))
33027                .unwrap();
33028            let mut req_result = {
33029                let client = &self.hub.client;
33030                dlg.pre_request();
33031                let mut req_builder = hyper::Request::builder()
33032                    .method(hyper::Method::POST)
33033                    .uri(url.as_str())
33034                    .header(USER_AGENT, self.hub._user_agent.clone());
33035
33036                if let Some(token) = token.as_ref() {
33037                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33038                }
33039
33040                let request = req_builder
33041                    .header(CONTENT_TYPE, json_mime_type.to_string())
33042                    .header(CONTENT_LENGTH, request_size as u64)
33043                    .body(common::to_body(
33044                        request_value_reader.get_ref().clone().into(),
33045                    ));
33046
33047                client.request(request.unwrap()).await
33048            };
33049
33050            match req_result {
33051                Err(err) => {
33052                    if let common::Retry::After(d) = dlg.http_error(&err) {
33053                        sleep(d).await;
33054                        continue;
33055                    }
33056                    dlg.finished(false);
33057                    return Err(common::Error::HttpError(err));
33058                }
33059                Ok(res) => {
33060                    let (mut parts, body) = res.into_parts();
33061                    let mut body = common::Body::new(body);
33062                    if !parts.status.is_success() {
33063                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33064                        let error = serde_json::from_str(&common::to_string(&bytes));
33065                        let response = common::to_response(parts, bytes.into());
33066
33067                        if let common::Retry::After(d) =
33068                            dlg.http_failure(&response, error.as_ref().ok())
33069                        {
33070                            sleep(d).await;
33071                            continue;
33072                        }
33073
33074                        dlg.finished(false);
33075
33076                        return Err(match error {
33077                            Ok(value) => common::Error::BadRequest(value),
33078                            _ => common::Error::Failure(response),
33079                        });
33080                    }
33081                    let response = {
33082                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33083                        let encoded = common::to_string(&bytes);
33084                        match serde_json::from_str(&encoded) {
33085                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33086                            Err(error) => {
33087                                dlg.response_json_decode_error(&encoded, &error);
33088                                return Err(common::Error::JsonDecodeError(
33089                                    encoded.to_string(),
33090                                    error,
33091                                ));
33092                            }
33093                        }
33094                    };
33095
33096                    dlg.finished(true);
33097                    return Ok(response);
33098                }
33099            }
33100        }
33101    }
33102
33103    ///
33104    /// Sets the *request* property to the given value.
33105    ///
33106    /// Even though the property as already been set when instantiating this call,
33107    /// we provide this method for API completeness.
33108    pub fn request(
33109        mut self,
33110        new_value: WorkflowTemplate,
33111    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
33112        self._request = new_value;
33113        self
33114    }
33115    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}
33116    ///
33117    /// Sets the *parent* path property to the given value.
33118    ///
33119    /// Even though the property as already been set when instantiating this call,
33120    /// we provide this method for API completeness.
33121    pub fn parent(
33122        mut self,
33123        new_value: &str,
33124    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
33125        self._parent = new_value.to_string();
33126        self
33127    }
33128    /// Optional. A tag that prevents multiple concurrent workflow instances with the same tag from running. This mitigates risk of concurrent instances started due to retries.It is recommended to always set this value to a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).The tag must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
33129    ///
33130    /// Sets the *request id* query property to the given value.
33131    pub fn request_id(
33132        mut self,
33133        new_value: &str,
33134    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
33135        self._request_id = Some(new_value.to_string());
33136        self
33137    }
33138    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33139    /// while executing the actual API request.
33140    ///
33141    /// ````text
33142    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33143    /// ````
33144    ///
33145    /// Sets the *delegate* property to the given value.
33146    pub fn delegate(
33147        mut self,
33148        new_value: &'a mut dyn common::Delegate,
33149    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
33150        self._delegate = Some(new_value);
33151        self
33152    }
33153
33154    /// Set any additional parameter of the query string used in the request.
33155    /// It should be used to set parameters which are not yet available through their own
33156    /// setters.
33157    ///
33158    /// Please note that this method must not be used to set any of the known parameters
33159    /// which have their own setter method. If done anyway, the request will fail.
33160    ///
33161    /// # Additional Parameters
33162    ///
33163    /// * *$.xgafv* (query-string) - V1 error format.
33164    /// * *access_token* (query-string) - OAuth access token.
33165    /// * *alt* (query-string) - Data format for response.
33166    /// * *callback* (query-string) - JSONP
33167    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33168    /// * *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.
33169    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33170    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33171    /// * *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.
33172    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33173    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33174    pub fn param<T>(
33175        mut self,
33176        name: T,
33177        value: T,
33178    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C>
33179    where
33180        T: AsRef<str>,
33181    {
33182        self._additional_params
33183            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33184        self
33185    }
33186
33187    /// Identifies the authorization scope for the method you are building.
33188    ///
33189    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33190    /// [`Scope::CloudPlatform`].
33191    ///
33192    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33193    /// tokens for more than one scope.
33194    ///
33195    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33196    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33197    /// sufficient, a read-write scope will do as well.
33198    pub fn add_scope<St>(
33199        mut self,
33200        scope: St,
33201    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C>
33202    where
33203        St: AsRef<str>,
33204    {
33205        self._scopes.insert(String::from(scope.as_ref()));
33206        self
33207    }
33208    /// Identifies the authorization scope(s) for the method you are building.
33209    ///
33210    /// See [`Self::add_scope()`] for details.
33211    pub fn add_scopes<I, St>(
33212        mut self,
33213        scopes: I,
33214    ) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C>
33215    where
33216        I: IntoIterator<Item = St>,
33217        St: AsRef<str>,
33218    {
33219        self._scopes
33220            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33221        self
33222    }
33223
33224    /// Removes all scopes, and no default scope will be used either.
33225    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33226    /// for details).
33227    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateInstantiateInlineCall<'a, C> {
33228        self._scopes.clear();
33229        self
33230    }
33231}
33232
33233/// Lists workflows that match the specified filter in the request.
33234///
33235/// A builder for the *regions.workflowTemplates.list* method supported by a *project* resource.
33236/// It is not used directly, but through a [`ProjectMethods`] instance.
33237///
33238/// # Example
33239///
33240/// Instantiate a resource method builder
33241///
33242/// ```test_harness,no_run
33243/// # extern crate hyper;
33244/// # extern crate hyper_rustls;
33245/// # extern crate google_dataproc1 as dataproc1;
33246/// # async fn dox() {
33247/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33248///
33249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33251/// #     secret,
33252/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33253/// # ).build().await.unwrap();
33254///
33255/// # let client = hyper_util::client::legacy::Client::builder(
33256/// #     hyper_util::rt::TokioExecutor::new()
33257/// # )
33258/// # .build(
33259/// #     hyper_rustls::HttpsConnectorBuilder::new()
33260/// #         .with_native_roots()
33261/// #         .unwrap()
33262/// #         .https_or_http()
33263/// #         .enable_http1()
33264/// #         .build()
33265/// # );
33266/// # let mut hub = Dataproc::new(client, auth);
33267/// // You can configure optional parameters by calling the respective setters at will, and
33268/// // execute the final call using `doit()`.
33269/// // Values shown here are possibly random and not representative !
33270/// let result = hub.projects().regions_workflow_templates_list("parent")
33271///              .page_token("sit")
33272///              .page_size(-32)
33273///              .doit().await;
33274/// # }
33275/// ```
33276pub struct ProjectRegionWorkflowTemplateListCall<'a, C>
33277where
33278    C: 'a,
33279{
33280    hub: &'a Dataproc<C>,
33281    _parent: String,
33282    _page_token: Option<String>,
33283    _page_size: Option<i32>,
33284    _delegate: Option<&'a mut dyn common::Delegate>,
33285    _additional_params: HashMap<String, String>,
33286    _scopes: BTreeSet<String>,
33287}
33288
33289impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateListCall<'a, C> {}
33290
33291impl<'a, C> ProjectRegionWorkflowTemplateListCall<'a, C>
33292where
33293    C: common::Connector,
33294{
33295    /// Perform the operation you have build so far.
33296    pub async fn doit(
33297        mut self,
33298    ) -> common::Result<(common::Response, ListWorkflowTemplatesResponse)> {
33299        use std::borrow::Cow;
33300        use std::io::{Read, Seek};
33301
33302        use common::{url::Params, ToParts};
33303        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33304
33305        let mut dd = common::DefaultDelegate;
33306        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33307        dlg.begin(common::MethodInfo {
33308            id: "dataproc.projects.regions.workflowTemplates.list",
33309            http_method: hyper::Method::GET,
33310        });
33311
33312        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
33313            if self._additional_params.contains_key(field) {
33314                dlg.finished(false);
33315                return Err(common::Error::FieldClash(field));
33316            }
33317        }
33318
33319        let mut params = Params::with_capacity(5 + self._additional_params.len());
33320        params.push("parent", self._parent);
33321        if let Some(value) = self._page_token.as_ref() {
33322            params.push("pageToken", value);
33323        }
33324        if let Some(value) = self._page_size.as_ref() {
33325            params.push("pageSize", value.to_string());
33326        }
33327
33328        params.extend(self._additional_params.iter());
33329
33330        params.push("alt", "json");
33331        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workflowTemplates";
33332        if self._scopes.is_empty() {
33333            self._scopes
33334                .insert(Scope::CloudPlatform.as_ref().to_string());
33335        }
33336
33337        #[allow(clippy::single_element_loop)]
33338        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
33339            url = params.uri_replacement(url, param_name, find_this, true);
33340        }
33341        {
33342            let to_remove = ["parent"];
33343            params.remove_params(&to_remove);
33344        }
33345
33346        let url = params.parse_with_url(&url);
33347
33348        loop {
33349            let token = match self
33350                .hub
33351                .auth
33352                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33353                .await
33354            {
33355                Ok(token) => token,
33356                Err(e) => match dlg.token(e) {
33357                    Ok(token) => token,
33358                    Err(e) => {
33359                        dlg.finished(false);
33360                        return Err(common::Error::MissingToken(e));
33361                    }
33362                },
33363            };
33364            let mut req_result = {
33365                let client = &self.hub.client;
33366                dlg.pre_request();
33367                let mut req_builder = hyper::Request::builder()
33368                    .method(hyper::Method::GET)
33369                    .uri(url.as_str())
33370                    .header(USER_AGENT, self.hub._user_agent.clone());
33371
33372                if let Some(token) = token.as_ref() {
33373                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33374                }
33375
33376                let request = req_builder
33377                    .header(CONTENT_LENGTH, 0_u64)
33378                    .body(common::to_body::<String>(None));
33379
33380                client.request(request.unwrap()).await
33381            };
33382
33383            match req_result {
33384                Err(err) => {
33385                    if let common::Retry::After(d) = dlg.http_error(&err) {
33386                        sleep(d).await;
33387                        continue;
33388                    }
33389                    dlg.finished(false);
33390                    return Err(common::Error::HttpError(err));
33391                }
33392                Ok(res) => {
33393                    let (mut parts, body) = res.into_parts();
33394                    let mut body = common::Body::new(body);
33395                    if !parts.status.is_success() {
33396                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33397                        let error = serde_json::from_str(&common::to_string(&bytes));
33398                        let response = common::to_response(parts, bytes.into());
33399
33400                        if let common::Retry::After(d) =
33401                            dlg.http_failure(&response, error.as_ref().ok())
33402                        {
33403                            sleep(d).await;
33404                            continue;
33405                        }
33406
33407                        dlg.finished(false);
33408
33409                        return Err(match error {
33410                            Ok(value) => common::Error::BadRequest(value),
33411                            _ => common::Error::Failure(response),
33412                        });
33413                    }
33414                    let response = {
33415                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33416                        let encoded = common::to_string(&bytes);
33417                        match serde_json::from_str(&encoded) {
33418                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33419                            Err(error) => {
33420                                dlg.response_json_decode_error(&encoded, &error);
33421                                return Err(common::Error::JsonDecodeError(
33422                                    encoded.to_string(),
33423                                    error,
33424                                ));
33425                            }
33426                        }
33427                    };
33428
33429                    dlg.finished(true);
33430                    return Ok(response);
33431                }
33432            }
33433        }
33434    }
33435
33436    /// Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region} For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}
33437    ///
33438    /// Sets the *parent* path property to the given value.
33439    ///
33440    /// Even though the property as already been set when instantiating this call,
33441    /// we provide this method for API completeness.
33442    pub fn parent(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
33443        self._parent = new_value.to_string();
33444        self
33445    }
33446    /// Optional. The page token, returned by a previous call, to request the next page of results.
33447    ///
33448    /// Sets the *page token* query property to the given value.
33449    pub fn page_token(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
33450        self._page_token = Some(new_value.to_string());
33451        self
33452    }
33453    /// Optional. The maximum number of results to return in each response.
33454    ///
33455    /// Sets the *page size* query property to the given value.
33456    pub fn page_size(mut self, new_value: i32) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
33457        self._page_size = Some(new_value);
33458        self
33459    }
33460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33461    /// while executing the actual API request.
33462    ///
33463    /// ````text
33464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33465    /// ````
33466    ///
33467    /// Sets the *delegate* property to the given value.
33468    pub fn delegate(
33469        mut self,
33470        new_value: &'a mut dyn common::Delegate,
33471    ) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
33472        self._delegate = Some(new_value);
33473        self
33474    }
33475
33476    /// Set any additional parameter of the query string used in the request.
33477    /// It should be used to set parameters which are not yet available through their own
33478    /// setters.
33479    ///
33480    /// Please note that this method must not be used to set any of the known parameters
33481    /// which have their own setter method. If done anyway, the request will fail.
33482    ///
33483    /// # Additional Parameters
33484    ///
33485    /// * *$.xgafv* (query-string) - V1 error format.
33486    /// * *access_token* (query-string) - OAuth access token.
33487    /// * *alt* (query-string) - Data format for response.
33488    /// * *callback* (query-string) - JSONP
33489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33490    /// * *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.
33491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33493    /// * *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.
33494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33496    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateListCall<'a, C>
33497    where
33498        T: AsRef<str>,
33499    {
33500        self._additional_params
33501            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33502        self
33503    }
33504
33505    /// Identifies the authorization scope for the method you are building.
33506    ///
33507    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33508    /// [`Scope::CloudPlatform`].
33509    ///
33510    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33511    /// tokens for more than one scope.
33512    ///
33513    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33514    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33515    /// sufficient, a read-write scope will do as well.
33516    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateListCall<'a, C>
33517    where
33518        St: AsRef<str>,
33519    {
33520        self._scopes.insert(String::from(scope.as_ref()));
33521        self
33522    }
33523    /// Identifies the authorization scope(s) for the method you are building.
33524    ///
33525    /// See [`Self::add_scope()`] for details.
33526    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionWorkflowTemplateListCall<'a, C>
33527    where
33528        I: IntoIterator<Item = St>,
33529        St: AsRef<str>,
33530    {
33531        self._scopes
33532            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33533        self
33534    }
33535
33536    /// Removes all scopes, and no default scope will be used either.
33537    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33538    /// for details).
33539    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateListCall<'a, C> {
33540        self._scopes.clear();
33541        self
33542    }
33543}
33544
33545/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
33546///
33547/// A builder for the *regions.workflowTemplates.setIamPolicy* method supported by a *project* resource.
33548/// It is not used directly, but through a [`ProjectMethods`] instance.
33549///
33550/// # Example
33551///
33552/// Instantiate a resource method builder
33553///
33554/// ```test_harness,no_run
33555/// # extern crate hyper;
33556/// # extern crate hyper_rustls;
33557/// # extern crate google_dataproc1 as dataproc1;
33558/// use dataproc1::api::SetIamPolicyRequest;
33559/// # async fn dox() {
33560/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33561///
33562/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33564/// #     secret,
33565/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33566/// # ).build().await.unwrap();
33567///
33568/// # let client = hyper_util::client::legacy::Client::builder(
33569/// #     hyper_util::rt::TokioExecutor::new()
33570/// # )
33571/// # .build(
33572/// #     hyper_rustls::HttpsConnectorBuilder::new()
33573/// #         .with_native_roots()
33574/// #         .unwrap()
33575/// #         .https_or_http()
33576/// #         .enable_http1()
33577/// #         .build()
33578/// # );
33579/// # let mut hub = Dataproc::new(client, auth);
33580/// // As the method needs a request, you would usually fill it with the desired information
33581/// // into the respective structure. Some of the parts shown here might not be applicable !
33582/// // Values shown here are possibly random and not representative !
33583/// let mut req = SetIamPolicyRequest::default();
33584///
33585/// // You can configure optional parameters by calling the respective setters at will, and
33586/// // execute the final call using `doit()`.
33587/// // Values shown here are possibly random and not representative !
33588/// let result = hub.projects().regions_workflow_templates_set_iam_policy(req, "resource")
33589///              .doit().await;
33590/// # }
33591/// ```
33592pub struct ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C>
33593where
33594    C: 'a,
33595{
33596    hub: &'a Dataproc<C>,
33597    _request: SetIamPolicyRequest,
33598    _resource: String,
33599    _delegate: Option<&'a mut dyn common::Delegate>,
33600    _additional_params: HashMap<String, String>,
33601    _scopes: BTreeSet<String>,
33602}
33603
33604impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {}
33605
33606impl<'a, C> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C>
33607where
33608    C: common::Connector,
33609{
33610    /// Perform the operation you have build so far.
33611    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
33612        use std::borrow::Cow;
33613        use std::io::{Read, Seek};
33614
33615        use common::{url::Params, ToParts};
33616        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33617
33618        let mut dd = common::DefaultDelegate;
33619        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33620        dlg.begin(common::MethodInfo {
33621            id: "dataproc.projects.regions.workflowTemplates.setIamPolicy",
33622            http_method: hyper::Method::POST,
33623        });
33624
33625        for &field in ["alt", "resource"].iter() {
33626            if self._additional_params.contains_key(field) {
33627                dlg.finished(false);
33628                return Err(common::Error::FieldClash(field));
33629            }
33630        }
33631
33632        let mut params = Params::with_capacity(4 + self._additional_params.len());
33633        params.push("resource", self._resource);
33634
33635        params.extend(self._additional_params.iter());
33636
33637        params.push("alt", "json");
33638        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
33639        if self._scopes.is_empty() {
33640            self._scopes
33641                .insert(Scope::CloudPlatform.as_ref().to_string());
33642        }
33643
33644        #[allow(clippy::single_element_loop)]
33645        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
33646            url = params.uri_replacement(url, param_name, find_this, true);
33647        }
33648        {
33649            let to_remove = ["resource"];
33650            params.remove_params(&to_remove);
33651        }
33652
33653        let url = params.parse_with_url(&url);
33654
33655        let mut json_mime_type = mime::APPLICATION_JSON;
33656        let mut request_value_reader = {
33657            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33658            common::remove_json_null_values(&mut value);
33659            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33660            serde_json::to_writer(&mut dst, &value).unwrap();
33661            dst
33662        };
33663        let request_size = request_value_reader
33664            .seek(std::io::SeekFrom::End(0))
33665            .unwrap();
33666        request_value_reader
33667            .seek(std::io::SeekFrom::Start(0))
33668            .unwrap();
33669
33670        loop {
33671            let token = match self
33672                .hub
33673                .auth
33674                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
33675                .await
33676            {
33677                Ok(token) => token,
33678                Err(e) => match dlg.token(e) {
33679                    Ok(token) => token,
33680                    Err(e) => {
33681                        dlg.finished(false);
33682                        return Err(common::Error::MissingToken(e));
33683                    }
33684                },
33685            };
33686            request_value_reader
33687                .seek(std::io::SeekFrom::Start(0))
33688                .unwrap();
33689            let mut req_result = {
33690                let client = &self.hub.client;
33691                dlg.pre_request();
33692                let mut req_builder = hyper::Request::builder()
33693                    .method(hyper::Method::POST)
33694                    .uri(url.as_str())
33695                    .header(USER_AGENT, self.hub._user_agent.clone());
33696
33697                if let Some(token) = token.as_ref() {
33698                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
33699                }
33700
33701                let request = req_builder
33702                    .header(CONTENT_TYPE, json_mime_type.to_string())
33703                    .header(CONTENT_LENGTH, request_size as u64)
33704                    .body(common::to_body(
33705                        request_value_reader.get_ref().clone().into(),
33706                    ));
33707
33708                client.request(request.unwrap()).await
33709            };
33710
33711            match req_result {
33712                Err(err) => {
33713                    if let common::Retry::After(d) = dlg.http_error(&err) {
33714                        sleep(d).await;
33715                        continue;
33716                    }
33717                    dlg.finished(false);
33718                    return Err(common::Error::HttpError(err));
33719                }
33720                Ok(res) => {
33721                    let (mut parts, body) = res.into_parts();
33722                    let mut body = common::Body::new(body);
33723                    if !parts.status.is_success() {
33724                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33725                        let error = serde_json::from_str(&common::to_string(&bytes));
33726                        let response = common::to_response(parts, bytes.into());
33727
33728                        if let common::Retry::After(d) =
33729                            dlg.http_failure(&response, error.as_ref().ok())
33730                        {
33731                            sleep(d).await;
33732                            continue;
33733                        }
33734
33735                        dlg.finished(false);
33736
33737                        return Err(match error {
33738                            Ok(value) => common::Error::BadRequest(value),
33739                            _ => common::Error::Failure(response),
33740                        });
33741                    }
33742                    let response = {
33743                        let bytes = common::to_bytes(body).await.unwrap_or_default();
33744                        let encoded = common::to_string(&bytes);
33745                        match serde_json::from_str(&encoded) {
33746                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
33747                            Err(error) => {
33748                                dlg.response_json_decode_error(&encoded, &error);
33749                                return Err(common::Error::JsonDecodeError(
33750                                    encoded.to_string(),
33751                                    error,
33752                                ));
33753                            }
33754                        }
33755                    };
33756
33757                    dlg.finished(true);
33758                    return Ok(response);
33759                }
33760            }
33761        }
33762    }
33763
33764    ///
33765    /// Sets the *request* property to the given value.
33766    ///
33767    /// Even though the property as already been set when instantiating this call,
33768    /// we provide this method for API completeness.
33769    pub fn request(
33770        mut self,
33771        new_value: SetIamPolicyRequest,
33772    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {
33773        self._request = new_value;
33774        self
33775    }
33776    /// REQUIRED: The resource for which the policy is being specified. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
33777    ///
33778    /// Sets the *resource* path property to the given value.
33779    ///
33780    /// Even though the property as already been set when instantiating this call,
33781    /// we provide this method for API completeness.
33782    pub fn resource(
33783        mut self,
33784        new_value: &str,
33785    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {
33786        self._resource = new_value.to_string();
33787        self
33788    }
33789    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
33790    /// while executing the actual API request.
33791    ///
33792    /// ````text
33793    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
33794    /// ````
33795    ///
33796    /// Sets the *delegate* property to the given value.
33797    pub fn delegate(
33798        mut self,
33799        new_value: &'a mut dyn common::Delegate,
33800    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {
33801        self._delegate = Some(new_value);
33802        self
33803    }
33804
33805    /// Set any additional parameter of the query string used in the request.
33806    /// It should be used to set parameters which are not yet available through their own
33807    /// setters.
33808    ///
33809    /// Please note that this method must not be used to set any of the known parameters
33810    /// which have their own setter method. If done anyway, the request will fail.
33811    ///
33812    /// # Additional Parameters
33813    ///
33814    /// * *$.xgafv* (query-string) - V1 error format.
33815    /// * *access_token* (query-string) - OAuth access token.
33816    /// * *alt* (query-string) - Data format for response.
33817    /// * *callback* (query-string) - JSONP
33818    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
33819    /// * *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.
33820    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
33821    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
33822    /// * *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.
33823    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
33824    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
33825    pub fn param<T>(
33826        mut self,
33827        name: T,
33828        value: T,
33829    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C>
33830    where
33831        T: AsRef<str>,
33832    {
33833        self._additional_params
33834            .insert(name.as_ref().to_string(), value.as_ref().to_string());
33835        self
33836    }
33837
33838    /// Identifies the authorization scope for the method you are building.
33839    ///
33840    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
33841    /// [`Scope::CloudPlatform`].
33842    ///
33843    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
33844    /// tokens for more than one scope.
33845    ///
33846    /// Usually there is more than one suitable scope to authorize an operation, some of which may
33847    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
33848    /// sufficient, a read-write scope will do as well.
33849    pub fn add_scope<St>(
33850        mut self,
33851        scope: St,
33852    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C>
33853    where
33854        St: AsRef<str>,
33855    {
33856        self._scopes.insert(String::from(scope.as_ref()));
33857        self
33858    }
33859    /// Identifies the authorization scope(s) for the method you are building.
33860    ///
33861    /// See [`Self::add_scope()`] for details.
33862    pub fn add_scopes<I, St>(
33863        mut self,
33864        scopes: I,
33865    ) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C>
33866    where
33867        I: IntoIterator<Item = St>,
33868        St: AsRef<str>,
33869    {
33870        self._scopes
33871            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
33872        self
33873    }
33874
33875    /// Removes all scopes, and no default scope will be used either.
33876    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
33877    /// for details).
33878    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateSetIamPolicyCall<'a, C> {
33879        self._scopes.clear();
33880        self
33881    }
33882}
33883
33884/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
33885///
33886/// A builder for the *regions.workflowTemplates.testIamPermissions* method supported by a *project* resource.
33887/// It is not used directly, but through a [`ProjectMethods`] instance.
33888///
33889/// # Example
33890///
33891/// Instantiate a resource method builder
33892///
33893/// ```test_harness,no_run
33894/// # extern crate hyper;
33895/// # extern crate hyper_rustls;
33896/// # extern crate google_dataproc1 as dataproc1;
33897/// use dataproc1::api::TestIamPermissionsRequest;
33898/// # async fn dox() {
33899/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
33900///
33901/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
33902/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
33903/// #     secret,
33904/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
33905/// # ).build().await.unwrap();
33906///
33907/// # let client = hyper_util::client::legacy::Client::builder(
33908/// #     hyper_util::rt::TokioExecutor::new()
33909/// # )
33910/// # .build(
33911/// #     hyper_rustls::HttpsConnectorBuilder::new()
33912/// #         .with_native_roots()
33913/// #         .unwrap()
33914/// #         .https_or_http()
33915/// #         .enable_http1()
33916/// #         .build()
33917/// # );
33918/// # let mut hub = Dataproc::new(client, auth);
33919/// // As the method needs a request, you would usually fill it with the desired information
33920/// // into the respective structure. Some of the parts shown here might not be applicable !
33921/// // Values shown here are possibly random and not representative !
33922/// let mut req = TestIamPermissionsRequest::default();
33923///
33924/// // You can configure optional parameters by calling the respective setters at will, and
33925/// // execute the final call using `doit()`.
33926/// // Values shown here are possibly random and not representative !
33927/// let result = hub.projects().regions_workflow_templates_test_iam_permissions(req, "resource")
33928///              .doit().await;
33929/// # }
33930/// ```
33931pub struct ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C>
33932where
33933    C: 'a,
33934{
33935    hub: &'a Dataproc<C>,
33936    _request: TestIamPermissionsRequest,
33937    _resource: String,
33938    _delegate: Option<&'a mut dyn common::Delegate>,
33939    _additional_params: HashMap<String, String>,
33940    _scopes: BTreeSet<String>,
33941}
33942
33943impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {}
33944
33945impl<'a, C> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C>
33946where
33947    C: common::Connector,
33948{
33949    /// Perform the operation you have build so far.
33950    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
33951        use std::borrow::Cow;
33952        use std::io::{Read, Seek};
33953
33954        use common::{url::Params, ToParts};
33955        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
33956
33957        let mut dd = common::DefaultDelegate;
33958        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
33959        dlg.begin(common::MethodInfo {
33960            id: "dataproc.projects.regions.workflowTemplates.testIamPermissions",
33961            http_method: hyper::Method::POST,
33962        });
33963
33964        for &field in ["alt", "resource"].iter() {
33965            if self._additional_params.contains_key(field) {
33966                dlg.finished(false);
33967                return Err(common::Error::FieldClash(field));
33968            }
33969        }
33970
33971        let mut params = Params::with_capacity(4 + self._additional_params.len());
33972        params.push("resource", self._resource);
33973
33974        params.extend(self._additional_params.iter());
33975
33976        params.push("alt", "json");
33977        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
33978        if self._scopes.is_empty() {
33979            self._scopes
33980                .insert(Scope::CloudPlatform.as_ref().to_string());
33981        }
33982
33983        #[allow(clippy::single_element_loop)]
33984        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
33985            url = params.uri_replacement(url, param_name, find_this, true);
33986        }
33987        {
33988            let to_remove = ["resource"];
33989            params.remove_params(&to_remove);
33990        }
33991
33992        let url = params.parse_with_url(&url);
33993
33994        let mut json_mime_type = mime::APPLICATION_JSON;
33995        let mut request_value_reader = {
33996            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
33997            common::remove_json_null_values(&mut value);
33998            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
33999            serde_json::to_writer(&mut dst, &value).unwrap();
34000            dst
34001        };
34002        let request_size = request_value_reader
34003            .seek(std::io::SeekFrom::End(0))
34004            .unwrap();
34005        request_value_reader
34006            .seek(std::io::SeekFrom::Start(0))
34007            .unwrap();
34008
34009        loop {
34010            let token = match self
34011                .hub
34012                .auth
34013                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34014                .await
34015            {
34016                Ok(token) => token,
34017                Err(e) => match dlg.token(e) {
34018                    Ok(token) => token,
34019                    Err(e) => {
34020                        dlg.finished(false);
34021                        return Err(common::Error::MissingToken(e));
34022                    }
34023                },
34024            };
34025            request_value_reader
34026                .seek(std::io::SeekFrom::Start(0))
34027                .unwrap();
34028            let mut req_result = {
34029                let client = &self.hub.client;
34030                dlg.pre_request();
34031                let mut req_builder = hyper::Request::builder()
34032                    .method(hyper::Method::POST)
34033                    .uri(url.as_str())
34034                    .header(USER_AGENT, self.hub._user_agent.clone());
34035
34036                if let Some(token) = token.as_ref() {
34037                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34038                }
34039
34040                let request = req_builder
34041                    .header(CONTENT_TYPE, json_mime_type.to_string())
34042                    .header(CONTENT_LENGTH, request_size as u64)
34043                    .body(common::to_body(
34044                        request_value_reader.get_ref().clone().into(),
34045                    ));
34046
34047                client.request(request.unwrap()).await
34048            };
34049
34050            match req_result {
34051                Err(err) => {
34052                    if let common::Retry::After(d) = dlg.http_error(&err) {
34053                        sleep(d).await;
34054                        continue;
34055                    }
34056                    dlg.finished(false);
34057                    return Err(common::Error::HttpError(err));
34058                }
34059                Ok(res) => {
34060                    let (mut parts, body) = res.into_parts();
34061                    let mut body = common::Body::new(body);
34062                    if !parts.status.is_success() {
34063                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34064                        let error = serde_json::from_str(&common::to_string(&bytes));
34065                        let response = common::to_response(parts, bytes.into());
34066
34067                        if let common::Retry::After(d) =
34068                            dlg.http_failure(&response, error.as_ref().ok())
34069                        {
34070                            sleep(d).await;
34071                            continue;
34072                        }
34073
34074                        dlg.finished(false);
34075
34076                        return Err(match error {
34077                            Ok(value) => common::Error::BadRequest(value),
34078                            _ => common::Error::Failure(response),
34079                        });
34080                    }
34081                    let response = {
34082                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34083                        let encoded = common::to_string(&bytes);
34084                        match serde_json::from_str(&encoded) {
34085                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34086                            Err(error) => {
34087                                dlg.response_json_decode_error(&encoded, &error);
34088                                return Err(common::Error::JsonDecodeError(
34089                                    encoded.to_string(),
34090                                    error,
34091                                ));
34092                            }
34093                        }
34094                    };
34095
34096                    dlg.finished(true);
34097                    return Ok(response);
34098                }
34099            }
34100        }
34101    }
34102
34103    ///
34104    /// Sets the *request* property to the given value.
34105    ///
34106    /// Even though the property as already been set when instantiating this call,
34107    /// we provide this method for API completeness.
34108    pub fn request(
34109        mut self,
34110        new_value: TestIamPermissionsRequest,
34111    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {
34112        self._request = new_value;
34113        self
34114    }
34115    /// REQUIRED: The resource for which the policy detail is being requested. See Resource names (https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
34116    ///
34117    /// Sets the *resource* path property to the given value.
34118    ///
34119    /// Even though the property as already been set when instantiating this call,
34120    /// we provide this method for API completeness.
34121    pub fn resource(
34122        mut self,
34123        new_value: &str,
34124    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {
34125        self._resource = new_value.to_string();
34126        self
34127    }
34128    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34129    /// while executing the actual API request.
34130    ///
34131    /// ````text
34132    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34133    /// ````
34134    ///
34135    /// Sets the *delegate* property to the given value.
34136    pub fn delegate(
34137        mut self,
34138        new_value: &'a mut dyn common::Delegate,
34139    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {
34140        self._delegate = Some(new_value);
34141        self
34142    }
34143
34144    /// Set any additional parameter of the query string used in the request.
34145    /// It should be used to set parameters which are not yet available through their own
34146    /// setters.
34147    ///
34148    /// Please note that this method must not be used to set any of the known parameters
34149    /// which have their own setter method. If done anyway, the request will fail.
34150    ///
34151    /// # Additional Parameters
34152    ///
34153    /// * *$.xgafv* (query-string) - V1 error format.
34154    /// * *access_token* (query-string) - OAuth access token.
34155    /// * *alt* (query-string) - Data format for response.
34156    /// * *callback* (query-string) - JSONP
34157    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34158    /// * *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.
34159    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34160    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34161    /// * *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.
34162    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34163    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34164    pub fn param<T>(
34165        mut self,
34166        name: T,
34167        value: T,
34168    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C>
34169    where
34170        T: AsRef<str>,
34171    {
34172        self._additional_params
34173            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34174        self
34175    }
34176
34177    /// Identifies the authorization scope for the method you are building.
34178    ///
34179    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34180    /// [`Scope::CloudPlatform`].
34181    ///
34182    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34183    /// tokens for more than one scope.
34184    ///
34185    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34186    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34187    /// sufficient, a read-write scope will do as well.
34188    pub fn add_scope<St>(
34189        mut self,
34190        scope: St,
34191    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C>
34192    where
34193        St: AsRef<str>,
34194    {
34195        self._scopes.insert(String::from(scope.as_ref()));
34196        self
34197    }
34198    /// Identifies the authorization scope(s) for the method you are building.
34199    ///
34200    /// See [`Self::add_scope()`] for details.
34201    pub fn add_scopes<I, St>(
34202        mut self,
34203        scopes: I,
34204    ) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C>
34205    where
34206        I: IntoIterator<Item = St>,
34207        St: AsRef<str>,
34208    {
34209        self._scopes
34210            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34211        self
34212    }
34213
34214    /// Removes all scopes, and no default scope will be used either.
34215    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34216    /// for details).
34217    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateTestIamPermissionCall<'a, C> {
34218        self._scopes.clear();
34219        self
34220    }
34221}
34222
34223/// Updates (replaces) workflow template. The updated template must contain version that matches the current server version.
34224///
34225/// A builder for the *regions.workflowTemplates.update* method supported by a *project* resource.
34226/// It is not used directly, but through a [`ProjectMethods`] instance.
34227///
34228/// # Example
34229///
34230/// Instantiate a resource method builder
34231///
34232/// ```test_harness,no_run
34233/// # extern crate hyper;
34234/// # extern crate hyper_rustls;
34235/// # extern crate google_dataproc1 as dataproc1;
34236/// use dataproc1::api::WorkflowTemplate;
34237/// # async fn dox() {
34238/// # use dataproc1::{Dataproc, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
34239///
34240/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
34241/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
34242/// #     secret,
34243/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
34244/// # ).build().await.unwrap();
34245///
34246/// # let client = hyper_util::client::legacy::Client::builder(
34247/// #     hyper_util::rt::TokioExecutor::new()
34248/// # )
34249/// # .build(
34250/// #     hyper_rustls::HttpsConnectorBuilder::new()
34251/// #         .with_native_roots()
34252/// #         .unwrap()
34253/// #         .https_or_http()
34254/// #         .enable_http1()
34255/// #         .build()
34256/// # );
34257/// # let mut hub = Dataproc::new(client, auth);
34258/// // As the method needs a request, you would usually fill it with the desired information
34259/// // into the respective structure. Some of the parts shown here might not be applicable !
34260/// // Values shown here are possibly random and not representative !
34261/// let mut req = WorkflowTemplate::default();
34262///
34263/// // You can configure optional parameters by calling the respective setters at will, and
34264/// // execute the final call using `doit()`.
34265/// // Values shown here are possibly random and not representative !
34266/// let result = hub.projects().regions_workflow_templates_update(req, "name")
34267///              .doit().await;
34268/// # }
34269/// ```
34270pub struct ProjectRegionWorkflowTemplateUpdateCall<'a, C>
34271where
34272    C: 'a,
34273{
34274    hub: &'a Dataproc<C>,
34275    _request: WorkflowTemplate,
34276    _name: String,
34277    _delegate: Option<&'a mut dyn common::Delegate>,
34278    _additional_params: HashMap<String, String>,
34279    _scopes: BTreeSet<String>,
34280}
34281
34282impl<'a, C> common::CallBuilder for ProjectRegionWorkflowTemplateUpdateCall<'a, C> {}
34283
34284impl<'a, C> ProjectRegionWorkflowTemplateUpdateCall<'a, C>
34285where
34286    C: common::Connector,
34287{
34288    /// Perform the operation you have build so far.
34289    pub async fn doit(mut self) -> common::Result<(common::Response, WorkflowTemplate)> {
34290        use std::borrow::Cow;
34291        use std::io::{Read, Seek};
34292
34293        use common::{url::Params, ToParts};
34294        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
34295
34296        let mut dd = common::DefaultDelegate;
34297        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
34298        dlg.begin(common::MethodInfo {
34299            id: "dataproc.projects.regions.workflowTemplates.update",
34300            http_method: hyper::Method::PUT,
34301        });
34302
34303        for &field in ["alt", "name"].iter() {
34304            if self._additional_params.contains_key(field) {
34305                dlg.finished(false);
34306                return Err(common::Error::FieldClash(field));
34307            }
34308        }
34309
34310        let mut params = Params::with_capacity(4 + self._additional_params.len());
34311        params.push("name", self._name);
34312
34313        params.extend(self._additional_params.iter());
34314
34315        params.push("alt", "json");
34316        let mut url = self.hub._base_url.clone() + "v1/{+name}";
34317        if self._scopes.is_empty() {
34318            self._scopes
34319                .insert(Scope::CloudPlatform.as_ref().to_string());
34320        }
34321
34322        #[allow(clippy::single_element_loop)]
34323        for &(find_this, param_name) in [("{+name}", "name")].iter() {
34324            url = params.uri_replacement(url, param_name, find_this, true);
34325        }
34326        {
34327            let to_remove = ["name"];
34328            params.remove_params(&to_remove);
34329        }
34330
34331        let url = params.parse_with_url(&url);
34332
34333        let mut json_mime_type = mime::APPLICATION_JSON;
34334        let mut request_value_reader = {
34335            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
34336            common::remove_json_null_values(&mut value);
34337            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
34338            serde_json::to_writer(&mut dst, &value).unwrap();
34339            dst
34340        };
34341        let request_size = request_value_reader
34342            .seek(std::io::SeekFrom::End(0))
34343            .unwrap();
34344        request_value_reader
34345            .seek(std::io::SeekFrom::Start(0))
34346            .unwrap();
34347
34348        loop {
34349            let token = match self
34350                .hub
34351                .auth
34352                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
34353                .await
34354            {
34355                Ok(token) => token,
34356                Err(e) => match dlg.token(e) {
34357                    Ok(token) => token,
34358                    Err(e) => {
34359                        dlg.finished(false);
34360                        return Err(common::Error::MissingToken(e));
34361                    }
34362                },
34363            };
34364            request_value_reader
34365                .seek(std::io::SeekFrom::Start(0))
34366                .unwrap();
34367            let mut req_result = {
34368                let client = &self.hub.client;
34369                dlg.pre_request();
34370                let mut req_builder = hyper::Request::builder()
34371                    .method(hyper::Method::PUT)
34372                    .uri(url.as_str())
34373                    .header(USER_AGENT, self.hub._user_agent.clone());
34374
34375                if let Some(token) = token.as_ref() {
34376                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
34377                }
34378
34379                let request = req_builder
34380                    .header(CONTENT_TYPE, json_mime_type.to_string())
34381                    .header(CONTENT_LENGTH, request_size as u64)
34382                    .body(common::to_body(
34383                        request_value_reader.get_ref().clone().into(),
34384                    ));
34385
34386                client.request(request.unwrap()).await
34387            };
34388
34389            match req_result {
34390                Err(err) => {
34391                    if let common::Retry::After(d) = dlg.http_error(&err) {
34392                        sleep(d).await;
34393                        continue;
34394                    }
34395                    dlg.finished(false);
34396                    return Err(common::Error::HttpError(err));
34397                }
34398                Ok(res) => {
34399                    let (mut parts, body) = res.into_parts();
34400                    let mut body = common::Body::new(body);
34401                    if !parts.status.is_success() {
34402                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34403                        let error = serde_json::from_str(&common::to_string(&bytes));
34404                        let response = common::to_response(parts, bytes.into());
34405
34406                        if let common::Retry::After(d) =
34407                            dlg.http_failure(&response, error.as_ref().ok())
34408                        {
34409                            sleep(d).await;
34410                            continue;
34411                        }
34412
34413                        dlg.finished(false);
34414
34415                        return Err(match error {
34416                            Ok(value) => common::Error::BadRequest(value),
34417                            _ => common::Error::Failure(response),
34418                        });
34419                    }
34420                    let response = {
34421                        let bytes = common::to_bytes(body).await.unwrap_or_default();
34422                        let encoded = common::to_string(&bytes);
34423                        match serde_json::from_str(&encoded) {
34424                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
34425                            Err(error) => {
34426                                dlg.response_json_decode_error(&encoded, &error);
34427                                return Err(common::Error::JsonDecodeError(
34428                                    encoded.to_string(),
34429                                    error,
34430                                ));
34431                            }
34432                        }
34433                    };
34434
34435                    dlg.finished(true);
34436                    return Ok(response);
34437                }
34438            }
34439        }
34440    }
34441
34442    ///
34443    /// Sets the *request* property to the given value.
34444    ///
34445    /// Even though the property as already been set when instantiating this call,
34446    /// we provide this method for API completeness.
34447    pub fn request(
34448        mut self,
34449        new_value: WorkflowTemplate,
34450    ) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C> {
34451        self._request = new_value;
34452        self
34453    }
34454    /// Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. For projects.regions.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id} For projects.locations.workflowTemplates, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}
34455    ///
34456    /// Sets the *name* path property to the given value.
34457    ///
34458    /// Even though the property as already been set when instantiating this call,
34459    /// we provide this method for API completeness.
34460    pub fn name(mut self, new_value: &str) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C> {
34461        self._name = new_value.to_string();
34462        self
34463    }
34464    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
34465    /// while executing the actual API request.
34466    ///
34467    /// ````text
34468    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
34469    /// ````
34470    ///
34471    /// Sets the *delegate* property to the given value.
34472    pub fn delegate(
34473        mut self,
34474        new_value: &'a mut dyn common::Delegate,
34475    ) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C> {
34476        self._delegate = Some(new_value);
34477        self
34478    }
34479
34480    /// Set any additional parameter of the query string used in the request.
34481    /// It should be used to set parameters which are not yet available through their own
34482    /// setters.
34483    ///
34484    /// Please note that this method must not be used to set any of the known parameters
34485    /// which have their own setter method. If done anyway, the request will fail.
34486    ///
34487    /// # Additional Parameters
34488    ///
34489    /// * *$.xgafv* (query-string) - V1 error format.
34490    /// * *access_token* (query-string) - OAuth access token.
34491    /// * *alt* (query-string) - Data format for response.
34492    /// * *callback* (query-string) - JSONP
34493    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
34494    /// * *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.
34495    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
34496    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
34497    /// * *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.
34498    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
34499    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
34500    pub fn param<T>(mut self, name: T, value: T) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C>
34501    where
34502        T: AsRef<str>,
34503    {
34504        self._additional_params
34505            .insert(name.as_ref().to_string(), value.as_ref().to_string());
34506        self
34507    }
34508
34509    /// Identifies the authorization scope for the method you are building.
34510    ///
34511    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
34512    /// [`Scope::CloudPlatform`].
34513    ///
34514    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
34515    /// tokens for more than one scope.
34516    ///
34517    /// Usually there is more than one suitable scope to authorize an operation, some of which may
34518    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
34519    /// sufficient, a read-write scope will do as well.
34520    pub fn add_scope<St>(mut self, scope: St) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C>
34521    where
34522        St: AsRef<str>,
34523    {
34524        self._scopes.insert(String::from(scope.as_ref()));
34525        self
34526    }
34527    /// Identifies the authorization scope(s) for the method you are building.
34528    ///
34529    /// See [`Self::add_scope()`] for details.
34530    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C>
34531    where
34532        I: IntoIterator<Item = St>,
34533        St: AsRef<str>,
34534    {
34535        self._scopes
34536            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
34537        self
34538    }
34539
34540    /// Removes all scopes, and no default scope will be used either.
34541    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
34542    /// for details).
34543    pub fn clear_scopes(mut self) -> ProjectRegionWorkflowTemplateUpdateCall<'a, C> {
34544        self._scopes.clear();
34545        self
34546    }
34547}