google_metastore1_beta/
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 DataprocMetastore 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_metastore1_beta as metastore1_beta;
49/// use metastore1_beta::api::Federation;
50/// use metastore1_beta::{Result, Error};
51/// # async fn dox() {
52/// use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = DataprocMetastore::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Federation::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_federations_create(req, "parent")
99///              .request_id("sed")
100///              .federation_id("amet.")
101///              .doit().await;
102///
103/// match result {
104///     Err(e) => match e {
105///         // The Error enum provides details about what exactly happened.
106///         // You can also just use its `Debug`, `Display` or `Error` traits
107///          Error::HttpError(_)
108///         |Error::Io(_)
109///         |Error::MissingAPIKey
110///         |Error::MissingToken(_)
111///         |Error::Cancelled
112///         |Error::UploadSizeLimitExceeded(_, _)
113///         |Error::Failure(_)
114///         |Error::BadRequest(_)
115///         |Error::FieldClash(_)
116///         |Error::JsonDecodeError(_, _) => println!("{}", e),
117///     },
118///     Ok(res) => println!("Success: {:?}", res),
119/// }
120/// # }
121/// ```
122#[derive(Clone)]
123pub struct DataprocMetastore<C> {
124    pub client: common::Client<C>,
125    pub auth: Box<dyn common::GetToken>,
126    _user_agent: String,
127    _base_url: String,
128    _root_url: String,
129}
130
131impl<C> common::Hub for DataprocMetastore<C> {}
132
133impl<'a, C> DataprocMetastore<C> {
134    pub fn new<A: 'static + common::GetToken>(
135        client: common::Client<C>,
136        auth: A,
137    ) -> DataprocMetastore<C> {
138        DataprocMetastore {
139            client,
140            auth: Box::new(auth),
141            _user_agent: "google-api-rust-client/7.0.0".to_string(),
142            _base_url: "https://metastore.googleapis.com/".to_string(),
143            _root_url: "https://metastore.googleapis.com/".to_string(),
144        }
145    }
146
147    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
148        ProjectMethods { hub: self }
149    }
150
151    /// Set the user-agent header field to use in all requests to the server.
152    /// It defaults to `google-api-rust-client/7.0.0`.
153    ///
154    /// Returns the previously set user-agent.
155    pub fn user_agent(&mut self, agent_name: String) -> String {
156        std::mem::replace(&mut self._user_agent, agent_name)
157    }
158
159    /// Set the base url to use in all requests to the server.
160    /// It defaults to `https://metastore.googleapis.com/`.
161    ///
162    /// Returns the previously set base url.
163    pub fn base_url(&mut self, new_base_url: String) -> String {
164        std::mem::replace(&mut self._base_url, new_base_url)
165    }
166
167    /// Set the root url to use in all requests to the server.
168    /// It defaults to `https://metastore.googleapis.com/`.
169    ///
170    /// Returns the previously set root url.
171    pub fn root_url(&mut self, new_root_url: String) -> String {
172        std::mem::replace(&mut self._root_url, new_root_url)
173    }
174}
175
176// ############
177// SCHEMAS ###
178// ##########
179/// Request message for DataprocMetastore.AlterMetadataResourceLocation.
180///
181/// # Activities
182///
183/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
184/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
185///
186/// * [locations services alter location projects](ProjectLocationServiceAlterLocationCall) (request)
187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
188#[serde_with::serde_as]
189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
190pub struct AlterMetadataResourceLocationRequest {
191    /// Required. The new location URI for the metadata resource.
192    #[serde(rename = "locationUri")]
193    pub location_uri: Option<String>,
194    /// Required. The relative metadata resource name in the following format.databases/{database_id} or databases/{database_id}/tables/{table_id} or databases/{database_id}/tables/{table_id}/partitions/{partition_id}
195    #[serde(rename = "resourceName")]
196    pub resource_name: Option<String>,
197}
198
199impl common::RequestValue for AlterMetadataResourceLocationRequest {}
200
201/// Request message for DataprocMetastore.AlterTableProperties.
202///
203/// # Activities
204///
205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
207///
208/// * [locations services alter table properties projects](ProjectLocationServiceAlterTablePropertyCall) (request)
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct AlterTablePropertiesRequest {
213    /// A map that describes the desired values to mutate. If update_mask is empty, the properties will not update. Otherwise, the properties only alters the value whose associated paths exist in the update mask
214    pub properties: Option<HashMap<String, String>>,
215    /// Required. The name of the table containing the properties you're altering in the following format.databases/{database_id}/tables/{table_id}
216    #[serde(rename = "tableName")]
217    pub table_name: Option<String>,
218    /// A field mask that specifies the metadata table properties that are overwritten by the update. Fields specified in the update_mask are relative to the resource (not to the full request). A field is overwritten if it is in the mask.For example, given the target properties: properties { a: 1 b: 2 } And an update properties: properties { a: 2 b: 3 c: 4 } then if the field mask is:paths: "properties.b", "properties.c"then the result will be: properties { a: 1 b: 3 c: 4 }
219    #[serde(rename = "updateMask")]
220    pub update_mask: Option<common::FieldMask>,
221}
222
223impl common::RequestValue for AlterTablePropertiesRequest {}
224
225/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs.If there are AuditConfigs for both allServices and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted.Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts jose@example.com from DATA_READ logging, and aliya@example.com from DATA_WRITE logging.
226///
227/// This type is not used in any activity, and only used as *part* of another schema.
228///
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct AuditConfig {
233    /// The configuration for logging of each type of permission.
234    #[serde(rename = "auditLogConfigs")]
235    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
236    /// Specifies a service that will be enabled for audit logging. For example, storage.googleapis.com, cloudsql.googleapis.com. allServices is a special value that covers all services.
237    pub service: Option<String>,
238}
239
240impl common::Part for AuditConfig {}
241
242/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
243///
244/// This type is not used in any activity, and only used as *part* of another schema.
245///
246#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
247#[serde_with::serde_as]
248#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
249pub struct AuditLogConfig {
250    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
251    #[serde(rename = "exemptedMembers")]
252    pub exempted_members: Option<Vec<String>>,
253    /// The log type that this config enables.
254    #[serde(rename = "logType")]
255    pub log_type: Option<String>,
256}
257
258impl common::Part for AuditLogConfig {}
259
260/// Represents the autoscaling configuration of a metastore service.
261///
262/// This type is not used in any activity, and only used as *part* of another schema.
263///
264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
265#[serde_with::serde_as]
266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
267pub struct AutoscalingConfig {
268    /// Optional. Whether or not autoscaling is enabled for this service.
269    #[serde(rename = "autoscalingEnabled")]
270    pub autoscaling_enabled: Option<bool>,
271    /// Output only. The scaling factor of a service with autoscaling enabled.
272    #[serde(rename = "autoscalingFactor")]
273    pub autoscaling_factor: Option<f32>,
274    /// Optional. The LimitConfig of the service.
275    #[serde(rename = "limitConfig")]
276    pub limit_config: Option<LimitConfig>,
277}
278
279impl common::Part for AutoscalingConfig {}
280
281/// Configuration information for the auxiliary service versions.
282///
283/// This type is not used in any activity, and only used as *part* of another schema.
284///
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct AuxiliaryVersionConfig {
289    /// Optional. A mapping of Hive metastore configuration key-value pairs to apply to the auxiliary Hive metastore (configured in hive-site.xml) in addition to the primary version's overrides. If keys are present in both the auxiliary version's overrides and the primary version's overrides, the value from the auxiliary version's overrides takes precedence.
290    #[serde(rename = "configOverrides")]
291    pub config_overrides: Option<HashMap<String, String>>,
292    /// Output only. The network configuration contains the endpoint URI(s) of the auxiliary Hive metastore service.
293    #[serde(rename = "networkConfig")]
294    pub network_config: Option<NetworkConfig>,
295    /// Optional. The Hive metastore version of the auxiliary service. It must be less than the primary Hive metastore service's version.
296    pub version: Option<String>,
297}
298
299impl common::Part for AuxiliaryVersionConfig {}
300
301/// Represents a backend metastore for the federation.
302///
303/// This type is not used in any activity, and only used as *part* of another schema.
304///
305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
306#[serde_with::serde_as]
307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
308pub struct BackendMetastore {
309    /// The type of the backend metastore.
310    #[serde(rename = "metastoreType")]
311    pub metastore_type: Option<String>,
312    /// The relative resource name of the metastore that is being federated. The formats of the relative resource names for the currently supported metastores are listed below: BigQuery projects/{project_id} Dataproc Metastore projects/{project_id}/locations/{location}/services/{service_id}
313    pub name: Option<String>,
314}
315
316impl common::Part for BackendMetastore {}
317
318/// The details of a backup resource.
319///
320/// # Activities
321///
322/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
323/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
324///
325/// * [locations services backups create projects](ProjectLocationServiceBackupCreateCall) (request)
326/// * [locations services backups get projects](ProjectLocationServiceBackupGetCall) (response)
327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
328#[serde_with::serde_as]
329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
330pub struct Backup {
331    /// Output only. The time when the backup was started.
332    #[serde(rename = "createTime")]
333    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
334    /// Optional. The description of the backup.
335    pub description: Option<String>,
336    /// Output only. The time when the backup finished creating.
337    #[serde(rename = "endTime")]
338    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
339    /// Immutable. Identifier. The relative resource name of the backup, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}
340    pub name: Option<String>,
341    /// Output only. Services that are restoring from the backup.
342    #[serde(rename = "restoringServices")]
343    pub restoring_services: Option<Vec<String>>,
344    /// Output only. The revision of the service at the time of backup.
345    #[serde(rename = "serviceRevision")]
346    pub service_revision: Option<Service>,
347    /// Output only. The current state of the backup.
348    pub state: Option<String>,
349}
350
351impl common::RequestValue for Backup {}
352impl common::ResponseResult for Backup {}
353
354/// Associates members, or principals, with a role.
355///
356/// This type is not used in any activity, and only used as *part* of another schema.
357///
358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
359#[serde_with::serde_as]
360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
361pub struct Binding {
362    /// 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).
363    pub condition: Option<Expr>,
364    /// 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.
365    pub members: Option<Vec<String>>,
366    /// 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).
367    pub role: Option<String>,
368}
369
370impl common::Part for Binding {}
371
372/// Request message for DataprocMetastore.CancelMigration.
373///
374/// # Activities
375///
376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
378///
379/// * [locations services cancel migration projects](ProjectLocationServiceCancelMigrationCall) (request)
380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
381#[serde_with::serde_as]
382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
383pub struct CancelMigrationRequest {
384    _never_set: Option<bool>,
385}
386
387impl common::RequestValue for CancelMigrationRequest {}
388
389/// The request message for Operations.CancelOperation.
390///
391/// # Activities
392///
393/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
394/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
395///
396/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
398#[serde_with::serde_as]
399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
400pub struct CancelOperationRequest {
401    _never_set: Option<bool>,
402}
403
404impl common::RequestValue for CancelOperationRequest {}
405
406/// Configuration information to start the Change Data Capture (CDC) streams from customer database to backend database of Dataproc Metastore.
407///
408/// This type is not used in any activity, and only used as *part* of another schema.
409///
410#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
411#[serde_with::serde_as]
412#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
413pub struct CdcConfig {
414    /// Optional. The bucket to write the intermediate stream event data in. The bucket name must be without any prefix like "gs://". See the bucket naming requirements (https://cloud.google.com/storage/docs/buckets#naming). This field is optional. If not set, the Artifacts Cloud Storage bucket will be used.
415    pub bucket: Option<String>,
416    /// Required. Input only. The password for the user that Datastream service should use for the MySQL connection. This field is not returned on request.
417    pub password: Option<String>,
418    /// Required. The URL of the subnetwork resource to create the VM instance hosting the reverse proxy in. More context in https://cloud.google.com/datastream/docs/private-connectivity#reverse-csql-proxy The subnetwork should reside in the network provided in the request that Datastream will peer to and should be in the same region as Datastream, in the following format. projects/{project_id}/regions/{region_id}/subnetworks/{subnetwork_id}
419    #[serde(rename = "reverseProxySubnet")]
420    pub reverse_proxy_subnet: Option<String>,
421    /// Optional. The root path inside the Cloud Storage bucket. The stream event data will be written to this path. The default value is /migration.
422    #[serde(rename = "rootPath")]
423    pub root_path: Option<String>,
424    /// Required. A /29 CIDR IP range for peering with datastream.
425    #[serde(rename = "subnetIpRange")]
426    pub subnet_ip_range: Option<String>,
427    /// Required. The username that the Datastream service should use for the MySQL connection.
428    pub username: Option<String>,
429    /// Required. Fully qualified name of the Cloud SQL instance's VPC network or the shared VPC network that Datastream will peer to, in the following format: projects/{project_id}/locations/global/networks/{network_id}. More context in https://cloud.google.com/datastream/docs/network-connectivity-options#privateconnectivity
430    #[serde(rename = "vpcNetwork")]
431    pub vpc_network: Option<String>,
432}
433
434impl common::Part for CdcConfig {}
435
436/// Configuration information to establish customer database connection before the cutover phase of migration
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct CloudSQLConnectionConfig {
444    /// Required. The hive database name.
445    #[serde(rename = "hiveDatabaseName")]
446    pub hive_database_name: Option<String>,
447    /// Required. Cloud SQL database connection name (project_id:region:instance_name)
448    #[serde(rename = "instanceConnectionName")]
449    pub instance_connection_name: Option<String>,
450    /// Required. The private IP address of the Cloud SQL instance.
451    #[serde(rename = "ipAddress")]
452    pub ip_address: Option<String>,
453    /// Required. The relative resource name of the subnetwork to be used for Private Service Connect. Note that this cannot be a regular subnet and is used only for NAT. (https://cloud.google.com/vpc/docs/about-vpc-hosted-services#psc-subnets) This subnet is used to publish the SOCKS5 proxy service. The subnet size must be at least /29 and it should reside in a network through which the Cloud SQL instance is accessible. The resource name should be in the format, projects/{project_id}/regions/{region_id}/subnetworks/{subnetwork_id}
454    #[serde(rename = "natSubnet")]
455    pub nat_subnet: Option<String>,
456    /// Required. Input only. The password for the user that Dataproc Metastore service will be using to connect to the database. This field is not returned on request.
457    pub password: Option<String>,
458    /// Required. The network port of the database.
459    pub port: Option<i32>,
460    /// Required. The relative resource name of the subnetwork to deploy the SOCKS5 proxy service in. The subnetwork should reside in a network through which the Cloud SQL instance is accessible. The resource name should be in the format, projects/{project_id}/regions/{region_id}/subnetworks/{subnetwork_id}
461    #[serde(rename = "proxySubnet")]
462    pub proxy_subnet: Option<String>,
463    /// Required. The username that Dataproc Metastore service will use to connect to the database.
464    pub username: Option<String>,
465}
466
467impl common::Part for CloudSQLConnectionConfig {}
468
469/// Configuration information for migrating from self-managed hive metastore on Google Cloud using Cloud SQL as the backend database to Dataproc Metastore.
470///
471/// This type is not used in any activity, and only used as *part* of another schema.
472///
473#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
474#[serde_with::serde_as]
475#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
476pub struct CloudSQLMigrationConfig {
477    /// Required. Configuration information to start the Change Data Capture (CDC) streams from customer database to backend database of Dataproc Metastore. Dataproc Metastore switches to using its backend database after the cutover phase of migration.
478    #[serde(rename = "cdcConfig")]
479    pub cdc_config: Option<CdcConfig>,
480    /// Required. Configuration information to establish customer database connection before the cutover phase of migration
481    #[serde(rename = "cloudSqlConnectionConfig")]
482    pub cloud_sql_connection_config: Option<CloudSQLConnectionConfig>,
483}
484
485impl common::Part for CloudSQLMigrationConfig {}
486
487/// Request message for DataprocMetastore.CompleteMigration.
488///
489/// # Activities
490///
491/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
492/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
493///
494/// * [locations services complete migration projects](ProjectLocationServiceCompleteMigrationCall) (request)
495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
496#[serde_with::serde_as]
497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
498pub struct CompleteMigrationRequest {
499    _never_set: Option<bool>,
500}
501
502impl common::RequestValue for CompleteMigrationRequest {}
503
504/// Contains information of the customer's network configurations.
505///
506/// This type is not used in any activity, and only used as *part* of another schema.
507///
508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
509#[serde_with::serde_as]
510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct Consumer {
512    /// Output only. The location of the endpoint URI. Format: projects/{project}/locations/{location}.
513    #[serde(rename = "endpointLocation")]
514    pub endpoint_location: Option<String>,
515    /// Output only. The URI of the endpoint used to access the metastore service.
516    #[serde(rename = "endpointUri")]
517    pub endpoint_uri: Option<String>,
518    /// Immutable. The subnetwork of the customer project from which an IP address is reserved and used as the Dataproc Metastore service's endpoint. It is accessible to hosts in the subnet and to all hosts in a subnet in the same region and same network. There must be at least one IP address available in the subnet's primary range. The subnet is specified in the following form:projects/{project_number}/regions/{region_id}/subnetworks/{subnetwork_id}
519    pub subnetwork: Option<String>,
520}
521
522impl common::Part for Consumer {}
523
524/// Custom configuration used to specify regions that the metastore service runs in. Currently only supported in the us multi-region.
525///
526/// This type is not used in any activity, and only used as *part* of another schema.
527///
528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
529#[serde_with::serde_as]
530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
531pub struct CustomRegionConfig {
532    /// Optional. The list of read-only regions where the metastore service runs in. These regions should be part (or subset) of the multi-region.
533    #[serde(rename = "readOnlyRegions")]
534    pub read_only_regions: Option<Vec<String>>,
535    /// Required. The list of read-write regions where the metastore service runs in. These regions should be part (or subset) of the multi-region.
536    #[serde(rename = "readWriteRegions")]
537    pub read_write_regions: Option<Vec<String>>,
538}
539
540impl common::Part for CustomRegionConfig {}
541
542/// Specifies how metastore metadata should be integrated with the Data Catalog service.
543///
544/// This type is not used in any activity, and only used as *part* of another schema.
545///
546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
547#[serde_with::serde_as]
548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
549pub struct DataCatalogConfig {
550    /// Optional. Defines whether the metastore metadata should be synced to Data Catalog. The default value is to disable syncing metastore metadata to Data Catalog.
551    pub enabled: Option<bool>,
552}
553
554impl common::Part for DataCatalogConfig {}
555
556/// A specification of the location of and metadata about a database dump from a relational database management system.
557///
558/// This type is not used in any activity, and only used as *part* of another schema.
559///
560#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
561#[serde_with::serde_as]
562#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
563pub struct DatabaseDump {
564    /// The type of the database.
565    #[serde(rename = "databaseType")]
566    pub database_type: Option<String>,
567    /// Optional. A Cloud Storage object or folder URI that specifies the source from which to import metadata. It must begin with gs://.
568    #[serde(rename = "gcsUri")]
569    pub gcs_uri: Option<String>,
570    /// Optional. The name of the source database.
571    #[serde(rename = "sourceDatabase")]
572    pub source_database: Option<String>,
573    /// Optional. The type of the database dump. If unspecified, defaults to MYSQL.
574    #[serde(rename = "type")]
575    pub type_: Option<String>,
576}
577
578impl common::Part for DatabaseDump {}
579
580/// Specifies how metastore metadata should be integrated with the Dataplex service.
581///
582/// This type is not used in any activity, and only used as *part* of another schema.
583///
584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
585#[serde_with::serde_as]
586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
587pub struct DataplexConfig {
588    /// Optional. A reference to the Lake resources that this metastore service is attached to. The key is the lake resource name. Example: projects/{project_number}/locations/{location_id}/lakes/{lake_id}.
589    #[serde(rename = "lakeResources")]
590    pub lake_resources: Option<HashMap<String, Lake>>,
591}
592
593impl common::Part for DataplexConfig {}
594
595/// 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); }
596///
597/// # Activities
598///
599/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
600/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
601///
602/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
603/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
605#[serde_with::serde_as]
606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
607pub struct Empty {
608    _never_set: Option<bool>,
609}
610
611impl common::ResponseResult for Empty {}
612
613/// Encryption settings for the service.
614///
615/// This type is not used in any activity, and only used as *part* of another schema.
616///
617#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
618#[serde_with::serde_as]
619#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
620pub struct EncryptionConfig {
621    /// Optional. The fully qualified customer provided Cloud KMS key name to use for customer data encryption, in the following format:projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}.
622    #[serde(rename = "kmsKey")]
623    pub kms_key: Option<String>,
624    /// Optional. The list of fully qualified customer provided Cloud KMS key names for the multi-regional service. Each key must be in the following format:projects/{project_number}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}.
625    #[serde(rename = "kmsKeys")]
626    pub kms_keys: Option<Vec<String>>,
627}
628
629impl common::Part for EncryptionConfig {}
630
631/// Request message for DataprocMetastore.ExportMetadata.
632///
633/// # Activities
634///
635/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
636/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
637///
638/// * [locations services export metadata projects](ProjectLocationServiceExportMetadataCall) (request)
639#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
640#[serde_with::serde_as]
641#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
642pub struct ExportMetadataRequest {
643    /// Optional. The type of the database dump. If unspecified, defaults to MYSQL.
644    #[serde(rename = "databaseDumpType")]
645    pub database_dump_type: Option<String>,
646    /// A Cloud Storage URI of a folder, in the format gs:///. A sub-folder containing exported files will be created below it.
647    #[serde(rename = "destinationGcsFolder")]
648    pub destination_gcs_folder: Option<String>,
649    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
650    #[serde(rename = "requestId")]
651    pub request_id: Option<String>,
652}
653
654impl common::RequestValue for ExportMetadataRequest {}
655
656/// 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.
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct Expr {
664    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
665    pub description: Option<String>,
666    /// Textual representation of an expression in Common Expression Language syntax.
667    pub expression: Option<String>,
668    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
669    pub location: Option<String>,
670    /// 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.
671    pub title: Option<String>,
672}
673
674impl common::Part for Expr {}
675
676/// Represents a federation of multiple backend metastores.
677///
678/// # Activities
679///
680/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
681/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
682///
683/// * [locations federations create projects](ProjectLocationFederationCreateCall) (request)
684/// * [locations federations get projects](ProjectLocationFederationGetCall) (response)
685/// * [locations federations patch projects](ProjectLocationFederationPatchCall) (request)
686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
687#[serde_with::serde_as]
688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
689pub struct Federation {
690    /// A map from BackendMetastore rank to BackendMetastores from which the federation service serves metadata at query time. The map key represents the order in which BackendMetastores should be evaluated to resolve database names at query time and should be greater than or equal to zero. A BackendMetastore with a lower number will be evaluated before a BackendMetastore with a higher number.
691    #[serde(rename = "backendMetastores")]
692    pub backend_metastores: Option<HashMap<String, BackendMetastore>>,
693    /// Output only. The time when the metastore federation was created.
694    #[serde(rename = "createTime")]
695    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
696    /// Output only. The federation endpoint.
697    #[serde(rename = "endpointUri")]
698    pub endpoint_uri: Option<String>,
699    /// User-defined labels for the metastore federation.
700    pub labels: Option<HashMap<String, String>>,
701    /// Immutable. The relative resource name of the federation, of the form: projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
702    pub name: Option<String>,
703    /// Output only. The current state of the federation.
704    pub state: Option<String>,
705    /// Output only. Additional information about the current state of the metastore federation, if available.
706    #[serde(rename = "stateMessage")]
707    pub state_message: Option<String>,
708    /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
709    pub tags: Option<HashMap<String, String>>,
710    /// Output only. The globally unique resource identifier of the metastore federation.
711    pub uid: Option<String>,
712    /// Output only. The time when the metastore federation was last updated.
713    #[serde(rename = "updateTime")]
714    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
715    /// Immutable. The Apache Hive metastore version of the federation. All backend metastore versions must be compatible with the federation version.
716    pub version: Option<String>,
717}
718
719impl common::RequestValue for Federation {}
720impl common::ResponseResult for Federation {}
721
722/// Specifies configuration information specific to running Hive metastore software as the metastore service.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct HiveMetastoreConfig {
730    /// Optional. A mapping of Hive metastore version to the auxiliary version configuration. When specified, a secondary Hive metastore service is created along with the primary service. All auxiliary versions must be less than the service's primary version. The key is the auxiliary service name and it must match the regular expression a-z?. This means that the first character must be a lowercase letter, and all the following characters must be hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen.
731    #[serde(rename = "auxiliaryVersions")]
732    pub auxiliary_versions: Option<HashMap<String, AuxiliaryVersionConfig>>,
733    /// Optional. A mapping of Hive metastore configuration key-value pairs to apply to the Hive metastore (configured in hive-site.xml). The mappings override system defaults (some keys cannot be overridden). These overrides are also applied to auxiliary versions and can be further customized in the auxiliary version's AuxiliaryVersionConfig.
734    #[serde(rename = "configOverrides")]
735    pub config_overrides: Option<HashMap<String, String>>,
736    /// Optional. The protocol to use for the metastore service endpoint. If unspecified, defaults to THRIFT.
737    #[serde(rename = "endpointProtocol")]
738    pub endpoint_protocol: Option<String>,
739    /// Optional. Information used to configure the Hive metastore service as a service principal in a Kerberos realm. To disable Kerberos, use the UpdateService method and specify this field's path (hive_metastore_config.kerberos_config) in the request's update_mask while omitting this field from the request's service.
740    #[serde(rename = "kerberosConfig")]
741    pub kerberos_config: Option<KerberosConfig>,
742    /// Immutable. The Hive metastore schema version.
743    pub version: Option<String>,
744}
745
746impl common::Part for HiveMetastoreConfig {}
747
748/// Configuration information for a Kerberos principal.
749///
750/// This type is not used in any activity, and only used as *part* of another schema.
751///
752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
753#[serde_with::serde_as]
754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
755pub struct KerberosConfig {
756    /// Optional. A Kerberos keytab file that can be used to authenticate a service principal with a Kerberos Key Distribution Center (KDC).
757    pub keytab: Option<Secret>,
758    /// Optional. A Cloud Storage URI that specifies the path to a krb5.conf file. It is of the form gs://{bucket_name}/path/to/krb5.conf, although the file does not need to be named krb5.conf explicitly.
759    #[serde(rename = "krb5ConfigGcsUri")]
760    pub krb5_config_gcs_uri: Option<String>,
761    /// Optional. A Kerberos principal that exists in the both the keytab the KDC to authenticate as. A typical principal is of the form primary/instance@REALM, but there is no exact format.
762    pub principal: Option<String>,
763}
764
765impl common::Part for KerberosConfig {}
766
767/// Represents a Lake resource
768///
769/// This type is not used in any activity, and only used as *part* of another schema.
770///
771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
772#[serde_with::serde_as]
773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
774pub struct Lake {
775    /// The Lake resource name. Example: projects/{project_number}/locations/{location_id}/lakes/{lake_id}
776    pub name: Option<String>,
777}
778
779impl common::Part for Lake {}
780
781/// The details of the latest scheduled backup.
782///
783/// This type is not used in any activity, and only used as *part* of another schema.
784///
785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
786#[serde_with::serde_as]
787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
788pub struct LatestBackup {
789    /// Output only. The ID of an in-progress scheduled backup. Empty if no backup is in progress.
790    #[serde(rename = "backupId")]
791    pub backup_id: Option<String>,
792    /// Output only. The duration of the backup completion.
793    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
794    pub duration: Option<chrono::Duration>,
795    /// Output only. The time when the backup was started.
796    #[serde(rename = "startTime")]
797    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
798    /// Output only. The current state of the backup.
799    pub state: Option<String>,
800}
801
802impl common::Part for LatestBackup {}
803
804/// Represents the autoscaling limit configuration of a metastore service.
805///
806/// This type is not used in any activity, and only used as *part* of another schema.
807///
808#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
809#[serde_with::serde_as]
810#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
811pub struct LimitConfig {
812    /// Optional. The highest scaling factor that the service should be autoscaled to.
813    #[serde(rename = "maxScalingFactor")]
814    pub max_scaling_factor: Option<f32>,
815    /// Optional. The lowest scaling factor that the service should be autoscaled to.
816    #[serde(rename = "minScalingFactor")]
817    pub min_scaling_factor: Option<f32>,
818}
819
820impl common::Part for LimitConfig {}
821
822/// Response message for DataprocMetastore.ListBackups.
823///
824/// # Activities
825///
826/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
827/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
828///
829/// * [locations services backups list projects](ProjectLocationServiceBackupListCall) (response)
830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
831#[serde_with::serde_as]
832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
833pub struct ListBackupsResponse {
834    /// The backups of the specified service.
835    pub backups: Option<Vec<Backup>>,
836    /// A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
837    #[serde(rename = "nextPageToken")]
838    pub next_page_token: Option<String>,
839    /// Locations that could not be reached.
840    pub unreachable: Option<Vec<String>>,
841}
842
843impl common::ResponseResult for ListBackupsResponse {}
844
845/// Response message for ListFederations
846///
847/// # Activities
848///
849/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
850/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
851///
852/// * [locations federations list projects](ProjectLocationFederationListCall) (response)
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct ListFederationsResponse {
857    /// The services in the specified location.
858    pub federations: Option<Vec<Federation>>,
859    /// A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
860    #[serde(rename = "nextPageToken")]
861    pub next_page_token: Option<String>,
862    /// Locations that could not be reached.
863    pub unreachable: Option<Vec<String>>,
864}
865
866impl common::ResponseResult for ListFederationsResponse {}
867
868/// The response message for Locations.ListLocations.
869///
870/// # Activities
871///
872/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
873/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
874///
875/// * [locations list projects](ProjectLocationListCall) (response)
876#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
877#[serde_with::serde_as]
878#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
879pub struct ListLocationsResponse {
880    /// A list of locations that matches the specified filter in the request.
881    pub locations: Option<Vec<Location>>,
882    /// The standard List next-page token.
883    #[serde(rename = "nextPageToken")]
884    pub next_page_token: Option<String>,
885}
886
887impl common::ResponseResult for ListLocationsResponse {}
888
889/// Response message for DataprocMetastore.ListMetadataImports.
890///
891/// # Activities
892///
893/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
894/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
895///
896/// * [locations services metadata imports list projects](ProjectLocationServiceMetadataImportListCall) (response)
897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
898#[serde_with::serde_as]
899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct ListMetadataImportsResponse {
901    /// The imports in the specified service.
902    #[serde(rename = "metadataImports")]
903    pub metadata_imports: Option<Vec<MetadataImport>>,
904    /// A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
905    #[serde(rename = "nextPageToken")]
906    pub next_page_token: Option<String>,
907    /// Locations that could not be reached.
908    pub unreachable: Option<Vec<String>>,
909}
910
911impl common::ResponseResult for ListMetadataImportsResponse {}
912
913/// Response message for DataprocMetastore.ListMigrationExecutions.
914///
915/// # Activities
916///
917/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
918/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
919///
920/// * [locations services migration executions list projects](ProjectLocationServiceMigrationExecutionListCall) (response)
921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
922#[serde_with::serde_as]
923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
924pub struct ListMigrationExecutionsResponse {
925    /// The migration executions on the specified service.
926    #[serde(rename = "migrationExecutions")]
927    pub migration_executions: Option<Vec<MigrationExecution>>,
928    /// A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
929    #[serde(rename = "nextPageToken")]
930    pub next_page_token: Option<String>,
931    /// Locations that could not be reached.
932    pub unreachable: Option<Vec<String>>,
933}
934
935impl common::ResponseResult for ListMigrationExecutionsResponse {}
936
937/// The response message for Operations.ListOperations.
938///
939/// # Activities
940///
941/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
942/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
943///
944/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
946#[serde_with::serde_as]
947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
948pub struct ListOperationsResponse {
949    /// The standard List next-page token.
950    #[serde(rename = "nextPageToken")]
951    pub next_page_token: Option<String>,
952    /// A list of operations that matches the specified filter in the request.
953    pub operations: Option<Vec<Operation>>,
954    /// Unordered list. Unreachable resources. Populated when the request sets ListOperationsRequest.return_partial_success and reads across collections. For example, when attempting to list all resources across all supported locations.
955    pub unreachable: Option<Vec<String>>,
956}
957
958impl common::ResponseResult for ListOperationsResponse {}
959
960/// Response message for DataprocMetastore.ListServices.
961///
962/// # Activities
963///
964/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
965/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
966///
967/// * [locations services list projects](ProjectLocationServiceListCall) (response)
968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
969#[serde_with::serde_as]
970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
971pub struct ListServicesResponse {
972    /// A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
973    #[serde(rename = "nextPageToken")]
974    pub next_page_token: Option<String>,
975    /// The services in the specified location.
976    pub services: Option<Vec<Service>>,
977    /// Locations that could not be reached.
978    pub unreachable: Option<Vec<String>>,
979}
980
981impl common::ResponseResult for ListServicesResponse {}
982
983/// A resource that represents a Google Cloud location.
984///
985/// # Activities
986///
987/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
988/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
989///
990/// * [locations get projects](ProjectLocationGetCall) (response)
991#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
992#[serde_with::serde_as]
993#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
994pub struct Location {
995    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
996    #[serde(rename = "displayName")]
997    pub display_name: Option<String>,
998    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
999    pub labels: Option<HashMap<String, String>>,
1000    /// The canonical id for this location. For example: "us-east1".
1001    #[serde(rename = "locationId")]
1002    pub location_id: Option<String>,
1003    /// Service-specific metadata. For example the available capacity at the given location.
1004    pub metadata: Option<HashMap<String, serde_json::Value>>,
1005    /// Resource name for the location, which may vary between implementations. For example: "projects/example-project/locations/us-east1"
1006    pub name: Option<String>,
1007}
1008
1009impl common::ResponseResult for Location {}
1010
1011/// Maintenance window. This specifies when Dataproc Metastore may perform system maintenance operation to the service.
1012///
1013/// This type is not used in any activity, and only used as *part* of another schema.
1014///
1015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1016#[serde_with::serde_as]
1017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1018pub struct MaintenanceWindow {
1019    /// Optional. The day of week, when the window starts.
1020    #[serde(rename = "dayOfWeek")]
1021    pub day_of_week: Option<String>,
1022    /// Optional. The hour of day (0-23) when the window starts.
1023    #[serde(rename = "hourOfDay")]
1024    pub hour_of_day: Option<i32>,
1025}
1026
1027impl common::Part for MaintenanceWindow {}
1028
1029/// The details of a metadata export operation.
1030///
1031/// This type is not used in any activity, and only used as *part* of another schema.
1032///
1033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1034#[serde_with::serde_as]
1035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1036pub struct MetadataExport {
1037    /// Output only. The type of the database dump.
1038    #[serde(rename = "databaseDumpType")]
1039    pub database_dump_type: Option<String>,
1040    /// Output only. A Cloud Storage URI of a folder that metadata are exported to, in the form of gs:////, where is automatically generated.
1041    #[serde(rename = "destinationGcsUri")]
1042    pub destination_gcs_uri: Option<String>,
1043    /// Output only. The time when the export ended.
1044    #[serde(rename = "endTime")]
1045    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1046    /// Output only. The time when the export started.
1047    #[serde(rename = "startTime")]
1048    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1049    /// Output only. The current state of the export.
1050    pub state: Option<String>,
1051}
1052
1053impl common::Part for MetadataExport {}
1054
1055/// A metastore resource that imports metadata.
1056///
1057/// # Activities
1058///
1059/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1060/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1061///
1062/// * [locations services metadata imports create projects](ProjectLocationServiceMetadataImportCreateCall) (request)
1063/// * [locations services metadata imports get projects](ProjectLocationServiceMetadataImportGetCall) (response)
1064/// * [locations services metadata imports patch projects](ProjectLocationServiceMetadataImportPatchCall) (request)
1065#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1066#[serde_with::serde_as]
1067#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1068pub struct MetadataImport {
1069    /// Output only. The time when the metadata import was started.
1070    #[serde(rename = "createTime")]
1071    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1072    /// Immutable. A database dump from a pre-existing metastore's database.
1073    #[serde(rename = "databaseDump")]
1074    pub database_dump: Option<DatabaseDump>,
1075    /// Optional. The description of the metadata import.
1076    pub description: Option<String>,
1077    /// Output only. The time when the metadata import finished.
1078    #[serde(rename = "endTime")]
1079    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1080    /// Immutable. Identifier. The relative resource name of the metadata import, of the form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}.
1081    pub name: Option<String>,
1082    /// Output only. The current state of the metadata import.
1083    pub state: Option<String>,
1084    /// Output only. The time when the metadata import was last updated.
1085    #[serde(rename = "updateTime")]
1086    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1087}
1088
1089impl common::RequestValue for MetadataImport {}
1090impl common::ResponseResult for MetadataImport {}
1091
1092/// Specifies how metastore metadata should be integrated with external services.
1093///
1094/// This type is not used in any activity, and only used as *part* of another schema.
1095///
1096#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1097#[serde_with::serde_as]
1098#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1099pub struct MetadataIntegration {
1100    /// Optional. The integration config for the Data Catalog service.
1101    #[serde(rename = "dataCatalogConfig")]
1102    pub data_catalog_config: Option<DataCatalogConfig>,
1103    /// Optional. The integration config for the Dataplex service.
1104    #[serde(rename = "dataplexConfig")]
1105    pub dataplex_config: Option<DataplexConfig>,
1106}
1107
1108impl common::Part for MetadataIntegration {}
1109
1110/// The metadata management activities of the metastore service.
1111///
1112/// This type is not used in any activity, and only used as *part* of another schema.
1113///
1114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1115#[serde_with::serde_as]
1116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1117pub struct MetadataManagementActivity {
1118    /// Output only. The latest metadata exports of the metastore service.
1119    #[serde(rename = "metadataExports")]
1120    pub metadata_exports: Option<Vec<MetadataExport>>,
1121    /// Output only. The latest restores of the metastore service.
1122    pub restores: Option<Vec<Restore>>,
1123}
1124
1125impl common::Part for MetadataManagementActivity {}
1126
1127/// The details of a migration execution resource.
1128///
1129/// # Activities
1130///
1131/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1132/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1133///
1134/// * [locations services migration executions get projects](ProjectLocationServiceMigrationExecutionGetCall) (response)
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct MigrationExecution {
1139    /// Configuration information specific to migrating from self-managed hive metastore on Google Cloud using Cloud SQL as the backend database to Dataproc Metastore.
1140    #[serde(rename = "cloudSqlMigrationConfig")]
1141    pub cloud_sql_migration_config: Option<CloudSQLMigrationConfig>,
1142    /// Output only. The time when the migration execution was started.
1143    #[serde(rename = "createTime")]
1144    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1145    /// Output only. The time when the migration execution finished.
1146    #[serde(rename = "endTime")]
1147    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1148    /// Output only. The relative resource name of the migration execution, in the following form: projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions/{migration_execution_id}
1149    pub name: Option<String>,
1150    /// Output only. The current phase of the migration execution.
1151    pub phase: Option<String>,
1152    /// Output only. The current state of the migration execution.
1153    pub state: Option<String>,
1154    /// Output only. Additional information about the current state of the migration execution.
1155    #[serde(rename = "stateMessage")]
1156    pub state_message: Option<String>,
1157}
1158
1159impl common::ResponseResult for MigrationExecution {}
1160
1161/// Request message for DataprocMetastore.MoveTableToDatabase.
1162///
1163/// # Activities
1164///
1165/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1166/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1167///
1168/// * [locations services move table to database projects](ProjectLocationServiceMoveTableToDatabaseCall) (request)
1169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1170#[serde_with::serde_as]
1171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1172pub struct MoveTableToDatabaseRequest {
1173    /// Required. The name of the database where the table resides.
1174    #[serde(rename = "dbName")]
1175    pub db_name: Option<String>,
1176    /// Required. The name of the database where the table should be moved.
1177    #[serde(rename = "destinationDbName")]
1178    pub destination_db_name: Option<String>,
1179    /// Required. The name of the table to be moved.
1180    #[serde(rename = "tableName")]
1181    pub table_name: Option<String>,
1182}
1183
1184impl common::RequestValue for MoveTableToDatabaseRequest {}
1185
1186/// The multi-region config for the Dataproc Metastore service.
1187///
1188/// This type is not used in any activity, and only used as *part* of another schema.
1189///
1190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1191#[serde_with::serde_as]
1192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1193pub struct MultiRegionConfig {
1194    /// Output only. The list of root CA certificates that a gRPC client uses to connect to a multi-regional Dataproc Metastore service.
1195    pub certificates: Option<Vec<RootCACertificate>>,
1196    /// no description provided
1197    #[serde(rename = "customRegionConfig")]
1198    pub custom_region_config: Option<CustomRegionConfig>,
1199}
1200
1201impl common::Part for MultiRegionConfig {}
1202
1203/// Network configuration for the Dataproc Metastore service.
1204///
1205/// This type is not used in any activity, and only used as *part* of another schema.
1206///
1207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1208#[serde_with::serde_as]
1209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1210pub struct NetworkConfig {
1211    /// Immutable. The consumer-side network configuration for the Dataproc Metastore instance.
1212    pub consumers: Option<Vec<Consumer>>,
1213    /// Optional. Enables custom routes to be imported and exported for the Dataproc Metastore service's peered VPC network.
1214    #[serde(rename = "customRoutesEnabled")]
1215    pub custom_routes_enabled: Option<bool>,
1216}
1217
1218impl common::Part for NetworkConfig {}
1219
1220/// This resource represents a long-running operation that is the result of a network API call.
1221///
1222/// # Activities
1223///
1224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1226///
1227/// * [locations federations create projects](ProjectLocationFederationCreateCall) (response)
1228/// * [locations federations delete projects](ProjectLocationFederationDeleteCall) (response)
1229/// * [locations federations patch projects](ProjectLocationFederationPatchCall) (response)
1230/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1231/// * [locations services backups create projects](ProjectLocationServiceBackupCreateCall) (response)
1232/// * [locations services backups delete projects](ProjectLocationServiceBackupDeleteCall) (response)
1233/// * [locations services metadata imports create projects](ProjectLocationServiceMetadataImportCreateCall) (response)
1234/// * [locations services metadata imports patch projects](ProjectLocationServiceMetadataImportPatchCall) (response)
1235/// * [locations services migration executions delete projects](ProjectLocationServiceMigrationExecutionDeleteCall) (response)
1236/// * [locations services alter location projects](ProjectLocationServiceAlterLocationCall) (response)
1237/// * [locations services alter table properties projects](ProjectLocationServiceAlterTablePropertyCall) (response)
1238/// * [locations services cancel migration projects](ProjectLocationServiceCancelMigrationCall) (response)
1239/// * [locations services complete migration projects](ProjectLocationServiceCompleteMigrationCall) (response)
1240/// * [locations services create projects](ProjectLocationServiceCreateCall) (response)
1241/// * [locations services delete projects](ProjectLocationServiceDeleteCall) (response)
1242/// * [locations services export metadata projects](ProjectLocationServiceExportMetadataCall) (response)
1243/// * [locations services move table to database projects](ProjectLocationServiceMoveTableToDatabaseCall) (response)
1244/// * [locations services patch projects](ProjectLocationServicePatchCall) (response)
1245/// * [locations services query metadata projects](ProjectLocationServiceQueryMetadataCall) (response)
1246/// * [locations services restore projects](ProjectLocationServiceRestoreCall) (response)
1247/// * [locations services start migration projects](ProjectLocationServiceStartMigrationCall) (response)
1248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1249#[serde_with::serde_as]
1250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1251pub struct Operation {
1252    /// 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.
1253    pub done: Option<bool>,
1254    /// The error result of the operation in case of failure or cancellation.
1255    pub error: Option<Status>,
1256    /// 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.
1257    pub metadata: Option<HashMap<String, serde_json::Value>>,
1258    /// 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}.
1259    pub name: Option<String>,
1260    /// 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.
1261    pub response: Option<HashMap<String, serde_json::Value>>,
1262}
1263
1264impl common::ResponseResult for Operation {}
1265
1266/// 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/).
1267///
1268/// # Activities
1269///
1270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1272///
1273/// * [locations federations get iam policy projects](ProjectLocationFederationGetIamPolicyCall) (response)
1274/// * [locations federations set iam policy projects](ProjectLocationFederationSetIamPolicyCall) (response)
1275/// * [locations services backups get iam policy projects](ProjectLocationServiceBackupGetIamPolicyCall) (response)
1276/// * [locations services backups set iam policy projects](ProjectLocationServiceBackupSetIamPolicyCall) (response)
1277/// * [locations services databases tables get iam policy projects](ProjectLocationServiceDatabaseTableGetIamPolicyCall) (response)
1278/// * [locations services databases tables set iam policy projects](ProjectLocationServiceDatabaseTableSetIamPolicyCall) (response)
1279/// * [locations services databases get iam policy projects](ProjectLocationServiceDatabaseGetIamPolicyCall) (response)
1280/// * [locations services databases set iam policy projects](ProjectLocationServiceDatabaseSetIamPolicyCall) (response)
1281/// * [locations services get iam policy projects](ProjectLocationServiceGetIamPolicyCall) (response)
1282/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (response)
1283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1284#[serde_with::serde_as]
1285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1286pub struct Policy {
1287    /// Specifies cloud audit logging configuration for this policy.
1288    #[serde(rename = "auditConfigs")]
1289    pub audit_configs: Option<Vec<AuditConfig>>,
1290    /// 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.
1291    pub bindings: Option<Vec<Binding>>,
1292    /// 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.
1293    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1294    pub etag: Option<Vec<u8>>,
1295    /// 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).
1296    pub version: Option<i32>,
1297}
1298
1299impl common::ResponseResult for Policy {}
1300
1301/// Request message for DataprocMetastore.QueryMetadata.
1302///
1303/// # Activities
1304///
1305/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1306/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1307///
1308/// * [locations services query metadata projects](ProjectLocationServiceQueryMetadataCall) (request)
1309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1310#[serde_with::serde_as]
1311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1312pub struct QueryMetadataRequest {
1313    /// Required. A read-only SQL query to execute against the metadata database. The query cannot change or mutate the data.
1314    pub query: Option<String>,
1315}
1316
1317impl common::RequestValue for QueryMetadataRequest {}
1318
1319/// Request message for DataprocMetastore.RemoveIamPolicy.
1320///
1321/// # Activities
1322///
1323/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1324/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1325///
1326/// * [locations services remove iam policy projects](ProjectLocationServiceRemoveIamPolicyCall) (request)
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct RemoveIamPolicyRequest {
1331    /// Optional. Removes IAM policy attached to database or table asynchronously when it is set. The default is false.
1332    pub asynchronous: Option<bool>,
1333}
1334
1335impl common::RequestValue for RemoveIamPolicyRequest {}
1336
1337/// Response message for DataprocMetastore.RemoveIamPolicy.
1338///
1339/// # Activities
1340///
1341/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1342/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1343///
1344/// * [locations services remove iam policy projects](ProjectLocationServiceRemoveIamPolicyCall) (response)
1345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1346#[serde_with::serde_as]
1347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1348pub struct RemoveIamPolicyResponse {
1349    /// True if the policy is successfully removed.
1350    pub success: Option<bool>,
1351}
1352
1353impl common::ResponseResult for RemoveIamPolicyResponse {}
1354
1355/// The details of a metadata restore operation.
1356///
1357/// This type is not used in any activity, and only used as *part* of another schema.
1358///
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct Restore {
1363    /// Output only. The relative resource name of the metastore service backup to restore from, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
1364    pub backup: Option<String>,
1365    /// Optional. A Cloud Storage URI specifying where the backup artifacts are stored, in the format gs:///.
1366    #[serde(rename = "backupLocation")]
1367    pub backup_location: Option<String>,
1368    /// Output only. The restore details containing the revision of the service to be restored to, in format of JSON.
1369    pub details: Option<String>,
1370    /// Output only. The time when the restore ended.
1371    #[serde(rename = "endTime")]
1372    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1373    /// Output only. The time when the restore started.
1374    #[serde(rename = "startTime")]
1375    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1376    /// Output only. The current state of the restore.
1377    pub state: Option<String>,
1378    /// Output only. The type of restore.
1379    #[serde(rename = "type")]
1380    pub type_: Option<String>,
1381}
1382
1383impl common::Part for Restore {}
1384
1385/// Request message for DataprocMetastore.RestoreService.
1386///
1387/// # Activities
1388///
1389/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1390/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1391///
1392/// * [locations services restore projects](ProjectLocationServiceRestoreCall) (request)
1393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1394#[serde_with::serde_as]
1395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1396pub struct RestoreServiceRequest {
1397    /// Optional. The relative resource name of the metastore service backup to restore from, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}/backups/{backup_id}. Mutually exclusive with backup_location, and exactly one of the two must be set.
1398    pub backup: Option<String>,
1399    /// Optional. A Cloud Storage URI specifying the location of the backup artifacts, namely - backup avro files under "avro/", backup_metastore.json and service.json, in the following form:gs://. Mutually exclusive with backup, and exactly one of the two must be set.
1400    #[serde(rename = "backupLocation")]
1401    pub backup_location: Option<String>,
1402    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1403    #[serde(rename = "requestId")]
1404    pub request_id: Option<String>,
1405    /// Optional. The type of restore. If unspecified, defaults to METADATA_ONLY.
1406    #[serde(rename = "restoreType")]
1407    pub restore_type: Option<String>,
1408}
1409
1410impl common::RequestValue for RestoreServiceRequest {}
1411
1412/// A gRPC client must install all root CA certificates to connect to a multi-regional Dataproc Metastore service and achieve failover.
1413///
1414/// This type is not used in any activity, and only used as *part* of another schema.
1415///
1416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1417#[serde_with::serde_as]
1418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1419pub struct RootCACertificate {
1420    /// The root CA certificate in PEM format. The maximum length is 65536 bytes.
1421    pub certificate: Option<String>,
1422    /// The certificate expiration time in timestamp format.
1423    #[serde(rename = "expirationTime")]
1424    pub expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1425}
1426
1427impl common::Part for RootCACertificate {}
1428
1429/// Represents the scaling configuration of a metastore service.
1430///
1431/// This type is not used in any activity, and only used as *part* of another schema.
1432///
1433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1434#[serde_with::serde_as]
1435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1436pub struct ScalingConfig {
1437    /// Optional. The autoscaling configuration.
1438    #[serde(rename = "autoscalingConfig")]
1439    pub autoscaling_config: Option<AutoscalingConfig>,
1440    /// An enum of readable instance sizes, with each instance size mapping to a float value (e.g. InstanceSize.EXTRA_SMALL = scaling_factor(0.1))
1441    #[serde(rename = "instanceSize")]
1442    pub instance_size: Option<String>,
1443    /// Scaling factor, increments of 0.1 for values less than 1.0, and increments of 1.0 for values greater than 1.0.
1444    #[serde(rename = "scalingFactor")]
1445    pub scaling_factor: Option<f32>,
1446}
1447
1448impl common::Part for ScalingConfig {}
1449
1450/// This specifies the configuration of scheduled backup.
1451///
1452/// This type is not used in any activity, and only used as *part* of another schema.
1453///
1454#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1455#[serde_with::serde_as]
1456#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1457pub struct ScheduledBackup {
1458    /// Optional. A Cloud Storage URI of a folder, in the format gs:///. A sub-folder containing backup files will be stored below it.
1459    #[serde(rename = "backupLocation")]
1460    pub backup_location: Option<String>,
1461    /// Optional. The scheduled interval in Cron format, see https://en.wikipedia.org/wiki/Cron The default is empty: scheduled backup is not enabled. Must be specified to enable scheduled backups.
1462    #[serde(rename = "cronSchedule")]
1463    pub cron_schedule: Option<String>,
1464    /// Optional. Defines whether the scheduled backup is enabled. The default value is false.
1465    pub enabled: Option<bool>,
1466    /// Output only. The details of the latest scheduled backup.
1467    #[serde(rename = "latestBackup")]
1468    pub latest_backup: Option<LatestBackup>,
1469    /// Output only. The time when the next backups execution is scheduled to start.
1470    #[serde(rename = "nextScheduledTime")]
1471    pub next_scheduled_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1472    /// Optional. Specifies the time zone to be used when interpreting cron_schedule. Must be a time zone name from the time zone database (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g. America/Los_Angeles or Africa/Abidjan. If left unspecified, the default is UTC.
1473    #[serde(rename = "timeZone")]
1474    pub time_zone: Option<String>,
1475}
1476
1477impl common::Part for ScheduledBackup {}
1478
1479/// A securely stored value.
1480///
1481/// This type is not used in any activity, and only used as *part* of another schema.
1482///
1483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1484#[serde_with::serde_as]
1485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1486pub struct Secret {
1487    /// Optional. The relative resource name of a Secret Manager secret version, in the following form:projects/{project_number}/secrets/{secret_id}/versions/{version_id}.
1488    #[serde(rename = "cloudSecret")]
1489    pub cloud_secret: Option<String>,
1490}
1491
1492impl common::Part for Secret {}
1493
1494/// A managed metastore service that serves metadata queries.
1495///
1496/// # Activities
1497///
1498/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1499/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1500///
1501/// * [locations services create projects](ProjectLocationServiceCreateCall) (request)
1502/// * [locations services get projects](ProjectLocationServiceGetCall) (response)
1503/// * [locations services patch projects](ProjectLocationServicePatchCall) (request)
1504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1505#[serde_with::serde_as]
1506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1507pub struct Service {
1508    /// Output only. A Cloud Storage URI (starting with gs://) that specifies where artifacts related to the metastore service are stored.
1509    #[serde(rename = "artifactGcsUri")]
1510    pub artifact_gcs_uri: Option<String>,
1511    /// Output only. The time when the metastore service was created.
1512    #[serde(rename = "createTime")]
1513    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1514    /// Immutable. The database type that the Metastore service stores its data.
1515    #[serde(rename = "databaseType")]
1516    pub database_type: Option<String>,
1517    /// Optional. Indicates if the dataproc metastore should be protected against accidental deletions.
1518    #[serde(rename = "deletionProtection")]
1519    pub deletion_protection: Option<bool>,
1520    /// Immutable. Information used to configure the Dataproc Metastore service to encrypt customer data at rest. Cannot be updated.
1521    #[serde(rename = "encryptionConfig")]
1522    pub encryption_config: Option<EncryptionConfig>,
1523    /// Output only. The URI of the endpoint used to access the metastore service.
1524    #[serde(rename = "endpointUri")]
1525    pub endpoint_uri: Option<String>,
1526    /// Configuration information specific to running Hive metastore software as the metastore service.
1527    #[serde(rename = "hiveMetastoreConfig")]
1528    pub hive_metastore_config: Option<HiveMetastoreConfig>,
1529    /// User-defined labels for the metastore service.
1530    pub labels: Option<HashMap<String, String>>,
1531    /// Optional. The one hour maintenance window of the metastore service. This specifies when the service can be restarted for maintenance purposes in UTC time. Maintenance window is not needed for services with the SPANNER database type.
1532    #[serde(rename = "maintenanceWindow")]
1533    pub maintenance_window: Option<MaintenanceWindow>,
1534    /// Optional. The setting that defines how metastore metadata should be integrated with external services and systems.
1535    #[serde(rename = "metadataIntegration")]
1536    pub metadata_integration: Option<MetadataIntegration>,
1537    /// Output only. The metadata management activities of the metastore service.
1538    #[serde(rename = "metadataManagementActivity")]
1539    pub metadata_management_activity: Option<MetadataManagementActivity>,
1540    /// Optional. Specifies the multi-region configuration information for the Hive metastore service.
1541    #[serde(rename = "multiRegionConfig")]
1542    pub multi_region_config: Option<MultiRegionConfig>,
1543    /// Immutable. Identifier. The relative resource name of the metastore service, in the following format:projects/{project_number}/locations/{location_id}/services/{service_id}.
1544    pub name: Option<String>,
1545    /// Immutable. The relative resource name of the VPC network on which the instance can be accessed. It is specified in the following form:projects/{project_number}/global/networks/{network_id}.
1546    pub network: Option<String>,
1547    /// Optional. The configuration specifying the network settings for the Dataproc Metastore service.
1548    #[serde(rename = "networkConfig")]
1549    pub network_config: Option<NetworkConfig>,
1550    /// Optional. The TCP port at which the metastore service is reached. Default: 9083.
1551    pub port: Option<i32>,
1552    /// Immutable. The release channel of the service. If unspecified, defaults to STABLE.
1553    #[serde(rename = "releaseChannel")]
1554    pub release_channel: Option<String>,
1555    /// Optional. Scaling configuration of the metastore service.
1556    #[serde(rename = "scalingConfig")]
1557    pub scaling_config: Option<ScalingConfig>,
1558    /// Optional. The configuration of scheduled backup for the metastore service.
1559    #[serde(rename = "scheduledBackup")]
1560    pub scheduled_backup: Option<ScheduledBackup>,
1561    /// Output only. The current state of the metastore service.
1562    pub state: Option<String>,
1563    /// Output only. Additional information about the current state of the metastore service, if available.
1564    #[serde(rename = "stateMessage")]
1565    pub state_message: Option<String>,
1566    /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
1567    pub tags: Option<HashMap<String, String>>,
1568    /// Optional. The configuration specifying telemetry settings for the Dataproc Metastore service. If unspecified defaults to JSON.
1569    #[serde(rename = "telemetryConfig")]
1570    pub telemetry_config: Option<TelemetryConfig>,
1571    /// Optional. The tier of the service.
1572    pub tier: Option<String>,
1573    /// Output only. The globally unique resource identifier of the metastore service.
1574    pub uid: Option<String>,
1575    /// Output only. The time when the metastore service was last updated.
1576    #[serde(rename = "updateTime")]
1577    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1578}
1579
1580impl common::RequestValue for Service {}
1581impl common::ResponseResult for Service {}
1582
1583/// Request message for SetIamPolicy method.
1584///
1585/// # Activities
1586///
1587/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1588/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1589///
1590/// * [locations federations set iam policy projects](ProjectLocationFederationSetIamPolicyCall) (request)
1591/// * [locations services backups set iam policy projects](ProjectLocationServiceBackupSetIamPolicyCall) (request)
1592/// * [locations services databases tables set iam policy projects](ProjectLocationServiceDatabaseTableSetIamPolicyCall) (request)
1593/// * [locations services databases set iam policy projects](ProjectLocationServiceDatabaseSetIamPolicyCall) (request)
1594/// * [locations services set iam policy projects](ProjectLocationServiceSetIamPolicyCall) (request)
1595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1596#[serde_with::serde_as]
1597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1598pub struct SetIamPolicyRequest {
1599    /// 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.
1600    pub policy: Option<Policy>,
1601    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:paths: "bindings, etag"
1602    #[serde(rename = "updateMask")]
1603    pub update_mask: Option<common::FieldMask>,
1604}
1605
1606impl common::RequestValue for SetIamPolicyRequest {}
1607
1608/// Request message for DataprocMetastore.StartMigration.
1609///
1610/// # Activities
1611///
1612/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1613/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1614///
1615/// * [locations services start migration projects](ProjectLocationServiceStartMigrationCall) (request)
1616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1617#[serde_with::serde_as]
1618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1619pub struct StartMigrationRequest {
1620    /// Required. The configuration details for the migration.
1621    #[serde(rename = "migrationExecution")]
1622    pub migration_execution: Option<MigrationExecution>,
1623    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
1624    #[serde(rename = "requestId")]
1625    pub request_id: Option<String>,
1626}
1627
1628impl common::RequestValue for StartMigrationRequest {}
1629
1630/// 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).
1631///
1632/// This type is not used in any activity, and only used as *part* of another schema.
1633///
1634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1635#[serde_with::serde_as]
1636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1637pub struct Status {
1638    /// The status code, which should be an enum value of google.rpc.Code.
1639    pub code: Option<i32>,
1640    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1641    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1642    /// 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.
1643    pub message: Option<String>,
1644}
1645
1646impl common::Part for Status {}
1647
1648/// Telemetry Configuration for the Dataproc Metastore service.
1649///
1650/// This type is not used in any activity, and only used as *part* of another schema.
1651///
1652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1653#[serde_with::serde_as]
1654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1655pub struct TelemetryConfig {
1656    /// Optional. The output format of the Dataproc Metastore service's logs.
1657    #[serde(rename = "logFormat")]
1658    pub log_format: Option<String>,
1659}
1660
1661impl common::Part for TelemetryConfig {}
1662
1663/// Request message for TestIamPermissions method.
1664///
1665/// # Activities
1666///
1667/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1668/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1669///
1670/// * [locations federations test iam permissions projects](ProjectLocationFederationTestIamPermissionCall) (request)
1671/// * [locations services backups test iam permissions projects](ProjectLocationServiceBackupTestIamPermissionCall) (request)
1672/// * [locations services databases tables test iam permissions projects](ProjectLocationServiceDatabaseTableTestIamPermissionCall) (request)
1673/// * [locations services databases test iam permissions projects](ProjectLocationServiceDatabaseTestIamPermissionCall) (request)
1674/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (request)
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct TestIamPermissionsRequest {
1679    /// 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).
1680    pub permissions: Option<Vec<String>>,
1681}
1682
1683impl common::RequestValue for TestIamPermissionsRequest {}
1684
1685/// Response message for TestIamPermissions method.
1686///
1687/// # Activities
1688///
1689/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1690/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1691///
1692/// * [locations federations test iam permissions projects](ProjectLocationFederationTestIamPermissionCall) (response)
1693/// * [locations services backups test iam permissions projects](ProjectLocationServiceBackupTestIamPermissionCall) (response)
1694/// * [locations services databases tables test iam permissions projects](ProjectLocationServiceDatabaseTableTestIamPermissionCall) (response)
1695/// * [locations services databases test iam permissions projects](ProjectLocationServiceDatabaseTestIamPermissionCall) (response)
1696/// * [locations services test iam permissions projects](ProjectLocationServiceTestIamPermissionCall) (response)
1697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1698#[serde_with::serde_as]
1699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1700pub struct TestIamPermissionsResponse {
1701    /// A subset of TestPermissionsRequest.permissions that the caller is allowed.
1702    pub permissions: Option<Vec<String>>,
1703}
1704
1705impl common::ResponseResult for TestIamPermissionsResponse {}
1706
1707// ###################
1708// MethodBuilders ###
1709// #################
1710
1711/// A builder providing access to all methods supported on *project* resources.
1712/// It is not used directly, but through the [`DataprocMetastore`] hub.
1713///
1714/// # Example
1715///
1716/// Instantiate a resource builder
1717///
1718/// ```test_harness,no_run
1719/// extern crate hyper;
1720/// extern crate hyper_rustls;
1721/// extern crate google_metastore1_beta as metastore1_beta;
1722///
1723/// # async fn dox() {
1724/// use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1725///
1726/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1727/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1728///     .with_native_roots()
1729///     .unwrap()
1730///     .https_only()
1731///     .enable_http2()
1732///     .build();
1733///
1734/// let executor = hyper_util::rt::TokioExecutor::new();
1735/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1736///     secret,
1737///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1738///     yup_oauth2::client::CustomHyperClientBuilder::from(
1739///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1740///     ),
1741/// ).build().await.unwrap();
1742///
1743/// let client = hyper_util::client::legacy::Client::builder(
1744///     hyper_util::rt::TokioExecutor::new()
1745/// )
1746/// .build(
1747///     hyper_rustls::HttpsConnectorBuilder::new()
1748///         .with_native_roots()
1749///         .unwrap()
1750///         .https_or_http()
1751///         .enable_http2()
1752///         .build()
1753/// );
1754/// let mut hub = DataprocMetastore::new(client, auth);
1755/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1756/// // like `locations_federations_create(...)`, `locations_federations_delete(...)`, `locations_federations_get(...)`, `locations_federations_get_iam_policy(...)`, `locations_federations_list(...)`, `locations_federations_patch(...)`, `locations_federations_set_iam_policy(...)`, `locations_federations_test_iam_permissions(...)`, `locations_get(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_services_alter_location(...)`, `locations_services_alter_table_properties(...)`, `locations_services_backups_create(...)`, `locations_services_backups_delete(...)`, `locations_services_backups_get(...)`, `locations_services_backups_get_iam_policy(...)`, `locations_services_backups_list(...)`, `locations_services_backups_set_iam_policy(...)`, `locations_services_backups_test_iam_permissions(...)`, `locations_services_cancel_migration(...)`, `locations_services_complete_migration(...)`, `locations_services_create(...)`, `locations_services_databases_get_iam_policy(...)`, `locations_services_databases_set_iam_policy(...)`, `locations_services_databases_tables_get_iam_policy(...)`, `locations_services_databases_tables_set_iam_policy(...)`, `locations_services_databases_tables_test_iam_permissions(...)`, `locations_services_databases_test_iam_permissions(...)`, `locations_services_delete(...)`, `locations_services_export_metadata(...)`, `locations_services_get(...)`, `locations_services_get_iam_policy(...)`, `locations_services_list(...)`, `locations_services_metadata_imports_create(...)`, `locations_services_metadata_imports_get(...)`, `locations_services_metadata_imports_list(...)`, `locations_services_metadata_imports_patch(...)`, `locations_services_migration_executions_delete(...)`, `locations_services_migration_executions_get(...)`, `locations_services_migration_executions_list(...)`, `locations_services_move_table_to_database(...)`, `locations_services_patch(...)`, `locations_services_query_metadata(...)`, `locations_services_remove_iam_policy(...)`, `locations_services_restore(...)`, `locations_services_set_iam_policy(...)`, `locations_services_start_migration(...)` and `locations_services_test_iam_permissions(...)`
1757/// // to build up your call.
1758/// let rb = hub.projects();
1759/// # }
1760/// ```
1761pub struct ProjectMethods<'a, C>
1762where
1763    C: 'a,
1764{
1765    hub: &'a DataprocMetastore<C>,
1766}
1767
1768impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1769
1770impl<'a, C> ProjectMethods<'a, C> {
1771    /// Create a builder to help you perform the following task:
1772    ///
1773    /// Creates a metastore federation in a project and location.
1774    ///
1775    /// # Arguments
1776    ///
1777    /// * `request` - No description provided.
1778    /// * `parent` - Required. The relative resource name of the location in which to create a federation service, in the following form:projects/{project_number}/locations/{location_id}.
1779    pub fn locations_federations_create(
1780        &self,
1781        request: Federation,
1782        parent: &str,
1783    ) -> ProjectLocationFederationCreateCall<'a, C> {
1784        ProjectLocationFederationCreateCall {
1785            hub: self.hub,
1786            _request: request,
1787            _parent: parent.to_string(),
1788            _request_id: Default::default(),
1789            _federation_id: Default::default(),
1790            _delegate: Default::default(),
1791            _additional_params: Default::default(),
1792            _scopes: Default::default(),
1793        }
1794    }
1795
1796    /// Create a builder to help you perform the following task:
1797    ///
1798    /// Deletes a single federation.
1799    ///
1800    /// # Arguments
1801    ///
1802    /// * `name` - Required. The relative resource name of the metastore federation to delete, in the following form:projects/{project_number}/locations/{location_id}/federations/{federation_id}.
1803    pub fn locations_federations_delete(
1804        &self,
1805        name: &str,
1806    ) -> ProjectLocationFederationDeleteCall<'a, C> {
1807        ProjectLocationFederationDeleteCall {
1808            hub: self.hub,
1809            _name: name.to_string(),
1810            _request_id: Default::default(),
1811            _delegate: Default::default(),
1812            _additional_params: Default::default(),
1813            _scopes: Default::default(),
1814        }
1815    }
1816
1817    /// Create a builder to help you perform the following task:
1818    ///
1819    /// Gets the details of a single federation.
1820    ///
1821    /// # Arguments
1822    ///
1823    /// * `name` - Required. The relative resource name of the metastore federation to retrieve, in the following form:projects/{project_number}/locations/{location_id}/federations/{federation_id}.
1824    pub fn locations_federations_get(&self, name: &str) -> ProjectLocationFederationGetCall<'a, C> {
1825        ProjectLocationFederationGetCall {
1826            hub: self.hub,
1827            _name: name.to_string(),
1828            _delegate: Default::default(),
1829            _additional_params: Default::default(),
1830            _scopes: Default::default(),
1831        }
1832    }
1833
1834    /// Create a builder to help you perform the following task:
1835    ///
1836    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1837    ///
1838    /// # Arguments
1839    ///
1840    /// * `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.
1841    pub fn locations_federations_get_iam_policy(
1842        &self,
1843        resource: &str,
1844    ) -> ProjectLocationFederationGetIamPolicyCall<'a, C> {
1845        ProjectLocationFederationGetIamPolicyCall {
1846            hub: self.hub,
1847            _resource: resource.to_string(),
1848            _options_requested_policy_version: Default::default(),
1849            _delegate: Default::default(),
1850            _additional_params: Default::default(),
1851            _scopes: Default::default(),
1852        }
1853    }
1854
1855    /// Create a builder to help you perform the following task:
1856    ///
1857    /// Lists federations in a project and location.
1858    ///
1859    /// # Arguments
1860    ///
1861    /// * `parent` - Required. The relative resource name of the location of metastore federations to list, in the following form: projects/{project_number}/locations/{location_id}.
1862    pub fn locations_federations_list(
1863        &self,
1864        parent: &str,
1865    ) -> ProjectLocationFederationListCall<'a, C> {
1866        ProjectLocationFederationListCall {
1867            hub: self.hub,
1868            _parent: parent.to_string(),
1869            _page_token: Default::default(),
1870            _page_size: Default::default(),
1871            _order_by: Default::default(),
1872            _filter: Default::default(),
1873            _delegate: Default::default(),
1874            _additional_params: Default::default(),
1875            _scopes: Default::default(),
1876        }
1877    }
1878
1879    /// Create a builder to help you perform the following task:
1880    ///
1881    /// Updates the fields of a federation.
1882    ///
1883    /// # Arguments
1884    ///
1885    /// * `request` - No description provided.
1886    /// * `name` - Immutable. The relative resource name of the federation, of the form: projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
1887    pub fn locations_federations_patch(
1888        &self,
1889        request: Federation,
1890        name: &str,
1891    ) -> ProjectLocationFederationPatchCall<'a, C> {
1892        ProjectLocationFederationPatchCall {
1893            hub: self.hub,
1894            _request: request,
1895            _name: name.to_string(),
1896            _update_mask: Default::default(),
1897            _request_id: Default::default(),
1898            _delegate: Default::default(),
1899            _additional_params: Default::default(),
1900            _scopes: Default::default(),
1901        }
1902    }
1903
1904    /// Create a builder to help you perform the following task:
1905    ///
1906    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
1907    ///
1908    /// # Arguments
1909    ///
1910    /// * `request` - No description provided.
1911    /// * `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.
1912    pub fn locations_federations_set_iam_policy(
1913        &self,
1914        request: SetIamPolicyRequest,
1915        resource: &str,
1916    ) -> ProjectLocationFederationSetIamPolicyCall<'a, C> {
1917        ProjectLocationFederationSetIamPolicyCall {
1918            hub: self.hub,
1919            _request: request,
1920            _resource: resource.to_string(),
1921            _delegate: Default::default(),
1922            _additional_params: Default::default(),
1923            _scopes: Default::default(),
1924        }
1925    }
1926
1927    /// Create a builder to help you perform the following task:
1928    ///
1929    /// 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.
1930    ///
1931    /// # Arguments
1932    ///
1933    /// * `request` - No description provided.
1934    /// * `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.
1935    pub fn locations_federations_test_iam_permissions(
1936        &self,
1937        request: TestIamPermissionsRequest,
1938        resource: &str,
1939    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C> {
1940        ProjectLocationFederationTestIamPermissionCall {
1941            hub: self.hub,
1942            _request: request,
1943            _resource: resource.to_string(),
1944            _delegate: Default::default(),
1945            _additional_params: Default::default(),
1946            _scopes: Default::default(),
1947        }
1948    }
1949
1950    /// Create a builder to help you perform the following task:
1951    ///
1952    /// 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.
1953    ///
1954    /// # Arguments
1955    ///
1956    /// * `request` - No description provided.
1957    /// * `name` - The name of the operation resource to be cancelled.
1958    pub fn locations_operations_cancel(
1959        &self,
1960        request: CancelOperationRequest,
1961        name: &str,
1962    ) -> ProjectLocationOperationCancelCall<'a, C> {
1963        ProjectLocationOperationCancelCall {
1964            hub: self.hub,
1965            _request: request,
1966            _name: name.to_string(),
1967            _delegate: Default::default(),
1968            _additional_params: Default::default(),
1969            _scopes: Default::default(),
1970        }
1971    }
1972
1973    /// Create a builder to help you perform the following task:
1974    ///
1975    /// 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.
1976    ///
1977    /// # Arguments
1978    ///
1979    /// * `name` - The name of the operation resource to be deleted.
1980    pub fn locations_operations_delete(
1981        &self,
1982        name: &str,
1983    ) -> ProjectLocationOperationDeleteCall<'a, C> {
1984        ProjectLocationOperationDeleteCall {
1985            hub: self.hub,
1986            _name: name.to_string(),
1987            _delegate: Default::default(),
1988            _additional_params: Default::default(),
1989            _scopes: Default::default(),
1990        }
1991    }
1992
1993    /// Create a builder to help you perform the following task:
1994    ///
1995    /// 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.
1996    ///
1997    /// # Arguments
1998    ///
1999    /// * `name` - The name of the operation resource.
2000    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2001        ProjectLocationOperationGetCall {
2002            hub: self.hub,
2003            _name: name.to_string(),
2004            _delegate: Default::default(),
2005            _additional_params: Default::default(),
2006            _scopes: Default::default(),
2007        }
2008    }
2009
2010    /// Create a builder to help you perform the following task:
2011    ///
2012    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
2013    ///
2014    /// # Arguments
2015    ///
2016    /// * `name` - The name of the operation's parent resource.
2017    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2018        ProjectLocationOperationListCall {
2019            hub: self.hub,
2020            _name: name.to_string(),
2021            _return_partial_success: Default::default(),
2022            _page_token: Default::default(),
2023            _page_size: Default::default(),
2024            _filter: Default::default(),
2025            _delegate: Default::default(),
2026            _additional_params: Default::default(),
2027            _scopes: Default::default(),
2028        }
2029    }
2030
2031    /// Create a builder to help you perform the following task:
2032    ///
2033    /// Creates a new backup in a given project and location.
2034    ///
2035    /// # Arguments
2036    ///
2037    /// * `request` - No description provided.
2038    /// * `parent` - Required. The relative resource name of the service in which to create a backup of the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
2039    pub fn locations_services_backups_create(
2040        &self,
2041        request: Backup,
2042        parent: &str,
2043    ) -> ProjectLocationServiceBackupCreateCall<'a, C> {
2044        ProjectLocationServiceBackupCreateCall {
2045            hub: self.hub,
2046            _request: request,
2047            _parent: parent.to_string(),
2048            _request_id: Default::default(),
2049            _backup_id: Default::default(),
2050            _delegate: Default::default(),
2051            _additional_params: Default::default(),
2052            _scopes: Default::default(),
2053        }
2054    }
2055
2056    /// Create a builder to help you perform the following task:
2057    ///
2058    /// Deletes a single backup.
2059    ///
2060    /// # Arguments
2061    ///
2062    /// * `name` - Required. The relative resource name of the backup to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
2063    pub fn locations_services_backups_delete(
2064        &self,
2065        name: &str,
2066    ) -> ProjectLocationServiceBackupDeleteCall<'a, C> {
2067        ProjectLocationServiceBackupDeleteCall {
2068            hub: self.hub,
2069            _name: name.to_string(),
2070            _request_id: Default::default(),
2071            _delegate: Default::default(),
2072            _additional_params: Default::default(),
2073            _scopes: Default::default(),
2074        }
2075    }
2076
2077    /// Create a builder to help you perform the following task:
2078    ///
2079    /// Gets details of a single backup.
2080    ///
2081    /// # Arguments
2082    ///
2083    /// * `name` - Required. The relative resource name of the backup to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
2084    pub fn locations_services_backups_get(
2085        &self,
2086        name: &str,
2087    ) -> ProjectLocationServiceBackupGetCall<'a, C> {
2088        ProjectLocationServiceBackupGetCall {
2089            hub: self.hub,
2090            _name: name.to_string(),
2091            _delegate: Default::default(),
2092            _additional_params: Default::default(),
2093            _scopes: Default::default(),
2094        }
2095    }
2096
2097    /// Create a builder to help you perform the following task:
2098    ///
2099    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2100    ///
2101    /// # Arguments
2102    ///
2103    /// * `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.
2104    pub fn locations_services_backups_get_iam_policy(
2105        &self,
2106        resource: &str,
2107    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {
2108        ProjectLocationServiceBackupGetIamPolicyCall {
2109            hub: self.hub,
2110            _resource: resource.to_string(),
2111            _options_requested_policy_version: Default::default(),
2112            _delegate: Default::default(),
2113            _additional_params: Default::default(),
2114            _scopes: Default::default(),
2115        }
2116    }
2117
2118    /// Create a builder to help you perform the following task:
2119    ///
2120    /// Lists backups in a service.
2121    ///
2122    /// # Arguments
2123    ///
2124    /// * `parent` - Required. The relative resource name of the service whose backups to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups.
2125    pub fn locations_services_backups_list(
2126        &self,
2127        parent: &str,
2128    ) -> ProjectLocationServiceBackupListCall<'a, C> {
2129        ProjectLocationServiceBackupListCall {
2130            hub: self.hub,
2131            _parent: parent.to_string(),
2132            _page_token: Default::default(),
2133            _page_size: Default::default(),
2134            _order_by: Default::default(),
2135            _filter: Default::default(),
2136            _delegate: Default::default(),
2137            _additional_params: Default::default(),
2138            _scopes: Default::default(),
2139        }
2140    }
2141
2142    /// Create a builder to help you perform the following task:
2143    ///
2144    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
2145    ///
2146    /// # Arguments
2147    ///
2148    /// * `request` - No description provided.
2149    /// * `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.
2150    pub fn locations_services_backups_set_iam_policy(
2151        &self,
2152        request: SetIamPolicyRequest,
2153        resource: &str,
2154    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {
2155        ProjectLocationServiceBackupSetIamPolicyCall {
2156            hub: self.hub,
2157            _request: request,
2158            _resource: resource.to_string(),
2159            _delegate: Default::default(),
2160            _additional_params: Default::default(),
2161            _scopes: Default::default(),
2162        }
2163    }
2164
2165    /// Create a builder to help you perform the following task:
2166    ///
2167    /// 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.
2168    ///
2169    /// # Arguments
2170    ///
2171    /// * `request` - No description provided.
2172    /// * `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.
2173    pub fn locations_services_backups_test_iam_permissions(
2174        &self,
2175        request: TestIamPermissionsRequest,
2176        resource: &str,
2177    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {
2178        ProjectLocationServiceBackupTestIamPermissionCall {
2179            hub: self.hub,
2180            _request: request,
2181            _resource: resource.to_string(),
2182            _delegate: Default::default(),
2183            _additional_params: Default::default(),
2184            _scopes: Default::default(),
2185        }
2186    }
2187
2188    /// Create a builder to help you perform the following task:
2189    ///
2190    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2191    ///
2192    /// # Arguments
2193    ///
2194    /// * `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.
2195    pub fn locations_services_databases_tables_get_iam_policy(
2196        &self,
2197        resource: &str,
2198    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {
2199        ProjectLocationServiceDatabaseTableGetIamPolicyCall {
2200            hub: self.hub,
2201            _resource: resource.to_string(),
2202            _options_requested_policy_version: Default::default(),
2203            _delegate: Default::default(),
2204            _additional_params: Default::default(),
2205            _scopes: Default::default(),
2206        }
2207    }
2208
2209    /// Create a builder to help you perform the following task:
2210    ///
2211    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
2212    ///
2213    /// # Arguments
2214    ///
2215    /// * `request` - No description provided.
2216    /// * `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.
2217    pub fn locations_services_databases_tables_set_iam_policy(
2218        &self,
2219        request: SetIamPolicyRequest,
2220        resource: &str,
2221    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {
2222        ProjectLocationServiceDatabaseTableSetIamPolicyCall {
2223            hub: self.hub,
2224            _request: request,
2225            _resource: resource.to_string(),
2226            _delegate: Default::default(),
2227            _additional_params: Default::default(),
2228            _scopes: Default::default(),
2229        }
2230    }
2231
2232    /// Create a builder to help you perform the following task:
2233    ///
2234    /// 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.
2235    ///
2236    /// # Arguments
2237    ///
2238    /// * `request` - No description provided.
2239    /// * `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.
2240    pub fn locations_services_databases_tables_test_iam_permissions(
2241        &self,
2242        request: TestIamPermissionsRequest,
2243        resource: &str,
2244    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C> {
2245        ProjectLocationServiceDatabaseTableTestIamPermissionCall {
2246            hub: self.hub,
2247            _request: request,
2248            _resource: resource.to_string(),
2249            _delegate: Default::default(),
2250            _additional_params: Default::default(),
2251            _scopes: Default::default(),
2252        }
2253    }
2254
2255    /// Create a builder to help you perform the following task:
2256    ///
2257    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2258    ///
2259    /// # Arguments
2260    ///
2261    /// * `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.
2262    pub fn locations_services_databases_get_iam_policy(
2263        &self,
2264        resource: &str,
2265    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {
2266        ProjectLocationServiceDatabaseGetIamPolicyCall {
2267            hub: self.hub,
2268            _resource: resource.to_string(),
2269            _options_requested_policy_version: Default::default(),
2270            _delegate: Default::default(),
2271            _additional_params: Default::default(),
2272            _scopes: Default::default(),
2273        }
2274    }
2275
2276    /// Create a builder to help you perform the following task:
2277    ///
2278    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
2279    ///
2280    /// # Arguments
2281    ///
2282    /// * `request` - No description provided.
2283    /// * `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.
2284    pub fn locations_services_databases_set_iam_policy(
2285        &self,
2286        request: SetIamPolicyRequest,
2287        resource: &str,
2288    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {
2289        ProjectLocationServiceDatabaseSetIamPolicyCall {
2290            hub: self.hub,
2291            _request: request,
2292            _resource: resource.to_string(),
2293            _delegate: Default::default(),
2294            _additional_params: Default::default(),
2295            _scopes: Default::default(),
2296        }
2297    }
2298
2299    /// Create a builder to help you perform the following task:
2300    ///
2301    /// 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.
2302    ///
2303    /// # Arguments
2304    ///
2305    /// * `request` - No description provided.
2306    /// * `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.
2307    pub fn locations_services_databases_test_iam_permissions(
2308        &self,
2309        request: TestIamPermissionsRequest,
2310        resource: &str,
2311    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {
2312        ProjectLocationServiceDatabaseTestIamPermissionCall {
2313            hub: self.hub,
2314            _request: request,
2315            _resource: resource.to_string(),
2316            _delegate: Default::default(),
2317            _additional_params: Default::default(),
2318            _scopes: Default::default(),
2319        }
2320    }
2321
2322    /// Create a builder to help you perform the following task:
2323    ///
2324    /// Creates a new MetadataImport in a given project and location.
2325    ///
2326    /// # Arguments
2327    ///
2328    /// * `request` - No description provided.
2329    /// * `parent` - Required. The relative resource name of the service in which to create a metastore import, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
2330    pub fn locations_services_metadata_imports_create(
2331        &self,
2332        request: MetadataImport,
2333        parent: &str,
2334    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
2335        ProjectLocationServiceMetadataImportCreateCall {
2336            hub: self.hub,
2337            _request: request,
2338            _parent: parent.to_string(),
2339            _request_id: Default::default(),
2340            _metadata_import_id: Default::default(),
2341            _delegate: Default::default(),
2342            _additional_params: Default::default(),
2343            _scopes: Default::default(),
2344        }
2345    }
2346
2347    /// Create a builder to help you perform the following task:
2348    ///
2349    /// Gets details of a single import.
2350    ///
2351    /// # Arguments
2352    ///
2353    /// * `name` - Required. The relative resource name of the metadata import to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}.
2354    pub fn locations_services_metadata_imports_get(
2355        &self,
2356        name: &str,
2357    ) -> ProjectLocationServiceMetadataImportGetCall<'a, C> {
2358        ProjectLocationServiceMetadataImportGetCall {
2359            hub: self.hub,
2360            _name: name.to_string(),
2361            _delegate: Default::default(),
2362            _additional_params: Default::default(),
2363            _scopes: Default::default(),
2364        }
2365    }
2366
2367    /// Create a builder to help you perform the following task:
2368    ///
2369    /// Lists imports in a service.
2370    ///
2371    /// # Arguments
2372    ///
2373    /// * `parent` - Required. The relative resource name of the service whose metadata imports to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports.
2374    pub fn locations_services_metadata_imports_list(
2375        &self,
2376        parent: &str,
2377    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
2378        ProjectLocationServiceMetadataImportListCall {
2379            hub: self.hub,
2380            _parent: parent.to_string(),
2381            _page_token: Default::default(),
2382            _page_size: Default::default(),
2383            _order_by: Default::default(),
2384            _filter: Default::default(),
2385            _delegate: Default::default(),
2386            _additional_params: Default::default(),
2387            _scopes: Default::default(),
2388        }
2389    }
2390
2391    /// Create a builder to help you perform the following task:
2392    ///
2393    /// Updates a single import. Only the description field of MetadataImport is supported to be updated.
2394    ///
2395    /// # Arguments
2396    ///
2397    /// * `request` - No description provided.
2398    /// * `name` - Immutable. Identifier. The relative resource name of the metadata import, of the form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}.
2399    pub fn locations_services_metadata_imports_patch(
2400        &self,
2401        request: MetadataImport,
2402        name: &str,
2403    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
2404        ProjectLocationServiceMetadataImportPatchCall {
2405            hub: self.hub,
2406            _request: request,
2407            _name: name.to_string(),
2408            _update_mask: Default::default(),
2409            _request_id: Default::default(),
2410            _delegate: Default::default(),
2411            _additional_params: Default::default(),
2412            _scopes: Default::default(),
2413        }
2414    }
2415
2416    /// Create a builder to help you perform the following task:
2417    ///
2418    /// Deletes a single migration execution.
2419    ///
2420    /// # Arguments
2421    ///
2422    /// * `name` - Required. The relative resource name of the migrationExecution to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions/{migration_execution_id}.
2423    pub fn locations_services_migration_executions_delete(
2424        &self,
2425        name: &str,
2426    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {
2427        ProjectLocationServiceMigrationExecutionDeleteCall {
2428            hub: self.hub,
2429            _name: name.to_string(),
2430            _request_id: Default::default(),
2431            _delegate: Default::default(),
2432            _additional_params: Default::default(),
2433            _scopes: Default::default(),
2434        }
2435    }
2436
2437    /// Create a builder to help you perform the following task:
2438    ///
2439    /// Gets details of a single migration execution.
2440    ///
2441    /// # Arguments
2442    ///
2443    /// * `name` - Required. The relative resource name of the migration execution to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions/{migration_execution_id}.
2444    pub fn locations_services_migration_executions_get(
2445        &self,
2446        name: &str,
2447    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C> {
2448        ProjectLocationServiceMigrationExecutionGetCall {
2449            hub: self.hub,
2450            _name: name.to_string(),
2451            _delegate: Default::default(),
2452            _additional_params: Default::default(),
2453            _scopes: Default::default(),
2454        }
2455    }
2456
2457    /// Create a builder to help you perform the following task:
2458    ///
2459    /// Lists migration executions on a service.
2460    ///
2461    /// # Arguments
2462    ///
2463    /// * `parent` - Required. The relative resource name of the service whose migration executions to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions.
2464    pub fn locations_services_migration_executions_list(
2465        &self,
2466        parent: &str,
2467    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
2468        ProjectLocationServiceMigrationExecutionListCall {
2469            hub: self.hub,
2470            _parent: parent.to_string(),
2471            _page_token: Default::default(),
2472            _page_size: Default::default(),
2473            _order_by: Default::default(),
2474            _filter: Default::default(),
2475            _delegate: Default::default(),
2476            _additional_params: Default::default(),
2477            _scopes: Default::default(),
2478        }
2479    }
2480
2481    /// Create a builder to help you perform the following task:
2482    ///
2483    /// Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.
2484    ///
2485    /// # Arguments
2486    ///
2487    /// * `request` - No description provided.
2488    /// * `service` - Required. The relative resource name of the metastore service to mutate metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2489    pub fn locations_services_alter_location(
2490        &self,
2491        request: AlterMetadataResourceLocationRequest,
2492        service: &str,
2493    ) -> ProjectLocationServiceAlterLocationCall<'a, C> {
2494        ProjectLocationServiceAlterLocationCall {
2495            hub: self.hub,
2496            _request: request,
2497            _service: service.to_string(),
2498            _delegate: Default::default(),
2499            _additional_params: Default::default(),
2500            _scopes: Default::default(),
2501        }
2502    }
2503
2504    /// Create a builder to help you perform the following task:
2505    ///
2506    /// Alter metadata table properties.
2507    ///
2508    /// # Arguments
2509    ///
2510    /// * `request` - No description provided.
2511    /// * `service` - Required. The relative resource name of the Dataproc Metastore service that's being used to mutate metadata table properties, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2512    pub fn locations_services_alter_table_properties(
2513        &self,
2514        request: AlterTablePropertiesRequest,
2515        service: &str,
2516    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C> {
2517        ProjectLocationServiceAlterTablePropertyCall {
2518            hub: self.hub,
2519            _request: request,
2520            _service: service.to_string(),
2521            _delegate: Default::default(),
2522            _additional_params: Default::default(),
2523            _scopes: Default::default(),
2524        }
2525    }
2526
2527    /// Create a builder to help you perform the following task:
2528    ///
2529    /// Cancels the ongoing Managed Migration process.
2530    ///
2531    /// # Arguments
2532    ///
2533    /// * `request` - No description provided.
2534    /// * `service` - Required. The relative resource name of the metastore service to cancel the ongoing migration to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2535    pub fn locations_services_cancel_migration(
2536        &self,
2537        request: CancelMigrationRequest,
2538        service: &str,
2539    ) -> ProjectLocationServiceCancelMigrationCall<'a, C> {
2540        ProjectLocationServiceCancelMigrationCall {
2541            hub: self.hub,
2542            _request: request,
2543            _service: service.to_string(),
2544            _delegate: Default::default(),
2545            _additional_params: Default::default(),
2546            _scopes: Default::default(),
2547        }
2548    }
2549
2550    /// Create a builder to help you perform the following task:
2551    ///
2552    /// Completes the managed migration process. The Dataproc Metastore service will switch to using its own backend database after successful migration.
2553    ///
2554    /// # Arguments
2555    ///
2556    /// * `request` - No description provided.
2557    /// * `service` - Required. The relative resource name of the metastore service to complete the migration to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2558    pub fn locations_services_complete_migration(
2559        &self,
2560        request: CompleteMigrationRequest,
2561        service: &str,
2562    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C> {
2563        ProjectLocationServiceCompleteMigrationCall {
2564            hub: self.hub,
2565            _request: request,
2566            _service: service.to_string(),
2567            _delegate: Default::default(),
2568            _additional_params: Default::default(),
2569            _scopes: Default::default(),
2570        }
2571    }
2572
2573    /// Create a builder to help you perform the following task:
2574    ///
2575    /// Creates a metastore service in a project and location.
2576    ///
2577    /// # Arguments
2578    ///
2579    /// * `request` - No description provided.
2580    /// * `parent` - Required. The relative resource name of the location in which to create a metastore service, in the following form:projects/{project_number}/locations/{location_id}.
2581    pub fn locations_services_create(
2582        &self,
2583        request: Service,
2584        parent: &str,
2585    ) -> ProjectLocationServiceCreateCall<'a, C> {
2586        ProjectLocationServiceCreateCall {
2587            hub: self.hub,
2588            _request: request,
2589            _parent: parent.to_string(),
2590            _service_id: Default::default(),
2591            _request_id: Default::default(),
2592            _delegate: Default::default(),
2593            _additional_params: Default::default(),
2594            _scopes: Default::default(),
2595        }
2596    }
2597
2598    /// Create a builder to help you perform the following task:
2599    ///
2600    /// Deletes a single service.
2601    ///
2602    /// # Arguments
2603    ///
2604    /// * `name` - Required. The relative resource name of the metastore service to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
2605    pub fn locations_services_delete(&self, name: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
2606        ProjectLocationServiceDeleteCall {
2607            hub: self.hub,
2608            _name: name.to_string(),
2609            _request_id: Default::default(),
2610            _delegate: Default::default(),
2611            _additional_params: Default::default(),
2612            _scopes: Default::default(),
2613        }
2614    }
2615
2616    /// Create a builder to help you perform the following task:
2617    ///
2618    /// Exports metadata from a service.
2619    ///
2620    /// # Arguments
2621    ///
2622    /// * `request` - No description provided.
2623    /// * `service` - Required. The relative resource name of the metastore service to run export, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}.
2624    pub fn locations_services_export_metadata(
2625        &self,
2626        request: ExportMetadataRequest,
2627        service: &str,
2628    ) -> ProjectLocationServiceExportMetadataCall<'a, C> {
2629        ProjectLocationServiceExportMetadataCall {
2630            hub: self.hub,
2631            _request: request,
2632            _service: service.to_string(),
2633            _delegate: Default::default(),
2634            _additional_params: Default::default(),
2635            _scopes: Default::default(),
2636        }
2637    }
2638
2639    /// Create a builder to help you perform the following task:
2640    ///
2641    /// Gets the details of a single service.
2642    ///
2643    /// # Arguments
2644    ///
2645    /// * `name` - Required. The relative resource name of the metastore service to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
2646    pub fn locations_services_get(&self, name: &str) -> ProjectLocationServiceGetCall<'a, C> {
2647        ProjectLocationServiceGetCall {
2648            hub: self.hub,
2649            _name: name.to_string(),
2650            _delegate: Default::default(),
2651            _additional_params: Default::default(),
2652            _scopes: Default::default(),
2653        }
2654    }
2655
2656    /// Create a builder to help you perform the following task:
2657    ///
2658    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2659    ///
2660    /// # Arguments
2661    ///
2662    /// * `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.
2663    pub fn locations_services_get_iam_policy(
2664        &self,
2665        resource: &str,
2666    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
2667        ProjectLocationServiceGetIamPolicyCall {
2668            hub: self.hub,
2669            _resource: resource.to_string(),
2670            _options_requested_policy_version: Default::default(),
2671            _delegate: Default::default(),
2672            _additional_params: Default::default(),
2673            _scopes: Default::default(),
2674        }
2675    }
2676
2677    /// Create a builder to help you perform the following task:
2678    ///
2679    /// Lists services in a project and location.
2680    ///
2681    /// # Arguments
2682    ///
2683    /// * `parent` - Required. The relative resource name of the location of metastore services to list, in the following form:projects/{project_number}/locations/{location_id}.
2684    pub fn locations_services_list(&self, parent: &str) -> ProjectLocationServiceListCall<'a, C> {
2685        ProjectLocationServiceListCall {
2686            hub: self.hub,
2687            _parent: parent.to_string(),
2688            _page_token: Default::default(),
2689            _page_size: Default::default(),
2690            _order_by: Default::default(),
2691            _filter: Default::default(),
2692            _delegate: Default::default(),
2693            _additional_params: Default::default(),
2694            _scopes: Default::default(),
2695        }
2696    }
2697
2698    /// Create a builder to help you perform the following task:
2699    ///
2700    /// Move a table to another database.
2701    ///
2702    /// # Arguments
2703    ///
2704    /// * `request` - No description provided.
2705    /// * `service` - Required. The relative resource name of the metastore service to mutate metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2706    pub fn locations_services_move_table_to_database(
2707        &self,
2708        request: MoveTableToDatabaseRequest,
2709        service: &str,
2710    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {
2711        ProjectLocationServiceMoveTableToDatabaseCall {
2712            hub: self.hub,
2713            _request: request,
2714            _service: service.to_string(),
2715            _delegate: Default::default(),
2716            _additional_params: Default::default(),
2717            _scopes: Default::default(),
2718        }
2719    }
2720
2721    /// Create a builder to help you perform the following task:
2722    ///
2723    /// Updates the parameters of a single service.
2724    ///
2725    /// # Arguments
2726    ///
2727    /// * `request` - No description provided.
2728    /// * `name` - Immutable. Identifier. The relative resource name of the metastore service, in the following format:projects/{project_number}/locations/{location_id}/services/{service_id}.
2729    pub fn locations_services_patch(
2730        &self,
2731        request: Service,
2732        name: &str,
2733    ) -> ProjectLocationServicePatchCall<'a, C> {
2734        ProjectLocationServicePatchCall {
2735            hub: self.hub,
2736            _request: request,
2737            _name: name.to_string(),
2738            _update_mask: Default::default(),
2739            _request_id: Default::default(),
2740            _delegate: Default::default(),
2741            _additional_params: Default::default(),
2742            _scopes: Default::default(),
2743        }
2744    }
2745
2746    /// Create a builder to help you perform the following task:
2747    ///
2748    /// Query Dataproc Metastore metadata.
2749    ///
2750    /// # Arguments
2751    ///
2752    /// * `request` - No description provided.
2753    /// * `service` - Required. The relative resource name of the metastore service to query metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2754    pub fn locations_services_query_metadata(
2755        &self,
2756        request: QueryMetadataRequest,
2757        service: &str,
2758    ) -> ProjectLocationServiceQueryMetadataCall<'a, C> {
2759        ProjectLocationServiceQueryMetadataCall {
2760            hub: self.hub,
2761            _request: request,
2762            _service: service.to_string(),
2763            _delegate: Default::default(),
2764            _additional_params: Default::default(),
2765            _scopes: Default::default(),
2766        }
2767    }
2768
2769    /// Create a builder to help you perform the following task:
2770    ///
2771    /// Removes the attached IAM policies for a resource
2772    ///
2773    /// # Arguments
2774    ///
2775    /// * `request` - No description provided.
2776    /// * `resource` - Required. The relative resource name of the dataplane resource to remove IAM policy, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id} or projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}.
2777    pub fn locations_services_remove_iam_policy(
2778        &self,
2779        request: RemoveIamPolicyRequest,
2780        resource: &str,
2781    ) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C> {
2782        ProjectLocationServiceRemoveIamPolicyCall {
2783            hub: self.hub,
2784            _request: request,
2785            _resource: resource.to_string(),
2786            _delegate: Default::default(),
2787            _additional_params: Default::default(),
2788            _scopes: Default::default(),
2789        }
2790    }
2791
2792    /// Create a builder to help you perform the following task:
2793    ///
2794    /// Restores a service from a backup.
2795    ///
2796    /// # Arguments
2797    ///
2798    /// * `request` - No description provided.
2799    /// * `service` - Required. The relative resource name of the metastore service to run restore, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}.
2800    pub fn locations_services_restore(
2801        &self,
2802        request: RestoreServiceRequest,
2803        service: &str,
2804    ) -> ProjectLocationServiceRestoreCall<'a, C> {
2805        ProjectLocationServiceRestoreCall {
2806            hub: self.hub,
2807            _request: request,
2808            _service: service.to_string(),
2809            _delegate: Default::default(),
2810            _additional_params: Default::default(),
2811            _scopes: Default::default(),
2812        }
2813    }
2814
2815    /// Create a builder to help you perform the following task:
2816    ///
2817    /// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
2818    ///
2819    /// # Arguments
2820    ///
2821    /// * `request` - No description provided.
2822    /// * `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.
2823    pub fn locations_services_set_iam_policy(
2824        &self,
2825        request: SetIamPolicyRequest,
2826        resource: &str,
2827    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
2828        ProjectLocationServiceSetIamPolicyCall {
2829            hub: self.hub,
2830            _request: request,
2831            _resource: resource.to_string(),
2832            _delegate: Default::default(),
2833            _additional_params: Default::default(),
2834            _scopes: Default::default(),
2835        }
2836    }
2837
2838    /// Create a builder to help you perform the following task:
2839    ///
2840    /// Starts the Managed Migration process.
2841    ///
2842    /// # Arguments
2843    ///
2844    /// * `request` - No description provided.
2845    /// * `service` - Required. The relative resource name of the metastore service to start migrating to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
2846    pub fn locations_services_start_migration(
2847        &self,
2848        request: StartMigrationRequest,
2849        service: &str,
2850    ) -> ProjectLocationServiceStartMigrationCall<'a, C> {
2851        ProjectLocationServiceStartMigrationCall {
2852            hub: self.hub,
2853            _request: request,
2854            _service: service.to_string(),
2855            _delegate: Default::default(),
2856            _additional_params: Default::default(),
2857            _scopes: Default::default(),
2858        }
2859    }
2860
2861    /// Create a builder to help you perform the following task:
2862    ///
2863    /// 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.
2864    ///
2865    /// # Arguments
2866    ///
2867    /// * `request` - No description provided.
2868    /// * `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.
2869    pub fn locations_services_test_iam_permissions(
2870        &self,
2871        request: TestIamPermissionsRequest,
2872        resource: &str,
2873    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
2874        ProjectLocationServiceTestIamPermissionCall {
2875            hub: self.hub,
2876            _request: request,
2877            _resource: resource.to_string(),
2878            _delegate: Default::default(),
2879            _additional_params: Default::default(),
2880            _scopes: Default::default(),
2881        }
2882    }
2883
2884    /// Create a builder to help you perform the following task:
2885    ///
2886    /// Gets information about a location.
2887    ///
2888    /// # Arguments
2889    ///
2890    /// * `name` - Resource name for the location.
2891    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2892        ProjectLocationGetCall {
2893            hub: self.hub,
2894            _name: name.to_string(),
2895            _delegate: Default::default(),
2896            _additional_params: Default::default(),
2897            _scopes: Default::default(),
2898        }
2899    }
2900
2901    /// Create a builder to help you perform the following task:
2902    ///
2903    /// Lists information about the supported locations for this service.
2904    ///
2905    /// # Arguments
2906    ///
2907    /// * `name` - The resource that owns the locations collection, if applicable.
2908    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2909        ProjectLocationListCall {
2910            hub: self.hub,
2911            _name: name.to_string(),
2912            _page_token: Default::default(),
2913            _page_size: Default::default(),
2914            _filter: Default::default(),
2915            _extra_location_types: Default::default(),
2916            _delegate: Default::default(),
2917            _additional_params: Default::default(),
2918            _scopes: Default::default(),
2919        }
2920    }
2921}
2922
2923// ###################
2924// CallBuilders   ###
2925// #################
2926
2927/// Creates a metastore federation in a project and location.
2928///
2929/// A builder for the *locations.federations.create* method supported by a *project* resource.
2930/// It is not used directly, but through a [`ProjectMethods`] instance.
2931///
2932/// # Example
2933///
2934/// Instantiate a resource method builder
2935///
2936/// ```test_harness,no_run
2937/// # extern crate hyper;
2938/// # extern crate hyper_rustls;
2939/// # extern crate google_metastore1_beta as metastore1_beta;
2940/// use metastore1_beta::api::Federation;
2941/// # async fn dox() {
2942/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2943///
2944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2945/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2946/// #     .with_native_roots()
2947/// #     .unwrap()
2948/// #     .https_only()
2949/// #     .enable_http2()
2950/// #     .build();
2951///
2952/// # let executor = hyper_util::rt::TokioExecutor::new();
2953/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2954/// #     secret,
2955/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2956/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2957/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2958/// #     ),
2959/// # ).build().await.unwrap();
2960///
2961/// # let client = hyper_util::client::legacy::Client::builder(
2962/// #     hyper_util::rt::TokioExecutor::new()
2963/// # )
2964/// # .build(
2965/// #     hyper_rustls::HttpsConnectorBuilder::new()
2966/// #         .with_native_roots()
2967/// #         .unwrap()
2968/// #         .https_or_http()
2969/// #         .enable_http2()
2970/// #         .build()
2971/// # );
2972/// # let mut hub = DataprocMetastore::new(client, auth);
2973/// // As the method needs a request, you would usually fill it with the desired information
2974/// // into the respective structure. Some of the parts shown here might not be applicable !
2975/// // Values shown here are possibly random and not representative !
2976/// let mut req = Federation::default();
2977///
2978/// // You can configure optional parameters by calling the respective setters at will, and
2979/// // execute the final call using `doit()`.
2980/// // Values shown here are possibly random and not representative !
2981/// let result = hub.projects().locations_federations_create(req, "parent")
2982///              .request_id("amet.")
2983///              .federation_id("duo")
2984///              .doit().await;
2985/// # }
2986/// ```
2987pub struct ProjectLocationFederationCreateCall<'a, C>
2988where
2989    C: 'a,
2990{
2991    hub: &'a DataprocMetastore<C>,
2992    _request: Federation,
2993    _parent: String,
2994    _request_id: Option<String>,
2995    _federation_id: Option<String>,
2996    _delegate: Option<&'a mut dyn common::Delegate>,
2997    _additional_params: HashMap<String, String>,
2998    _scopes: BTreeSet<String>,
2999}
3000
3001impl<'a, C> common::CallBuilder for ProjectLocationFederationCreateCall<'a, C> {}
3002
3003impl<'a, C> ProjectLocationFederationCreateCall<'a, C>
3004where
3005    C: common::Connector,
3006{
3007    /// Perform the operation you have build so far.
3008    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3009        use std::borrow::Cow;
3010        use std::io::{Read, Seek};
3011
3012        use common::{url::Params, ToParts};
3013        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3014
3015        let mut dd = common::DefaultDelegate;
3016        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3017        dlg.begin(common::MethodInfo {
3018            id: "metastore.projects.locations.federations.create",
3019            http_method: hyper::Method::POST,
3020        });
3021
3022        for &field in ["alt", "parent", "requestId", "federationId"].iter() {
3023            if self._additional_params.contains_key(field) {
3024                dlg.finished(false);
3025                return Err(common::Error::FieldClash(field));
3026            }
3027        }
3028
3029        let mut params = Params::with_capacity(6 + self._additional_params.len());
3030        params.push("parent", self._parent);
3031        if let Some(value) = self._request_id.as_ref() {
3032            params.push("requestId", value);
3033        }
3034        if let Some(value) = self._federation_id.as_ref() {
3035            params.push("federationId", value);
3036        }
3037
3038        params.extend(self._additional_params.iter());
3039
3040        params.push("alt", "json");
3041        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/federations";
3042        if self._scopes.is_empty() {
3043            self._scopes
3044                .insert(Scope::CloudPlatform.as_ref().to_string());
3045        }
3046
3047        #[allow(clippy::single_element_loop)]
3048        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3049            url = params.uri_replacement(url, param_name, find_this, true);
3050        }
3051        {
3052            let to_remove = ["parent"];
3053            params.remove_params(&to_remove);
3054        }
3055
3056        let url = params.parse_with_url(&url);
3057
3058        let mut json_mime_type = mime::APPLICATION_JSON;
3059        let mut request_value_reader = {
3060            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3061            common::remove_json_null_values(&mut value);
3062            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3063            serde_json::to_writer(&mut dst, &value).unwrap();
3064            dst
3065        };
3066        let request_size = request_value_reader
3067            .seek(std::io::SeekFrom::End(0))
3068            .unwrap();
3069        request_value_reader
3070            .seek(std::io::SeekFrom::Start(0))
3071            .unwrap();
3072
3073        loop {
3074            let token = match self
3075                .hub
3076                .auth
3077                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3078                .await
3079            {
3080                Ok(token) => token,
3081                Err(e) => match dlg.token(e) {
3082                    Ok(token) => token,
3083                    Err(e) => {
3084                        dlg.finished(false);
3085                        return Err(common::Error::MissingToken(e));
3086                    }
3087                },
3088            };
3089            request_value_reader
3090                .seek(std::io::SeekFrom::Start(0))
3091                .unwrap();
3092            let mut req_result = {
3093                let client = &self.hub.client;
3094                dlg.pre_request();
3095                let mut req_builder = hyper::Request::builder()
3096                    .method(hyper::Method::POST)
3097                    .uri(url.as_str())
3098                    .header(USER_AGENT, self.hub._user_agent.clone());
3099
3100                if let Some(token) = token.as_ref() {
3101                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3102                }
3103
3104                let request = req_builder
3105                    .header(CONTENT_TYPE, json_mime_type.to_string())
3106                    .header(CONTENT_LENGTH, request_size as u64)
3107                    .body(common::to_body(
3108                        request_value_reader.get_ref().clone().into(),
3109                    ));
3110
3111                client.request(request.unwrap()).await
3112            };
3113
3114            match req_result {
3115                Err(err) => {
3116                    if let common::Retry::After(d) = dlg.http_error(&err) {
3117                        sleep(d).await;
3118                        continue;
3119                    }
3120                    dlg.finished(false);
3121                    return Err(common::Error::HttpError(err));
3122                }
3123                Ok(res) => {
3124                    let (mut parts, body) = res.into_parts();
3125                    let mut body = common::Body::new(body);
3126                    if !parts.status.is_success() {
3127                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3128                        let error = serde_json::from_str(&common::to_string(&bytes));
3129                        let response = common::to_response(parts, bytes.into());
3130
3131                        if let common::Retry::After(d) =
3132                            dlg.http_failure(&response, error.as_ref().ok())
3133                        {
3134                            sleep(d).await;
3135                            continue;
3136                        }
3137
3138                        dlg.finished(false);
3139
3140                        return Err(match error {
3141                            Ok(value) => common::Error::BadRequest(value),
3142                            _ => common::Error::Failure(response),
3143                        });
3144                    }
3145                    let response = {
3146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3147                        let encoded = common::to_string(&bytes);
3148                        match serde_json::from_str(&encoded) {
3149                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3150                            Err(error) => {
3151                                dlg.response_json_decode_error(&encoded, &error);
3152                                return Err(common::Error::JsonDecodeError(
3153                                    encoded.to_string(),
3154                                    error,
3155                                ));
3156                            }
3157                        }
3158                    };
3159
3160                    dlg.finished(true);
3161                    return Ok(response);
3162                }
3163            }
3164        }
3165    }
3166
3167    ///
3168    /// Sets the *request* property to the given value.
3169    ///
3170    /// Even though the property as already been set when instantiating this call,
3171    /// we provide this method for API completeness.
3172    pub fn request(mut self, new_value: Federation) -> ProjectLocationFederationCreateCall<'a, C> {
3173        self._request = new_value;
3174        self
3175    }
3176    /// Required. The relative resource name of the location in which to create a federation service, in the following form:projects/{project_number}/locations/{location_id}.
3177    ///
3178    /// Sets the *parent* path property to the given value.
3179    ///
3180    /// Even though the property as already been set when instantiating this call,
3181    /// we provide this method for API completeness.
3182    pub fn parent(mut self, new_value: &str) -> ProjectLocationFederationCreateCall<'a, C> {
3183        self._parent = new_value.to_string();
3184        self
3185    }
3186    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
3187    ///
3188    /// Sets the *request id* query property to the given value.
3189    pub fn request_id(mut self, new_value: &str) -> ProjectLocationFederationCreateCall<'a, C> {
3190        self._request_id = Some(new_value.to_string());
3191        self
3192    }
3193    /// Required. The ID of the metastore federation, which is used as the final component of the metastore federation's name.This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.
3194    ///
3195    /// Sets the *federation id* query property to the given value.
3196    pub fn federation_id(mut self, new_value: &str) -> ProjectLocationFederationCreateCall<'a, C> {
3197        self._federation_id = Some(new_value.to_string());
3198        self
3199    }
3200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3201    /// while executing the actual API request.
3202    ///
3203    /// ````text
3204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3205    /// ````
3206    ///
3207    /// Sets the *delegate* property to the given value.
3208    pub fn delegate(
3209        mut self,
3210        new_value: &'a mut dyn common::Delegate,
3211    ) -> ProjectLocationFederationCreateCall<'a, C> {
3212        self._delegate = Some(new_value);
3213        self
3214    }
3215
3216    /// Set any additional parameter of the query string used in the request.
3217    /// It should be used to set parameters which are not yet available through their own
3218    /// setters.
3219    ///
3220    /// Please note that this method must not be used to set any of the known parameters
3221    /// which have their own setter method. If done anyway, the request will fail.
3222    ///
3223    /// # Additional Parameters
3224    ///
3225    /// * *$.xgafv* (query-string) - V1 error format.
3226    /// * *access_token* (query-string) - OAuth access token.
3227    /// * *alt* (query-string) - Data format for response.
3228    /// * *callback* (query-string) - JSONP
3229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3230    /// * *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.
3231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3233    /// * *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.
3234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3236    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationCreateCall<'a, C>
3237    where
3238        T: AsRef<str>,
3239    {
3240        self._additional_params
3241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3242        self
3243    }
3244
3245    /// Identifies the authorization scope for the method you are building.
3246    ///
3247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3248    /// [`Scope::CloudPlatform`].
3249    ///
3250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3251    /// tokens for more than one scope.
3252    ///
3253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3255    /// sufficient, a read-write scope will do as well.
3256    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationCreateCall<'a, C>
3257    where
3258        St: AsRef<str>,
3259    {
3260        self._scopes.insert(String::from(scope.as_ref()));
3261        self
3262    }
3263    /// Identifies the authorization scope(s) for the method you are building.
3264    ///
3265    /// See [`Self::add_scope()`] for details.
3266    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFederationCreateCall<'a, C>
3267    where
3268        I: IntoIterator<Item = St>,
3269        St: AsRef<str>,
3270    {
3271        self._scopes
3272            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3273        self
3274    }
3275
3276    /// Removes all scopes, and no default scope will be used either.
3277    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3278    /// for details).
3279    pub fn clear_scopes(mut self) -> ProjectLocationFederationCreateCall<'a, C> {
3280        self._scopes.clear();
3281        self
3282    }
3283}
3284
3285/// Deletes a single federation.
3286///
3287/// A builder for the *locations.federations.delete* method supported by a *project* resource.
3288/// It is not used directly, but through a [`ProjectMethods`] instance.
3289///
3290/// # Example
3291///
3292/// Instantiate a resource method builder
3293///
3294/// ```test_harness,no_run
3295/// # extern crate hyper;
3296/// # extern crate hyper_rustls;
3297/// # extern crate google_metastore1_beta as metastore1_beta;
3298/// # async fn dox() {
3299/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3300///
3301/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3302/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3303/// #     .with_native_roots()
3304/// #     .unwrap()
3305/// #     .https_only()
3306/// #     .enable_http2()
3307/// #     .build();
3308///
3309/// # let executor = hyper_util::rt::TokioExecutor::new();
3310/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3311/// #     secret,
3312/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3313/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3314/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3315/// #     ),
3316/// # ).build().await.unwrap();
3317///
3318/// # let client = hyper_util::client::legacy::Client::builder(
3319/// #     hyper_util::rt::TokioExecutor::new()
3320/// # )
3321/// # .build(
3322/// #     hyper_rustls::HttpsConnectorBuilder::new()
3323/// #         .with_native_roots()
3324/// #         .unwrap()
3325/// #         .https_or_http()
3326/// #         .enable_http2()
3327/// #         .build()
3328/// # );
3329/// # let mut hub = DataprocMetastore::new(client, auth);
3330/// // You can configure optional parameters by calling the respective setters at will, and
3331/// // execute the final call using `doit()`.
3332/// // Values shown here are possibly random and not representative !
3333/// let result = hub.projects().locations_federations_delete("name")
3334///              .request_id("gubergren")
3335///              .doit().await;
3336/// # }
3337/// ```
3338pub struct ProjectLocationFederationDeleteCall<'a, C>
3339where
3340    C: 'a,
3341{
3342    hub: &'a DataprocMetastore<C>,
3343    _name: String,
3344    _request_id: Option<String>,
3345    _delegate: Option<&'a mut dyn common::Delegate>,
3346    _additional_params: HashMap<String, String>,
3347    _scopes: BTreeSet<String>,
3348}
3349
3350impl<'a, C> common::CallBuilder for ProjectLocationFederationDeleteCall<'a, C> {}
3351
3352impl<'a, C> ProjectLocationFederationDeleteCall<'a, C>
3353where
3354    C: common::Connector,
3355{
3356    /// Perform the operation you have build so far.
3357    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3358        use std::borrow::Cow;
3359        use std::io::{Read, Seek};
3360
3361        use common::{url::Params, ToParts};
3362        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3363
3364        let mut dd = common::DefaultDelegate;
3365        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3366        dlg.begin(common::MethodInfo {
3367            id: "metastore.projects.locations.federations.delete",
3368            http_method: hyper::Method::DELETE,
3369        });
3370
3371        for &field in ["alt", "name", "requestId"].iter() {
3372            if self._additional_params.contains_key(field) {
3373                dlg.finished(false);
3374                return Err(common::Error::FieldClash(field));
3375            }
3376        }
3377
3378        let mut params = Params::with_capacity(4 + self._additional_params.len());
3379        params.push("name", self._name);
3380        if let Some(value) = self._request_id.as_ref() {
3381            params.push("requestId", value);
3382        }
3383
3384        params.extend(self._additional_params.iter());
3385
3386        params.push("alt", "json");
3387        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
3388        if self._scopes.is_empty() {
3389            self._scopes
3390                .insert(Scope::CloudPlatform.as_ref().to_string());
3391        }
3392
3393        #[allow(clippy::single_element_loop)]
3394        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3395            url = params.uri_replacement(url, param_name, find_this, true);
3396        }
3397        {
3398            let to_remove = ["name"];
3399            params.remove_params(&to_remove);
3400        }
3401
3402        let url = params.parse_with_url(&url);
3403
3404        loop {
3405            let token = match self
3406                .hub
3407                .auth
3408                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3409                .await
3410            {
3411                Ok(token) => token,
3412                Err(e) => match dlg.token(e) {
3413                    Ok(token) => token,
3414                    Err(e) => {
3415                        dlg.finished(false);
3416                        return Err(common::Error::MissingToken(e));
3417                    }
3418                },
3419            };
3420            let mut req_result = {
3421                let client = &self.hub.client;
3422                dlg.pre_request();
3423                let mut req_builder = hyper::Request::builder()
3424                    .method(hyper::Method::DELETE)
3425                    .uri(url.as_str())
3426                    .header(USER_AGENT, self.hub._user_agent.clone());
3427
3428                if let Some(token) = token.as_ref() {
3429                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3430                }
3431
3432                let request = req_builder
3433                    .header(CONTENT_LENGTH, 0_u64)
3434                    .body(common::to_body::<String>(None));
3435
3436                client.request(request.unwrap()).await
3437            };
3438
3439            match req_result {
3440                Err(err) => {
3441                    if let common::Retry::After(d) = dlg.http_error(&err) {
3442                        sleep(d).await;
3443                        continue;
3444                    }
3445                    dlg.finished(false);
3446                    return Err(common::Error::HttpError(err));
3447                }
3448                Ok(res) => {
3449                    let (mut parts, body) = res.into_parts();
3450                    let mut body = common::Body::new(body);
3451                    if !parts.status.is_success() {
3452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3453                        let error = serde_json::from_str(&common::to_string(&bytes));
3454                        let response = common::to_response(parts, bytes.into());
3455
3456                        if let common::Retry::After(d) =
3457                            dlg.http_failure(&response, error.as_ref().ok())
3458                        {
3459                            sleep(d).await;
3460                            continue;
3461                        }
3462
3463                        dlg.finished(false);
3464
3465                        return Err(match error {
3466                            Ok(value) => common::Error::BadRequest(value),
3467                            _ => common::Error::Failure(response),
3468                        });
3469                    }
3470                    let response = {
3471                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3472                        let encoded = common::to_string(&bytes);
3473                        match serde_json::from_str(&encoded) {
3474                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3475                            Err(error) => {
3476                                dlg.response_json_decode_error(&encoded, &error);
3477                                return Err(common::Error::JsonDecodeError(
3478                                    encoded.to_string(),
3479                                    error,
3480                                ));
3481                            }
3482                        }
3483                    };
3484
3485                    dlg.finished(true);
3486                    return Ok(response);
3487                }
3488            }
3489        }
3490    }
3491
3492    /// Required. The relative resource name of the metastore federation to delete, in the following form:projects/{project_number}/locations/{location_id}/federations/{federation_id}.
3493    ///
3494    /// Sets the *name* path property to the given value.
3495    ///
3496    /// Even though the property as already been set when instantiating this call,
3497    /// we provide this method for API completeness.
3498    pub fn name(mut self, new_value: &str) -> ProjectLocationFederationDeleteCall<'a, C> {
3499        self._name = new_value.to_string();
3500        self
3501    }
3502    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
3503    ///
3504    /// Sets the *request id* query property to the given value.
3505    pub fn request_id(mut self, new_value: &str) -> ProjectLocationFederationDeleteCall<'a, C> {
3506        self._request_id = Some(new_value.to_string());
3507        self
3508    }
3509    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3510    /// while executing the actual API request.
3511    ///
3512    /// ````text
3513    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3514    /// ````
3515    ///
3516    /// Sets the *delegate* property to the given value.
3517    pub fn delegate(
3518        mut self,
3519        new_value: &'a mut dyn common::Delegate,
3520    ) -> ProjectLocationFederationDeleteCall<'a, C> {
3521        self._delegate = Some(new_value);
3522        self
3523    }
3524
3525    /// Set any additional parameter of the query string used in the request.
3526    /// It should be used to set parameters which are not yet available through their own
3527    /// setters.
3528    ///
3529    /// Please note that this method must not be used to set any of the known parameters
3530    /// which have their own setter method. If done anyway, the request will fail.
3531    ///
3532    /// # Additional Parameters
3533    ///
3534    /// * *$.xgafv* (query-string) - V1 error format.
3535    /// * *access_token* (query-string) - OAuth access token.
3536    /// * *alt* (query-string) - Data format for response.
3537    /// * *callback* (query-string) - JSONP
3538    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3539    /// * *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.
3540    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3541    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3542    /// * *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.
3543    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3544    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3545    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationDeleteCall<'a, C>
3546    where
3547        T: AsRef<str>,
3548    {
3549        self._additional_params
3550            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3551        self
3552    }
3553
3554    /// Identifies the authorization scope for the method you are building.
3555    ///
3556    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3557    /// [`Scope::CloudPlatform`].
3558    ///
3559    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3560    /// tokens for more than one scope.
3561    ///
3562    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3563    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3564    /// sufficient, a read-write scope will do as well.
3565    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationDeleteCall<'a, C>
3566    where
3567        St: AsRef<str>,
3568    {
3569        self._scopes.insert(String::from(scope.as_ref()));
3570        self
3571    }
3572    /// Identifies the authorization scope(s) for the method you are building.
3573    ///
3574    /// See [`Self::add_scope()`] for details.
3575    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFederationDeleteCall<'a, C>
3576    where
3577        I: IntoIterator<Item = St>,
3578        St: AsRef<str>,
3579    {
3580        self._scopes
3581            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3582        self
3583    }
3584
3585    /// Removes all scopes, and no default scope will be used either.
3586    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3587    /// for details).
3588    pub fn clear_scopes(mut self) -> ProjectLocationFederationDeleteCall<'a, C> {
3589        self._scopes.clear();
3590        self
3591    }
3592}
3593
3594/// Gets the details of a single federation.
3595///
3596/// A builder for the *locations.federations.get* method supported by a *project* resource.
3597/// It is not used directly, but through a [`ProjectMethods`] instance.
3598///
3599/// # Example
3600///
3601/// Instantiate a resource method builder
3602///
3603/// ```test_harness,no_run
3604/// # extern crate hyper;
3605/// # extern crate hyper_rustls;
3606/// # extern crate google_metastore1_beta as metastore1_beta;
3607/// # async fn dox() {
3608/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3609///
3610/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3611/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3612/// #     .with_native_roots()
3613/// #     .unwrap()
3614/// #     .https_only()
3615/// #     .enable_http2()
3616/// #     .build();
3617///
3618/// # let executor = hyper_util::rt::TokioExecutor::new();
3619/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3620/// #     secret,
3621/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3622/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3623/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3624/// #     ),
3625/// # ).build().await.unwrap();
3626///
3627/// # let client = hyper_util::client::legacy::Client::builder(
3628/// #     hyper_util::rt::TokioExecutor::new()
3629/// # )
3630/// # .build(
3631/// #     hyper_rustls::HttpsConnectorBuilder::new()
3632/// #         .with_native_roots()
3633/// #         .unwrap()
3634/// #         .https_or_http()
3635/// #         .enable_http2()
3636/// #         .build()
3637/// # );
3638/// # let mut hub = DataprocMetastore::new(client, auth);
3639/// // You can configure optional parameters by calling the respective setters at will, and
3640/// // execute the final call using `doit()`.
3641/// // Values shown here are possibly random and not representative !
3642/// let result = hub.projects().locations_federations_get("name")
3643///              .doit().await;
3644/// # }
3645/// ```
3646pub struct ProjectLocationFederationGetCall<'a, C>
3647where
3648    C: 'a,
3649{
3650    hub: &'a DataprocMetastore<C>,
3651    _name: String,
3652    _delegate: Option<&'a mut dyn common::Delegate>,
3653    _additional_params: HashMap<String, String>,
3654    _scopes: BTreeSet<String>,
3655}
3656
3657impl<'a, C> common::CallBuilder for ProjectLocationFederationGetCall<'a, C> {}
3658
3659impl<'a, C> ProjectLocationFederationGetCall<'a, C>
3660where
3661    C: common::Connector,
3662{
3663    /// Perform the operation you have build so far.
3664    pub async fn doit(mut self) -> common::Result<(common::Response, Federation)> {
3665        use std::borrow::Cow;
3666        use std::io::{Read, Seek};
3667
3668        use common::{url::Params, ToParts};
3669        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3670
3671        let mut dd = common::DefaultDelegate;
3672        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3673        dlg.begin(common::MethodInfo {
3674            id: "metastore.projects.locations.federations.get",
3675            http_method: hyper::Method::GET,
3676        });
3677
3678        for &field in ["alt", "name"].iter() {
3679            if self._additional_params.contains_key(field) {
3680                dlg.finished(false);
3681                return Err(common::Error::FieldClash(field));
3682            }
3683        }
3684
3685        let mut params = Params::with_capacity(3 + self._additional_params.len());
3686        params.push("name", self._name);
3687
3688        params.extend(self._additional_params.iter());
3689
3690        params.push("alt", "json");
3691        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
3692        if self._scopes.is_empty() {
3693            self._scopes
3694                .insert(Scope::CloudPlatform.as_ref().to_string());
3695        }
3696
3697        #[allow(clippy::single_element_loop)]
3698        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3699            url = params.uri_replacement(url, param_name, find_this, true);
3700        }
3701        {
3702            let to_remove = ["name"];
3703            params.remove_params(&to_remove);
3704        }
3705
3706        let url = params.parse_with_url(&url);
3707
3708        loop {
3709            let token = match self
3710                .hub
3711                .auth
3712                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3713                .await
3714            {
3715                Ok(token) => token,
3716                Err(e) => match dlg.token(e) {
3717                    Ok(token) => token,
3718                    Err(e) => {
3719                        dlg.finished(false);
3720                        return Err(common::Error::MissingToken(e));
3721                    }
3722                },
3723            };
3724            let mut req_result = {
3725                let client = &self.hub.client;
3726                dlg.pre_request();
3727                let mut req_builder = hyper::Request::builder()
3728                    .method(hyper::Method::GET)
3729                    .uri(url.as_str())
3730                    .header(USER_AGENT, self.hub._user_agent.clone());
3731
3732                if let Some(token) = token.as_ref() {
3733                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3734                }
3735
3736                let request = req_builder
3737                    .header(CONTENT_LENGTH, 0_u64)
3738                    .body(common::to_body::<String>(None));
3739
3740                client.request(request.unwrap()).await
3741            };
3742
3743            match req_result {
3744                Err(err) => {
3745                    if let common::Retry::After(d) = dlg.http_error(&err) {
3746                        sleep(d).await;
3747                        continue;
3748                    }
3749                    dlg.finished(false);
3750                    return Err(common::Error::HttpError(err));
3751                }
3752                Ok(res) => {
3753                    let (mut parts, body) = res.into_parts();
3754                    let mut body = common::Body::new(body);
3755                    if !parts.status.is_success() {
3756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3757                        let error = serde_json::from_str(&common::to_string(&bytes));
3758                        let response = common::to_response(parts, bytes.into());
3759
3760                        if let common::Retry::After(d) =
3761                            dlg.http_failure(&response, error.as_ref().ok())
3762                        {
3763                            sleep(d).await;
3764                            continue;
3765                        }
3766
3767                        dlg.finished(false);
3768
3769                        return Err(match error {
3770                            Ok(value) => common::Error::BadRequest(value),
3771                            _ => common::Error::Failure(response),
3772                        });
3773                    }
3774                    let response = {
3775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3776                        let encoded = common::to_string(&bytes);
3777                        match serde_json::from_str(&encoded) {
3778                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3779                            Err(error) => {
3780                                dlg.response_json_decode_error(&encoded, &error);
3781                                return Err(common::Error::JsonDecodeError(
3782                                    encoded.to_string(),
3783                                    error,
3784                                ));
3785                            }
3786                        }
3787                    };
3788
3789                    dlg.finished(true);
3790                    return Ok(response);
3791                }
3792            }
3793        }
3794    }
3795
3796    /// Required. The relative resource name of the metastore federation to retrieve, in the following form:projects/{project_number}/locations/{location_id}/federations/{federation_id}.
3797    ///
3798    /// Sets the *name* path property to the given value.
3799    ///
3800    /// Even though the property as already been set when instantiating this call,
3801    /// we provide this method for API completeness.
3802    pub fn name(mut self, new_value: &str) -> ProjectLocationFederationGetCall<'a, C> {
3803        self._name = new_value.to_string();
3804        self
3805    }
3806    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3807    /// while executing the actual API request.
3808    ///
3809    /// ````text
3810    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3811    /// ````
3812    ///
3813    /// Sets the *delegate* property to the given value.
3814    pub fn delegate(
3815        mut self,
3816        new_value: &'a mut dyn common::Delegate,
3817    ) -> ProjectLocationFederationGetCall<'a, C> {
3818        self._delegate = Some(new_value);
3819        self
3820    }
3821
3822    /// Set any additional parameter of the query string used in the request.
3823    /// It should be used to set parameters which are not yet available through their own
3824    /// setters.
3825    ///
3826    /// Please note that this method must not be used to set any of the known parameters
3827    /// which have their own setter method. If done anyway, the request will fail.
3828    ///
3829    /// # Additional Parameters
3830    ///
3831    /// * *$.xgafv* (query-string) - V1 error format.
3832    /// * *access_token* (query-string) - OAuth access token.
3833    /// * *alt* (query-string) - Data format for response.
3834    /// * *callback* (query-string) - JSONP
3835    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3836    /// * *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.
3837    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3838    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3839    /// * *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.
3840    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3841    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3842    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationGetCall<'a, C>
3843    where
3844        T: AsRef<str>,
3845    {
3846        self._additional_params
3847            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3848        self
3849    }
3850
3851    /// Identifies the authorization scope for the method you are building.
3852    ///
3853    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3854    /// [`Scope::CloudPlatform`].
3855    ///
3856    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3857    /// tokens for more than one scope.
3858    ///
3859    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3860    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3861    /// sufficient, a read-write scope will do as well.
3862    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationGetCall<'a, C>
3863    where
3864        St: AsRef<str>,
3865    {
3866        self._scopes.insert(String::from(scope.as_ref()));
3867        self
3868    }
3869    /// Identifies the authorization scope(s) for the method you are building.
3870    ///
3871    /// See [`Self::add_scope()`] for details.
3872    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFederationGetCall<'a, C>
3873    where
3874        I: IntoIterator<Item = St>,
3875        St: AsRef<str>,
3876    {
3877        self._scopes
3878            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3879        self
3880    }
3881
3882    /// Removes all scopes, and no default scope will be used either.
3883    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3884    /// for details).
3885    pub fn clear_scopes(mut self) -> ProjectLocationFederationGetCall<'a, C> {
3886        self._scopes.clear();
3887        self
3888    }
3889}
3890
3891/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3892///
3893/// A builder for the *locations.federations.getIamPolicy* method supported by a *project* resource.
3894/// It is not used directly, but through a [`ProjectMethods`] instance.
3895///
3896/// # Example
3897///
3898/// Instantiate a resource method builder
3899///
3900/// ```test_harness,no_run
3901/// # extern crate hyper;
3902/// # extern crate hyper_rustls;
3903/// # extern crate google_metastore1_beta as metastore1_beta;
3904/// # async fn dox() {
3905/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3906///
3907/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3908/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3909/// #     .with_native_roots()
3910/// #     .unwrap()
3911/// #     .https_only()
3912/// #     .enable_http2()
3913/// #     .build();
3914///
3915/// # let executor = hyper_util::rt::TokioExecutor::new();
3916/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3917/// #     secret,
3918/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3919/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3920/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3921/// #     ),
3922/// # ).build().await.unwrap();
3923///
3924/// # let client = hyper_util::client::legacy::Client::builder(
3925/// #     hyper_util::rt::TokioExecutor::new()
3926/// # )
3927/// # .build(
3928/// #     hyper_rustls::HttpsConnectorBuilder::new()
3929/// #         .with_native_roots()
3930/// #         .unwrap()
3931/// #         .https_or_http()
3932/// #         .enable_http2()
3933/// #         .build()
3934/// # );
3935/// # let mut hub = DataprocMetastore::new(client, auth);
3936/// // You can configure optional parameters by calling the respective setters at will, and
3937/// // execute the final call using `doit()`.
3938/// // Values shown here are possibly random and not representative !
3939/// let result = hub.projects().locations_federations_get_iam_policy("resource")
3940///              .options_requested_policy_version(-75)
3941///              .doit().await;
3942/// # }
3943/// ```
3944pub struct ProjectLocationFederationGetIamPolicyCall<'a, C>
3945where
3946    C: 'a,
3947{
3948    hub: &'a DataprocMetastore<C>,
3949    _resource: String,
3950    _options_requested_policy_version: Option<i32>,
3951    _delegate: Option<&'a mut dyn common::Delegate>,
3952    _additional_params: HashMap<String, String>,
3953    _scopes: BTreeSet<String>,
3954}
3955
3956impl<'a, C> common::CallBuilder for ProjectLocationFederationGetIamPolicyCall<'a, C> {}
3957
3958impl<'a, C> ProjectLocationFederationGetIamPolicyCall<'a, C>
3959where
3960    C: common::Connector,
3961{
3962    /// Perform the operation you have build so far.
3963    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3964        use std::borrow::Cow;
3965        use std::io::{Read, Seek};
3966
3967        use common::{url::Params, ToParts};
3968        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3969
3970        let mut dd = common::DefaultDelegate;
3971        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3972        dlg.begin(common::MethodInfo {
3973            id: "metastore.projects.locations.federations.getIamPolicy",
3974            http_method: hyper::Method::GET,
3975        });
3976
3977        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3978            if self._additional_params.contains_key(field) {
3979                dlg.finished(false);
3980                return Err(common::Error::FieldClash(field));
3981            }
3982        }
3983
3984        let mut params = Params::with_capacity(4 + self._additional_params.len());
3985        params.push("resource", self._resource);
3986        if let Some(value) = self._options_requested_policy_version.as_ref() {
3987            params.push("options.requestedPolicyVersion", value.to_string());
3988        }
3989
3990        params.extend(self._additional_params.iter());
3991
3992        params.push("alt", "json");
3993        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:getIamPolicy";
3994        if self._scopes.is_empty() {
3995            self._scopes
3996                .insert(Scope::CloudPlatform.as_ref().to_string());
3997        }
3998
3999        #[allow(clippy::single_element_loop)]
4000        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4001            url = params.uri_replacement(url, param_name, find_this, true);
4002        }
4003        {
4004            let to_remove = ["resource"];
4005            params.remove_params(&to_remove);
4006        }
4007
4008        let url = params.parse_with_url(&url);
4009
4010        loop {
4011            let token = match self
4012                .hub
4013                .auth
4014                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4015                .await
4016            {
4017                Ok(token) => token,
4018                Err(e) => match dlg.token(e) {
4019                    Ok(token) => token,
4020                    Err(e) => {
4021                        dlg.finished(false);
4022                        return Err(common::Error::MissingToken(e));
4023                    }
4024                },
4025            };
4026            let mut req_result = {
4027                let client = &self.hub.client;
4028                dlg.pre_request();
4029                let mut req_builder = hyper::Request::builder()
4030                    .method(hyper::Method::GET)
4031                    .uri(url.as_str())
4032                    .header(USER_AGENT, self.hub._user_agent.clone());
4033
4034                if let Some(token) = token.as_ref() {
4035                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4036                }
4037
4038                let request = req_builder
4039                    .header(CONTENT_LENGTH, 0_u64)
4040                    .body(common::to_body::<String>(None));
4041
4042                client.request(request.unwrap()).await
4043            };
4044
4045            match req_result {
4046                Err(err) => {
4047                    if let common::Retry::After(d) = dlg.http_error(&err) {
4048                        sleep(d).await;
4049                        continue;
4050                    }
4051                    dlg.finished(false);
4052                    return Err(common::Error::HttpError(err));
4053                }
4054                Ok(res) => {
4055                    let (mut parts, body) = res.into_parts();
4056                    let mut body = common::Body::new(body);
4057                    if !parts.status.is_success() {
4058                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4059                        let error = serde_json::from_str(&common::to_string(&bytes));
4060                        let response = common::to_response(parts, bytes.into());
4061
4062                        if let common::Retry::After(d) =
4063                            dlg.http_failure(&response, error.as_ref().ok())
4064                        {
4065                            sleep(d).await;
4066                            continue;
4067                        }
4068
4069                        dlg.finished(false);
4070
4071                        return Err(match error {
4072                            Ok(value) => common::Error::BadRequest(value),
4073                            _ => common::Error::Failure(response),
4074                        });
4075                    }
4076                    let response = {
4077                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4078                        let encoded = common::to_string(&bytes);
4079                        match serde_json::from_str(&encoded) {
4080                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4081                            Err(error) => {
4082                                dlg.response_json_decode_error(&encoded, &error);
4083                                return Err(common::Error::JsonDecodeError(
4084                                    encoded.to_string(),
4085                                    error,
4086                                ));
4087                            }
4088                        }
4089                    };
4090
4091                    dlg.finished(true);
4092                    return Ok(response);
4093                }
4094            }
4095        }
4096    }
4097
4098    /// 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.
4099    ///
4100    /// Sets the *resource* path property to the given value.
4101    ///
4102    /// Even though the property as already been set when instantiating this call,
4103    /// we provide this method for API completeness.
4104    pub fn resource(mut self, new_value: &str) -> ProjectLocationFederationGetIamPolicyCall<'a, C> {
4105        self._resource = new_value.to_string();
4106        self
4107    }
4108    /// 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).
4109    ///
4110    /// Sets the *options.requested policy version* query property to the given value.
4111    pub fn options_requested_policy_version(
4112        mut self,
4113        new_value: i32,
4114    ) -> ProjectLocationFederationGetIamPolicyCall<'a, C> {
4115        self._options_requested_policy_version = Some(new_value);
4116        self
4117    }
4118    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4119    /// while executing the actual API request.
4120    ///
4121    /// ````text
4122    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4123    /// ````
4124    ///
4125    /// Sets the *delegate* property to the given value.
4126    pub fn delegate(
4127        mut self,
4128        new_value: &'a mut dyn common::Delegate,
4129    ) -> ProjectLocationFederationGetIamPolicyCall<'a, C> {
4130        self._delegate = Some(new_value);
4131        self
4132    }
4133
4134    /// Set any additional parameter of the query string used in the request.
4135    /// It should be used to set parameters which are not yet available through their own
4136    /// setters.
4137    ///
4138    /// Please note that this method must not be used to set any of the known parameters
4139    /// which have their own setter method. If done anyway, the request will fail.
4140    ///
4141    /// # Additional Parameters
4142    ///
4143    /// * *$.xgafv* (query-string) - V1 error format.
4144    /// * *access_token* (query-string) - OAuth access token.
4145    /// * *alt* (query-string) - Data format for response.
4146    /// * *callback* (query-string) - JSONP
4147    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4148    /// * *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.
4149    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4150    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4151    /// * *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.
4152    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4153    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4154    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationGetIamPolicyCall<'a, C>
4155    where
4156        T: AsRef<str>,
4157    {
4158        self._additional_params
4159            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4160        self
4161    }
4162
4163    /// Identifies the authorization scope for the method you are building.
4164    ///
4165    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4166    /// [`Scope::CloudPlatform`].
4167    ///
4168    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4169    /// tokens for more than one scope.
4170    ///
4171    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4172    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4173    /// sufficient, a read-write scope will do as well.
4174    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationGetIamPolicyCall<'a, C>
4175    where
4176        St: AsRef<str>,
4177    {
4178        self._scopes.insert(String::from(scope.as_ref()));
4179        self
4180    }
4181    /// Identifies the authorization scope(s) for the method you are building.
4182    ///
4183    /// See [`Self::add_scope()`] for details.
4184    pub fn add_scopes<I, St>(
4185        mut self,
4186        scopes: I,
4187    ) -> ProjectLocationFederationGetIamPolicyCall<'a, C>
4188    where
4189        I: IntoIterator<Item = St>,
4190        St: AsRef<str>,
4191    {
4192        self._scopes
4193            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4194        self
4195    }
4196
4197    /// Removes all scopes, and no default scope will be used either.
4198    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4199    /// for details).
4200    pub fn clear_scopes(mut self) -> ProjectLocationFederationGetIamPolicyCall<'a, C> {
4201        self._scopes.clear();
4202        self
4203    }
4204}
4205
4206/// Lists federations in a project and location.
4207///
4208/// A builder for the *locations.federations.list* method supported by a *project* resource.
4209/// It is not used directly, but through a [`ProjectMethods`] instance.
4210///
4211/// # Example
4212///
4213/// Instantiate a resource method builder
4214///
4215/// ```test_harness,no_run
4216/// # extern crate hyper;
4217/// # extern crate hyper_rustls;
4218/// # extern crate google_metastore1_beta as metastore1_beta;
4219/// # async fn dox() {
4220/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4221///
4222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4223/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4224/// #     .with_native_roots()
4225/// #     .unwrap()
4226/// #     .https_only()
4227/// #     .enable_http2()
4228/// #     .build();
4229///
4230/// # let executor = hyper_util::rt::TokioExecutor::new();
4231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4232/// #     secret,
4233/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4234/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4235/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4236/// #     ),
4237/// # ).build().await.unwrap();
4238///
4239/// # let client = hyper_util::client::legacy::Client::builder(
4240/// #     hyper_util::rt::TokioExecutor::new()
4241/// # )
4242/// # .build(
4243/// #     hyper_rustls::HttpsConnectorBuilder::new()
4244/// #         .with_native_roots()
4245/// #         .unwrap()
4246/// #         .https_or_http()
4247/// #         .enable_http2()
4248/// #         .build()
4249/// # );
4250/// # let mut hub = DataprocMetastore::new(client, auth);
4251/// // You can configure optional parameters by calling the respective setters at will, and
4252/// // execute the final call using `doit()`.
4253/// // Values shown here are possibly random and not representative !
4254/// let result = hub.projects().locations_federations_list("parent")
4255///              .page_token("ea")
4256///              .page_size(-55)
4257///              .order_by("invidunt")
4258///              .filter("amet")
4259///              .doit().await;
4260/// # }
4261/// ```
4262pub struct ProjectLocationFederationListCall<'a, C>
4263where
4264    C: 'a,
4265{
4266    hub: &'a DataprocMetastore<C>,
4267    _parent: String,
4268    _page_token: Option<String>,
4269    _page_size: Option<i32>,
4270    _order_by: Option<String>,
4271    _filter: Option<String>,
4272    _delegate: Option<&'a mut dyn common::Delegate>,
4273    _additional_params: HashMap<String, String>,
4274    _scopes: BTreeSet<String>,
4275}
4276
4277impl<'a, C> common::CallBuilder for ProjectLocationFederationListCall<'a, C> {}
4278
4279impl<'a, C> ProjectLocationFederationListCall<'a, C>
4280where
4281    C: common::Connector,
4282{
4283    /// Perform the operation you have build so far.
4284    pub async fn doit(mut self) -> common::Result<(common::Response, ListFederationsResponse)> {
4285        use std::borrow::Cow;
4286        use std::io::{Read, Seek};
4287
4288        use common::{url::Params, ToParts};
4289        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4290
4291        let mut dd = common::DefaultDelegate;
4292        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4293        dlg.begin(common::MethodInfo {
4294            id: "metastore.projects.locations.federations.list",
4295            http_method: hyper::Method::GET,
4296        });
4297
4298        for &field in [
4299            "alt",
4300            "parent",
4301            "pageToken",
4302            "pageSize",
4303            "orderBy",
4304            "filter",
4305        ]
4306        .iter()
4307        {
4308            if self._additional_params.contains_key(field) {
4309                dlg.finished(false);
4310                return Err(common::Error::FieldClash(field));
4311            }
4312        }
4313
4314        let mut params = Params::with_capacity(7 + self._additional_params.len());
4315        params.push("parent", self._parent);
4316        if let Some(value) = self._page_token.as_ref() {
4317            params.push("pageToken", value);
4318        }
4319        if let Some(value) = self._page_size.as_ref() {
4320            params.push("pageSize", value.to_string());
4321        }
4322        if let Some(value) = self._order_by.as_ref() {
4323            params.push("orderBy", value);
4324        }
4325        if let Some(value) = self._filter.as_ref() {
4326            params.push("filter", value);
4327        }
4328
4329        params.extend(self._additional_params.iter());
4330
4331        params.push("alt", "json");
4332        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/federations";
4333        if self._scopes.is_empty() {
4334            self._scopes
4335                .insert(Scope::CloudPlatform.as_ref().to_string());
4336        }
4337
4338        #[allow(clippy::single_element_loop)]
4339        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4340            url = params.uri_replacement(url, param_name, find_this, true);
4341        }
4342        {
4343            let to_remove = ["parent"];
4344            params.remove_params(&to_remove);
4345        }
4346
4347        let url = params.parse_with_url(&url);
4348
4349        loop {
4350            let token = match self
4351                .hub
4352                .auth
4353                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4354                .await
4355            {
4356                Ok(token) => token,
4357                Err(e) => match dlg.token(e) {
4358                    Ok(token) => token,
4359                    Err(e) => {
4360                        dlg.finished(false);
4361                        return Err(common::Error::MissingToken(e));
4362                    }
4363                },
4364            };
4365            let mut req_result = {
4366                let client = &self.hub.client;
4367                dlg.pre_request();
4368                let mut req_builder = hyper::Request::builder()
4369                    .method(hyper::Method::GET)
4370                    .uri(url.as_str())
4371                    .header(USER_AGENT, self.hub._user_agent.clone());
4372
4373                if let Some(token) = token.as_ref() {
4374                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4375                }
4376
4377                let request = req_builder
4378                    .header(CONTENT_LENGTH, 0_u64)
4379                    .body(common::to_body::<String>(None));
4380
4381                client.request(request.unwrap()).await
4382            };
4383
4384            match req_result {
4385                Err(err) => {
4386                    if let common::Retry::After(d) = dlg.http_error(&err) {
4387                        sleep(d).await;
4388                        continue;
4389                    }
4390                    dlg.finished(false);
4391                    return Err(common::Error::HttpError(err));
4392                }
4393                Ok(res) => {
4394                    let (mut parts, body) = res.into_parts();
4395                    let mut body = common::Body::new(body);
4396                    if !parts.status.is_success() {
4397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4398                        let error = serde_json::from_str(&common::to_string(&bytes));
4399                        let response = common::to_response(parts, bytes.into());
4400
4401                        if let common::Retry::After(d) =
4402                            dlg.http_failure(&response, error.as_ref().ok())
4403                        {
4404                            sleep(d).await;
4405                            continue;
4406                        }
4407
4408                        dlg.finished(false);
4409
4410                        return Err(match error {
4411                            Ok(value) => common::Error::BadRequest(value),
4412                            _ => common::Error::Failure(response),
4413                        });
4414                    }
4415                    let response = {
4416                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4417                        let encoded = common::to_string(&bytes);
4418                        match serde_json::from_str(&encoded) {
4419                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4420                            Err(error) => {
4421                                dlg.response_json_decode_error(&encoded, &error);
4422                                return Err(common::Error::JsonDecodeError(
4423                                    encoded.to_string(),
4424                                    error,
4425                                ));
4426                            }
4427                        }
4428                    };
4429
4430                    dlg.finished(true);
4431                    return Ok(response);
4432                }
4433            }
4434        }
4435    }
4436
4437    /// Required. The relative resource name of the location of metastore federations to list, in the following form: projects/{project_number}/locations/{location_id}.
4438    ///
4439    /// Sets the *parent* path property to the given value.
4440    ///
4441    /// Even though the property as already been set when instantiating this call,
4442    /// we provide this method for API completeness.
4443    pub fn parent(mut self, new_value: &str) -> ProjectLocationFederationListCall<'a, C> {
4444        self._parent = new_value.to_string();
4445        self
4446    }
4447    /// Optional. A page token, received from a previous ListFederationServices call. Provide this token to retrieve the subsequent page.To retrieve the first page, supply an empty page token.When paginating, other parameters provided to ListFederationServices must match the call that provided the page token.
4448    ///
4449    /// Sets the *page token* query property to the given value.
4450    pub fn page_token(mut self, new_value: &str) -> ProjectLocationFederationListCall<'a, C> {
4451        self._page_token = Some(new_value.to_string());
4452        self
4453    }
4454    /// Optional. The maximum number of federations to return. The response may contain less than the maximum number. If unspecified, no more than 500 services are returned. The maximum value is 1000; values above 1000 are changed to 1000.
4455    ///
4456    /// Sets the *page size* query property to the given value.
4457    pub fn page_size(mut self, new_value: i32) -> ProjectLocationFederationListCall<'a, C> {
4458        self._page_size = Some(new_value);
4459        self
4460    }
4461    /// Optional. Specify the ordering of results as described in Sorting Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not specified, the results will be sorted in the default order.
4462    ///
4463    /// Sets the *order by* query property to the given value.
4464    pub fn order_by(mut self, new_value: &str) -> ProjectLocationFederationListCall<'a, C> {
4465        self._order_by = Some(new_value.to_string());
4466        self
4467    }
4468    /// Optional. The filter to apply to list results.
4469    ///
4470    /// Sets the *filter* query property to the given value.
4471    pub fn filter(mut self, new_value: &str) -> ProjectLocationFederationListCall<'a, C> {
4472        self._filter = Some(new_value.to_string());
4473        self
4474    }
4475    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4476    /// while executing the actual API request.
4477    ///
4478    /// ````text
4479    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4480    /// ````
4481    ///
4482    /// Sets the *delegate* property to the given value.
4483    pub fn delegate(
4484        mut self,
4485        new_value: &'a mut dyn common::Delegate,
4486    ) -> ProjectLocationFederationListCall<'a, C> {
4487        self._delegate = Some(new_value);
4488        self
4489    }
4490
4491    /// Set any additional parameter of the query string used in the request.
4492    /// It should be used to set parameters which are not yet available through their own
4493    /// setters.
4494    ///
4495    /// Please note that this method must not be used to set any of the known parameters
4496    /// which have their own setter method. If done anyway, the request will fail.
4497    ///
4498    /// # Additional Parameters
4499    ///
4500    /// * *$.xgafv* (query-string) - V1 error format.
4501    /// * *access_token* (query-string) - OAuth access token.
4502    /// * *alt* (query-string) - Data format for response.
4503    /// * *callback* (query-string) - JSONP
4504    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4505    /// * *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.
4506    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4507    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4508    /// * *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.
4509    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4510    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4511    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationListCall<'a, C>
4512    where
4513        T: AsRef<str>,
4514    {
4515        self._additional_params
4516            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4517        self
4518    }
4519
4520    /// Identifies the authorization scope for the method you are building.
4521    ///
4522    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4523    /// [`Scope::CloudPlatform`].
4524    ///
4525    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4526    /// tokens for more than one scope.
4527    ///
4528    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4529    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4530    /// sufficient, a read-write scope will do as well.
4531    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationListCall<'a, C>
4532    where
4533        St: AsRef<str>,
4534    {
4535        self._scopes.insert(String::from(scope.as_ref()));
4536        self
4537    }
4538    /// Identifies the authorization scope(s) for the method you are building.
4539    ///
4540    /// See [`Self::add_scope()`] for details.
4541    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFederationListCall<'a, C>
4542    where
4543        I: IntoIterator<Item = St>,
4544        St: AsRef<str>,
4545    {
4546        self._scopes
4547            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4548        self
4549    }
4550
4551    /// Removes all scopes, and no default scope will be used either.
4552    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4553    /// for details).
4554    pub fn clear_scopes(mut self) -> ProjectLocationFederationListCall<'a, C> {
4555        self._scopes.clear();
4556        self
4557    }
4558}
4559
4560/// Updates the fields of a federation.
4561///
4562/// A builder for the *locations.federations.patch* method supported by a *project* resource.
4563/// It is not used directly, but through a [`ProjectMethods`] instance.
4564///
4565/// # Example
4566///
4567/// Instantiate a resource method builder
4568///
4569/// ```test_harness,no_run
4570/// # extern crate hyper;
4571/// # extern crate hyper_rustls;
4572/// # extern crate google_metastore1_beta as metastore1_beta;
4573/// use metastore1_beta::api::Federation;
4574/// # async fn dox() {
4575/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4576///
4577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4578/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4579/// #     .with_native_roots()
4580/// #     .unwrap()
4581/// #     .https_only()
4582/// #     .enable_http2()
4583/// #     .build();
4584///
4585/// # let executor = hyper_util::rt::TokioExecutor::new();
4586/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4587/// #     secret,
4588/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4589/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4590/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4591/// #     ),
4592/// # ).build().await.unwrap();
4593///
4594/// # let client = hyper_util::client::legacy::Client::builder(
4595/// #     hyper_util::rt::TokioExecutor::new()
4596/// # )
4597/// # .build(
4598/// #     hyper_rustls::HttpsConnectorBuilder::new()
4599/// #         .with_native_roots()
4600/// #         .unwrap()
4601/// #         .https_or_http()
4602/// #         .enable_http2()
4603/// #         .build()
4604/// # );
4605/// # let mut hub = DataprocMetastore::new(client, auth);
4606/// // As the method needs a request, you would usually fill it with the desired information
4607/// // into the respective structure. Some of the parts shown here might not be applicable !
4608/// // Values shown here are possibly random and not representative !
4609/// let mut req = Federation::default();
4610///
4611/// // You can configure optional parameters by calling the respective setters at will, and
4612/// // execute the final call using `doit()`.
4613/// // Values shown here are possibly random and not representative !
4614/// let result = hub.projects().locations_federations_patch(req, "name")
4615///              .update_mask(FieldMask::new::<&str>(&[]))
4616///              .request_id("ipsum")
4617///              .doit().await;
4618/// # }
4619/// ```
4620pub struct ProjectLocationFederationPatchCall<'a, C>
4621where
4622    C: 'a,
4623{
4624    hub: &'a DataprocMetastore<C>,
4625    _request: Federation,
4626    _name: String,
4627    _update_mask: Option<common::FieldMask>,
4628    _request_id: Option<String>,
4629    _delegate: Option<&'a mut dyn common::Delegate>,
4630    _additional_params: HashMap<String, String>,
4631    _scopes: BTreeSet<String>,
4632}
4633
4634impl<'a, C> common::CallBuilder for ProjectLocationFederationPatchCall<'a, C> {}
4635
4636impl<'a, C> ProjectLocationFederationPatchCall<'a, C>
4637where
4638    C: common::Connector,
4639{
4640    /// Perform the operation you have build so far.
4641    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4642        use std::borrow::Cow;
4643        use std::io::{Read, Seek};
4644
4645        use common::{url::Params, ToParts};
4646        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4647
4648        let mut dd = common::DefaultDelegate;
4649        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4650        dlg.begin(common::MethodInfo {
4651            id: "metastore.projects.locations.federations.patch",
4652            http_method: hyper::Method::PATCH,
4653        });
4654
4655        for &field in ["alt", "name", "updateMask", "requestId"].iter() {
4656            if self._additional_params.contains_key(field) {
4657                dlg.finished(false);
4658                return Err(common::Error::FieldClash(field));
4659            }
4660        }
4661
4662        let mut params = Params::with_capacity(6 + self._additional_params.len());
4663        params.push("name", self._name);
4664        if let Some(value) = self._update_mask.as_ref() {
4665            params.push("updateMask", value.to_string());
4666        }
4667        if let Some(value) = self._request_id.as_ref() {
4668            params.push("requestId", value);
4669        }
4670
4671        params.extend(self._additional_params.iter());
4672
4673        params.push("alt", "json");
4674        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
4675        if self._scopes.is_empty() {
4676            self._scopes
4677                .insert(Scope::CloudPlatform.as_ref().to_string());
4678        }
4679
4680        #[allow(clippy::single_element_loop)]
4681        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4682            url = params.uri_replacement(url, param_name, find_this, true);
4683        }
4684        {
4685            let to_remove = ["name"];
4686            params.remove_params(&to_remove);
4687        }
4688
4689        let url = params.parse_with_url(&url);
4690
4691        let mut json_mime_type = mime::APPLICATION_JSON;
4692        let mut request_value_reader = {
4693            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4694            common::remove_json_null_values(&mut value);
4695            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4696            serde_json::to_writer(&mut dst, &value).unwrap();
4697            dst
4698        };
4699        let request_size = request_value_reader
4700            .seek(std::io::SeekFrom::End(0))
4701            .unwrap();
4702        request_value_reader
4703            .seek(std::io::SeekFrom::Start(0))
4704            .unwrap();
4705
4706        loop {
4707            let token = match self
4708                .hub
4709                .auth
4710                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4711                .await
4712            {
4713                Ok(token) => token,
4714                Err(e) => match dlg.token(e) {
4715                    Ok(token) => token,
4716                    Err(e) => {
4717                        dlg.finished(false);
4718                        return Err(common::Error::MissingToken(e));
4719                    }
4720                },
4721            };
4722            request_value_reader
4723                .seek(std::io::SeekFrom::Start(0))
4724                .unwrap();
4725            let mut req_result = {
4726                let client = &self.hub.client;
4727                dlg.pre_request();
4728                let mut req_builder = hyper::Request::builder()
4729                    .method(hyper::Method::PATCH)
4730                    .uri(url.as_str())
4731                    .header(USER_AGENT, self.hub._user_agent.clone());
4732
4733                if let Some(token) = token.as_ref() {
4734                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4735                }
4736
4737                let request = req_builder
4738                    .header(CONTENT_TYPE, json_mime_type.to_string())
4739                    .header(CONTENT_LENGTH, request_size as u64)
4740                    .body(common::to_body(
4741                        request_value_reader.get_ref().clone().into(),
4742                    ));
4743
4744                client.request(request.unwrap()).await
4745            };
4746
4747            match req_result {
4748                Err(err) => {
4749                    if let common::Retry::After(d) = dlg.http_error(&err) {
4750                        sleep(d).await;
4751                        continue;
4752                    }
4753                    dlg.finished(false);
4754                    return Err(common::Error::HttpError(err));
4755                }
4756                Ok(res) => {
4757                    let (mut parts, body) = res.into_parts();
4758                    let mut body = common::Body::new(body);
4759                    if !parts.status.is_success() {
4760                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4761                        let error = serde_json::from_str(&common::to_string(&bytes));
4762                        let response = common::to_response(parts, bytes.into());
4763
4764                        if let common::Retry::After(d) =
4765                            dlg.http_failure(&response, error.as_ref().ok())
4766                        {
4767                            sleep(d).await;
4768                            continue;
4769                        }
4770
4771                        dlg.finished(false);
4772
4773                        return Err(match error {
4774                            Ok(value) => common::Error::BadRequest(value),
4775                            _ => common::Error::Failure(response),
4776                        });
4777                    }
4778                    let response = {
4779                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4780                        let encoded = common::to_string(&bytes);
4781                        match serde_json::from_str(&encoded) {
4782                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4783                            Err(error) => {
4784                                dlg.response_json_decode_error(&encoded, &error);
4785                                return Err(common::Error::JsonDecodeError(
4786                                    encoded.to_string(),
4787                                    error,
4788                                ));
4789                            }
4790                        }
4791                    };
4792
4793                    dlg.finished(true);
4794                    return Ok(response);
4795                }
4796            }
4797        }
4798    }
4799
4800    ///
4801    /// Sets the *request* property to the given value.
4802    ///
4803    /// Even though the property as already been set when instantiating this call,
4804    /// we provide this method for API completeness.
4805    pub fn request(mut self, new_value: Federation) -> ProjectLocationFederationPatchCall<'a, C> {
4806        self._request = new_value;
4807        self
4808    }
4809    /// Immutable. The relative resource name of the federation, of the form: projects/{project_number}/locations/{location_id}/federations/{federation_id}`.
4810    ///
4811    /// Sets the *name* path property to the given value.
4812    ///
4813    /// Even though the property as already been set when instantiating this call,
4814    /// we provide this method for API completeness.
4815    pub fn name(mut self, new_value: &str) -> ProjectLocationFederationPatchCall<'a, C> {
4816        self._name = new_value.to_string();
4817        self
4818    }
4819    /// Required. A field mask used to specify the fields to be overwritten in the metastore federation resource by the update. Fields specified in the update_mask are relative to the resource (not to the full request). A field is overwritten if it is in the mask.
4820    ///
4821    /// Sets the *update mask* query property to the given value.
4822    pub fn update_mask(
4823        mut self,
4824        new_value: common::FieldMask,
4825    ) -> ProjectLocationFederationPatchCall<'a, C> {
4826        self._update_mask = Some(new_value);
4827        self
4828    }
4829    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
4830    ///
4831    /// Sets the *request id* query property to the given value.
4832    pub fn request_id(mut self, new_value: &str) -> ProjectLocationFederationPatchCall<'a, C> {
4833        self._request_id = Some(new_value.to_string());
4834        self
4835    }
4836    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4837    /// while executing the actual API request.
4838    ///
4839    /// ````text
4840    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4841    /// ````
4842    ///
4843    /// Sets the *delegate* property to the given value.
4844    pub fn delegate(
4845        mut self,
4846        new_value: &'a mut dyn common::Delegate,
4847    ) -> ProjectLocationFederationPatchCall<'a, C> {
4848        self._delegate = Some(new_value);
4849        self
4850    }
4851
4852    /// Set any additional parameter of the query string used in the request.
4853    /// It should be used to set parameters which are not yet available through their own
4854    /// setters.
4855    ///
4856    /// Please note that this method must not be used to set any of the known parameters
4857    /// which have their own setter method. If done anyway, the request will fail.
4858    ///
4859    /// # Additional Parameters
4860    ///
4861    /// * *$.xgafv* (query-string) - V1 error format.
4862    /// * *access_token* (query-string) - OAuth access token.
4863    /// * *alt* (query-string) - Data format for response.
4864    /// * *callback* (query-string) - JSONP
4865    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4866    /// * *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.
4867    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4868    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4869    /// * *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.
4870    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4871    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4872    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationPatchCall<'a, C>
4873    where
4874        T: AsRef<str>,
4875    {
4876        self._additional_params
4877            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4878        self
4879    }
4880
4881    /// Identifies the authorization scope for the method you are building.
4882    ///
4883    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4884    /// [`Scope::CloudPlatform`].
4885    ///
4886    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4887    /// tokens for more than one scope.
4888    ///
4889    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4890    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4891    /// sufficient, a read-write scope will do as well.
4892    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationPatchCall<'a, C>
4893    where
4894        St: AsRef<str>,
4895    {
4896        self._scopes.insert(String::from(scope.as_ref()));
4897        self
4898    }
4899    /// Identifies the authorization scope(s) for the method you are building.
4900    ///
4901    /// See [`Self::add_scope()`] for details.
4902    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFederationPatchCall<'a, C>
4903    where
4904        I: IntoIterator<Item = St>,
4905        St: AsRef<str>,
4906    {
4907        self._scopes
4908            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4909        self
4910    }
4911
4912    /// Removes all scopes, and no default scope will be used either.
4913    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4914    /// for details).
4915    pub fn clear_scopes(mut self) -> ProjectLocationFederationPatchCall<'a, C> {
4916        self._scopes.clear();
4917        self
4918    }
4919}
4920
4921/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
4922///
4923/// A builder for the *locations.federations.setIamPolicy* method supported by a *project* resource.
4924/// It is not used directly, but through a [`ProjectMethods`] instance.
4925///
4926/// # Example
4927///
4928/// Instantiate a resource method builder
4929///
4930/// ```test_harness,no_run
4931/// # extern crate hyper;
4932/// # extern crate hyper_rustls;
4933/// # extern crate google_metastore1_beta as metastore1_beta;
4934/// use metastore1_beta::api::SetIamPolicyRequest;
4935/// # async fn dox() {
4936/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4937///
4938/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4939/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4940/// #     .with_native_roots()
4941/// #     .unwrap()
4942/// #     .https_only()
4943/// #     .enable_http2()
4944/// #     .build();
4945///
4946/// # let executor = hyper_util::rt::TokioExecutor::new();
4947/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4948/// #     secret,
4949/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4950/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4951/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4952/// #     ),
4953/// # ).build().await.unwrap();
4954///
4955/// # let client = hyper_util::client::legacy::Client::builder(
4956/// #     hyper_util::rt::TokioExecutor::new()
4957/// # )
4958/// # .build(
4959/// #     hyper_rustls::HttpsConnectorBuilder::new()
4960/// #         .with_native_roots()
4961/// #         .unwrap()
4962/// #         .https_or_http()
4963/// #         .enable_http2()
4964/// #         .build()
4965/// # );
4966/// # let mut hub = DataprocMetastore::new(client, auth);
4967/// // As the method needs a request, you would usually fill it with the desired information
4968/// // into the respective structure. Some of the parts shown here might not be applicable !
4969/// // Values shown here are possibly random and not representative !
4970/// let mut req = SetIamPolicyRequest::default();
4971///
4972/// // You can configure optional parameters by calling the respective setters at will, and
4973/// // execute the final call using `doit()`.
4974/// // Values shown here are possibly random and not representative !
4975/// let result = hub.projects().locations_federations_set_iam_policy(req, "resource")
4976///              .doit().await;
4977/// # }
4978/// ```
4979pub struct ProjectLocationFederationSetIamPolicyCall<'a, C>
4980where
4981    C: 'a,
4982{
4983    hub: &'a DataprocMetastore<C>,
4984    _request: SetIamPolicyRequest,
4985    _resource: String,
4986    _delegate: Option<&'a mut dyn common::Delegate>,
4987    _additional_params: HashMap<String, String>,
4988    _scopes: BTreeSet<String>,
4989}
4990
4991impl<'a, C> common::CallBuilder for ProjectLocationFederationSetIamPolicyCall<'a, C> {}
4992
4993impl<'a, C> ProjectLocationFederationSetIamPolicyCall<'a, C>
4994where
4995    C: common::Connector,
4996{
4997    /// Perform the operation you have build so far.
4998    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4999        use std::borrow::Cow;
5000        use std::io::{Read, Seek};
5001
5002        use common::{url::Params, ToParts};
5003        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5004
5005        let mut dd = common::DefaultDelegate;
5006        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5007        dlg.begin(common::MethodInfo {
5008            id: "metastore.projects.locations.federations.setIamPolicy",
5009            http_method: hyper::Method::POST,
5010        });
5011
5012        for &field in ["alt", "resource"].iter() {
5013            if self._additional_params.contains_key(field) {
5014                dlg.finished(false);
5015                return Err(common::Error::FieldClash(field));
5016            }
5017        }
5018
5019        let mut params = Params::with_capacity(4 + self._additional_params.len());
5020        params.push("resource", self._resource);
5021
5022        params.extend(self._additional_params.iter());
5023
5024        params.push("alt", "json");
5025        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:setIamPolicy";
5026        if self._scopes.is_empty() {
5027            self._scopes
5028                .insert(Scope::CloudPlatform.as_ref().to_string());
5029        }
5030
5031        #[allow(clippy::single_element_loop)]
5032        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5033            url = params.uri_replacement(url, param_name, find_this, true);
5034        }
5035        {
5036            let to_remove = ["resource"];
5037            params.remove_params(&to_remove);
5038        }
5039
5040        let url = params.parse_with_url(&url);
5041
5042        let mut json_mime_type = mime::APPLICATION_JSON;
5043        let mut request_value_reader = {
5044            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5045            common::remove_json_null_values(&mut value);
5046            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5047            serde_json::to_writer(&mut dst, &value).unwrap();
5048            dst
5049        };
5050        let request_size = request_value_reader
5051            .seek(std::io::SeekFrom::End(0))
5052            .unwrap();
5053        request_value_reader
5054            .seek(std::io::SeekFrom::Start(0))
5055            .unwrap();
5056
5057        loop {
5058            let token = match self
5059                .hub
5060                .auth
5061                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5062                .await
5063            {
5064                Ok(token) => token,
5065                Err(e) => match dlg.token(e) {
5066                    Ok(token) => token,
5067                    Err(e) => {
5068                        dlg.finished(false);
5069                        return Err(common::Error::MissingToken(e));
5070                    }
5071                },
5072            };
5073            request_value_reader
5074                .seek(std::io::SeekFrom::Start(0))
5075                .unwrap();
5076            let mut req_result = {
5077                let client = &self.hub.client;
5078                dlg.pre_request();
5079                let mut req_builder = hyper::Request::builder()
5080                    .method(hyper::Method::POST)
5081                    .uri(url.as_str())
5082                    .header(USER_AGENT, self.hub._user_agent.clone());
5083
5084                if let Some(token) = token.as_ref() {
5085                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5086                }
5087
5088                let request = req_builder
5089                    .header(CONTENT_TYPE, json_mime_type.to_string())
5090                    .header(CONTENT_LENGTH, request_size as u64)
5091                    .body(common::to_body(
5092                        request_value_reader.get_ref().clone().into(),
5093                    ));
5094
5095                client.request(request.unwrap()).await
5096            };
5097
5098            match req_result {
5099                Err(err) => {
5100                    if let common::Retry::After(d) = dlg.http_error(&err) {
5101                        sleep(d).await;
5102                        continue;
5103                    }
5104                    dlg.finished(false);
5105                    return Err(common::Error::HttpError(err));
5106                }
5107                Ok(res) => {
5108                    let (mut parts, body) = res.into_parts();
5109                    let mut body = common::Body::new(body);
5110                    if !parts.status.is_success() {
5111                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5112                        let error = serde_json::from_str(&common::to_string(&bytes));
5113                        let response = common::to_response(parts, bytes.into());
5114
5115                        if let common::Retry::After(d) =
5116                            dlg.http_failure(&response, error.as_ref().ok())
5117                        {
5118                            sleep(d).await;
5119                            continue;
5120                        }
5121
5122                        dlg.finished(false);
5123
5124                        return Err(match error {
5125                            Ok(value) => common::Error::BadRequest(value),
5126                            _ => common::Error::Failure(response),
5127                        });
5128                    }
5129                    let response = {
5130                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5131                        let encoded = common::to_string(&bytes);
5132                        match serde_json::from_str(&encoded) {
5133                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5134                            Err(error) => {
5135                                dlg.response_json_decode_error(&encoded, &error);
5136                                return Err(common::Error::JsonDecodeError(
5137                                    encoded.to_string(),
5138                                    error,
5139                                ));
5140                            }
5141                        }
5142                    };
5143
5144                    dlg.finished(true);
5145                    return Ok(response);
5146                }
5147            }
5148        }
5149    }
5150
5151    ///
5152    /// Sets the *request* property to the given value.
5153    ///
5154    /// Even though the property as already been set when instantiating this call,
5155    /// we provide this method for API completeness.
5156    pub fn request(
5157        mut self,
5158        new_value: SetIamPolicyRequest,
5159    ) -> ProjectLocationFederationSetIamPolicyCall<'a, C> {
5160        self._request = new_value;
5161        self
5162    }
5163    /// 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.
5164    ///
5165    /// Sets the *resource* path property to the given value.
5166    ///
5167    /// Even though the property as already been set when instantiating this call,
5168    /// we provide this method for API completeness.
5169    pub fn resource(mut self, new_value: &str) -> ProjectLocationFederationSetIamPolicyCall<'a, C> {
5170        self._resource = new_value.to_string();
5171        self
5172    }
5173    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5174    /// while executing the actual API request.
5175    ///
5176    /// ````text
5177    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5178    /// ````
5179    ///
5180    /// Sets the *delegate* property to the given value.
5181    pub fn delegate(
5182        mut self,
5183        new_value: &'a mut dyn common::Delegate,
5184    ) -> ProjectLocationFederationSetIamPolicyCall<'a, C> {
5185        self._delegate = Some(new_value);
5186        self
5187    }
5188
5189    /// Set any additional parameter of the query string used in the request.
5190    /// It should be used to set parameters which are not yet available through their own
5191    /// setters.
5192    ///
5193    /// Please note that this method must not be used to set any of the known parameters
5194    /// which have their own setter method. If done anyway, the request will fail.
5195    ///
5196    /// # Additional Parameters
5197    ///
5198    /// * *$.xgafv* (query-string) - V1 error format.
5199    /// * *access_token* (query-string) - OAuth access token.
5200    /// * *alt* (query-string) - Data format for response.
5201    /// * *callback* (query-string) - JSONP
5202    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5203    /// * *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.
5204    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5205    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5206    /// * *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.
5207    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5208    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5209    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFederationSetIamPolicyCall<'a, C>
5210    where
5211        T: AsRef<str>,
5212    {
5213        self._additional_params
5214            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5215        self
5216    }
5217
5218    /// Identifies the authorization scope for the method you are building.
5219    ///
5220    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5221    /// [`Scope::CloudPlatform`].
5222    ///
5223    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5224    /// tokens for more than one scope.
5225    ///
5226    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5227    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5228    /// sufficient, a read-write scope will do as well.
5229    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFederationSetIamPolicyCall<'a, C>
5230    where
5231        St: AsRef<str>,
5232    {
5233        self._scopes.insert(String::from(scope.as_ref()));
5234        self
5235    }
5236    /// Identifies the authorization scope(s) for the method you are building.
5237    ///
5238    /// See [`Self::add_scope()`] for details.
5239    pub fn add_scopes<I, St>(
5240        mut self,
5241        scopes: I,
5242    ) -> ProjectLocationFederationSetIamPolicyCall<'a, C>
5243    where
5244        I: IntoIterator<Item = St>,
5245        St: AsRef<str>,
5246    {
5247        self._scopes
5248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5249        self
5250    }
5251
5252    /// Removes all scopes, and no default scope will be used either.
5253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5254    /// for details).
5255    pub fn clear_scopes(mut self) -> ProjectLocationFederationSetIamPolicyCall<'a, C> {
5256        self._scopes.clear();
5257        self
5258    }
5259}
5260
5261/// 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.
5262///
5263/// A builder for the *locations.federations.testIamPermissions* method supported by a *project* resource.
5264/// It is not used directly, but through a [`ProjectMethods`] instance.
5265///
5266/// # Example
5267///
5268/// Instantiate a resource method builder
5269///
5270/// ```test_harness,no_run
5271/// # extern crate hyper;
5272/// # extern crate hyper_rustls;
5273/// # extern crate google_metastore1_beta as metastore1_beta;
5274/// use metastore1_beta::api::TestIamPermissionsRequest;
5275/// # async fn dox() {
5276/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5277///
5278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5279/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5280/// #     .with_native_roots()
5281/// #     .unwrap()
5282/// #     .https_only()
5283/// #     .enable_http2()
5284/// #     .build();
5285///
5286/// # let executor = hyper_util::rt::TokioExecutor::new();
5287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5288/// #     secret,
5289/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5290/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5291/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5292/// #     ),
5293/// # ).build().await.unwrap();
5294///
5295/// # let client = hyper_util::client::legacy::Client::builder(
5296/// #     hyper_util::rt::TokioExecutor::new()
5297/// # )
5298/// # .build(
5299/// #     hyper_rustls::HttpsConnectorBuilder::new()
5300/// #         .with_native_roots()
5301/// #         .unwrap()
5302/// #         .https_or_http()
5303/// #         .enable_http2()
5304/// #         .build()
5305/// # );
5306/// # let mut hub = DataprocMetastore::new(client, auth);
5307/// // As the method needs a request, you would usually fill it with the desired information
5308/// // into the respective structure. Some of the parts shown here might not be applicable !
5309/// // Values shown here are possibly random and not representative !
5310/// let mut req = TestIamPermissionsRequest::default();
5311///
5312/// // You can configure optional parameters by calling the respective setters at will, and
5313/// // execute the final call using `doit()`.
5314/// // Values shown here are possibly random and not representative !
5315/// let result = hub.projects().locations_federations_test_iam_permissions(req, "resource")
5316///              .doit().await;
5317/// # }
5318/// ```
5319pub struct ProjectLocationFederationTestIamPermissionCall<'a, C>
5320where
5321    C: 'a,
5322{
5323    hub: &'a DataprocMetastore<C>,
5324    _request: TestIamPermissionsRequest,
5325    _resource: String,
5326    _delegate: Option<&'a mut dyn common::Delegate>,
5327    _additional_params: HashMap<String, String>,
5328    _scopes: BTreeSet<String>,
5329}
5330
5331impl<'a, C> common::CallBuilder for ProjectLocationFederationTestIamPermissionCall<'a, C> {}
5332
5333impl<'a, C> ProjectLocationFederationTestIamPermissionCall<'a, C>
5334where
5335    C: common::Connector,
5336{
5337    /// Perform the operation you have build so far.
5338    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
5339        use std::borrow::Cow;
5340        use std::io::{Read, Seek};
5341
5342        use common::{url::Params, ToParts};
5343        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5344
5345        let mut dd = common::DefaultDelegate;
5346        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5347        dlg.begin(common::MethodInfo {
5348            id: "metastore.projects.locations.federations.testIamPermissions",
5349            http_method: hyper::Method::POST,
5350        });
5351
5352        for &field in ["alt", "resource"].iter() {
5353            if self._additional_params.contains_key(field) {
5354                dlg.finished(false);
5355                return Err(common::Error::FieldClash(field));
5356            }
5357        }
5358
5359        let mut params = Params::with_capacity(4 + self._additional_params.len());
5360        params.push("resource", self._resource);
5361
5362        params.extend(self._additional_params.iter());
5363
5364        params.push("alt", "json");
5365        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:testIamPermissions";
5366        if self._scopes.is_empty() {
5367            self._scopes
5368                .insert(Scope::CloudPlatform.as_ref().to_string());
5369        }
5370
5371        #[allow(clippy::single_element_loop)]
5372        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5373            url = params.uri_replacement(url, param_name, find_this, true);
5374        }
5375        {
5376            let to_remove = ["resource"];
5377            params.remove_params(&to_remove);
5378        }
5379
5380        let url = params.parse_with_url(&url);
5381
5382        let mut json_mime_type = mime::APPLICATION_JSON;
5383        let mut request_value_reader = {
5384            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5385            common::remove_json_null_values(&mut value);
5386            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5387            serde_json::to_writer(&mut dst, &value).unwrap();
5388            dst
5389        };
5390        let request_size = request_value_reader
5391            .seek(std::io::SeekFrom::End(0))
5392            .unwrap();
5393        request_value_reader
5394            .seek(std::io::SeekFrom::Start(0))
5395            .unwrap();
5396
5397        loop {
5398            let token = match self
5399                .hub
5400                .auth
5401                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5402                .await
5403            {
5404                Ok(token) => token,
5405                Err(e) => match dlg.token(e) {
5406                    Ok(token) => token,
5407                    Err(e) => {
5408                        dlg.finished(false);
5409                        return Err(common::Error::MissingToken(e));
5410                    }
5411                },
5412            };
5413            request_value_reader
5414                .seek(std::io::SeekFrom::Start(0))
5415                .unwrap();
5416            let mut req_result = {
5417                let client = &self.hub.client;
5418                dlg.pre_request();
5419                let mut req_builder = hyper::Request::builder()
5420                    .method(hyper::Method::POST)
5421                    .uri(url.as_str())
5422                    .header(USER_AGENT, self.hub._user_agent.clone());
5423
5424                if let Some(token) = token.as_ref() {
5425                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5426                }
5427
5428                let request = req_builder
5429                    .header(CONTENT_TYPE, json_mime_type.to_string())
5430                    .header(CONTENT_LENGTH, request_size as u64)
5431                    .body(common::to_body(
5432                        request_value_reader.get_ref().clone().into(),
5433                    ));
5434
5435                client.request(request.unwrap()).await
5436            };
5437
5438            match req_result {
5439                Err(err) => {
5440                    if let common::Retry::After(d) = dlg.http_error(&err) {
5441                        sleep(d).await;
5442                        continue;
5443                    }
5444                    dlg.finished(false);
5445                    return Err(common::Error::HttpError(err));
5446                }
5447                Ok(res) => {
5448                    let (mut parts, body) = res.into_parts();
5449                    let mut body = common::Body::new(body);
5450                    if !parts.status.is_success() {
5451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5452                        let error = serde_json::from_str(&common::to_string(&bytes));
5453                        let response = common::to_response(parts, bytes.into());
5454
5455                        if let common::Retry::After(d) =
5456                            dlg.http_failure(&response, error.as_ref().ok())
5457                        {
5458                            sleep(d).await;
5459                            continue;
5460                        }
5461
5462                        dlg.finished(false);
5463
5464                        return Err(match error {
5465                            Ok(value) => common::Error::BadRequest(value),
5466                            _ => common::Error::Failure(response),
5467                        });
5468                    }
5469                    let response = {
5470                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5471                        let encoded = common::to_string(&bytes);
5472                        match serde_json::from_str(&encoded) {
5473                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5474                            Err(error) => {
5475                                dlg.response_json_decode_error(&encoded, &error);
5476                                return Err(common::Error::JsonDecodeError(
5477                                    encoded.to_string(),
5478                                    error,
5479                                ));
5480                            }
5481                        }
5482                    };
5483
5484                    dlg.finished(true);
5485                    return Ok(response);
5486                }
5487            }
5488        }
5489    }
5490
5491    ///
5492    /// Sets the *request* property to the given value.
5493    ///
5494    /// Even though the property as already been set when instantiating this call,
5495    /// we provide this method for API completeness.
5496    pub fn request(
5497        mut self,
5498        new_value: TestIamPermissionsRequest,
5499    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C> {
5500        self._request = new_value;
5501        self
5502    }
5503    /// 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.
5504    ///
5505    /// Sets the *resource* path property to the given value.
5506    ///
5507    /// Even though the property as already been set when instantiating this call,
5508    /// we provide this method for API completeness.
5509    pub fn resource(
5510        mut self,
5511        new_value: &str,
5512    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C> {
5513        self._resource = new_value.to_string();
5514        self
5515    }
5516    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5517    /// while executing the actual API request.
5518    ///
5519    /// ````text
5520    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5521    /// ````
5522    ///
5523    /// Sets the *delegate* property to the given value.
5524    pub fn delegate(
5525        mut self,
5526        new_value: &'a mut dyn common::Delegate,
5527    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C> {
5528        self._delegate = Some(new_value);
5529        self
5530    }
5531
5532    /// Set any additional parameter of the query string used in the request.
5533    /// It should be used to set parameters which are not yet available through their own
5534    /// setters.
5535    ///
5536    /// Please note that this method must not be used to set any of the known parameters
5537    /// which have their own setter method. If done anyway, the request will fail.
5538    ///
5539    /// # Additional Parameters
5540    ///
5541    /// * *$.xgafv* (query-string) - V1 error format.
5542    /// * *access_token* (query-string) - OAuth access token.
5543    /// * *alt* (query-string) - Data format for response.
5544    /// * *callback* (query-string) - JSONP
5545    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5546    /// * *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.
5547    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5548    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5549    /// * *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.
5550    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5551    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5552    pub fn param<T>(
5553        mut self,
5554        name: T,
5555        value: T,
5556    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C>
5557    where
5558        T: AsRef<str>,
5559    {
5560        self._additional_params
5561            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5562        self
5563    }
5564
5565    /// Identifies the authorization scope for the method you are building.
5566    ///
5567    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5568    /// [`Scope::CloudPlatform`].
5569    ///
5570    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5571    /// tokens for more than one scope.
5572    ///
5573    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5574    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5575    /// sufficient, a read-write scope will do as well.
5576    pub fn add_scope<St>(
5577        mut self,
5578        scope: St,
5579    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C>
5580    where
5581        St: AsRef<str>,
5582    {
5583        self._scopes.insert(String::from(scope.as_ref()));
5584        self
5585    }
5586    /// Identifies the authorization scope(s) for the method you are building.
5587    ///
5588    /// See [`Self::add_scope()`] for details.
5589    pub fn add_scopes<I, St>(
5590        mut self,
5591        scopes: I,
5592    ) -> ProjectLocationFederationTestIamPermissionCall<'a, C>
5593    where
5594        I: IntoIterator<Item = St>,
5595        St: AsRef<str>,
5596    {
5597        self._scopes
5598            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5599        self
5600    }
5601
5602    /// Removes all scopes, and no default scope will be used either.
5603    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5604    /// for details).
5605    pub fn clear_scopes(mut self) -> ProjectLocationFederationTestIamPermissionCall<'a, C> {
5606        self._scopes.clear();
5607        self
5608    }
5609}
5610
5611/// 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.
5612///
5613/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
5614/// It is not used directly, but through a [`ProjectMethods`] instance.
5615///
5616/// # Example
5617///
5618/// Instantiate a resource method builder
5619///
5620/// ```test_harness,no_run
5621/// # extern crate hyper;
5622/// # extern crate hyper_rustls;
5623/// # extern crate google_metastore1_beta as metastore1_beta;
5624/// use metastore1_beta::api::CancelOperationRequest;
5625/// # async fn dox() {
5626/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5627///
5628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5630/// #     .with_native_roots()
5631/// #     .unwrap()
5632/// #     .https_only()
5633/// #     .enable_http2()
5634/// #     .build();
5635///
5636/// # let executor = hyper_util::rt::TokioExecutor::new();
5637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5638/// #     secret,
5639/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5640/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5641/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5642/// #     ),
5643/// # ).build().await.unwrap();
5644///
5645/// # let client = hyper_util::client::legacy::Client::builder(
5646/// #     hyper_util::rt::TokioExecutor::new()
5647/// # )
5648/// # .build(
5649/// #     hyper_rustls::HttpsConnectorBuilder::new()
5650/// #         .with_native_roots()
5651/// #         .unwrap()
5652/// #         .https_or_http()
5653/// #         .enable_http2()
5654/// #         .build()
5655/// # );
5656/// # let mut hub = DataprocMetastore::new(client, auth);
5657/// // As the method needs a request, you would usually fill it with the desired information
5658/// // into the respective structure. Some of the parts shown here might not be applicable !
5659/// // Values shown here are possibly random and not representative !
5660/// let mut req = CancelOperationRequest::default();
5661///
5662/// // You can configure optional parameters by calling the respective setters at will, and
5663/// // execute the final call using `doit()`.
5664/// // Values shown here are possibly random and not representative !
5665/// let result = hub.projects().locations_operations_cancel(req, "name")
5666///              .doit().await;
5667/// # }
5668/// ```
5669pub struct ProjectLocationOperationCancelCall<'a, C>
5670where
5671    C: 'a,
5672{
5673    hub: &'a DataprocMetastore<C>,
5674    _request: CancelOperationRequest,
5675    _name: String,
5676    _delegate: Option<&'a mut dyn common::Delegate>,
5677    _additional_params: HashMap<String, String>,
5678    _scopes: BTreeSet<String>,
5679}
5680
5681impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
5682
5683impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
5684where
5685    C: common::Connector,
5686{
5687    /// Perform the operation you have build so far.
5688    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5689        use std::borrow::Cow;
5690        use std::io::{Read, Seek};
5691
5692        use common::{url::Params, ToParts};
5693        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5694
5695        let mut dd = common::DefaultDelegate;
5696        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5697        dlg.begin(common::MethodInfo {
5698            id: "metastore.projects.locations.operations.cancel",
5699            http_method: hyper::Method::POST,
5700        });
5701
5702        for &field in ["alt", "name"].iter() {
5703            if self._additional_params.contains_key(field) {
5704                dlg.finished(false);
5705                return Err(common::Error::FieldClash(field));
5706            }
5707        }
5708
5709        let mut params = Params::with_capacity(4 + self._additional_params.len());
5710        params.push("name", self._name);
5711
5712        params.extend(self._additional_params.iter());
5713
5714        params.push("alt", "json");
5715        let mut url = self.hub._base_url.clone() + "v1beta/{+name}:cancel";
5716        if self._scopes.is_empty() {
5717            self._scopes
5718                .insert(Scope::CloudPlatform.as_ref().to_string());
5719        }
5720
5721        #[allow(clippy::single_element_loop)]
5722        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5723            url = params.uri_replacement(url, param_name, find_this, true);
5724        }
5725        {
5726            let to_remove = ["name"];
5727            params.remove_params(&to_remove);
5728        }
5729
5730        let url = params.parse_with_url(&url);
5731
5732        let mut json_mime_type = mime::APPLICATION_JSON;
5733        let mut request_value_reader = {
5734            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5735            common::remove_json_null_values(&mut value);
5736            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5737            serde_json::to_writer(&mut dst, &value).unwrap();
5738            dst
5739        };
5740        let request_size = request_value_reader
5741            .seek(std::io::SeekFrom::End(0))
5742            .unwrap();
5743        request_value_reader
5744            .seek(std::io::SeekFrom::Start(0))
5745            .unwrap();
5746
5747        loop {
5748            let token = match self
5749                .hub
5750                .auth
5751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5752                .await
5753            {
5754                Ok(token) => token,
5755                Err(e) => match dlg.token(e) {
5756                    Ok(token) => token,
5757                    Err(e) => {
5758                        dlg.finished(false);
5759                        return Err(common::Error::MissingToken(e));
5760                    }
5761                },
5762            };
5763            request_value_reader
5764                .seek(std::io::SeekFrom::Start(0))
5765                .unwrap();
5766            let mut req_result = {
5767                let client = &self.hub.client;
5768                dlg.pre_request();
5769                let mut req_builder = hyper::Request::builder()
5770                    .method(hyper::Method::POST)
5771                    .uri(url.as_str())
5772                    .header(USER_AGENT, self.hub._user_agent.clone());
5773
5774                if let Some(token) = token.as_ref() {
5775                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5776                }
5777
5778                let request = req_builder
5779                    .header(CONTENT_TYPE, json_mime_type.to_string())
5780                    .header(CONTENT_LENGTH, request_size as u64)
5781                    .body(common::to_body(
5782                        request_value_reader.get_ref().clone().into(),
5783                    ));
5784
5785                client.request(request.unwrap()).await
5786            };
5787
5788            match req_result {
5789                Err(err) => {
5790                    if let common::Retry::After(d) = dlg.http_error(&err) {
5791                        sleep(d).await;
5792                        continue;
5793                    }
5794                    dlg.finished(false);
5795                    return Err(common::Error::HttpError(err));
5796                }
5797                Ok(res) => {
5798                    let (mut parts, body) = res.into_parts();
5799                    let mut body = common::Body::new(body);
5800                    if !parts.status.is_success() {
5801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5802                        let error = serde_json::from_str(&common::to_string(&bytes));
5803                        let response = common::to_response(parts, bytes.into());
5804
5805                        if let common::Retry::After(d) =
5806                            dlg.http_failure(&response, error.as_ref().ok())
5807                        {
5808                            sleep(d).await;
5809                            continue;
5810                        }
5811
5812                        dlg.finished(false);
5813
5814                        return Err(match error {
5815                            Ok(value) => common::Error::BadRequest(value),
5816                            _ => common::Error::Failure(response),
5817                        });
5818                    }
5819                    let response = {
5820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5821                        let encoded = common::to_string(&bytes);
5822                        match serde_json::from_str(&encoded) {
5823                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5824                            Err(error) => {
5825                                dlg.response_json_decode_error(&encoded, &error);
5826                                return Err(common::Error::JsonDecodeError(
5827                                    encoded.to_string(),
5828                                    error,
5829                                ));
5830                            }
5831                        }
5832                    };
5833
5834                    dlg.finished(true);
5835                    return Ok(response);
5836                }
5837            }
5838        }
5839    }
5840
5841    ///
5842    /// Sets the *request* property to the given value.
5843    ///
5844    /// Even though the property as already been set when instantiating this call,
5845    /// we provide this method for API completeness.
5846    pub fn request(
5847        mut self,
5848        new_value: CancelOperationRequest,
5849    ) -> ProjectLocationOperationCancelCall<'a, C> {
5850        self._request = new_value;
5851        self
5852    }
5853    /// The name of the operation resource to be cancelled.
5854    ///
5855    /// Sets the *name* path property to the given value.
5856    ///
5857    /// Even though the property as already been set when instantiating this call,
5858    /// we provide this method for API completeness.
5859    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
5860        self._name = new_value.to_string();
5861        self
5862    }
5863    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5864    /// while executing the actual API request.
5865    ///
5866    /// ````text
5867    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5868    /// ````
5869    ///
5870    /// Sets the *delegate* property to the given value.
5871    pub fn delegate(
5872        mut self,
5873        new_value: &'a mut dyn common::Delegate,
5874    ) -> ProjectLocationOperationCancelCall<'a, C> {
5875        self._delegate = Some(new_value);
5876        self
5877    }
5878
5879    /// Set any additional parameter of the query string used in the request.
5880    /// It should be used to set parameters which are not yet available through their own
5881    /// setters.
5882    ///
5883    /// Please note that this method must not be used to set any of the known parameters
5884    /// which have their own setter method. If done anyway, the request will fail.
5885    ///
5886    /// # Additional Parameters
5887    ///
5888    /// * *$.xgafv* (query-string) - V1 error format.
5889    /// * *access_token* (query-string) - OAuth access token.
5890    /// * *alt* (query-string) - Data format for response.
5891    /// * *callback* (query-string) - JSONP
5892    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5893    /// * *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.
5894    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5895    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5896    /// * *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.
5897    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5898    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5899    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
5900    where
5901        T: AsRef<str>,
5902    {
5903        self._additional_params
5904            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5905        self
5906    }
5907
5908    /// Identifies the authorization scope for the method you are building.
5909    ///
5910    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5911    /// [`Scope::CloudPlatform`].
5912    ///
5913    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5914    /// tokens for more than one scope.
5915    ///
5916    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5917    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5918    /// sufficient, a read-write scope will do as well.
5919    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
5920    where
5921        St: AsRef<str>,
5922    {
5923        self._scopes.insert(String::from(scope.as_ref()));
5924        self
5925    }
5926    /// Identifies the authorization scope(s) for the method you are building.
5927    ///
5928    /// See [`Self::add_scope()`] for details.
5929    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
5930    where
5931        I: IntoIterator<Item = St>,
5932        St: AsRef<str>,
5933    {
5934        self._scopes
5935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5936        self
5937    }
5938
5939    /// Removes all scopes, and no default scope will be used either.
5940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5941    /// for details).
5942    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
5943        self._scopes.clear();
5944        self
5945    }
5946}
5947
5948/// 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.
5949///
5950/// A builder for the *locations.operations.delete* method supported by a *project* resource.
5951/// It is not used directly, but through a [`ProjectMethods`] instance.
5952///
5953/// # Example
5954///
5955/// Instantiate a resource method builder
5956///
5957/// ```test_harness,no_run
5958/// # extern crate hyper;
5959/// # extern crate hyper_rustls;
5960/// # extern crate google_metastore1_beta as metastore1_beta;
5961/// # async fn dox() {
5962/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5963///
5964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5965/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5966/// #     .with_native_roots()
5967/// #     .unwrap()
5968/// #     .https_only()
5969/// #     .enable_http2()
5970/// #     .build();
5971///
5972/// # let executor = hyper_util::rt::TokioExecutor::new();
5973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5974/// #     secret,
5975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5976/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5977/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5978/// #     ),
5979/// # ).build().await.unwrap();
5980///
5981/// # let client = hyper_util::client::legacy::Client::builder(
5982/// #     hyper_util::rt::TokioExecutor::new()
5983/// # )
5984/// # .build(
5985/// #     hyper_rustls::HttpsConnectorBuilder::new()
5986/// #         .with_native_roots()
5987/// #         .unwrap()
5988/// #         .https_or_http()
5989/// #         .enable_http2()
5990/// #         .build()
5991/// # );
5992/// # let mut hub = DataprocMetastore::new(client, auth);
5993/// // You can configure optional parameters by calling the respective setters at will, and
5994/// // execute the final call using `doit()`.
5995/// // Values shown here are possibly random and not representative !
5996/// let result = hub.projects().locations_operations_delete("name")
5997///              .doit().await;
5998/// # }
5999/// ```
6000pub struct ProjectLocationOperationDeleteCall<'a, C>
6001where
6002    C: 'a,
6003{
6004    hub: &'a DataprocMetastore<C>,
6005    _name: String,
6006    _delegate: Option<&'a mut dyn common::Delegate>,
6007    _additional_params: HashMap<String, String>,
6008    _scopes: BTreeSet<String>,
6009}
6010
6011impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
6012
6013impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
6014where
6015    C: common::Connector,
6016{
6017    /// Perform the operation you have build so far.
6018    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6019        use std::borrow::Cow;
6020        use std::io::{Read, Seek};
6021
6022        use common::{url::Params, ToParts};
6023        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6024
6025        let mut dd = common::DefaultDelegate;
6026        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6027        dlg.begin(common::MethodInfo {
6028            id: "metastore.projects.locations.operations.delete",
6029            http_method: hyper::Method::DELETE,
6030        });
6031
6032        for &field in ["alt", "name"].iter() {
6033            if self._additional_params.contains_key(field) {
6034                dlg.finished(false);
6035                return Err(common::Error::FieldClash(field));
6036            }
6037        }
6038
6039        let mut params = Params::with_capacity(3 + self._additional_params.len());
6040        params.push("name", self._name);
6041
6042        params.extend(self._additional_params.iter());
6043
6044        params.push("alt", "json");
6045        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
6046        if self._scopes.is_empty() {
6047            self._scopes
6048                .insert(Scope::CloudPlatform.as_ref().to_string());
6049        }
6050
6051        #[allow(clippy::single_element_loop)]
6052        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6053            url = params.uri_replacement(url, param_name, find_this, true);
6054        }
6055        {
6056            let to_remove = ["name"];
6057            params.remove_params(&to_remove);
6058        }
6059
6060        let url = params.parse_with_url(&url);
6061
6062        loop {
6063            let token = match self
6064                .hub
6065                .auth
6066                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6067                .await
6068            {
6069                Ok(token) => token,
6070                Err(e) => match dlg.token(e) {
6071                    Ok(token) => token,
6072                    Err(e) => {
6073                        dlg.finished(false);
6074                        return Err(common::Error::MissingToken(e));
6075                    }
6076                },
6077            };
6078            let mut req_result = {
6079                let client = &self.hub.client;
6080                dlg.pre_request();
6081                let mut req_builder = hyper::Request::builder()
6082                    .method(hyper::Method::DELETE)
6083                    .uri(url.as_str())
6084                    .header(USER_AGENT, self.hub._user_agent.clone());
6085
6086                if let Some(token) = token.as_ref() {
6087                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6088                }
6089
6090                let request = req_builder
6091                    .header(CONTENT_LENGTH, 0_u64)
6092                    .body(common::to_body::<String>(None));
6093
6094                client.request(request.unwrap()).await
6095            };
6096
6097            match req_result {
6098                Err(err) => {
6099                    if let common::Retry::After(d) = dlg.http_error(&err) {
6100                        sleep(d).await;
6101                        continue;
6102                    }
6103                    dlg.finished(false);
6104                    return Err(common::Error::HttpError(err));
6105                }
6106                Ok(res) => {
6107                    let (mut parts, body) = res.into_parts();
6108                    let mut body = common::Body::new(body);
6109                    if !parts.status.is_success() {
6110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6111                        let error = serde_json::from_str(&common::to_string(&bytes));
6112                        let response = common::to_response(parts, bytes.into());
6113
6114                        if let common::Retry::After(d) =
6115                            dlg.http_failure(&response, error.as_ref().ok())
6116                        {
6117                            sleep(d).await;
6118                            continue;
6119                        }
6120
6121                        dlg.finished(false);
6122
6123                        return Err(match error {
6124                            Ok(value) => common::Error::BadRequest(value),
6125                            _ => common::Error::Failure(response),
6126                        });
6127                    }
6128                    let response = {
6129                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6130                        let encoded = common::to_string(&bytes);
6131                        match serde_json::from_str(&encoded) {
6132                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6133                            Err(error) => {
6134                                dlg.response_json_decode_error(&encoded, &error);
6135                                return Err(common::Error::JsonDecodeError(
6136                                    encoded.to_string(),
6137                                    error,
6138                                ));
6139                            }
6140                        }
6141                    };
6142
6143                    dlg.finished(true);
6144                    return Ok(response);
6145                }
6146            }
6147        }
6148    }
6149
6150    /// The name of the operation resource to be deleted.
6151    ///
6152    /// Sets the *name* path property to the given value.
6153    ///
6154    /// Even though the property as already been set when instantiating this call,
6155    /// we provide this method for API completeness.
6156    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
6157        self._name = new_value.to_string();
6158        self
6159    }
6160    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6161    /// while executing the actual API request.
6162    ///
6163    /// ````text
6164    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6165    /// ````
6166    ///
6167    /// Sets the *delegate* property to the given value.
6168    pub fn delegate(
6169        mut self,
6170        new_value: &'a mut dyn common::Delegate,
6171    ) -> ProjectLocationOperationDeleteCall<'a, C> {
6172        self._delegate = Some(new_value);
6173        self
6174    }
6175
6176    /// Set any additional parameter of the query string used in the request.
6177    /// It should be used to set parameters which are not yet available through their own
6178    /// setters.
6179    ///
6180    /// Please note that this method must not be used to set any of the known parameters
6181    /// which have their own setter method. If done anyway, the request will fail.
6182    ///
6183    /// # Additional Parameters
6184    ///
6185    /// * *$.xgafv* (query-string) - V1 error format.
6186    /// * *access_token* (query-string) - OAuth access token.
6187    /// * *alt* (query-string) - Data format for response.
6188    /// * *callback* (query-string) - JSONP
6189    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6190    /// * *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.
6191    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6192    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6193    /// * *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.
6194    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6195    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6196    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
6197    where
6198        T: AsRef<str>,
6199    {
6200        self._additional_params
6201            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6202        self
6203    }
6204
6205    /// Identifies the authorization scope for the method you are building.
6206    ///
6207    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6208    /// [`Scope::CloudPlatform`].
6209    ///
6210    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6211    /// tokens for more than one scope.
6212    ///
6213    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6214    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6215    /// sufficient, a read-write scope will do as well.
6216    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
6217    where
6218        St: AsRef<str>,
6219    {
6220        self._scopes.insert(String::from(scope.as_ref()));
6221        self
6222    }
6223    /// Identifies the authorization scope(s) for the method you are building.
6224    ///
6225    /// See [`Self::add_scope()`] for details.
6226    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
6227    where
6228        I: IntoIterator<Item = St>,
6229        St: AsRef<str>,
6230    {
6231        self._scopes
6232            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6233        self
6234    }
6235
6236    /// Removes all scopes, and no default scope will be used either.
6237    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6238    /// for details).
6239    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
6240        self._scopes.clear();
6241        self
6242    }
6243}
6244
6245/// 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.
6246///
6247/// A builder for the *locations.operations.get* method supported by a *project* resource.
6248/// It is not used directly, but through a [`ProjectMethods`] instance.
6249///
6250/// # Example
6251///
6252/// Instantiate a resource method builder
6253///
6254/// ```test_harness,no_run
6255/// # extern crate hyper;
6256/// # extern crate hyper_rustls;
6257/// # extern crate google_metastore1_beta as metastore1_beta;
6258/// # async fn dox() {
6259/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6260///
6261/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6262/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6263/// #     .with_native_roots()
6264/// #     .unwrap()
6265/// #     .https_only()
6266/// #     .enable_http2()
6267/// #     .build();
6268///
6269/// # let executor = hyper_util::rt::TokioExecutor::new();
6270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6271/// #     secret,
6272/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6273/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6274/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6275/// #     ),
6276/// # ).build().await.unwrap();
6277///
6278/// # let client = hyper_util::client::legacy::Client::builder(
6279/// #     hyper_util::rt::TokioExecutor::new()
6280/// # )
6281/// # .build(
6282/// #     hyper_rustls::HttpsConnectorBuilder::new()
6283/// #         .with_native_roots()
6284/// #         .unwrap()
6285/// #         .https_or_http()
6286/// #         .enable_http2()
6287/// #         .build()
6288/// # );
6289/// # let mut hub = DataprocMetastore::new(client, auth);
6290/// // You can configure optional parameters by calling the respective setters at will, and
6291/// // execute the final call using `doit()`.
6292/// // Values shown here are possibly random and not representative !
6293/// let result = hub.projects().locations_operations_get("name")
6294///              .doit().await;
6295/// # }
6296/// ```
6297pub struct ProjectLocationOperationGetCall<'a, C>
6298where
6299    C: 'a,
6300{
6301    hub: &'a DataprocMetastore<C>,
6302    _name: String,
6303    _delegate: Option<&'a mut dyn common::Delegate>,
6304    _additional_params: HashMap<String, String>,
6305    _scopes: BTreeSet<String>,
6306}
6307
6308impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
6309
6310impl<'a, C> ProjectLocationOperationGetCall<'a, C>
6311where
6312    C: common::Connector,
6313{
6314    /// Perform the operation you have build so far.
6315    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6316        use std::borrow::Cow;
6317        use std::io::{Read, Seek};
6318
6319        use common::{url::Params, ToParts};
6320        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6321
6322        let mut dd = common::DefaultDelegate;
6323        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6324        dlg.begin(common::MethodInfo {
6325            id: "metastore.projects.locations.operations.get",
6326            http_method: hyper::Method::GET,
6327        });
6328
6329        for &field in ["alt", "name"].iter() {
6330            if self._additional_params.contains_key(field) {
6331                dlg.finished(false);
6332                return Err(common::Error::FieldClash(field));
6333            }
6334        }
6335
6336        let mut params = Params::with_capacity(3 + self._additional_params.len());
6337        params.push("name", self._name);
6338
6339        params.extend(self._additional_params.iter());
6340
6341        params.push("alt", "json");
6342        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
6343        if self._scopes.is_empty() {
6344            self._scopes
6345                .insert(Scope::CloudPlatform.as_ref().to_string());
6346        }
6347
6348        #[allow(clippy::single_element_loop)]
6349        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6350            url = params.uri_replacement(url, param_name, find_this, true);
6351        }
6352        {
6353            let to_remove = ["name"];
6354            params.remove_params(&to_remove);
6355        }
6356
6357        let url = params.parse_with_url(&url);
6358
6359        loop {
6360            let token = match self
6361                .hub
6362                .auth
6363                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6364                .await
6365            {
6366                Ok(token) => token,
6367                Err(e) => match dlg.token(e) {
6368                    Ok(token) => token,
6369                    Err(e) => {
6370                        dlg.finished(false);
6371                        return Err(common::Error::MissingToken(e));
6372                    }
6373                },
6374            };
6375            let mut req_result = {
6376                let client = &self.hub.client;
6377                dlg.pre_request();
6378                let mut req_builder = hyper::Request::builder()
6379                    .method(hyper::Method::GET)
6380                    .uri(url.as_str())
6381                    .header(USER_AGENT, self.hub._user_agent.clone());
6382
6383                if let Some(token) = token.as_ref() {
6384                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6385                }
6386
6387                let request = req_builder
6388                    .header(CONTENT_LENGTH, 0_u64)
6389                    .body(common::to_body::<String>(None));
6390
6391                client.request(request.unwrap()).await
6392            };
6393
6394            match req_result {
6395                Err(err) => {
6396                    if let common::Retry::After(d) = dlg.http_error(&err) {
6397                        sleep(d).await;
6398                        continue;
6399                    }
6400                    dlg.finished(false);
6401                    return Err(common::Error::HttpError(err));
6402                }
6403                Ok(res) => {
6404                    let (mut parts, body) = res.into_parts();
6405                    let mut body = common::Body::new(body);
6406                    if !parts.status.is_success() {
6407                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6408                        let error = serde_json::from_str(&common::to_string(&bytes));
6409                        let response = common::to_response(parts, bytes.into());
6410
6411                        if let common::Retry::After(d) =
6412                            dlg.http_failure(&response, error.as_ref().ok())
6413                        {
6414                            sleep(d).await;
6415                            continue;
6416                        }
6417
6418                        dlg.finished(false);
6419
6420                        return Err(match error {
6421                            Ok(value) => common::Error::BadRequest(value),
6422                            _ => common::Error::Failure(response),
6423                        });
6424                    }
6425                    let response = {
6426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6427                        let encoded = common::to_string(&bytes);
6428                        match serde_json::from_str(&encoded) {
6429                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6430                            Err(error) => {
6431                                dlg.response_json_decode_error(&encoded, &error);
6432                                return Err(common::Error::JsonDecodeError(
6433                                    encoded.to_string(),
6434                                    error,
6435                                ));
6436                            }
6437                        }
6438                    };
6439
6440                    dlg.finished(true);
6441                    return Ok(response);
6442                }
6443            }
6444        }
6445    }
6446
6447    /// The name of the operation resource.
6448    ///
6449    /// Sets the *name* path property to the given value.
6450    ///
6451    /// Even though the property as already been set when instantiating this call,
6452    /// we provide this method for API completeness.
6453    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
6454        self._name = new_value.to_string();
6455        self
6456    }
6457    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6458    /// while executing the actual API request.
6459    ///
6460    /// ````text
6461    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6462    /// ````
6463    ///
6464    /// Sets the *delegate* property to the given value.
6465    pub fn delegate(
6466        mut self,
6467        new_value: &'a mut dyn common::Delegate,
6468    ) -> ProjectLocationOperationGetCall<'a, C> {
6469        self._delegate = Some(new_value);
6470        self
6471    }
6472
6473    /// Set any additional parameter of the query string used in the request.
6474    /// It should be used to set parameters which are not yet available through their own
6475    /// setters.
6476    ///
6477    /// Please note that this method must not be used to set any of the known parameters
6478    /// which have their own setter method. If done anyway, the request will fail.
6479    ///
6480    /// # Additional Parameters
6481    ///
6482    /// * *$.xgafv* (query-string) - V1 error format.
6483    /// * *access_token* (query-string) - OAuth access token.
6484    /// * *alt* (query-string) - Data format for response.
6485    /// * *callback* (query-string) - JSONP
6486    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6487    /// * *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.
6488    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6489    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6490    /// * *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.
6491    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6492    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6493    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
6494    where
6495        T: AsRef<str>,
6496    {
6497        self._additional_params
6498            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6499        self
6500    }
6501
6502    /// Identifies the authorization scope for the method you are building.
6503    ///
6504    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6505    /// [`Scope::CloudPlatform`].
6506    ///
6507    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6508    /// tokens for more than one scope.
6509    ///
6510    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6511    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6512    /// sufficient, a read-write scope will do as well.
6513    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
6514    where
6515        St: AsRef<str>,
6516    {
6517        self._scopes.insert(String::from(scope.as_ref()));
6518        self
6519    }
6520    /// Identifies the authorization scope(s) for the method you are building.
6521    ///
6522    /// See [`Self::add_scope()`] for details.
6523    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
6524    where
6525        I: IntoIterator<Item = St>,
6526        St: AsRef<str>,
6527    {
6528        self._scopes
6529            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6530        self
6531    }
6532
6533    /// Removes all scopes, and no default scope will be used either.
6534    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6535    /// for details).
6536    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
6537        self._scopes.clear();
6538        self
6539    }
6540}
6541
6542/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
6543///
6544/// A builder for the *locations.operations.list* method supported by a *project* resource.
6545/// It is not used directly, but through a [`ProjectMethods`] instance.
6546///
6547/// # Example
6548///
6549/// Instantiate a resource method builder
6550///
6551/// ```test_harness,no_run
6552/// # extern crate hyper;
6553/// # extern crate hyper_rustls;
6554/// # extern crate google_metastore1_beta as metastore1_beta;
6555/// # async fn dox() {
6556/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6557///
6558/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6559/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6560/// #     .with_native_roots()
6561/// #     .unwrap()
6562/// #     .https_only()
6563/// #     .enable_http2()
6564/// #     .build();
6565///
6566/// # let executor = hyper_util::rt::TokioExecutor::new();
6567/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6568/// #     secret,
6569/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6570/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6571/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6572/// #     ),
6573/// # ).build().await.unwrap();
6574///
6575/// # let client = hyper_util::client::legacy::Client::builder(
6576/// #     hyper_util::rt::TokioExecutor::new()
6577/// # )
6578/// # .build(
6579/// #     hyper_rustls::HttpsConnectorBuilder::new()
6580/// #         .with_native_roots()
6581/// #         .unwrap()
6582/// #         .https_or_http()
6583/// #         .enable_http2()
6584/// #         .build()
6585/// # );
6586/// # let mut hub = DataprocMetastore::new(client, auth);
6587/// // You can configure optional parameters by calling the respective setters at will, and
6588/// // execute the final call using `doit()`.
6589/// // Values shown here are possibly random and not representative !
6590/// let result = hub.projects().locations_operations_list("name")
6591///              .return_partial_success(true)
6592///              .page_token("est")
6593///              .page_size(-62)
6594///              .filter("ea")
6595///              .doit().await;
6596/// # }
6597/// ```
6598pub struct ProjectLocationOperationListCall<'a, C>
6599where
6600    C: 'a,
6601{
6602    hub: &'a DataprocMetastore<C>,
6603    _name: String,
6604    _return_partial_success: Option<bool>,
6605    _page_token: Option<String>,
6606    _page_size: Option<i32>,
6607    _filter: Option<String>,
6608    _delegate: Option<&'a mut dyn common::Delegate>,
6609    _additional_params: HashMap<String, String>,
6610    _scopes: BTreeSet<String>,
6611}
6612
6613impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
6614
6615impl<'a, C> ProjectLocationOperationListCall<'a, C>
6616where
6617    C: common::Connector,
6618{
6619    /// Perform the operation you have build so far.
6620    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
6621        use std::borrow::Cow;
6622        use std::io::{Read, Seek};
6623
6624        use common::{url::Params, ToParts};
6625        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6626
6627        let mut dd = common::DefaultDelegate;
6628        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6629        dlg.begin(common::MethodInfo {
6630            id: "metastore.projects.locations.operations.list",
6631            http_method: hyper::Method::GET,
6632        });
6633
6634        for &field in [
6635            "alt",
6636            "name",
6637            "returnPartialSuccess",
6638            "pageToken",
6639            "pageSize",
6640            "filter",
6641        ]
6642        .iter()
6643        {
6644            if self._additional_params.contains_key(field) {
6645                dlg.finished(false);
6646                return Err(common::Error::FieldClash(field));
6647            }
6648        }
6649
6650        let mut params = Params::with_capacity(7 + self._additional_params.len());
6651        params.push("name", self._name);
6652        if let Some(value) = self._return_partial_success.as_ref() {
6653            params.push("returnPartialSuccess", value.to_string());
6654        }
6655        if let Some(value) = self._page_token.as_ref() {
6656            params.push("pageToken", value);
6657        }
6658        if let Some(value) = self._page_size.as_ref() {
6659            params.push("pageSize", value.to_string());
6660        }
6661        if let Some(value) = self._filter.as_ref() {
6662            params.push("filter", value);
6663        }
6664
6665        params.extend(self._additional_params.iter());
6666
6667        params.push("alt", "json");
6668        let mut url = self.hub._base_url.clone() + "v1beta/{+name}/operations";
6669        if self._scopes.is_empty() {
6670            self._scopes
6671                .insert(Scope::CloudPlatform.as_ref().to_string());
6672        }
6673
6674        #[allow(clippy::single_element_loop)]
6675        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6676            url = params.uri_replacement(url, param_name, find_this, true);
6677        }
6678        {
6679            let to_remove = ["name"];
6680            params.remove_params(&to_remove);
6681        }
6682
6683        let url = params.parse_with_url(&url);
6684
6685        loop {
6686            let token = match self
6687                .hub
6688                .auth
6689                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6690                .await
6691            {
6692                Ok(token) => token,
6693                Err(e) => match dlg.token(e) {
6694                    Ok(token) => token,
6695                    Err(e) => {
6696                        dlg.finished(false);
6697                        return Err(common::Error::MissingToken(e));
6698                    }
6699                },
6700            };
6701            let mut req_result = {
6702                let client = &self.hub.client;
6703                dlg.pre_request();
6704                let mut req_builder = hyper::Request::builder()
6705                    .method(hyper::Method::GET)
6706                    .uri(url.as_str())
6707                    .header(USER_AGENT, self.hub._user_agent.clone());
6708
6709                if let Some(token) = token.as_ref() {
6710                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6711                }
6712
6713                let request = req_builder
6714                    .header(CONTENT_LENGTH, 0_u64)
6715                    .body(common::to_body::<String>(None));
6716
6717                client.request(request.unwrap()).await
6718            };
6719
6720            match req_result {
6721                Err(err) => {
6722                    if let common::Retry::After(d) = dlg.http_error(&err) {
6723                        sleep(d).await;
6724                        continue;
6725                    }
6726                    dlg.finished(false);
6727                    return Err(common::Error::HttpError(err));
6728                }
6729                Ok(res) => {
6730                    let (mut parts, body) = res.into_parts();
6731                    let mut body = common::Body::new(body);
6732                    if !parts.status.is_success() {
6733                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6734                        let error = serde_json::from_str(&common::to_string(&bytes));
6735                        let response = common::to_response(parts, bytes.into());
6736
6737                        if let common::Retry::After(d) =
6738                            dlg.http_failure(&response, error.as_ref().ok())
6739                        {
6740                            sleep(d).await;
6741                            continue;
6742                        }
6743
6744                        dlg.finished(false);
6745
6746                        return Err(match error {
6747                            Ok(value) => common::Error::BadRequest(value),
6748                            _ => common::Error::Failure(response),
6749                        });
6750                    }
6751                    let response = {
6752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6753                        let encoded = common::to_string(&bytes);
6754                        match serde_json::from_str(&encoded) {
6755                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6756                            Err(error) => {
6757                                dlg.response_json_decode_error(&encoded, &error);
6758                                return Err(common::Error::JsonDecodeError(
6759                                    encoded.to_string(),
6760                                    error,
6761                                ));
6762                            }
6763                        }
6764                    };
6765
6766                    dlg.finished(true);
6767                    return Ok(response);
6768                }
6769            }
6770        }
6771    }
6772
6773    /// The name of the operation's parent resource.
6774    ///
6775    /// Sets the *name* path property to the given value.
6776    ///
6777    /// Even though the property as already been set when instantiating this call,
6778    /// we provide this method for API completeness.
6779    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6780        self._name = new_value.to_string();
6781        self
6782    }
6783    /// When set to true, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field.This can only be true when reading across collections. For example, when parent is set to "projects/example/locations/-".This field is not supported by default and will result in an UNIMPLEMENTED error if set unless explicitly documented otherwise in service or product specific documentation.
6784    ///
6785    /// Sets the *return partial success* query property to the given value.
6786    pub fn return_partial_success(
6787        mut self,
6788        new_value: bool,
6789    ) -> ProjectLocationOperationListCall<'a, C> {
6790        self._return_partial_success = Some(new_value);
6791        self
6792    }
6793    /// The standard list page token.
6794    ///
6795    /// Sets the *page token* query property to the given value.
6796    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6797        self._page_token = Some(new_value.to_string());
6798        self
6799    }
6800    /// The standard list page size.
6801    ///
6802    /// Sets the *page size* query property to the given value.
6803    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
6804        self._page_size = Some(new_value);
6805        self
6806    }
6807    /// The standard list filter.
6808    ///
6809    /// Sets the *filter* query property to the given value.
6810    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6811        self._filter = Some(new_value.to_string());
6812        self
6813    }
6814    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6815    /// while executing the actual API request.
6816    ///
6817    /// ````text
6818    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6819    /// ````
6820    ///
6821    /// Sets the *delegate* property to the given value.
6822    pub fn delegate(
6823        mut self,
6824        new_value: &'a mut dyn common::Delegate,
6825    ) -> ProjectLocationOperationListCall<'a, C> {
6826        self._delegate = Some(new_value);
6827        self
6828    }
6829
6830    /// Set any additional parameter of the query string used in the request.
6831    /// It should be used to set parameters which are not yet available through their own
6832    /// setters.
6833    ///
6834    /// Please note that this method must not be used to set any of the known parameters
6835    /// which have their own setter method. If done anyway, the request will fail.
6836    ///
6837    /// # Additional Parameters
6838    ///
6839    /// * *$.xgafv* (query-string) - V1 error format.
6840    /// * *access_token* (query-string) - OAuth access token.
6841    /// * *alt* (query-string) - Data format for response.
6842    /// * *callback* (query-string) - JSONP
6843    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6844    /// * *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.
6845    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6846    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6847    /// * *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.
6848    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6849    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6850    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
6851    where
6852        T: AsRef<str>,
6853    {
6854        self._additional_params
6855            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6856        self
6857    }
6858
6859    /// Identifies the authorization scope for the method you are building.
6860    ///
6861    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6862    /// [`Scope::CloudPlatform`].
6863    ///
6864    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6865    /// tokens for more than one scope.
6866    ///
6867    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6868    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6869    /// sufficient, a read-write scope will do as well.
6870    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
6871    where
6872        St: AsRef<str>,
6873    {
6874        self._scopes.insert(String::from(scope.as_ref()));
6875        self
6876    }
6877    /// Identifies the authorization scope(s) for the method you are building.
6878    ///
6879    /// See [`Self::add_scope()`] for details.
6880    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
6881    where
6882        I: IntoIterator<Item = St>,
6883        St: AsRef<str>,
6884    {
6885        self._scopes
6886            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6887        self
6888    }
6889
6890    /// Removes all scopes, and no default scope will be used either.
6891    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6892    /// for details).
6893    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
6894        self._scopes.clear();
6895        self
6896    }
6897}
6898
6899/// Creates a new backup in a given project and location.
6900///
6901/// A builder for the *locations.services.backups.create* method supported by a *project* resource.
6902/// It is not used directly, but through a [`ProjectMethods`] instance.
6903///
6904/// # Example
6905///
6906/// Instantiate a resource method builder
6907///
6908/// ```test_harness,no_run
6909/// # extern crate hyper;
6910/// # extern crate hyper_rustls;
6911/// # extern crate google_metastore1_beta as metastore1_beta;
6912/// use metastore1_beta::api::Backup;
6913/// # async fn dox() {
6914/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6915///
6916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6917/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6918/// #     .with_native_roots()
6919/// #     .unwrap()
6920/// #     .https_only()
6921/// #     .enable_http2()
6922/// #     .build();
6923///
6924/// # let executor = hyper_util::rt::TokioExecutor::new();
6925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6926/// #     secret,
6927/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6928/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6929/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6930/// #     ),
6931/// # ).build().await.unwrap();
6932///
6933/// # let client = hyper_util::client::legacy::Client::builder(
6934/// #     hyper_util::rt::TokioExecutor::new()
6935/// # )
6936/// # .build(
6937/// #     hyper_rustls::HttpsConnectorBuilder::new()
6938/// #         .with_native_roots()
6939/// #         .unwrap()
6940/// #         .https_or_http()
6941/// #         .enable_http2()
6942/// #         .build()
6943/// # );
6944/// # let mut hub = DataprocMetastore::new(client, auth);
6945/// // As the method needs a request, you would usually fill it with the desired information
6946/// // into the respective structure. Some of the parts shown here might not be applicable !
6947/// // Values shown here are possibly random and not representative !
6948/// let mut req = Backup::default();
6949///
6950/// // You can configure optional parameters by calling the respective setters at will, and
6951/// // execute the final call using `doit()`.
6952/// // Values shown here are possibly random and not representative !
6953/// let result = hub.projects().locations_services_backups_create(req, "parent")
6954///              .request_id("Lorem")
6955///              .backup_id("eos")
6956///              .doit().await;
6957/// # }
6958/// ```
6959pub struct ProjectLocationServiceBackupCreateCall<'a, C>
6960where
6961    C: 'a,
6962{
6963    hub: &'a DataprocMetastore<C>,
6964    _request: Backup,
6965    _parent: String,
6966    _request_id: Option<String>,
6967    _backup_id: Option<String>,
6968    _delegate: Option<&'a mut dyn common::Delegate>,
6969    _additional_params: HashMap<String, String>,
6970    _scopes: BTreeSet<String>,
6971}
6972
6973impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupCreateCall<'a, C> {}
6974
6975impl<'a, C> ProjectLocationServiceBackupCreateCall<'a, C>
6976where
6977    C: common::Connector,
6978{
6979    /// Perform the operation you have build so far.
6980    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6981        use std::borrow::Cow;
6982        use std::io::{Read, Seek};
6983
6984        use common::{url::Params, ToParts};
6985        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6986
6987        let mut dd = common::DefaultDelegate;
6988        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6989        dlg.begin(common::MethodInfo {
6990            id: "metastore.projects.locations.services.backups.create",
6991            http_method: hyper::Method::POST,
6992        });
6993
6994        for &field in ["alt", "parent", "requestId", "backupId"].iter() {
6995            if self._additional_params.contains_key(field) {
6996                dlg.finished(false);
6997                return Err(common::Error::FieldClash(field));
6998            }
6999        }
7000
7001        let mut params = Params::with_capacity(6 + self._additional_params.len());
7002        params.push("parent", self._parent);
7003        if let Some(value) = self._request_id.as_ref() {
7004            params.push("requestId", value);
7005        }
7006        if let Some(value) = self._backup_id.as_ref() {
7007            params.push("backupId", value);
7008        }
7009
7010        params.extend(self._additional_params.iter());
7011
7012        params.push("alt", "json");
7013        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/backups";
7014        if self._scopes.is_empty() {
7015            self._scopes
7016                .insert(Scope::CloudPlatform.as_ref().to_string());
7017        }
7018
7019        #[allow(clippy::single_element_loop)]
7020        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7021            url = params.uri_replacement(url, param_name, find_this, true);
7022        }
7023        {
7024            let to_remove = ["parent"];
7025            params.remove_params(&to_remove);
7026        }
7027
7028        let url = params.parse_with_url(&url);
7029
7030        let mut json_mime_type = mime::APPLICATION_JSON;
7031        let mut request_value_reader = {
7032            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7033            common::remove_json_null_values(&mut value);
7034            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7035            serde_json::to_writer(&mut dst, &value).unwrap();
7036            dst
7037        };
7038        let request_size = request_value_reader
7039            .seek(std::io::SeekFrom::End(0))
7040            .unwrap();
7041        request_value_reader
7042            .seek(std::io::SeekFrom::Start(0))
7043            .unwrap();
7044
7045        loop {
7046            let token = match self
7047                .hub
7048                .auth
7049                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7050                .await
7051            {
7052                Ok(token) => token,
7053                Err(e) => match dlg.token(e) {
7054                    Ok(token) => token,
7055                    Err(e) => {
7056                        dlg.finished(false);
7057                        return Err(common::Error::MissingToken(e));
7058                    }
7059                },
7060            };
7061            request_value_reader
7062                .seek(std::io::SeekFrom::Start(0))
7063                .unwrap();
7064            let mut req_result = {
7065                let client = &self.hub.client;
7066                dlg.pre_request();
7067                let mut req_builder = hyper::Request::builder()
7068                    .method(hyper::Method::POST)
7069                    .uri(url.as_str())
7070                    .header(USER_AGENT, self.hub._user_agent.clone());
7071
7072                if let Some(token) = token.as_ref() {
7073                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7074                }
7075
7076                let request = req_builder
7077                    .header(CONTENT_TYPE, json_mime_type.to_string())
7078                    .header(CONTENT_LENGTH, request_size as u64)
7079                    .body(common::to_body(
7080                        request_value_reader.get_ref().clone().into(),
7081                    ));
7082
7083                client.request(request.unwrap()).await
7084            };
7085
7086            match req_result {
7087                Err(err) => {
7088                    if let common::Retry::After(d) = dlg.http_error(&err) {
7089                        sleep(d).await;
7090                        continue;
7091                    }
7092                    dlg.finished(false);
7093                    return Err(common::Error::HttpError(err));
7094                }
7095                Ok(res) => {
7096                    let (mut parts, body) = res.into_parts();
7097                    let mut body = common::Body::new(body);
7098                    if !parts.status.is_success() {
7099                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7100                        let error = serde_json::from_str(&common::to_string(&bytes));
7101                        let response = common::to_response(parts, bytes.into());
7102
7103                        if let common::Retry::After(d) =
7104                            dlg.http_failure(&response, error.as_ref().ok())
7105                        {
7106                            sleep(d).await;
7107                            continue;
7108                        }
7109
7110                        dlg.finished(false);
7111
7112                        return Err(match error {
7113                            Ok(value) => common::Error::BadRequest(value),
7114                            _ => common::Error::Failure(response),
7115                        });
7116                    }
7117                    let response = {
7118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7119                        let encoded = common::to_string(&bytes);
7120                        match serde_json::from_str(&encoded) {
7121                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7122                            Err(error) => {
7123                                dlg.response_json_decode_error(&encoded, &error);
7124                                return Err(common::Error::JsonDecodeError(
7125                                    encoded.to_string(),
7126                                    error,
7127                                ));
7128                            }
7129                        }
7130                    };
7131
7132                    dlg.finished(true);
7133                    return Ok(response);
7134                }
7135            }
7136        }
7137    }
7138
7139    ///
7140    /// Sets the *request* property to the given value.
7141    ///
7142    /// Even though the property as already been set when instantiating this call,
7143    /// we provide this method for API completeness.
7144    pub fn request(mut self, new_value: Backup) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7145        self._request = new_value;
7146        self
7147    }
7148    /// Required. The relative resource name of the service in which to create a backup of the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
7149    ///
7150    /// Sets the *parent* path property to the given value.
7151    ///
7152    /// Even though the property as already been set when instantiating this call,
7153    /// we provide this method for API completeness.
7154    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7155        self._parent = new_value.to_string();
7156        self
7157    }
7158    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
7159    ///
7160    /// Sets the *request id* query property to the given value.
7161    pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7162        self._request_id = Some(new_value.to_string());
7163        self
7164    }
7165    /// Required. The ID of the backup, which is used as the final component of the backup's name.This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.
7166    ///
7167    /// Sets the *backup id* query property to the given value.
7168    pub fn backup_id(mut self, new_value: &str) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7169        self._backup_id = Some(new_value.to_string());
7170        self
7171    }
7172    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7173    /// while executing the actual API request.
7174    ///
7175    /// ````text
7176    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7177    /// ````
7178    ///
7179    /// Sets the *delegate* property to the given value.
7180    pub fn delegate(
7181        mut self,
7182        new_value: &'a mut dyn common::Delegate,
7183    ) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7184        self._delegate = Some(new_value);
7185        self
7186    }
7187
7188    /// Set any additional parameter of the query string used in the request.
7189    /// It should be used to set parameters which are not yet available through their own
7190    /// setters.
7191    ///
7192    /// Please note that this method must not be used to set any of the known parameters
7193    /// which have their own setter method. If done anyway, the request will fail.
7194    ///
7195    /// # Additional Parameters
7196    ///
7197    /// * *$.xgafv* (query-string) - V1 error format.
7198    /// * *access_token* (query-string) - OAuth access token.
7199    /// * *alt* (query-string) - Data format for response.
7200    /// * *callback* (query-string) - JSONP
7201    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7202    /// * *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.
7203    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7204    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7205    /// * *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.
7206    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7207    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7208    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceBackupCreateCall<'a, C>
7209    where
7210        T: AsRef<str>,
7211    {
7212        self._additional_params
7213            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7214        self
7215    }
7216
7217    /// Identifies the authorization scope for the method you are building.
7218    ///
7219    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7220    /// [`Scope::CloudPlatform`].
7221    ///
7222    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7223    /// tokens for more than one scope.
7224    ///
7225    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7226    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7227    /// sufficient, a read-write scope will do as well.
7228    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupCreateCall<'a, C>
7229    where
7230        St: AsRef<str>,
7231    {
7232        self._scopes.insert(String::from(scope.as_ref()));
7233        self
7234    }
7235    /// Identifies the authorization scope(s) for the method you are building.
7236    ///
7237    /// See [`Self::add_scope()`] for details.
7238    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceBackupCreateCall<'a, C>
7239    where
7240        I: IntoIterator<Item = St>,
7241        St: AsRef<str>,
7242    {
7243        self._scopes
7244            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7245        self
7246    }
7247
7248    /// Removes all scopes, and no default scope will be used either.
7249    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7250    /// for details).
7251    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupCreateCall<'a, C> {
7252        self._scopes.clear();
7253        self
7254    }
7255}
7256
7257/// Deletes a single backup.
7258///
7259/// A builder for the *locations.services.backups.delete* method supported by a *project* resource.
7260/// It is not used directly, but through a [`ProjectMethods`] instance.
7261///
7262/// # Example
7263///
7264/// Instantiate a resource method builder
7265///
7266/// ```test_harness,no_run
7267/// # extern crate hyper;
7268/// # extern crate hyper_rustls;
7269/// # extern crate google_metastore1_beta as metastore1_beta;
7270/// # async fn dox() {
7271/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7272///
7273/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7274/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7275/// #     .with_native_roots()
7276/// #     .unwrap()
7277/// #     .https_only()
7278/// #     .enable_http2()
7279/// #     .build();
7280///
7281/// # let executor = hyper_util::rt::TokioExecutor::new();
7282/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7283/// #     secret,
7284/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7285/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7286/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7287/// #     ),
7288/// # ).build().await.unwrap();
7289///
7290/// # let client = hyper_util::client::legacy::Client::builder(
7291/// #     hyper_util::rt::TokioExecutor::new()
7292/// # )
7293/// # .build(
7294/// #     hyper_rustls::HttpsConnectorBuilder::new()
7295/// #         .with_native_roots()
7296/// #         .unwrap()
7297/// #         .https_or_http()
7298/// #         .enable_http2()
7299/// #         .build()
7300/// # );
7301/// # let mut hub = DataprocMetastore::new(client, auth);
7302/// // You can configure optional parameters by calling the respective setters at will, and
7303/// // execute the final call using `doit()`.
7304/// // Values shown here are possibly random and not representative !
7305/// let result = hub.projects().locations_services_backups_delete("name")
7306///              .request_id("sed")
7307///              .doit().await;
7308/// # }
7309/// ```
7310pub struct ProjectLocationServiceBackupDeleteCall<'a, C>
7311where
7312    C: 'a,
7313{
7314    hub: &'a DataprocMetastore<C>,
7315    _name: String,
7316    _request_id: Option<String>,
7317    _delegate: Option<&'a mut dyn common::Delegate>,
7318    _additional_params: HashMap<String, String>,
7319    _scopes: BTreeSet<String>,
7320}
7321
7322impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupDeleteCall<'a, C> {}
7323
7324impl<'a, C> ProjectLocationServiceBackupDeleteCall<'a, C>
7325where
7326    C: common::Connector,
7327{
7328    /// Perform the operation you have build so far.
7329    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7330        use std::borrow::Cow;
7331        use std::io::{Read, Seek};
7332
7333        use common::{url::Params, ToParts};
7334        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7335
7336        let mut dd = common::DefaultDelegate;
7337        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7338        dlg.begin(common::MethodInfo {
7339            id: "metastore.projects.locations.services.backups.delete",
7340            http_method: hyper::Method::DELETE,
7341        });
7342
7343        for &field in ["alt", "name", "requestId"].iter() {
7344            if self._additional_params.contains_key(field) {
7345                dlg.finished(false);
7346                return Err(common::Error::FieldClash(field));
7347            }
7348        }
7349
7350        let mut params = Params::with_capacity(4 + self._additional_params.len());
7351        params.push("name", self._name);
7352        if let Some(value) = self._request_id.as_ref() {
7353            params.push("requestId", value);
7354        }
7355
7356        params.extend(self._additional_params.iter());
7357
7358        params.push("alt", "json");
7359        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7360        if self._scopes.is_empty() {
7361            self._scopes
7362                .insert(Scope::CloudPlatform.as_ref().to_string());
7363        }
7364
7365        #[allow(clippy::single_element_loop)]
7366        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7367            url = params.uri_replacement(url, param_name, find_this, true);
7368        }
7369        {
7370            let to_remove = ["name"];
7371            params.remove_params(&to_remove);
7372        }
7373
7374        let url = params.parse_with_url(&url);
7375
7376        loop {
7377            let token = match self
7378                .hub
7379                .auth
7380                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7381                .await
7382            {
7383                Ok(token) => token,
7384                Err(e) => match dlg.token(e) {
7385                    Ok(token) => token,
7386                    Err(e) => {
7387                        dlg.finished(false);
7388                        return Err(common::Error::MissingToken(e));
7389                    }
7390                },
7391            };
7392            let mut req_result = {
7393                let client = &self.hub.client;
7394                dlg.pre_request();
7395                let mut req_builder = hyper::Request::builder()
7396                    .method(hyper::Method::DELETE)
7397                    .uri(url.as_str())
7398                    .header(USER_AGENT, self.hub._user_agent.clone());
7399
7400                if let Some(token) = token.as_ref() {
7401                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7402                }
7403
7404                let request = req_builder
7405                    .header(CONTENT_LENGTH, 0_u64)
7406                    .body(common::to_body::<String>(None));
7407
7408                client.request(request.unwrap()).await
7409            };
7410
7411            match req_result {
7412                Err(err) => {
7413                    if let common::Retry::After(d) = dlg.http_error(&err) {
7414                        sleep(d).await;
7415                        continue;
7416                    }
7417                    dlg.finished(false);
7418                    return Err(common::Error::HttpError(err));
7419                }
7420                Ok(res) => {
7421                    let (mut parts, body) = res.into_parts();
7422                    let mut body = common::Body::new(body);
7423                    if !parts.status.is_success() {
7424                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7425                        let error = serde_json::from_str(&common::to_string(&bytes));
7426                        let response = common::to_response(parts, bytes.into());
7427
7428                        if let common::Retry::After(d) =
7429                            dlg.http_failure(&response, error.as_ref().ok())
7430                        {
7431                            sleep(d).await;
7432                            continue;
7433                        }
7434
7435                        dlg.finished(false);
7436
7437                        return Err(match error {
7438                            Ok(value) => common::Error::BadRequest(value),
7439                            _ => common::Error::Failure(response),
7440                        });
7441                    }
7442                    let response = {
7443                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7444                        let encoded = common::to_string(&bytes);
7445                        match serde_json::from_str(&encoded) {
7446                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7447                            Err(error) => {
7448                                dlg.response_json_decode_error(&encoded, &error);
7449                                return Err(common::Error::JsonDecodeError(
7450                                    encoded.to_string(),
7451                                    error,
7452                                ));
7453                            }
7454                        }
7455                    };
7456
7457                    dlg.finished(true);
7458                    return Ok(response);
7459                }
7460            }
7461        }
7462    }
7463
7464    /// Required. The relative resource name of the backup to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
7465    ///
7466    /// Sets the *name* path property to the given value.
7467    ///
7468    /// Even though the property as already been set when instantiating this call,
7469    /// we provide this method for API completeness.
7470    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceBackupDeleteCall<'a, C> {
7471        self._name = new_value.to_string();
7472        self
7473    }
7474    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
7475    ///
7476    /// Sets the *request id* query property to the given value.
7477    pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceBackupDeleteCall<'a, C> {
7478        self._request_id = Some(new_value.to_string());
7479        self
7480    }
7481    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7482    /// while executing the actual API request.
7483    ///
7484    /// ````text
7485    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7486    /// ````
7487    ///
7488    /// Sets the *delegate* property to the given value.
7489    pub fn delegate(
7490        mut self,
7491        new_value: &'a mut dyn common::Delegate,
7492    ) -> ProjectLocationServiceBackupDeleteCall<'a, C> {
7493        self._delegate = Some(new_value);
7494        self
7495    }
7496
7497    /// Set any additional parameter of the query string used in the request.
7498    /// It should be used to set parameters which are not yet available through their own
7499    /// setters.
7500    ///
7501    /// Please note that this method must not be used to set any of the known parameters
7502    /// which have their own setter method. If done anyway, the request will fail.
7503    ///
7504    /// # Additional Parameters
7505    ///
7506    /// * *$.xgafv* (query-string) - V1 error format.
7507    /// * *access_token* (query-string) - OAuth access token.
7508    /// * *alt* (query-string) - Data format for response.
7509    /// * *callback* (query-string) - JSONP
7510    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7511    /// * *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.
7512    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7513    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7514    /// * *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.
7515    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7516    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7517    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceBackupDeleteCall<'a, C>
7518    where
7519        T: AsRef<str>,
7520    {
7521        self._additional_params
7522            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7523        self
7524    }
7525
7526    /// Identifies the authorization scope for the method you are building.
7527    ///
7528    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7529    /// [`Scope::CloudPlatform`].
7530    ///
7531    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7532    /// tokens for more than one scope.
7533    ///
7534    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7535    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7536    /// sufficient, a read-write scope will do as well.
7537    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupDeleteCall<'a, C>
7538    where
7539        St: AsRef<str>,
7540    {
7541        self._scopes.insert(String::from(scope.as_ref()));
7542        self
7543    }
7544    /// Identifies the authorization scope(s) for the method you are building.
7545    ///
7546    /// See [`Self::add_scope()`] for details.
7547    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceBackupDeleteCall<'a, C>
7548    where
7549        I: IntoIterator<Item = St>,
7550        St: AsRef<str>,
7551    {
7552        self._scopes
7553            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7554        self
7555    }
7556
7557    /// Removes all scopes, and no default scope will be used either.
7558    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7559    /// for details).
7560    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupDeleteCall<'a, C> {
7561        self._scopes.clear();
7562        self
7563    }
7564}
7565
7566/// Gets details of a single backup.
7567///
7568/// A builder for the *locations.services.backups.get* method supported by a *project* resource.
7569/// It is not used directly, but through a [`ProjectMethods`] instance.
7570///
7571/// # Example
7572///
7573/// Instantiate a resource method builder
7574///
7575/// ```test_harness,no_run
7576/// # extern crate hyper;
7577/// # extern crate hyper_rustls;
7578/// # extern crate google_metastore1_beta as metastore1_beta;
7579/// # async fn dox() {
7580/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7581///
7582/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7583/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7584/// #     .with_native_roots()
7585/// #     .unwrap()
7586/// #     .https_only()
7587/// #     .enable_http2()
7588/// #     .build();
7589///
7590/// # let executor = hyper_util::rt::TokioExecutor::new();
7591/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7592/// #     secret,
7593/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7594/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7595/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7596/// #     ),
7597/// # ).build().await.unwrap();
7598///
7599/// # let client = hyper_util::client::legacy::Client::builder(
7600/// #     hyper_util::rt::TokioExecutor::new()
7601/// # )
7602/// # .build(
7603/// #     hyper_rustls::HttpsConnectorBuilder::new()
7604/// #         .with_native_roots()
7605/// #         .unwrap()
7606/// #         .https_or_http()
7607/// #         .enable_http2()
7608/// #         .build()
7609/// # );
7610/// # let mut hub = DataprocMetastore::new(client, auth);
7611/// // You can configure optional parameters by calling the respective setters at will, and
7612/// // execute the final call using `doit()`.
7613/// // Values shown here are possibly random and not representative !
7614/// let result = hub.projects().locations_services_backups_get("name")
7615///              .doit().await;
7616/// # }
7617/// ```
7618pub struct ProjectLocationServiceBackupGetCall<'a, C>
7619where
7620    C: 'a,
7621{
7622    hub: &'a DataprocMetastore<C>,
7623    _name: String,
7624    _delegate: Option<&'a mut dyn common::Delegate>,
7625    _additional_params: HashMap<String, String>,
7626    _scopes: BTreeSet<String>,
7627}
7628
7629impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupGetCall<'a, C> {}
7630
7631impl<'a, C> ProjectLocationServiceBackupGetCall<'a, C>
7632where
7633    C: common::Connector,
7634{
7635    /// Perform the operation you have build so far.
7636    pub async fn doit(mut self) -> common::Result<(common::Response, Backup)> {
7637        use std::borrow::Cow;
7638        use std::io::{Read, Seek};
7639
7640        use common::{url::Params, ToParts};
7641        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7642
7643        let mut dd = common::DefaultDelegate;
7644        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7645        dlg.begin(common::MethodInfo {
7646            id: "metastore.projects.locations.services.backups.get",
7647            http_method: hyper::Method::GET,
7648        });
7649
7650        for &field in ["alt", "name"].iter() {
7651            if self._additional_params.contains_key(field) {
7652                dlg.finished(false);
7653                return Err(common::Error::FieldClash(field));
7654            }
7655        }
7656
7657        let mut params = Params::with_capacity(3 + self._additional_params.len());
7658        params.push("name", self._name);
7659
7660        params.extend(self._additional_params.iter());
7661
7662        params.push("alt", "json");
7663        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
7664        if self._scopes.is_empty() {
7665            self._scopes
7666                .insert(Scope::CloudPlatform.as_ref().to_string());
7667        }
7668
7669        #[allow(clippy::single_element_loop)]
7670        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7671            url = params.uri_replacement(url, param_name, find_this, true);
7672        }
7673        {
7674            let to_remove = ["name"];
7675            params.remove_params(&to_remove);
7676        }
7677
7678        let url = params.parse_with_url(&url);
7679
7680        loop {
7681            let token = match self
7682                .hub
7683                .auth
7684                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7685                .await
7686            {
7687                Ok(token) => token,
7688                Err(e) => match dlg.token(e) {
7689                    Ok(token) => token,
7690                    Err(e) => {
7691                        dlg.finished(false);
7692                        return Err(common::Error::MissingToken(e));
7693                    }
7694                },
7695            };
7696            let mut req_result = {
7697                let client = &self.hub.client;
7698                dlg.pre_request();
7699                let mut req_builder = hyper::Request::builder()
7700                    .method(hyper::Method::GET)
7701                    .uri(url.as_str())
7702                    .header(USER_AGENT, self.hub._user_agent.clone());
7703
7704                if let Some(token) = token.as_ref() {
7705                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7706                }
7707
7708                let request = req_builder
7709                    .header(CONTENT_LENGTH, 0_u64)
7710                    .body(common::to_body::<String>(None));
7711
7712                client.request(request.unwrap()).await
7713            };
7714
7715            match req_result {
7716                Err(err) => {
7717                    if let common::Retry::After(d) = dlg.http_error(&err) {
7718                        sleep(d).await;
7719                        continue;
7720                    }
7721                    dlg.finished(false);
7722                    return Err(common::Error::HttpError(err));
7723                }
7724                Ok(res) => {
7725                    let (mut parts, body) = res.into_parts();
7726                    let mut body = common::Body::new(body);
7727                    if !parts.status.is_success() {
7728                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7729                        let error = serde_json::from_str(&common::to_string(&bytes));
7730                        let response = common::to_response(parts, bytes.into());
7731
7732                        if let common::Retry::After(d) =
7733                            dlg.http_failure(&response, error.as_ref().ok())
7734                        {
7735                            sleep(d).await;
7736                            continue;
7737                        }
7738
7739                        dlg.finished(false);
7740
7741                        return Err(match error {
7742                            Ok(value) => common::Error::BadRequest(value),
7743                            _ => common::Error::Failure(response),
7744                        });
7745                    }
7746                    let response = {
7747                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7748                        let encoded = common::to_string(&bytes);
7749                        match serde_json::from_str(&encoded) {
7750                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7751                            Err(error) => {
7752                                dlg.response_json_decode_error(&encoded, &error);
7753                                return Err(common::Error::JsonDecodeError(
7754                                    encoded.to_string(),
7755                                    error,
7756                                ));
7757                            }
7758                        }
7759                    };
7760
7761                    dlg.finished(true);
7762                    return Ok(response);
7763                }
7764            }
7765        }
7766    }
7767
7768    /// Required. The relative resource name of the backup to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups/{backup_id}.
7769    ///
7770    /// Sets the *name* path property to the given value.
7771    ///
7772    /// Even though the property as already been set when instantiating this call,
7773    /// we provide this method for API completeness.
7774    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceBackupGetCall<'a, C> {
7775        self._name = new_value.to_string();
7776        self
7777    }
7778    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7779    /// while executing the actual API request.
7780    ///
7781    /// ````text
7782    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7783    /// ````
7784    ///
7785    /// Sets the *delegate* property to the given value.
7786    pub fn delegate(
7787        mut self,
7788        new_value: &'a mut dyn common::Delegate,
7789    ) -> ProjectLocationServiceBackupGetCall<'a, C> {
7790        self._delegate = Some(new_value);
7791        self
7792    }
7793
7794    /// Set any additional parameter of the query string used in the request.
7795    /// It should be used to set parameters which are not yet available through their own
7796    /// setters.
7797    ///
7798    /// Please note that this method must not be used to set any of the known parameters
7799    /// which have their own setter method. If done anyway, the request will fail.
7800    ///
7801    /// # Additional Parameters
7802    ///
7803    /// * *$.xgafv* (query-string) - V1 error format.
7804    /// * *access_token* (query-string) - OAuth access token.
7805    /// * *alt* (query-string) - Data format for response.
7806    /// * *callback* (query-string) - JSONP
7807    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7808    /// * *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.
7809    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7810    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7811    /// * *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.
7812    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7813    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7814    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceBackupGetCall<'a, C>
7815    where
7816        T: AsRef<str>,
7817    {
7818        self._additional_params
7819            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7820        self
7821    }
7822
7823    /// Identifies the authorization scope for the method you are building.
7824    ///
7825    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7826    /// [`Scope::CloudPlatform`].
7827    ///
7828    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7829    /// tokens for more than one scope.
7830    ///
7831    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7832    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7833    /// sufficient, a read-write scope will do as well.
7834    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupGetCall<'a, C>
7835    where
7836        St: AsRef<str>,
7837    {
7838        self._scopes.insert(String::from(scope.as_ref()));
7839        self
7840    }
7841    /// Identifies the authorization scope(s) for the method you are building.
7842    ///
7843    /// See [`Self::add_scope()`] for details.
7844    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceBackupGetCall<'a, C>
7845    where
7846        I: IntoIterator<Item = St>,
7847        St: AsRef<str>,
7848    {
7849        self._scopes
7850            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7851        self
7852    }
7853
7854    /// Removes all scopes, and no default scope will be used either.
7855    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7856    /// for details).
7857    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupGetCall<'a, C> {
7858        self._scopes.clear();
7859        self
7860    }
7861}
7862
7863/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
7864///
7865/// A builder for the *locations.services.backups.getIamPolicy* method supported by a *project* resource.
7866/// It is not used directly, but through a [`ProjectMethods`] instance.
7867///
7868/// # Example
7869///
7870/// Instantiate a resource method builder
7871///
7872/// ```test_harness,no_run
7873/// # extern crate hyper;
7874/// # extern crate hyper_rustls;
7875/// # extern crate google_metastore1_beta as metastore1_beta;
7876/// # async fn dox() {
7877/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7878///
7879/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7880/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7881/// #     .with_native_roots()
7882/// #     .unwrap()
7883/// #     .https_only()
7884/// #     .enable_http2()
7885/// #     .build();
7886///
7887/// # let executor = hyper_util::rt::TokioExecutor::new();
7888/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7889/// #     secret,
7890/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7891/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7892/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7893/// #     ),
7894/// # ).build().await.unwrap();
7895///
7896/// # let client = hyper_util::client::legacy::Client::builder(
7897/// #     hyper_util::rt::TokioExecutor::new()
7898/// # )
7899/// # .build(
7900/// #     hyper_rustls::HttpsConnectorBuilder::new()
7901/// #         .with_native_roots()
7902/// #         .unwrap()
7903/// #         .https_or_http()
7904/// #         .enable_http2()
7905/// #         .build()
7906/// # );
7907/// # let mut hub = DataprocMetastore::new(client, auth);
7908/// // You can configure optional parameters by calling the respective setters at will, and
7909/// // execute the final call using `doit()`.
7910/// // Values shown here are possibly random and not representative !
7911/// let result = hub.projects().locations_services_backups_get_iam_policy("resource")
7912///              .options_requested_policy_version(-61)
7913///              .doit().await;
7914/// # }
7915/// ```
7916pub struct ProjectLocationServiceBackupGetIamPolicyCall<'a, C>
7917where
7918    C: 'a,
7919{
7920    hub: &'a DataprocMetastore<C>,
7921    _resource: String,
7922    _options_requested_policy_version: Option<i32>,
7923    _delegate: Option<&'a mut dyn common::Delegate>,
7924    _additional_params: HashMap<String, String>,
7925    _scopes: BTreeSet<String>,
7926}
7927
7928impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {}
7929
7930impl<'a, C> ProjectLocationServiceBackupGetIamPolicyCall<'a, C>
7931where
7932    C: common::Connector,
7933{
7934    /// Perform the operation you have build so far.
7935    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7936        use std::borrow::Cow;
7937        use std::io::{Read, Seek};
7938
7939        use common::{url::Params, ToParts};
7940        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7941
7942        let mut dd = common::DefaultDelegate;
7943        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7944        dlg.begin(common::MethodInfo {
7945            id: "metastore.projects.locations.services.backups.getIamPolicy",
7946            http_method: hyper::Method::GET,
7947        });
7948
7949        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
7950            if self._additional_params.contains_key(field) {
7951                dlg.finished(false);
7952                return Err(common::Error::FieldClash(field));
7953            }
7954        }
7955
7956        let mut params = Params::with_capacity(4 + self._additional_params.len());
7957        params.push("resource", self._resource);
7958        if let Some(value) = self._options_requested_policy_version.as_ref() {
7959            params.push("options.requestedPolicyVersion", value.to_string());
7960        }
7961
7962        params.extend(self._additional_params.iter());
7963
7964        params.push("alt", "json");
7965        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:getIamPolicy";
7966        if self._scopes.is_empty() {
7967            self._scopes
7968                .insert(Scope::CloudPlatform.as_ref().to_string());
7969        }
7970
7971        #[allow(clippy::single_element_loop)]
7972        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7973            url = params.uri_replacement(url, param_name, find_this, true);
7974        }
7975        {
7976            let to_remove = ["resource"];
7977            params.remove_params(&to_remove);
7978        }
7979
7980        let url = params.parse_with_url(&url);
7981
7982        loop {
7983            let token = match self
7984                .hub
7985                .auth
7986                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7987                .await
7988            {
7989                Ok(token) => token,
7990                Err(e) => match dlg.token(e) {
7991                    Ok(token) => token,
7992                    Err(e) => {
7993                        dlg.finished(false);
7994                        return Err(common::Error::MissingToken(e));
7995                    }
7996                },
7997            };
7998            let mut req_result = {
7999                let client = &self.hub.client;
8000                dlg.pre_request();
8001                let mut req_builder = hyper::Request::builder()
8002                    .method(hyper::Method::GET)
8003                    .uri(url.as_str())
8004                    .header(USER_AGENT, self.hub._user_agent.clone());
8005
8006                if let Some(token) = token.as_ref() {
8007                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8008                }
8009
8010                let request = req_builder
8011                    .header(CONTENT_LENGTH, 0_u64)
8012                    .body(common::to_body::<String>(None));
8013
8014                client.request(request.unwrap()).await
8015            };
8016
8017            match req_result {
8018                Err(err) => {
8019                    if let common::Retry::After(d) = dlg.http_error(&err) {
8020                        sleep(d).await;
8021                        continue;
8022                    }
8023                    dlg.finished(false);
8024                    return Err(common::Error::HttpError(err));
8025                }
8026                Ok(res) => {
8027                    let (mut parts, body) = res.into_parts();
8028                    let mut body = common::Body::new(body);
8029                    if !parts.status.is_success() {
8030                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8031                        let error = serde_json::from_str(&common::to_string(&bytes));
8032                        let response = common::to_response(parts, bytes.into());
8033
8034                        if let common::Retry::After(d) =
8035                            dlg.http_failure(&response, error.as_ref().ok())
8036                        {
8037                            sleep(d).await;
8038                            continue;
8039                        }
8040
8041                        dlg.finished(false);
8042
8043                        return Err(match error {
8044                            Ok(value) => common::Error::BadRequest(value),
8045                            _ => common::Error::Failure(response),
8046                        });
8047                    }
8048                    let response = {
8049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8050                        let encoded = common::to_string(&bytes);
8051                        match serde_json::from_str(&encoded) {
8052                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8053                            Err(error) => {
8054                                dlg.response_json_decode_error(&encoded, &error);
8055                                return Err(common::Error::JsonDecodeError(
8056                                    encoded.to_string(),
8057                                    error,
8058                                ));
8059                            }
8060                        }
8061                    };
8062
8063                    dlg.finished(true);
8064                    return Ok(response);
8065                }
8066            }
8067        }
8068    }
8069
8070    /// 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.
8071    ///
8072    /// Sets the *resource* path property to the given value.
8073    ///
8074    /// Even though the property as already been set when instantiating this call,
8075    /// we provide this method for API completeness.
8076    pub fn resource(
8077        mut self,
8078        new_value: &str,
8079    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {
8080        self._resource = new_value.to_string();
8081        self
8082    }
8083    /// 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).
8084    ///
8085    /// Sets the *options.requested policy version* query property to the given value.
8086    pub fn options_requested_policy_version(
8087        mut self,
8088        new_value: i32,
8089    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {
8090        self._options_requested_policy_version = Some(new_value);
8091        self
8092    }
8093    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8094    /// while executing the actual API request.
8095    ///
8096    /// ````text
8097    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8098    /// ````
8099    ///
8100    /// Sets the *delegate* property to the given value.
8101    pub fn delegate(
8102        mut self,
8103        new_value: &'a mut dyn common::Delegate,
8104    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {
8105        self._delegate = Some(new_value);
8106        self
8107    }
8108
8109    /// Set any additional parameter of the query string used in the request.
8110    /// It should be used to set parameters which are not yet available through their own
8111    /// setters.
8112    ///
8113    /// Please note that this method must not be used to set any of the known parameters
8114    /// which have their own setter method. If done anyway, the request will fail.
8115    ///
8116    /// # Additional Parameters
8117    ///
8118    /// * *$.xgafv* (query-string) - V1 error format.
8119    /// * *access_token* (query-string) - OAuth access token.
8120    /// * *alt* (query-string) - Data format for response.
8121    /// * *callback* (query-string) - JSONP
8122    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8123    /// * *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.
8124    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8125    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8126    /// * *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.
8127    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8128    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8129    pub fn param<T>(
8130        mut self,
8131        name: T,
8132        value: T,
8133    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C>
8134    where
8135        T: AsRef<str>,
8136    {
8137        self._additional_params
8138            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8139        self
8140    }
8141
8142    /// Identifies the authorization scope for the method you are building.
8143    ///
8144    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8145    /// [`Scope::CloudPlatform`].
8146    ///
8147    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8148    /// tokens for more than one scope.
8149    ///
8150    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8151    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8152    /// sufficient, a read-write scope will do as well.
8153    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C>
8154    where
8155        St: AsRef<str>,
8156    {
8157        self._scopes.insert(String::from(scope.as_ref()));
8158        self
8159    }
8160    /// Identifies the authorization scope(s) for the method you are building.
8161    ///
8162    /// See [`Self::add_scope()`] for details.
8163    pub fn add_scopes<I, St>(
8164        mut self,
8165        scopes: I,
8166    ) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C>
8167    where
8168        I: IntoIterator<Item = St>,
8169        St: AsRef<str>,
8170    {
8171        self._scopes
8172            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8173        self
8174    }
8175
8176    /// Removes all scopes, and no default scope will be used either.
8177    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8178    /// for details).
8179    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupGetIamPolicyCall<'a, C> {
8180        self._scopes.clear();
8181        self
8182    }
8183}
8184
8185/// Lists backups in a service.
8186///
8187/// A builder for the *locations.services.backups.list* method supported by a *project* resource.
8188/// It is not used directly, but through a [`ProjectMethods`] instance.
8189///
8190/// # Example
8191///
8192/// Instantiate a resource method builder
8193///
8194/// ```test_harness,no_run
8195/// # extern crate hyper;
8196/// # extern crate hyper_rustls;
8197/// # extern crate google_metastore1_beta as metastore1_beta;
8198/// # async fn dox() {
8199/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8200///
8201/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8202/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8203/// #     .with_native_roots()
8204/// #     .unwrap()
8205/// #     .https_only()
8206/// #     .enable_http2()
8207/// #     .build();
8208///
8209/// # let executor = hyper_util::rt::TokioExecutor::new();
8210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8211/// #     secret,
8212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8213/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8214/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8215/// #     ),
8216/// # ).build().await.unwrap();
8217///
8218/// # let client = hyper_util::client::legacy::Client::builder(
8219/// #     hyper_util::rt::TokioExecutor::new()
8220/// # )
8221/// # .build(
8222/// #     hyper_rustls::HttpsConnectorBuilder::new()
8223/// #         .with_native_roots()
8224/// #         .unwrap()
8225/// #         .https_or_http()
8226/// #         .enable_http2()
8227/// #         .build()
8228/// # );
8229/// # let mut hub = DataprocMetastore::new(client, auth);
8230/// // You can configure optional parameters by calling the respective setters at will, and
8231/// // execute the final call using `doit()`.
8232/// // Values shown here are possibly random and not representative !
8233/// let result = hub.projects().locations_services_backups_list("parent")
8234///              .page_token("kasd")
8235///              .page_size(-24)
8236///              .order_by("sed")
8237///              .filter("et")
8238///              .doit().await;
8239/// # }
8240/// ```
8241pub struct ProjectLocationServiceBackupListCall<'a, C>
8242where
8243    C: 'a,
8244{
8245    hub: &'a DataprocMetastore<C>,
8246    _parent: String,
8247    _page_token: Option<String>,
8248    _page_size: Option<i32>,
8249    _order_by: Option<String>,
8250    _filter: Option<String>,
8251    _delegate: Option<&'a mut dyn common::Delegate>,
8252    _additional_params: HashMap<String, String>,
8253    _scopes: BTreeSet<String>,
8254}
8255
8256impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupListCall<'a, C> {}
8257
8258impl<'a, C> ProjectLocationServiceBackupListCall<'a, C>
8259where
8260    C: common::Connector,
8261{
8262    /// Perform the operation you have build so far.
8263    pub async fn doit(mut self) -> common::Result<(common::Response, ListBackupsResponse)> {
8264        use std::borrow::Cow;
8265        use std::io::{Read, Seek};
8266
8267        use common::{url::Params, ToParts};
8268        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8269
8270        let mut dd = common::DefaultDelegate;
8271        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8272        dlg.begin(common::MethodInfo {
8273            id: "metastore.projects.locations.services.backups.list",
8274            http_method: hyper::Method::GET,
8275        });
8276
8277        for &field in [
8278            "alt",
8279            "parent",
8280            "pageToken",
8281            "pageSize",
8282            "orderBy",
8283            "filter",
8284        ]
8285        .iter()
8286        {
8287            if self._additional_params.contains_key(field) {
8288                dlg.finished(false);
8289                return Err(common::Error::FieldClash(field));
8290            }
8291        }
8292
8293        let mut params = Params::with_capacity(7 + self._additional_params.len());
8294        params.push("parent", self._parent);
8295        if let Some(value) = self._page_token.as_ref() {
8296            params.push("pageToken", value);
8297        }
8298        if let Some(value) = self._page_size.as_ref() {
8299            params.push("pageSize", value.to_string());
8300        }
8301        if let Some(value) = self._order_by.as_ref() {
8302            params.push("orderBy", value);
8303        }
8304        if let Some(value) = self._filter.as_ref() {
8305            params.push("filter", value);
8306        }
8307
8308        params.extend(self._additional_params.iter());
8309
8310        params.push("alt", "json");
8311        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/backups";
8312        if self._scopes.is_empty() {
8313            self._scopes
8314                .insert(Scope::CloudPlatform.as_ref().to_string());
8315        }
8316
8317        #[allow(clippy::single_element_loop)]
8318        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8319            url = params.uri_replacement(url, param_name, find_this, true);
8320        }
8321        {
8322            let to_remove = ["parent"];
8323            params.remove_params(&to_remove);
8324        }
8325
8326        let url = params.parse_with_url(&url);
8327
8328        loop {
8329            let token = match self
8330                .hub
8331                .auth
8332                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8333                .await
8334            {
8335                Ok(token) => token,
8336                Err(e) => match dlg.token(e) {
8337                    Ok(token) => token,
8338                    Err(e) => {
8339                        dlg.finished(false);
8340                        return Err(common::Error::MissingToken(e));
8341                    }
8342                },
8343            };
8344            let mut req_result = {
8345                let client = &self.hub.client;
8346                dlg.pre_request();
8347                let mut req_builder = hyper::Request::builder()
8348                    .method(hyper::Method::GET)
8349                    .uri(url.as_str())
8350                    .header(USER_AGENT, self.hub._user_agent.clone());
8351
8352                if let Some(token) = token.as_ref() {
8353                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8354                }
8355
8356                let request = req_builder
8357                    .header(CONTENT_LENGTH, 0_u64)
8358                    .body(common::to_body::<String>(None));
8359
8360                client.request(request.unwrap()).await
8361            };
8362
8363            match req_result {
8364                Err(err) => {
8365                    if let common::Retry::After(d) = dlg.http_error(&err) {
8366                        sleep(d).await;
8367                        continue;
8368                    }
8369                    dlg.finished(false);
8370                    return Err(common::Error::HttpError(err));
8371                }
8372                Ok(res) => {
8373                    let (mut parts, body) = res.into_parts();
8374                    let mut body = common::Body::new(body);
8375                    if !parts.status.is_success() {
8376                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8377                        let error = serde_json::from_str(&common::to_string(&bytes));
8378                        let response = common::to_response(parts, bytes.into());
8379
8380                        if let common::Retry::After(d) =
8381                            dlg.http_failure(&response, error.as_ref().ok())
8382                        {
8383                            sleep(d).await;
8384                            continue;
8385                        }
8386
8387                        dlg.finished(false);
8388
8389                        return Err(match error {
8390                            Ok(value) => common::Error::BadRequest(value),
8391                            _ => common::Error::Failure(response),
8392                        });
8393                    }
8394                    let response = {
8395                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8396                        let encoded = common::to_string(&bytes);
8397                        match serde_json::from_str(&encoded) {
8398                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8399                            Err(error) => {
8400                                dlg.response_json_decode_error(&encoded, &error);
8401                                return Err(common::Error::JsonDecodeError(
8402                                    encoded.to_string(),
8403                                    error,
8404                                ));
8405                            }
8406                        }
8407                    };
8408
8409                    dlg.finished(true);
8410                    return Ok(response);
8411                }
8412            }
8413        }
8414    }
8415
8416    /// Required. The relative resource name of the service whose backups to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/backups.
8417    ///
8418    /// Sets the *parent* path property to the given value.
8419    ///
8420    /// Even though the property as already been set when instantiating this call,
8421    /// we provide this method for API completeness.
8422    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceBackupListCall<'a, C> {
8423        self._parent = new_value.to_string();
8424        self
8425    }
8426    /// Optional. A page token, received from a previous DataprocMetastore.ListBackups call. Provide this token to retrieve the subsequent page.To retrieve the first page, supply an empty page token.When paginating, other parameters provided to DataprocMetastore.ListBackups must match the call that provided the page token.
8427    ///
8428    /// Sets the *page token* query property to the given value.
8429    pub fn page_token(mut self, new_value: &str) -> ProjectLocationServiceBackupListCall<'a, C> {
8430        self._page_token = Some(new_value.to_string());
8431        self
8432    }
8433    /// Optional. The maximum number of backups to return. The response may contain less than the maximum number. If unspecified, no more than 500 backups are returned. The maximum value is 1000; values above 1000 are changed to 1000.
8434    ///
8435    /// Sets the *page size* query property to the given value.
8436    pub fn page_size(mut self, new_value: i32) -> ProjectLocationServiceBackupListCall<'a, C> {
8437        self._page_size = Some(new_value);
8438        self
8439    }
8440    /// Optional. Specify the ordering of results as described in Sorting Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not specified, the results will be sorted in the default order.
8441    ///
8442    /// Sets the *order by* query property to the given value.
8443    pub fn order_by(mut self, new_value: &str) -> ProjectLocationServiceBackupListCall<'a, C> {
8444        self._order_by = Some(new_value.to_string());
8445        self
8446    }
8447    /// Optional. The filter to apply to list results.
8448    ///
8449    /// Sets the *filter* query property to the given value.
8450    pub fn filter(mut self, new_value: &str) -> ProjectLocationServiceBackupListCall<'a, C> {
8451        self._filter = Some(new_value.to_string());
8452        self
8453    }
8454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8455    /// while executing the actual API request.
8456    ///
8457    /// ````text
8458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8459    /// ````
8460    ///
8461    /// Sets the *delegate* property to the given value.
8462    pub fn delegate(
8463        mut self,
8464        new_value: &'a mut dyn common::Delegate,
8465    ) -> ProjectLocationServiceBackupListCall<'a, C> {
8466        self._delegate = Some(new_value);
8467        self
8468    }
8469
8470    /// Set any additional parameter of the query string used in the request.
8471    /// It should be used to set parameters which are not yet available through their own
8472    /// setters.
8473    ///
8474    /// Please note that this method must not be used to set any of the known parameters
8475    /// which have their own setter method. If done anyway, the request will fail.
8476    ///
8477    /// # Additional Parameters
8478    ///
8479    /// * *$.xgafv* (query-string) - V1 error format.
8480    /// * *access_token* (query-string) - OAuth access token.
8481    /// * *alt* (query-string) - Data format for response.
8482    /// * *callback* (query-string) - JSONP
8483    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8484    /// * *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.
8485    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8486    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8487    /// * *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.
8488    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8489    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8490    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceBackupListCall<'a, C>
8491    where
8492        T: AsRef<str>,
8493    {
8494        self._additional_params
8495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8496        self
8497    }
8498
8499    /// Identifies the authorization scope for the method you are building.
8500    ///
8501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8502    /// [`Scope::CloudPlatform`].
8503    ///
8504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8505    /// tokens for more than one scope.
8506    ///
8507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8509    /// sufficient, a read-write scope will do as well.
8510    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupListCall<'a, C>
8511    where
8512        St: AsRef<str>,
8513    {
8514        self._scopes.insert(String::from(scope.as_ref()));
8515        self
8516    }
8517    /// Identifies the authorization scope(s) for the method you are building.
8518    ///
8519    /// See [`Self::add_scope()`] for details.
8520    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceBackupListCall<'a, C>
8521    where
8522        I: IntoIterator<Item = St>,
8523        St: AsRef<str>,
8524    {
8525        self._scopes
8526            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8527        self
8528    }
8529
8530    /// Removes all scopes, and no default scope will be used either.
8531    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8532    /// for details).
8533    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupListCall<'a, C> {
8534        self._scopes.clear();
8535        self
8536    }
8537}
8538
8539/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
8540///
8541/// A builder for the *locations.services.backups.setIamPolicy* method supported by a *project* resource.
8542/// It is not used directly, but through a [`ProjectMethods`] instance.
8543///
8544/// # Example
8545///
8546/// Instantiate a resource method builder
8547///
8548/// ```test_harness,no_run
8549/// # extern crate hyper;
8550/// # extern crate hyper_rustls;
8551/// # extern crate google_metastore1_beta as metastore1_beta;
8552/// use metastore1_beta::api::SetIamPolicyRequest;
8553/// # async fn dox() {
8554/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8555///
8556/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8557/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8558/// #     .with_native_roots()
8559/// #     .unwrap()
8560/// #     .https_only()
8561/// #     .enable_http2()
8562/// #     .build();
8563///
8564/// # let executor = hyper_util::rt::TokioExecutor::new();
8565/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8566/// #     secret,
8567/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8568/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8569/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8570/// #     ),
8571/// # ).build().await.unwrap();
8572///
8573/// # let client = hyper_util::client::legacy::Client::builder(
8574/// #     hyper_util::rt::TokioExecutor::new()
8575/// # )
8576/// # .build(
8577/// #     hyper_rustls::HttpsConnectorBuilder::new()
8578/// #         .with_native_roots()
8579/// #         .unwrap()
8580/// #         .https_or_http()
8581/// #         .enable_http2()
8582/// #         .build()
8583/// # );
8584/// # let mut hub = DataprocMetastore::new(client, auth);
8585/// // As the method needs a request, you would usually fill it with the desired information
8586/// // into the respective structure. Some of the parts shown here might not be applicable !
8587/// // Values shown here are possibly random and not representative !
8588/// let mut req = SetIamPolicyRequest::default();
8589///
8590/// // You can configure optional parameters by calling the respective setters at will, and
8591/// // execute the final call using `doit()`.
8592/// // Values shown here are possibly random and not representative !
8593/// let result = hub.projects().locations_services_backups_set_iam_policy(req, "resource")
8594///              .doit().await;
8595/// # }
8596/// ```
8597pub struct ProjectLocationServiceBackupSetIamPolicyCall<'a, C>
8598where
8599    C: 'a,
8600{
8601    hub: &'a DataprocMetastore<C>,
8602    _request: SetIamPolicyRequest,
8603    _resource: String,
8604    _delegate: Option<&'a mut dyn common::Delegate>,
8605    _additional_params: HashMap<String, String>,
8606    _scopes: BTreeSet<String>,
8607}
8608
8609impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {}
8610
8611impl<'a, C> ProjectLocationServiceBackupSetIamPolicyCall<'a, C>
8612where
8613    C: common::Connector,
8614{
8615    /// Perform the operation you have build so far.
8616    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
8617        use std::borrow::Cow;
8618        use std::io::{Read, Seek};
8619
8620        use common::{url::Params, ToParts};
8621        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8622
8623        let mut dd = common::DefaultDelegate;
8624        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8625        dlg.begin(common::MethodInfo {
8626            id: "metastore.projects.locations.services.backups.setIamPolicy",
8627            http_method: hyper::Method::POST,
8628        });
8629
8630        for &field in ["alt", "resource"].iter() {
8631            if self._additional_params.contains_key(field) {
8632                dlg.finished(false);
8633                return Err(common::Error::FieldClash(field));
8634            }
8635        }
8636
8637        let mut params = Params::with_capacity(4 + self._additional_params.len());
8638        params.push("resource", self._resource);
8639
8640        params.extend(self._additional_params.iter());
8641
8642        params.push("alt", "json");
8643        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:setIamPolicy";
8644        if self._scopes.is_empty() {
8645            self._scopes
8646                .insert(Scope::CloudPlatform.as_ref().to_string());
8647        }
8648
8649        #[allow(clippy::single_element_loop)]
8650        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8651            url = params.uri_replacement(url, param_name, find_this, true);
8652        }
8653        {
8654            let to_remove = ["resource"];
8655            params.remove_params(&to_remove);
8656        }
8657
8658        let url = params.parse_with_url(&url);
8659
8660        let mut json_mime_type = mime::APPLICATION_JSON;
8661        let mut request_value_reader = {
8662            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8663            common::remove_json_null_values(&mut value);
8664            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8665            serde_json::to_writer(&mut dst, &value).unwrap();
8666            dst
8667        };
8668        let request_size = request_value_reader
8669            .seek(std::io::SeekFrom::End(0))
8670            .unwrap();
8671        request_value_reader
8672            .seek(std::io::SeekFrom::Start(0))
8673            .unwrap();
8674
8675        loop {
8676            let token = match self
8677                .hub
8678                .auth
8679                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8680                .await
8681            {
8682                Ok(token) => token,
8683                Err(e) => match dlg.token(e) {
8684                    Ok(token) => token,
8685                    Err(e) => {
8686                        dlg.finished(false);
8687                        return Err(common::Error::MissingToken(e));
8688                    }
8689                },
8690            };
8691            request_value_reader
8692                .seek(std::io::SeekFrom::Start(0))
8693                .unwrap();
8694            let mut req_result = {
8695                let client = &self.hub.client;
8696                dlg.pre_request();
8697                let mut req_builder = hyper::Request::builder()
8698                    .method(hyper::Method::POST)
8699                    .uri(url.as_str())
8700                    .header(USER_AGENT, self.hub._user_agent.clone());
8701
8702                if let Some(token) = token.as_ref() {
8703                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8704                }
8705
8706                let request = req_builder
8707                    .header(CONTENT_TYPE, json_mime_type.to_string())
8708                    .header(CONTENT_LENGTH, request_size as u64)
8709                    .body(common::to_body(
8710                        request_value_reader.get_ref().clone().into(),
8711                    ));
8712
8713                client.request(request.unwrap()).await
8714            };
8715
8716            match req_result {
8717                Err(err) => {
8718                    if let common::Retry::After(d) = dlg.http_error(&err) {
8719                        sleep(d).await;
8720                        continue;
8721                    }
8722                    dlg.finished(false);
8723                    return Err(common::Error::HttpError(err));
8724                }
8725                Ok(res) => {
8726                    let (mut parts, body) = res.into_parts();
8727                    let mut body = common::Body::new(body);
8728                    if !parts.status.is_success() {
8729                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8730                        let error = serde_json::from_str(&common::to_string(&bytes));
8731                        let response = common::to_response(parts, bytes.into());
8732
8733                        if let common::Retry::After(d) =
8734                            dlg.http_failure(&response, error.as_ref().ok())
8735                        {
8736                            sleep(d).await;
8737                            continue;
8738                        }
8739
8740                        dlg.finished(false);
8741
8742                        return Err(match error {
8743                            Ok(value) => common::Error::BadRequest(value),
8744                            _ => common::Error::Failure(response),
8745                        });
8746                    }
8747                    let response = {
8748                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8749                        let encoded = common::to_string(&bytes);
8750                        match serde_json::from_str(&encoded) {
8751                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8752                            Err(error) => {
8753                                dlg.response_json_decode_error(&encoded, &error);
8754                                return Err(common::Error::JsonDecodeError(
8755                                    encoded.to_string(),
8756                                    error,
8757                                ));
8758                            }
8759                        }
8760                    };
8761
8762                    dlg.finished(true);
8763                    return Ok(response);
8764                }
8765            }
8766        }
8767    }
8768
8769    ///
8770    /// Sets the *request* property to the given value.
8771    ///
8772    /// Even though the property as already been set when instantiating this call,
8773    /// we provide this method for API completeness.
8774    pub fn request(
8775        mut self,
8776        new_value: SetIamPolicyRequest,
8777    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {
8778        self._request = new_value;
8779        self
8780    }
8781    /// 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.
8782    ///
8783    /// Sets the *resource* path property to the given value.
8784    ///
8785    /// Even though the property as already been set when instantiating this call,
8786    /// we provide this method for API completeness.
8787    pub fn resource(
8788        mut self,
8789        new_value: &str,
8790    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {
8791        self._resource = new_value.to_string();
8792        self
8793    }
8794    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8795    /// while executing the actual API request.
8796    ///
8797    /// ````text
8798    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8799    /// ````
8800    ///
8801    /// Sets the *delegate* property to the given value.
8802    pub fn delegate(
8803        mut self,
8804        new_value: &'a mut dyn common::Delegate,
8805    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {
8806        self._delegate = Some(new_value);
8807        self
8808    }
8809
8810    /// Set any additional parameter of the query string used in the request.
8811    /// It should be used to set parameters which are not yet available through their own
8812    /// setters.
8813    ///
8814    /// Please note that this method must not be used to set any of the known parameters
8815    /// which have their own setter method. If done anyway, the request will fail.
8816    ///
8817    /// # Additional Parameters
8818    ///
8819    /// * *$.xgafv* (query-string) - V1 error format.
8820    /// * *access_token* (query-string) - OAuth access token.
8821    /// * *alt* (query-string) - Data format for response.
8822    /// * *callback* (query-string) - JSONP
8823    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8824    /// * *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.
8825    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8826    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8827    /// * *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.
8828    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8829    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8830    pub fn param<T>(
8831        mut self,
8832        name: T,
8833        value: T,
8834    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C>
8835    where
8836        T: AsRef<str>,
8837    {
8838        self._additional_params
8839            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8840        self
8841    }
8842
8843    /// Identifies the authorization scope for the method you are building.
8844    ///
8845    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8846    /// [`Scope::CloudPlatform`].
8847    ///
8848    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8849    /// tokens for more than one scope.
8850    ///
8851    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8852    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8853    /// sufficient, a read-write scope will do as well.
8854    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C>
8855    where
8856        St: AsRef<str>,
8857    {
8858        self._scopes.insert(String::from(scope.as_ref()));
8859        self
8860    }
8861    /// Identifies the authorization scope(s) for the method you are building.
8862    ///
8863    /// See [`Self::add_scope()`] for details.
8864    pub fn add_scopes<I, St>(
8865        mut self,
8866        scopes: I,
8867    ) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C>
8868    where
8869        I: IntoIterator<Item = St>,
8870        St: AsRef<str>,
8871    {
8872        self._scopes
8873            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8874        self
8875    }
8876
8877    /// Removes all scopes, and no default scope will be used either.
8878    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8879    /// for details).
8880    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupSetIamPolicyCall<'a, C> {
8881        self._scopes.clear();
8882        self
8883    }
8884}
8885
8886/// 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.
8887///
8888/// A builder for the *locations.services.backups.testIamPermissions* method supported by a *project* resource.
8889/// It is not used directly, but through a [`ProjectMethods`] instance.
8890///
8891/// # Example
8892///
8893/// Instantiate a resource method builder
8894///
8895/// ```test_harness,no_run
8896/// # extern crate hyper;
8897/// # extern crate hyper_rustls;
8898/// # extern crate google_metastore1_beta as metastore1_beta;
8899/// use metastore1_beta::api::TestIamPermissionsRequest;
8900/// # async fn dox() {
8901/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8902///
8903/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8904/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8905/// #     .with_native_roots()
8906/// #     .unwrap()
8907/// #     .https_only()
8908/// #     .enable_http2()
8909/// #     .build();
8910///
8911/// # let executor = hyper_util::rt::TokioExecutor::new();
8912/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8913/// #     secret,
8914/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8915/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8916/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8917/// #     ),
8918/// # ).build().await.unwrap();
8919///
8920/// # let client = hyper_util::client::legacy::Client::builder(
8921/// #     hyper_util::rt::TokioExecutor::new()
8922/// # )
8923/// # .build(
8924/// #     hyper_rustls::HttpsConnectorBuilder::new()
8925/// #         .with_native_roots()
8926/// #         .unwrap()
8927/// #         .https_or_http()
8928/// #         .enable_http2()
8929/// #         .build()
8930/// # );
8931/// # let mut hub = DataprocMetastore::new(client, auth);
8932/// // As the method needs a request, you would usually fill it with the desired information
8933/// // into the respective structure. Some of the parts shown here might not be applicable !
8934/// // Values shown here are possibly random and not representative !
8935/// let mut req = TestIamPermissionsRequest::default();
8936///
8937/// // You can configure optional parameters by calling the respective setters at will, and
8938/// // execute the final call using `doit()`.
8939/// // Values shown here are possibly random and not representative !
8940/// let result = hub.projects().locations_services_backups_test_iam_permissions(req, "resource")
8941///              .doit().await;
8942/// # }
8943/// ```
8944pub struct ProjectLocationServiceBackupTestIamPermissionCall<'a, C>
8945where
8946    C: 'a,
8947{
8948    hub: &'a DataprocMetastore<C>,
8949    _request: TestIamPermissionsRequest,
8950    _resource: String,
8951    _delegate: Option<&'a mut dyn common::Delegate>,
8952    _additional_params: HashMap<String, String>,
8953    _scopes: BTreeSet<String>,
8954}
8955
8956impl<'a, C> common::CallBuilder for ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {}
8957
8958impl<'a, C> ProjectLocationServiceBackupTestIamPermissionCall<'a, C>
8959where
8960    C: common::Connector,
8961{
8962    /// Perform the operation you have build so far.
8963    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
8964        use std::borrow::Cow;
8965        use std::io::{Read, Seek};
8966
8967        use common::{url::Params, ToParts};
8968        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8969
8970        let mut dd = common::DefaultDelegate;
8971        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8972        dlg.begin(common::MethodInfo {
8973            id: "metastore.projects.locations.services.backups.testIamPermissions",
8974            http_method: hyper::Method::POST,
8975        });
8976
8977        for &field in ["alt", "resource"].iter() {
8978            if self._additional_params.contains_key(field) {
8979                dlg.finished(false);
8980                return Err(common::Error::FieldClash(field));
8981            }
8982        }
8983
8984        let mut params = Params::with_capacity(4 + self._additional_params.len());
8985        params.push("resource", self._resource);
8986
8987        params.extend(self._additional_params.iter());
8988
8989        params.push("alt", "json");
8990        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:testIamPermissions";
8991        if self._scopes.is_empty() {
8992            self._scopes
8993                .insert(Scope::CloudPlatform.as_ref().to_string());
8994        }
8995
8996        #[allow(clippy::single_element_loop)]
8997        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8998            url = params.uri_replacement(url, param_name, find_this, true);
8999        }
9000        {
9001            let to_remove = ["resource"];
9002            params.remove_params(&to_remove);
9003        }
9004
9005        let url = params.parse_with_url(&url);
9006
9007        let mut json_mime_type = mime::APPLICATION_JSON;
9008        let mut request_value_reader = {
9009            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9010            common::remove_json_null_values(&mut value);
9011            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9012            serde_json::to_writer(&mut dst, &value).unwrap();
9013            dst
9014        };
9015        let request_size = request_value_reader
9016            .seek(std::io::SeekFrom::End(0))
9017            .unwrap();
9018        request_value_reader
9019            .seek(std::io::SeekFrom::Start(0))
9020            .unwrap();
9021
9022        loop {
9023            let token = match self
9024                .hub
9025                .auth
9026                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9027                .await
9028            {
9029                Ok(token) => token,
9030                Err(e) => match dlg.token(e) {
9031                    Ok(token) => token,
9032                    Err(e) => {
9033                        dlg.finished(false);
9034                        return Err(common::Error::MissingToken(e));
9035                    }
9036                },
9037            };
9038            request_value_reader
9039                .seek(std::io::SeekFrom::Start(0))
9040                .unwrap();
9041            let mut req_result = {
9042                let client = &self.hub.client;
9043                dlg.pre_request();
9044                let mut req_builder = hyper::Request::builder()
9045                    .method(hyper::Method::POST)
9046                    .uri(url.as_str())
9047                    .header(USER_AGENT, self.hub._user_agent.clone());
9048
9049                if let Some(token) = token.as_ref() {
9050                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9051                }
9052
9053                let request = req_builder
9054                    .header(CONTENT_TYPE, json_mime_type.to_string())
9055                    .header(CONTENT_LENGTH, request_size as u64)
9056                    .body(common::to_body(
9057                        request_value_reader.get_ref().clone().into(),
9058                    ));
9059
9060                client.request(request.unwrap()).await
9061            };
9062
9063            match req_result {
9064                Err(err) => {
9065                    if let common::Retry::After(d) = dlg.http_error(&err) {
9066                        sleep(d).await;
9067                        continue;
9068                    }
9069                    dlg.finished(false);
9070                    return Err(common::Error::HttpError(err));
9071                }
9072                Ok(res) => {
9073                    let (mut parts, body) = res.into_parts();
9074                    let mut body = common::Body::new(body);
9075                    if !parts.status.is_success() {
9076                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9077                        let error = serde_json::from_str(&common::to_string(&bytes));
9078                        let response = common::to_response(parts, bytes.into());
9079
9080                        if let common::Retry::After(d) =
9081                            dlg.http_failure(&response, error.as_ref().ok())
9082                        {
9083                            sleep(d).await;
9084                            continue;
9085                        }
9086
9087                        dlg.finished(false);
9088
9089                        return Err(match error {
9090                            Ok(value) => common::Error::BadRequest(value),
9091                            _ => common::Error::Failure(response),
9092                        });
9093                    }
9094                    let response = {
9095                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9096                        let encoded = common::to_string(&bytes);
9097                        match serde_json::from_str(&encoded) {
9098                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9099                            Err(error) => {
9100                                dlg.response_json_decode_error(&encoded, &error);
9101                                return Err(common::Error::JsonDecodeError(
9102                                    encoded.to_string(),
9103                                    error,
9104                                ));
9105                            }
9106                        }
9107                    };
9108
9109                    dlg.finished(true);
9110                    return Ok(response);
9111                }
9112            }
9113        }
9114    }
9115
9116    ///
9117    /// Sets the *request* property to the given value.
9118    ///
9119    /// Even though the property as already been set when instantiating this call,
9120    /// we provide this method for API completeness.
9121    pub fn request(
9122        mut self,
9123        new_value: TestIamPermissionsRequest,
9124    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {
9125        self._request = new_value;
9126        self
9127    }
9128    /// 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.
9129    ///
9130    /// Sets the *resource* path property to the given value.
9131    ///
9132    /// Even though the property as already been set when instantiating this call,
9133    /// we provide this method for API completeness.
9134    pub fn resource(
9135        mut self,
9136        new_value: &str,
9137    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {
9138        self._resource = new_value.to_string();
9139        self
9140    }
9141    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9142    /// while executing the actual API request.
9143    ///
9144    /// ````text
9145    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9146    /// ````
9147    ///
9148    /// Sets the *delegate* property to the given value.
9149    pub fn delegate(
9150        mut self,
9151        new_value: &'a mut dyn common::Delegate,
9152    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {
9153        self._delegate = Some(new_value);
9154        self
9155    }
9156
9157    /// Set any additional parameter of the query string used in the request.
9158    /// It should be used to set parameters which are not yet available through their own
9159    /// setters.
9160    ///
9161    /// Please note that this method must not be used to set any of the known parameters
9162    /// which have their own setter method. If done anyway, the request will fail.
9163    ///
9164    /// # Additional Parameters
9165    ///
9166    /// * *$.xgafv* (query-string) - V1 error format.
9167    /// * *access_token* (query-string) - OAuth access token.
9168    /// * *alt* (query-string) - Data format for response.
9169    /// * *callback* (query-string) - JSONP
9170    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9171    /// * *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.
9172    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9173    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9174    /// * *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.
9175    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9176    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9177    pub fn param<T>(
9178        mut self,
9179        name: T,
9180        value: T,
9181    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C>
9182    where
9183        T: AsRef<str>,
9184    {
9185        self._additional_params
9186            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9187        self
9188    }
9189
9190    /// Identifies the authorization scope for the method you are building.
9191    ///
9192    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9193    /// [`Scope::CloudPlatform`].
9194    ///
9195    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9196    /// tokens for more than one scope.
9197    ///
9198    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9199    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9200    /// sufficient, a read-write scope will do as well.
9201    pub fn add_scope<St>(
9202        mut self,
9203        scope: St,
9204    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C>
9205    where
9206        St: AsRef<str>,
9207    {
9208        self._scopes.insert(String::from(scope.as_ref()));
9209        self
9210    }
9211    /// Identifies the authorization scope(s) for the method you are building.
9212    ///
9213    /// See [`Self::add_scope()`] for details.
9214    pub fn add_scopes<I, St>(
9215        mut self,
9216        scopes: I,
9217    ) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C>
9218    where
9219        I: IntoIterator<Item = St>,
9220        St: AsRef<str>,
9221    {
9222        self._scopes
9223            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9224        self
9225    }
9226
9227    /// Removes all scopes, and no default scope will be used either.
9228    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9229    /// for details).
9230    pub fn clear_scopes(mut self) -> ProjectLocationServiceBackupTestIamPermissionCall<'a, C> {
9231        self._scopes.clear();
9232        self
9233    }
9234}
9235
9236/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
9237///
9238/// A builder for the *locations.services.databases.tables.getIamPolicy* method supported by a *project* resource.
9239/// It is not used directly, but through a [`ProjectMethods`] instance.
9240///
9241/// # Example
9242///
9243/// Instantiate a resource method builder
9244///
9245/// ```test_harness,no_run
9246/// # extern crate hyper;
9247/// # extern crate hyper_rustls;
9248/// # extern crate google_metastore1_beta as metastore1_beta;
9249/// # async fn dox() {
9250/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9251///
9252/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9253/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9254/// #     .with_native_roots()
9255/// #     .unwrap()
9256/// #     .https_only()
9257/// #     .enable_http2()
9258/// #     .build();
9259///
9260/// # let executor = hyper_util::rt::TokioExecutor::new();
9261/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9262/// #     secret,
9263/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9264/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9265/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9266/// #     ),
9267/// # ).build().await.unwrap();
9268///
9269/// # let client = hyper_util::client::legacy::Client::builder(
9270/// #     hyper_util::rt::TokioExecutor::new()
9271/// # )
9272/// # .build(
9273/// #     hyper_rustls::HttpsConnectorBuilder::new()
9274/// #         .with_native_roots()
9275/// #         .unwrap()
9276/// #         .https_or_http()
9277/// #         .enable_http2()
9278/// #         .build()
9279/// # );
9280/// # let mut hub = DataprocMetastore::new(client, auth);
9281/// // You can configure optional parameters by calling the respective setters at will, and
9282/// // execute the final call using `doit()`.
9283/// // Values shown here are possibly random and not representative !
9284/// let result = hub.projects().locations_services_databases_tables_get_iam_policy("resource")
9285///              .options_requested_policy_version(-93)
9286///              .doit().await;
9287/// # }
9288/// ```
9289pub struct ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C>
9290where
9291    C: 'a,
9292{
9293    hub: &'a DataprocMetastore<C>,
9294    _resource: String,
9295    _options_requested_policy_version: Option<i32>,
9296    _delegate: Option<&'a mut dyn common::Delegate>,
9297    _additional_params: HashMap<String, String>,
9298    _scopes: BTreeSet<String>,
9299}
9300
9301impl<'a, C> common::CallBuilder for ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {}
9302
9303impl<'a, C> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C>
9304where
9305    C: common::Connector,
9306{
9307    /// Perform the operation you have build so far.
9308    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9309        use std::borrow::Cow;
9310        use std::io::{Read, Seek};
9311
9312        use common::{url::Params, ToParts};
9313        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9314
9315        let mut dd = common::DefaultDelegate;
9316        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9317        dlg.begin(common::MethodInfo {
9318            id: "metastore.projects.locations.services.databases.tables.getIamPolicy",
9319            http_method: hyper::Method::GET,
9320        });
9321
9322        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
9323            if self._additional_params.contains_key(field) {
9324                dlg.finished(false);
9325                return Err(common::Error::FieldClash(field));
9326            }
9327        }
9328
9329        let mut params = Params::with_capacity(4 + self._additional_params.len());
9330        params.push("resource", self._resource);
9331        if let Some(value) = self._options_requested_policy_version.as_ref() {
9332            params.push("options.requestedPolicyVersion", value.to_string());
9333        }
9334
9335        params.extend(self._additional_params.iter());
9336
9337        params.push("alt", "json");
9338        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:getIamPolicy";
9339        if self._scopes.is_empty() {
9340            self._scopes
9341                .insert(Scope::CloudPlatform.as_ref().to_string());
9342        }
9343
9344        #[allow(clippy::single_element_loop)]
9345        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9346            url = params.uri_replacement(url, param_name, find_this, true);
9347        }
9348        {
9349            let to_remove = ["resource"];
9350            params.remove_params(&to_remove);
9351        }
9352
9353        let url = params.parse_with_url(&url);
9354
9355        loop {
9356            let token = match self
9357                .hub
9358                .auth
9359                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9360                .await
9361            {
9362                Ok(token) => token,
9363                Err(e) => match dlg.token(e) {
9364                    Ok(token) => token,
9365                    Err(e) => {
9366                        dlg.finished(false);
9367                        return Err(common::Error::MissingToken(e));
9368                    }
9369                },
9370            };
9371            let mut req_result = {
9372                let client = &self.hub.client;
9373                dlg.pre_request();
9374                let mut req_builder = hyper::Request::builder()
9375                    .method(hyper::Method::GET)
9376                    .uri(url.as_str())
9377                    .header(USER_AGENT, self.hub._user_agent.clone());
9378
9379                if let Some(token) = token.as_ref() {
9380                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9381                }
9382
9383                let request = req_builder
9384                    .header(CONTENT_LENGTH, 0_u64)
9385                    .body(common::to_body::<String>(None));
9386
9387                client.request(request.unwrap()).await
9388            };
9389
9390            match req_result {
9391                Err(err) => {
9392                    if let common::Retry::After(d) = dlg.http_error(&err) {
9393                        sleep(d).await;
9394                        continue;
9395                    }
9396                    dlg.finished(false);
9397                    return Err(common::Error::HttpError(err));
9398                }
9399                Ok(res) => {
9400                    let (mut parts, body) = res.into_parts();
9401                    let mut body = common::Body::new(body);
9402                    if !parts.status.is_success() {
9403                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9404                        let error = serde_json::from_str(&common::to_string(&bytes));
9405                        let response = common::to_response(parts, bytes.into());
9406
9407                        if let common::Retry::After(d) =
9408                            dlg.http_failure(&response, error.as_ref().ok())
9409                        {
9410                            sleep(d).await;
9411                            continue;
9412                        }
9413
9414                        dlg.finished(false);
9415
9416                        return Err(match error {
9417                            Ok(value) => common::Error::BadRequest(value),
9418                            _ => common::Error::Failure(response),
9419                        });
9420                    }
9421                    let response = {
9422                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9423                        let encoded = common::to_string(&bytes);
9424                        match serde_json::from_str(&encoded) {
9425                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9426                            Err(error) => {
9427                                dlg.response_json_decode_error(&encoded, &error);
9428                                return Err(common::Error::JsonDecodeError(
9429                                    encoded.to_string(),
9430                                    error,
9431                                ));
9432                            }
9433                        }
9434                    };
9435
9436                    dlg.finished(true);
9437                    return Ok(response);
9438                }
9439            }
9440        }
9441    }
9442
9443    /// 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.
9444    ///
9445    /// Sets the *resource* path property to the given value.
9446    ///
9447    /// Even though the property as already been set when instantiating this call,
9448    /// we provide this method for API completeness.
9449    pub fn resource(
9450        mut self,
9451        new_value: &str,
9452    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {
9453        self._resource = new_value.to_string();
9454        self
9455    }
9456    /// 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).
9457    ///
9458    /// Sets the *options.requested policy version* query property to the given value.
9459    pub fn options_requested_policy_version(
9460        mut self,
9461        new_value: i32,
9462    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {
9463        self._options_requested_policy_version = Some(new_value);
9464        self
9465    }
9466    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9467    /// while executing the actual API request.
9468    ///
9469    /// ````text
9470    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9471    /// ````
9472    ///
9473    /// Sets the *delegate* property to the given value.
9474    pub fn delegate(
9475        mut self,
9476        new_value: &'a mut dyn common::Delegate,
9477    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {
9478        self._delegate = Some(new_value);
9479        self
9480    }
9481
9482    /// Set any additional parameter of the query string used in the request.
9483    /// It should be used to set parameters which are not yet available through their own
9484    /// setters.
9485    ///
9486    /// Please note that this method must not be used to set any of the known parameters
9487    /// which have their own setter method. If done anyway, the request will fail.
9488    ///
9489    /// # Additional Parameters
9490    ///
9491    /// * *$.xgafv* (query-string) - V1 error format.
9492    /// * *access_token* (query-string) - OAuth access token.
9493    /// * *alt* (query-string) - Data format for response.
9494    /// * *callback* (query-string) - JSONP
9495    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9496    /// * *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.
9497    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9498    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9499    /// * *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.
9500    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9501    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9502    pub fn param<T>(
9503        mut self,
9504        name: T,
9505        value: T,
9506    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C>
9507    where
9508        T: AsRef<str>,
9509    {
9510        self._additional_params
9511            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9512        self
9513    }
9514
9515    /// Identifies the authorization scope for the method you are building.
9516    ///
9517    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9518    /// [`Scope::CloudPlatform`].
9519    ///
9520    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9521    /// tokens for more than one scope.
9522    ///
9523    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9524    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9525    /// sufficient, a read-write scope will do as well.
9526    pub fn add_scope<St>(
9527        mut self,
9528        scope: St,
9529    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C>
9530    where
9531        St: AsRef<str>,
9532    {
9533        self._scopes.insert(String::from(scope.as_ref()));
9534        self
9535    }
9536    /// Identifies the authorization scope(s) for the method you are building.
9537    ///
9538    /// See [`Self::add_scope()`] for details.
9539    pub fn add_scopes<I, St>(
9540        mut self,
9541        scopes: I,
9542    ) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C>
9543    where
9544        I: IntoIterator<Item = St>,
9545        St: AsRef<str>,
9546    {
9547        self._scopes
9548            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9549        self
9550    }
9551
9552    /// Removes all scopes, and no default scope will be used either.
9553    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9554    /// for details).
9555    pub fn clear_scopes(mut self) -> ProjectLocationServiceDatabaseTableGetIamPolicyCall<'a, C> {
9556        self._scopes.clear();
9557        self
9558    }
9559}
9560
9561/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
9562///
9563/// A builder for the *locations.services.databases.tables.setIamPolicy* method supported by a *project* resource.
9564/// It is not used directly, but through a [`ProjectMethods`] instance.
9565///
9566/// # Example
9567///
9568/// Instantiate a resource method builder
9569///
9570/// ```test_harness,no_run
9571/// # extern crate hyper;
9572/// # extern crate hyper_rustls;
9573/// # extern crate google_metastore1_beta as metastore1_beta;
9574/// use metastore1_beta::api::SetIamPolicyRequest;
9575/// # async fn dox() {
9576/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9577///
9578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9579/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9580/// #     .with_native_roots()
9581/// #     .unwrap()
9582/// #     .https_only()
9583/// #     .enable_http2()
9584/// #     .build();
9585///
9586/// # let executor = hyper_util::rt::TokioExecutor::new();
9587/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9588/// #     secret,
9589/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9590/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9591/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9592/// #     ),
9593/// # ).build().await.unwrap();
9594///
9595/// # let client = hyper_util::client::legacy::Client::builder(
9596/// #     hyper_util::rt::TokioExecutor::new()
9597/// # )
9598/// # .build(
9599/// #     hyper_rustls::HttpsConnectorBuilder::new()
9600/// #         .with_native_roots()
9601/// #         .unwrap()
9602/// #         .https_or_http()
9603/// #         .enable_http2()
9604/// #         .build()
9605/// # );
9606/// # let mut hub = DataprocMetastore::new(client, auth);
9607/// // As the method needs a request, you would usually fill it with the desired information
9608/// // into the respective structure. Some of the parts shown here might not be applicable !
9609/// // Values shown here are possibly random and not representative !
9610/// let mut req = SetIamPolicyRequest::default();
9611///
9612/// // You can configure optional parameters by calling the respective setters at will, and
9613/// // execute the final call using `doit()`.
9614/// // Values shown here are possibly random and not representative !
9615/// let result = hub.projects().locations_services_databases_tables_set_iam_policy(req, "resource")
9616///              .doit().await;
9617/// # }
9618/// ```
9619pub struct ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C>
9620where
9621    C: 'a,
9622{
9623    hub: &'a DataprocMetastore<C>,
9624    _request: SetIamPolicyRequest,
9625    _resource: String,
9626    _delegate: Option<&'a mut dyn common::Delegate>,
9627    _additional_params: HashMap<String, String>,
9628    _scopes: BTreeSet<String>,
9629}
9630
9631impl<'a, C> common::CallBuilder for ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {}
9632
9633impl<'a, C> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C>
9634where
9635    C: common::Connector,
9636{
9637    /// Perform the operation you have build so far.
9638    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9639        use std::borrow::Cow;
9640        use std::io::{Read, Seek};
9641
9642        use common::{url::Params, ToParts};
9643        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9644
9645        let mut dd = common::DefaultDelegate;
9646        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9647        dlg.begin(common::MethodInfo {
9648            id: "metastore.projects.locations.services.databases.tables.setIamPolicy",
9649            http_method: hyper::Method::POST,
9650        });
9651
9652        for &field in ["alt", "resource"].iter() {
9653            if self._additional_params.contains_key(field) {
9654                dlg.finished(false);
9655                return Err(common::Error::FieldClash(field));
9656            }
9657        }
9658
9659        let mut params = Params::with_capacity(4 + self._additional_params.len());
9660        params.push("resource", self._resource);
9661
9662        params.extend(self._additional_params.iter());
9663
9664        params.push("alt", "json");
9665        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:setIamPolicy";
9666        if self._scopes.is_empty() {
9667            self._scopes
9668                .insert(Scope::CloudPlatform.as_ref().to_string());
9669        }
9670
9671        #[allow(clippy::single_element_loop)]
9672        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9673            url = params.uri_replacement(url, param_name, find_this, true);
9674        }
9675        {
9676            let to_remove = ["resource"];
9677            params.remove_params(&to_remove);
9678        }
9679
9680        let url = params.parse_with_url(&url);
9681
9682        let mut json_mime_type = mime::APPLICATION_JSON;
9683        let mut request_value_reader = {
9684            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9685            common::remove_json_null_values(&mut value);
9686            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9687            serde_json::to_writer(&mut dst, &value).unwrap();
9688            dst
9689        };
9690        let request_size = request_value_reader
9691            .seek(std::io::SeekFrom::End(0))
9692            .unwrap();
9693        request_value_reader
9694            .seek(std::io::SeekFrom::Start(0))
9695            .unwrap();
9696
9697        loop {
9698            let token = match self
9699                .hub
9700                .auth
9701                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9702                .await
9703            {
9704                Ok(token) => token,
9705                Err(e) => match dlg.token(e) {
9706                    Ok(token) => token,
9707                    Err(e) => {
9708                        dlg.finished(false);
9709                        return Err(common::Error::MissingToken(e));
9710                    }
9711                },
9712            };
9713            request_value_reader
9714                .seek(std::io::SeekFrom::Start(0))
9715                .unwrap();
9716            let mut req_result = {
9717                let client = &self.hub.client;
9718                dlg.pre_request();
9719                let mut req_builder = hyper::Request::builder()
9720                    .method(hyper::Method::POST)
9721                    .uri(url.as_str())
9722                    .header(USER_AGENT, self.hub._user_agent.clone());
9723
9724                if let Some(token) = token.as_ref() {
9725                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9726                }
9727
9728                let request = req_builder
9729                    .header(CONTENT_TYPE, json_mime_type.to_string())
9730                    .header(CONTENT_LENGTH, request_size as u64)
9731                    .body(common::to_body(
9732                        request_value_reader.get_ref().clone().into(),
9733                    ));
9734
9735                client.request(request.unwrap()).await
9736            };
9737
9738            match req_result {
9739                Err(err) => {
9740                    if let common::Retry::After(d) = dlg.http_error(&err) {
9741                        sleep(d).await;
9742                        continue;
9743                    }
9744                    dlg.finished(false);
9745                    return Err(common::Error::HttpError(err));
9746                }
9747                Ok(res) => {
9748                    let (mut parts, body) = res.into_parts();
9749                    let mut body = common::Body::new(body);
9750                    if !parts.status.is_success() {
9751                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9752                        let error = serde_json::from_str(&common::to_string(&bytes));
9753                        let response = common::to_response(parts, bytes.into());
9754
9755                        if let common::Retry::After(d) =
9756                            dlg.http_failure(&response, error.as_ref().ok())
9757                        {
9758                            sleep(d).await;
9759                            continue;
9760                        }
9761
9762                        dlg.finished(false);
9763
9764                        return Err(match error {
9765                            Ok(value) => common::Error::BadRequest(value),
9766                            _ => common::Error::Failure(response),
9767                        });
9768                    }
9769                    let response = {
9770                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9771                        let encoded = common::to_string(&bytes);
9772                        match serde_json::from_str(&encoded) {
9773                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9774                            Err(error) => {
9775                                dlg.response_json_decode_error(&encoded, &error);
9776                                return Err(common::Error::JsonDecodeError(
9777                                    encoded.to_string(),
9778                                    error,
9779                                ));
9780                            }
9781                        }
9782                    };
9783
9784                    dlg.finished(true);
9785                    return Ok(response);
9786                }
9787            }
9788        }
9789    }
9790
9791    ///
9792    /// Sets the *request* property to the given value.
9793    ///
9794    /// Even though the property as already been set when instantiating this call,
9795    /// we provide this method for API completeness.
9796    pub fn request(
9797        mut self,
9798        new_value: SetIamPolicyRequest,
9799    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {
9800        self._request = new_value;
9801        self
9802    }
9803    /// 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.
9804    ///
9805    /// Sets the *resource* path property to the given value.
9806    ///
9807    /// Even though the property as already been set when instantiating this call,
9808    /// we provide this method for API completeness.
9809    pub fn resource(
9810        mut self,
9811        new_value: &str,
9812    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {
9813        self._resource = new_value.to_string();
9814        self
9815    }
9816    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9817    /// while executing the actual API request.
9818    ///
9819    /// ````text
9820    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9821    /// ````
9822    ///
9823    /// Sets the *delegate* property to the given value.
9824    pub fn delegate(
9825        mut self,
9826        new_value: &'a mut dyn common::Delegate,
9827    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {
9828        self._delegate = Some(new_value);
9829        self
9830    }
9831
9832    /// Set any additional parameter of the query string used in the request.
9833    /// It should be used to set parameters which are not yet available through their own
9834    /// setters.
9835    ///
9836    /// Please note that this method must not be used to set any of the known parameters
9837    /// which have their own setter method. If done anyway, the request will fail.
9838    ///
9839    /// # Additional Parameters
9840    ///
9841    /// * *$.xgafv* (query-string) - V1 error format.
9842    /// * *access_token* (query-string) - OAuth access token.
9843    /// * *alt* (query-string) - Data format for response.
9844    /// * *callback* (query-string) - JSONP
9845    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9846    /// * *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.
9847    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9848    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9849    /// * *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.
9850    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9851    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9852    pub fn param<T>(
9853        mut self,
9854        name: T,
9855        value: T,
9856    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C>
9857    where
9858        T: AsRef<str>,
9859    {
9860        self._additional_params
9861            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9862        self
9863    }
9864
9865    /// Identifies the authorization scope for the method you are building.
9866    ///
9867    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9868    /// [`Scope::CloudPlatform`].
9869    ///
9870    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9871    /// tokens for more than one scope.
9872    ///
9873    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9874    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9875    /// sufficient, a read-write scope will do as well.
9876    pub fn add_scope<St>(
9877        mut self,
9878        scope: St,
9879    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C>
9880    where
9881        St: AsRef<str>,
9882    {
9883        self._scopes.insert(String::from(scope.as_ref()));
9884        self
9885    }
9886    /// Identifies the authorization scope(s) for the method you are building.
9887    ///
9888    /// See [`Self::add_scope()`] for details.
9889    pub fn add_scopes<I, St>(
9890        mut self,
9891        scopes: I,
9892    ) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C>
9893    where
9894        I: IntoIterator<Item = St>,
9895        St: AsRef<str>,
9896    {
9897        self._scopes
9898            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9899        self
9900    }
9901
9902    /// Removes all scopes, and no default scope will be used either.
9903    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9904    /// for details).
9905    pub fn clear_scopes(mut self) -> ProjectLocationServiceDatabaseTableSetIamPolicyCall<'a, C> {
9906        self._scopes.clear();
9907        self
9908    }
9909}
9910
9911/// 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.
9912///
9913/// A builder for the *locations.services.databases.tables.testIamPermissions* method supported by a *project* resource.
9914/// It is not used directly, but through a [`ProjectMethods`] instance.
9915///
9916/// # Example
9917///
9918/// Instantiate a resource method builder
9919///
9920/// ```test_harness,no_run
9921/// # extern crate hyper;
9922/// # extern crate hyper_rustls;
9923/// # extern crate google_metastore1_beta as metastore1_beta;
9924/// use metastore1_beta::api::TestIamPermissionsRequest;
9925/// # async fn dox() {
9926/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9927///
9928/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9929/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9930/// #     .with_native_roots()
9931/// #     .unwrap()
9932/// #     .https_only()
9933/// #     .enable_http2()
9934/// #     .build();
9935///
9936/// # let executor = hyper_util::rt::TokioExecutor::new();
9937/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9938/// #     secret,
9939/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9940/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9941/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9942/// #     ),
9943/// # ).build().await.unwrap();
9944///
9945/// # let client = hyper_util::client::legacy::Client::builder(
9946/// #     hyper_util::rt::TokioExecutor::new()
9947/// # )
9948/// # .build(
9949/// #     hyper_rustls::HttpsConnectorBuilder::new()
9950/// #         .with_native_roots()
9951/// #         .unwrap()
9952/// #         .https_or_http()
9953/// #         .enable_http2()
9954/// #         .build()
9955/// # );
9956/// # let mut hub = DataprocMetastore::new(client, auth);
9957/// // As the method needs a request, you would usually fill it with the desired information
9958/// // into the respective structure. Some of the parts shown here might not be applicable !
9959/// // Values shown here are possibly random and not representative !
9960/// let mut req = TestIamPermissionsRequest::default();
9961///
9962/// // You can configure optional parameters by calling the respective setters at will, and
9963/// // execute the final call using `doit()`.
9964/// // Values shown here are possibly random and not representative !
9965/// let result = hub.projects().locations_services_databases_tables_test_iam_permissions(req, "resource")
9966///              .doit().await;
9967/// # }
9968/// ```
9969pub struct ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
9970where
9971    C: 'a,
9972{
9973    hub: &'a DataprocMetastore<C>,
9974    _request: TestIamPermissionsRequest,
9975    _resource: String,
9976    _delegate: Option<&'a mut dyn common::Delegate>,
9977    _additional_params: HashMap<String, String>,
9978    _scopes: BTreeSet<String>,
9979}
9980
9981impl<'a, C> common::CallBuilder
9982    for ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
9983{
9984}
9985
9986impl<'a, C> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
9987where
9988    C: common::Connector,
9989{
9990    /// Perform the operation you have build so far.
9991    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
9992        use std::borrow::Cow;
9993        use std::io::{Read, Seek};
9994
9995        use common::{url::Params, ToParts};
9996        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9997
9998        let mut dd = common::DefaultDelegate;
9999        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10000        dlg.begin(common::MethodInfo {
10001            id: "metastore.projects.locations.services.databases.tables.testIamPermissions",
10002            http_method: hyper::Method::POST,
10003        });
10004
10005        for &field in ["alt", "resource"].iter() {
10006            if self._additional_params.contains_key(field) {
10007                dlg.finished(false);
10008                return Err(common::Error::FieldClash(field));
10009            }
10010        }
10011
10012        let mut params = Params::with_capacity(4 + self._additional_params.len());
10013        params.push("resource", self._resource);
10014
10015        params.extend(self._additional_params.iter());
10016
10017        params.push("alt", "json");
10018        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:testIamPermissions";
10019        if self._scopes.is_empty() {
10020            self._scopes
10021                .insert(Scope::CloudPlatform.as_ref().to_string());
10022        }
10023
10024        #[allow(clippy::single_element_loop)]
10025        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10026            url = params.uri_replacement(url, param_name, find_this, true);
10027        }
10028        {
10029            let to_remove = ["resource"];
10030            params.remove_params(&to_remove);
10031        }
10032
10033        let url = params.parse_with_url(&url);
10034
10035        let mut json_mime_type = mime::APPLICATION_JSON;
10036        let mut request_value_reader = {
10037            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10038            common::remove_json_null_values(&mut value);
10039            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10040            serde_json::to_writer(&mut dst, &value).unwrap();
10041            dst
10042        };
10043        let request_size = request_value_reader
10044            .seek(std::io::SeekFrom::End(0))
10045            .unwrap();
10046        request_value_reader
10047            .seek(std::io::SeekFrom::Start(0))
10048            .unwrap();
10049
10050        loop {
10051            let token = match self
10052                .hub
10053                .auth
10054                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10055                .await
10056            {
10057                Ok(token) => token,
10058                Err(e) => match dlg.token(e) {
10059                    Ok(token) => token,
10060                    Err(e) => {
10061                        dlg.finished(false);
10062                        return Err(common::Error::MissingToken(e));
10063                    }
10064                },
10065            };
10066            request_value_reader
10067                .seek(std::io::SeekFrom::Start(0))
10068                .unwrap();
10069            let mut req_result = {
10070                let client = &self.hub.client;
10071                dlg.pre_request();
10072                let mut req_builder = hyper::Request::builder()
10073                    .method(hyper::Method::POST)
10074                    .uri(url.as_str())
10075                    .header(USER_AGENT, self.hub._user_agent.clone());
10076
10077                if let Some(token) = token.as_ref() {
10078                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10079                }
10080
10081                let request = req_builder
10082                    .header(CONTENT_TYPE, json_mime_type.to_string())
10083                    .header(CONTENT_LENGTH, request_size as u64)
10084                    .body(common::to_body(
10085                        request_value_reader.get_ref().clone().into(),
10086                    ));
10087
10088                client.request(request.unwrap()).await
10089            };
10090
10091            match req_result {
10092                Err(err) => {
10093                    if let common::Retry::After(d) = dlg.http_error(&err) {
10094                        sleep(d).await;
10095                        continue;
10096                    }
10097                    dlg.finished(false);
10098                    return Err(common::Error::HttpError(err));
10099                }
10100                Ok(res) => {
10101                    let (mut parts, body) = res.into_parts();
10102                    let mut body = common::Body::new(body);
10103                    if !parts.status.is_success() {
10104                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10105                        let error = serde_json::from_str(&common::to_string(&bytes));
10106                        let response = common::to_response(parts, bytes.into());
10107
10108                        if let common::Retry::After(d) =
10109                            dlg.http_failure(&response, error.as_ref().ok())
10110                        {
10111                            sleep(d).await;
10112                            continue;
10113                        }
10114
10115                        dlg.finished(false);
10116
10117                        return Err(match error {
10118                            Ok(value) => common::Error::BadRequest(value),
10119                            _ => common::Error::Failure(response),
10120                        });
10121                    }
10122                    let response = {
10123                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10124                        let encoded = common::to_string(&bytes);
10125                        match serde_json::from_str(&encoded) {
10126                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10127                            Err(error) => {
10128                                dlg.response_json_decode_error(&encoded, &error);
10129                                return Err(common::Error::JsonDecodeError(
10130                                    encoded.to_string(),
10131                                    error,
10132                                ));
10133                            }
10134                        }
10135                    };
10136
10137                    dlg.finished(true);
10138                    return Ok(response);
10139                }
10140            }
10141        }
10142    }
10143
10144    ///
10145    /// Sets the *request* property to the given value.
10146    ///
10147    /// Even though the property as already been set when instantiating this call,
10148    /// we provide this method for API completeness.
10149    pub fn request(
10150        mut self,
10151        new_value: TestIamPermissionsRequest,
10152    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C> {
10153        self._request = new_value;
10154        self
10155    }
10156    /// 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.
10157    ///
10158    /// Sets the *resource* path property to the given value.
10159    ///
10160    /// Even though the property as already been set when instantiating this call,
10161    /// we provide this method for API completeness.
10162    pub fn resource(
10163        mut self,
10164        new_value: &str,
10165    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C> {
10166        self._resource = new_value.to_string();
10167        self
10168    }
10169    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10170    /// while executing the actual API request.
10171    ///
10172    /// ````text
10173    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10174    /// ````
10175    ///
10176    /// Sets the *delegate* property to the given value.
10177    pub fn delegate(
10178        mut self,
10179        new_value: &'a mut dyn common::Delegate,
10180    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C> {
10181        self._delegate = Some(new_value);
10182        self
10183    }
10184
10185    /// Set any additional parameter of the query string used in the request.
10186    /// It should be used to set parameters which are not yet available through their own
10187    /// setters.
10188    ///
10189    /// Please note that this method must not be used to set any of the known parameters
10190    /// which have their own setter method. If done anyway, the request will fail.
10191    ///
10192    /// # Additional Parameters
10193    ///
10194    /// * *$.xgafv* (query-string) - V1 error format.
10195    /// * *access_token* (query-string) - OAuth access token.
10196    /// * *alt* (query-string) - Data format for response.
10197    /// * *callback* (query-string) - JSONP
10198    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10199    /// * *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.
10200    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10201    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10202    /// * *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.
10203    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10204    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10205    pub fn param<T>(
10206        mut self,
10207        name: T,
10208        value: T,
10209    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
10210    where
10211        T: AsRef<str>,
10212    {
10213        self._additional_params
10214            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10215        self
10216    }
10217
10218    /// Identifies the authorization scope for the method you are building.
10219    ///
10220    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10221    /// [`Scope::CloudPlatform`].
10222    ///
10223    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10224    /// tokens for more than one scope.
10225    ///
10226    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10227    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10228    /// sufficient, a read-write scope will do as well.
10229    pub fn add_scope<St>(
10230        mut self,
10231        scope: St,
10232    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
10233    where
10234        St: AsRef<str>,
10235    {
10236        self._scopes.insert(String::from(scope.as_ref()));
10237        self
10238    }
10239    /// Identifies the authorization scope(s) for the method you are building.
10240    ///
10241    /// See [`Self::add_scope()`] for details.
10242    pub fn add_scopes<I, St>(
10243        mut self,
10244        scopes: I,
10245    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C>
10246    where
10247        I: IntoIterator<Item = St>,
10248        St: AsRef<str>,
10249    {
10250        self._scopes
10251            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10252        self
10253    }
10254
10255    /// Removes all scopes, and no default scope will be used either.
10256    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10257    /// for details).
10258    pub fn clear_scopes(
10259        mut self,
10260    ) -> ProjectLocationServiceDatabaseTableTestIamPermissionCall<'a, C> {
10261        self._scopes.clear();
10262        self
10263    }
10264}
10265
10266/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
10267///
10268/// A builder for the *locations.services.databases.getIamPolicy* method supported by a *project* resource.
10269/// It is not used directly, but through a [`ProjectMethods`] instance.
10270///
10271/// # Example
10272///
10273/// Instantiate a resource method builder
10274///
10275/// ```test_harness,no_run
10276/// # extern crate hyper;
10277/// # extern crate hyper_rustls;
10278/// # extern crate google_metastore1_beta as metastore1_beta;
10279/// # async fn dox() {
10280/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10281///
10282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10283/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10284/// #     .with_native_roots()
10285/// #     .unwrap()
10286/// #     .https_only()
10287/// #     .enable_http2()
10288/// #     .build();
10289///
10290/// # let executor = hyper_util::rt::TokioExecutor::new();
10291/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10292/// #     secret,
10293/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10294/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10295/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10296/// #     ),
10297/// # ).build().await.unwrap();
10298///
10299/// # let client = hyper_util::client::legacy::Client::builder(
10300/// #     hyper_util::rt::TokioExecutor::new()
10301/// # )
10302/// # .build(
10303/// #     hyper_rustls::HttpsConnectorBuilder::new()
10304/// #         .with_native_roots()
10305/// #         .unwrap()
10306/// #         .https_or_http()
10307/// #         .enable_http2()
10308/// #         .build()
10309/// # );
10310/// # let mut hub = DataprocMetastore::new(client, auth);
10311/// // You can configure optional parameters by calling the respective setters at will, and
10312/// // execute the final call using `doit()`.
10313/// // Values shown here are possibly random and not representative !
10314/// let result = hub.projects().locations_services_databases_get_iam_policy("resource")
10315///              .options_requested_policy_version(-28)
10316///              .doit().await;
10317/// # }
10318/// ```
10319pub struct ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C>
10320where
10321    C: 'a,
10322{
10323    hub: &'a DataprocMetastore<C>,
10324    _resource: String,
10325    _options_requested_policy_version: Option<i32>,
10326    _delegate: Option<&'a mut dyn common::Delegate>,
10327    _additional_params: HashMap<String, String>,
10328    _scopes: BTreeSet<String>,
10329}
10330
10331impl<'a, C> common::CallBuilder for ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {}
10332
10333impl<'a, C> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C>
10334where
10335    C: common::Connector,
10336{
10337    /// Perform the operation you have build so far.
10338    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10339        use std::borrow::Cow;
10340        use std::io::{Read, Seek};
10341
10342        use common::{url::Params, ToParts};
10343        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10344
10345        let mut dd = common::DefaultDelegate;
10346        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10347        dlg.begin(common::MethodInfo {
10348            id: "metastore.projects.locations.services.databases.getIamPolicy",
10349            http_method: hyper::Method::GET,
10350        });
10351
10352        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
10353            if self._additional_params.contains_key(field) {
10354                dlg.finished(false);
10355                return Err(common::Error::FieldClash(field));
10356            }
10357        }
10358
10359        let mut params = Params::with_capacity(4 + self._additional_params.len());
10360        params.push("resource", self._resource);
10361        if let Some(value) = self._options_requested_policy_version.as_ref() {
10362            params.push("options.requestedPolicyVersion", value.to_string());
10363        }
10364
10365        params.extend(self._additional_params.iter());
10366
10367        params.push("alt", "json");
10368        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:getIamPolicy";
10369        if self._scopes.is_empty() {
10370            self._scopes
10371                .insert(Scope::CloudPlatform.as_ref().to_string());
10372        }
10373
10374        #[allow(clippy::single_element_loop)]
10375        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10376            url = params.uri_replacement(url, param_name, find_this, true);
10377        }
10378        {
10379            let to_remove = ["resource"];
10380            params.remove_params(&to_remove);
10381        }
10382
10383        let url = params.parse_with_url(&url);
10384
10385        loop {
10386            let token = match self
10387                .hub
10388                .auth
10389                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10390                .await
10391            {
10392                Ok(token) => token,
10393                Err(e) => match dlg.token(e) {
10394                    Ok(token) => token,
10395                    Err(e) => {
10396                        dlg.finished(false);
10397                        return Err(common::Error::MissingToken(e));
10398                    }
10399                },
10400            };
10401            let mut req_result = {
10402                let client = &self.hub.client;
10403                dlg.pre_request();
10404                let mut req_builder = hyper::Request::builder()
10405                    .method(hyper::Method::GET)
10406                    .uri(url.as_str())
10407                    .header(USER_AGENT, self.hub._user_agent.clone());
10408
10409                if let Some(token) = token.as_ref() {
10410                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10411                }
10412
10413                let request = req_builder
10414                    .header(CONTENT_LENGTH, 0_u64)
10415                    .body(common::to_body::<String>(None));
10416
10417                client.request(request.unwrap()).await
10418            };
10419
10420            match req_result {
10421                Err(err) => {
10422                    if let common::Retry::After(d) = dlg.http_error(&err) {
10423                        sleep(d).await;
10424                        continue;
10425                    }
10426                    dlg.finished(false);
10427                    return Err(common::Error::HttpError(err));
10428                }
10429                Ok(res) => {
10430                    let (mut parts, body) = res.into_parts();
10431                    let mut body = common::Body::new(body);
10432                    if !parts.status.is_success() {
10433                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10434                        let error = serde_json::from_str(&common::to_string(&bytes));
10435                        let response = common::to_response(parts, bytes.into());
10436
10437                        if let common::Retry::After(d) =
10438                            dlg.http_failure(&response, error.as_ref().ok())
10439                        {
10440                            sleep(d).await;
10441                            continue;
10442                        }
10443
10444                        dlg.finished(false);
10445
10446                        return Err(match error {
10447                            Ok(value) => common::Error::BadRequest(value),
10448                            _ => common::Error::Failure(response),
10449                        });
10450                    }
10451                    let response = {
10452                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10453                        let encoded = common::to_string(&bytes);
10454                        match serde_json::from_str(&encoded) {
10455                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10456                            Err(error) => {
10457                                dlg.response_json_decode_error(&encoded, &error);
10458                                return Err(common::Error::JsonDecodeError(
10459                                    encoded.to_string(),
10460                                    error,
10461                                ));
10462                            }
10463                        }
10464                    };
10465
10466                    dlg.finished(true);
10467                    return Ok(response);
10468                }
10469            }
10470        }
10471    }
10472
10473    /// 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.
10474    ///
10475    /// Sets the *resource* path property to the given value.
10476    ///
10477    /// Even though the property as already been set when instantiating this call,
10478    /// we provide this method for API completeness.
10479    pub fn resource(
10480        mut self,
10481        new_value: &str,
10482    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {
10483        self._resource = new_value.to_string();
10484        self
10485    }
10486    /// 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).
10487    ///
10488    /// Sets the *options.requested policy version* query property to the given value.
10489    pub fn options_requested_policy_version(
10490        mut self,
10491        new_value: i32,
10492    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {
10493        self._options_requested_policy_version = Some(new_value);
10494        self
10495    }
10496    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10497    /// while executing the actual API request.
10498    ///
10499    /// ````text
10500    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10501    /// ````
10502    ///
10503    /// Sets the *delegate* property to the given value.
10504    pub fn delegate(
10505        mut self,
10506        new_value: &'a mut dyn common::Delegate,
10507    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {
10508        self._delegate = Some(new_value);
10509        self
10510    }
10511
10512    /// Set any additional parameter of the query string used in the request.
10513    /// It should be used to set parameters which are not yet available through their own
10514    /// setters.
10515    ///
10516    /// Please note that this method must not be used to set any of the known parameters
10517    /// which have their own setter method. If done anyway, the request will fail.
10518    ///
10519    /// # Additional Parameters
10520    ///
10521    /// * *$.xgafv* (query-string) - V1 error format.
10522    /// * *access_token* (query-string) - OAuth access token.
10523    /// * *alt* (query-string) - Data format for response.
10524    /// * *callback* (query-string) - JSONP
10525    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10526    /// * *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.
10527    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10528    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10529    /// * *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.
10530    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10531    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10532    pub fn param<T>(
10533        mut self,
10534        name: T,
10535        value: T,
10536    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C>
10537    where
10538        T: AsRef<str>,
10539    {
10540        self._additional_params
10541            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10542        self
10543    }
10544
10545    /// Identifies the authorization scope for the method you are building.
10546    ///
10547    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10548    /// [`Scope::CloudPlatform`].
10549    ///
10550    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10551    /// tokens for more than one scope.
10552    ///
10553    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10554    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10555    /// sufficient, a read-write scope will do as well.
10556    pub fn add_scope<St>(
10557        mut self,
10558        scope: St,
10559    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C>
10560    where
10561        St: AsRef<str>,
10562    {
10563        self._scopes.insert(String::from(scope.as_ref()));
10564        self
10565    }
10566    /// Identifies the authorization scope(s) for the method you are building.
10567    ///
10568    /// See [`Self::add_scope()`] for details.
10569    pub fn add_scopes<I, St>(
10570        mut self,
10571        scopes: I,
10572    ) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C>
10573    where
10574        I: IntoIterator<Item = St>,
10575        St: AsRef<str>,
10576    {
10577        self._scopes
10578            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10579        self
10580    }
10581
10582    /// Removes all scopes, and no default scope will be used either.
10583    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10584    /// for details).
10585    pub fn clear_scopes(mut self) -> ProjectLocationServiceDatabaseGetIamPolicyCall<'a, C> {
10586        self._scopes.clear();
10587        self
10588    }
10589}
10590
10591/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
10592///
10593/// A builder for the *locations.services.databases.setIamPolicy* method supported by a *project* resource.
10594/// It is not used directly, but through a [`ProjectMethods`] instance.
10595///
10596/// # Example
10597///
10598/// Instantiate a resource method builder
10599///
10600/// ```test_harness,no_run
10601/// # extern crate hyper;
10602/// # extern crate hyper_rustls;
10603/// # extern crate google_metastore1_beta as metastore1_beta;
10604/// use metastore1_beta::api::SetIamPolicyRequest;
10605/// # async fn dox() {
10606/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10607///
10608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10609/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10610/// #     .with_native_roots()
10611/// #     .unwrap()
10612/// #     .https_only()
10613/// #     .enable_http2()
10614/// #     .build();
10615///
10616/// # let executor = hyper_util::rt::TokioExecutor::new();
10617/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10618/// #     secret,
10619/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10620/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10621/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10622/// #     ),
10623/// # ).build().await.unwrap();
10624///
10625/// # let client = hyper_util::client::legacy::Client::builder(
10626/// #     hyper_util::rt::TokioExecutor::new()
10627/// # )
10628/// # .build(
10629/// #     hyper_rustls::HttpsConnectorBuilder::new()
10630/// #         .with_native_roots()
10631/// #         .unwrap()
10632/// #         .https_or_http()
10633/// #         .enable_http2()
10634/// #         .build()
10635/// # );
10636/// # let mut hub = DataprocMetastore::new(client, auth);
10637/// // As the method needs a request, you would usually fill it with the desired information
10638/// // into the respective structure. Some of the parts shown here might not be applicable !
10639/// // Values shown here are possibly random and not representative !
10640/// let mut req = SetIamPolicyRequest::default();
10641///
10642/// // You can configure optional parameters by calling the respective setters at will, and
10643/// // execute the final call using `doit()`.
10644/// // Values shown here are possibly random and not representative !
10645/// let result = hub.projects().locations_services_databases_set_iam_policy(req, "resource")
10646///              .doit().await;
10647/// # }
10648/// ```
10649pub struct ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C>
10650where
10651    C: 'a,
10652{
10653    hub: &'a DataprocMetastore<C>,
10654    _request: SetIamPolicyRequest,
10655    _resource: String,
10656    _delegate: Option<&'a mut dyn common::Delegate>,
10657    _additional_params: HashMap<String, String>,
10658    _scopes: BTreeSet<String>,
10659}
10660
10661impl<'a, C> common::CallBuilder for ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {}
10662
10663impl<'a, C> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C>
10664where
10665    C: common::Connector,
10666{
10667    /// Perform the operation you have build so far.
10668    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10669        use std::borrow::Cow;
10670        use std::io::{Read, Seek};
10671
10672        use common::{url::Params, ToParts};
10673        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10674
10675        let mut dd = common::DefaultDelegate;
10676        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10677        dlg.begin(common::MethodInfo {
10678            id: "metastore.projects.locations.services.databases.setIamPolicy",
10679            http_method: hyper::Method::POST,
10680        });
10681
10682        for &field in ["alt", "resource"].iter() {
10683            if self._additional_params.contains_key(field) {
10684                dlg.finished(false);
10685                return Err(common::Error::FieldClash(field));
10686            }
10687        }
10688
10689        let mut params = Params::with_capacity(4 + self._additional_params.len());
10690        params.push("resource", self._resource);
10691
10692        params.extend(self._additional_params.iter());
10693
10694        params.push("alt", "json");
10695        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:setIamPolicy";
10696        if self._scopes.is_empty() {
10697            self._scopes
10698                .insert(Scope::CloudPlatform.as_ref().to_string());
10699        }
10700
10701        #[allow(clippy::single_element_loop)]
10702        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10703            url = params.uri_replacement(url, param_name, find_this, true);
10704        }
10705        {
10706            let to_remove = ["resource"];
10707            params.remove_params(&to_remove);
10708        }
10709
10710        let url = params.parse_with_url(&url);
10711
10712        let mut json_mime_type = mime::APPLICATION_JSON;
10713        let mut request_value_reader = {
10714            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10715            common::remove_json_null_values(&mut value);
10716            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10717            serde_json::to_writer(&mut dst, &value).unwrap();
10718            dst
10719        };
10720        let request_size = request_value_reader
10721            .seek(std::io::SeekFrom::End(0))
10722            .unwrap();
10723        request_value_reader
10724            .seek(std::io::SeekFrom::Start(0))
10725            .unwrap();
10726
10727        loop {
10728            let token = match self
10729                .hub
10730                .auth
10731                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10732                .await
10733            {
10734                Ok(token) => token,
10735                Err(e) => match dlg.token(e) {
10736                    Ok(token) => token,
10737                    Err(e) => {
10738                        dlg.finished(false);
10739                        return Err(common::Error::MissingToken(e));
10740                    }
10741                },
10742            };
10743            request_value_reader
10744                .seek(std::io::SeekFrom::Start(0))
10745                .unwrap();
10746            let mut req_result = {
10747                let client = &self.hub.client;
10748                dlg.pre_request();
10749                let mut req_builder = hyper::Request::builder()
10750                    .method(hyper::Method::POST)
10751                    .uri(url.as_str())
10752                    .header(USER_AGENT, self.hub._user_agent.clone());
10753
10754                if let Some(token) = token.as_ref() {
10755                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10756                }
10757
10758                let request = req_builder
10759                    .header(CONTENT_TYPE, json_mime_type.to_string())
10760                    .header(CONTENT_LENGTH, request_size as u64)
10761                    .body(common::to_body(
10762                        request_value_reader.get_ref().clone().into(),
10763                    ));
10764
10765                client.request(request.unwrap()).await
10766            };
10767
10768            match req_result {
10769                Err(err) => {
10770                    if let common::Retry::After(d) = dlg.http_error(&err) {
10771                        sleep(d).await;
10772                        continue;
10773                    }
10774                    dlg.finished(false);
10775                    return Err(common::Error::HttpError(err));
10776                }
10777                Ok(res) => {
10778                    let (mut parts, body) = res.into_parts();
10779                    let mut body = common::Body::new(body);
10780                    if !parts.status.is_success() {
10781                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10782                        let error = serde_json::from_str(&common::to_string(&bytes));
10783                        let response = common::to_response(parts, bytes.into());
10784
10785                        if let common::Retry::After(d) =
10786                            dlg.http_failure(&response, error.as_ref().ok())
10787                        {
10788                            sleep(d).await;
10789                            continue;
10790                        }
10791
10792                        dlg.finished(false);
10793
10794                        return Err(match error {
10795                            Ok(value) => common::Error::BadRequest(value),
10796                            _ => common::Error::Failure(response),
10797                        });
10798                    }
10799                    let response = {
10800                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10801                        let encoded = common::to_string(&bytes);
10802                        match serde_json::from_str(&encoded) {
10803                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10804                            Err(error) => {
10805                                dlg.response_json_decode_error(&encoded, &error);
10806                                return Err(common::Error::JsonDecodeError(
10807                                    encoded.to_string(),
10808                                    error,
10809                                ));
10810                            }
10811                        }
10812                    };
10813
10814                    dlg.finished(true);
10815                    return Ok(response);
10816                }
10817            }
10818        }
10819    }
10820
10821    ///
10822    /// Sets the *request* property to the given value.
10823    ///
10824    /// Even though the property as already been set when instantiating this call,
10825    /// we provide this method for API completeness.
10826    pub fn request(
10827        mut self,
10828        new_value: SetIamPolicyRequest,
10829    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {
10830        self._request = new_value;
10831        self
10832    }
10833    /// 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.
10834    ///
10835    /// Sets the *resource* path property to the given value.
10836    ///
10837    /// Even though the property as already been set when instantiating this call,
10838    /// we provide this method for API completeness.
10839    pub fn resource(
10840        mut self,
10841        new_value: &str,
10842    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {
10843        self._resource = new_value.to_string();
10844        self
10845    }
10846    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10847    /// while executing the actual API request.
10848    ///
10849    /// ````text
10850    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10851    /// ````
10852    ///
10853    /// Sets the *delegate* property to the given value.
10854    pub fn delegate(
10855        mut self,
10856        new_value: &'a mut dyn common::Delegate,
10857    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {
10858        self._delegate = Some(new_value);
10859        self
10860    }
10861
10862    /// Set any additional parameter of the query string used in the request.
10863    /// It should be used to set parameters which are not yet available through their own
10864    /// setters.
10865    ///
10866    /// Please note that this method must not be used to set any of the known parameters
10867    /// which have their own setter method. If done anyway, the request will fail.
10868    ///
10869    /// # Additional Parameters
10870    ///
10871    /// * *$.xgafv* (query-string) - V1 error format.
10872    /// * *access_token* (query-string) - OAuth access token.
10873    /// * *alt* (query-string) - Data format for response.
10874    /// * *callback* (query-string) - JSONP
10875    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10876    /// * *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.
10877    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10878    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10879    /// * *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.
10880    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10881    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10882    pub fn param<T>(
10883        mut self,
10884        name: T,
10885        value: T,
10886    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C>
10887    where
10888        T: AsRef<str>,
10889    {
10890        self._additional_params
10891            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10892        self
10893    }
10894
10895    /// Identifies the authorization scope for the method you are building.
10896    ///
10897    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10898    /// [`Scope::CloudPlatform`].
10899    ///
10900    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10901    /// tokens for more than one scope.
10902    ///
10903    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10904    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10905    /// sufficient, a read-write scope will do as well.
10906    pub fn add_scope<St>(
10907        mut self,
10908        scope: St,
10909    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C>
10910    where
10911        St: AsRef<str>,
10912    {
10913        self._scopes.insert(String::from(scope.as_ref()));
10914        self
10915    }
10916    /// Identifies the authorization scope(s) for the method you are building.
10917    ///
10918    /// See [`Self::add_scope()`] for details.
10919    pub fn add_scopes<I, St>(
10920        mut self,
10921        scopes: I,
10922    ) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C>
10923    where
10924        I: IntoIterator<Item = St>,
10925        St: AsRef<str>,
10926    {
10927        self._scopes
10928            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10929        self
10930    }
10931
10932    /// Removes all scopes, and no default scope will be used either.
10933    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10934    /// for details).
10935    pub fn clear_scopes(mut self) -> ProjectLocationServiceDatabaseSetIamPolicyCall<'a, C> {
10936        self._scopes.clear();
10937        self
10938    }
10939}
10940
10941/// 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.
10942///
10943/// A builder for the *locations.services.databases.testIamPermissions* method supported by a *project* resource.
10944/// It is not used directly, but through a [`ProjectMethods`] instance.
10945///
10946/// # Example
10947///
10948/// Instantiate a resource method builder
10949///
10950/// ```test_harness,no_run
10951/// # extern crate hyper;
10952/// # extern crate hyper_rustls;
10953/// # extern crate google_metastore1_beta as metastore1_beta;
10954/// use metastore1_beta::api::TestIamPermissionsRequest;
10955/// # async fn dox() {
10956/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10957///
10958/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10959/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10960/// #     .with_native_roots()
10961/// #     .unwrap()
10962/// #     .https_only()
10963/// #     .enable_http2()
10964/// #     .build();
10965///
10966/// # let executor = hyper_util::rt::TokioExecutor::new();
10967/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10968/// #     secret,
10969/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10970/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10971/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10972/// #     ),
10973/// # ).build().await.unwrap();
10974///
10975/// # let client = hyper_util::client::legacy::Client::builder(
10976/// #     hyper_util::rt::TokioExecutor::new()
10977/// # )
10978/// # .build(
10979/// #     hyper_rustls::HttpsConnectorBuilder::new()
10980/// #         .with_native_roots()
10981/// #         .unwrap()
10982/// #         .https_or_http()
10983/// #         .enable_http2()
10984/// #         .build()
10985/// # );
10986/// # let mut hub = DataprocMetastore::new(client, auth);
10987/// // As the method needs a request, you would usually fill it with the desired information
10988/// // into the respective structure. Some of the parts shown here might not be applicable !
10989/// // Values shown here are possibly random and not representative !
10990/// let mut req = TestIamPermissionsRequest::default();
10991///
10992/// // You can configure optional parameters by calling the respective setters at will, and
10993/// // execute the final call using `doit()`.
10994/// // Values shown here are possibly random and not representative !
10995/// let result = hub.projects().locations_services_databases_test_iam_permissions(req, "resource")
10996///              .doit().await;
10997/// # }
10998/// ```
10999pub struct ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C>
11000where
11001    C: 'a,
11002{
11003    hub: &'a DataprocMetastore<C>,
11004    _request: TestIamPermissionsRequest,
11005    _resource: String,
11006    _delegate: Option<&'a mut dyn common::Delegate>,
11007    _additional_params: HashMap<String, String>,
11008    _scopes: BTreeSet<String>,
11009}
11010
11011impl<'a, C> common::CallBuilder for ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {}
11012
11013impl<'a, C> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C>
11014where
11015    C: common::Connector,
11016{
11017    /// Perform the operation you have build so far.
11018    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
11019        use std::borrow::Cow;
11020        use std::io::{Read, Seek};
11021
11022        use common::{url::Params, ToParts};
11023        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11024
11025        let mut dd = common::DefaultDelegate;
11026        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11027        dlg.begin(common::MethodInfo {
11028            id: "metastore.projects.locations.services.databases.testIamPermissions",
11029            http_method: hyper::Method::POST,
11030        });
11031
11032        for &field in ["alt", "resource"].iter() {
11033            if self._additional_params.contains_key(field) {
11034                dlg.finished(false);
11035                return Err(common::Error::FieldClash(field));
11036            }
11037        }
11038
11039        let mut params = Params::with_capacity(4 + self._additional_params.len());
11040        params.push("resource", self._resource);
11041
11042        params.extend(self._additional_params.iter());
11043
11044        params.push("alt", "json");
11045        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:testIamPermissions";
11046        if self._scopes.is_empty() {
11047            self._scopes
11048                .insert(Scope::CloudPlatform.as_ref().to_string());
11049        }
11050
11051        #[allow(clippy::single_element_loop)]
11052        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11053            url = params.uri_replacement(url, param_name, find_this, true);
11054        }
11055        {
11056            let to_remove = ["resource"];
11057            params.remove_params(&to_remove);
11058        }
11059
11060        let url = params.parse_with_url(&url);
11061
11062        let mut json_mime_type = mime::APPLICATION_JSON;
11063        let mut request_value_reader = {
11064            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11065            common::remove_json_null_values(&mut value);
11066            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11067            serde_json::to_writer(&mut dst, &value).unwrap();
11068            dst
11069        };
11070        let request_size = request_value_reader
11071            .seek(std::io::SeekFrom::End(0))
11072            .unwrap();
11073        request_value_reader
11074            .seek(std::io::SeekFrom::Start(0))
11075            .unwrap();
11076
11077        loop {
11078            let token = match self
11079                .hub
11080                .auth
11081                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11082                .await
11083            {
11084                Ok(token) => token,
11085                Err(e) => match dlg.token(e) {
11086                    Ok(token) => token,
11087                    Err(e) => {
11088                        dlg.finished(false);
11089                        return Err(common::Error::MissingToken(e));
11090                    }
11091                },
11092            };
11093            request_value_reader
11094                .seek(std::io::SeekFrom::Start(0))
11095                .unwrap();
11096            let mut req_result = {
11097                let client = &self.hub.client;
11098                dlg.pre_request();
11099                let mut req_builder = hyper::Request::builder()
11100                    .method(hyper::Method::POST)
11101                    .uri(url.as_str())
11102                    .header(USER_AGENT, self.hub._user_agent.clone());
11103
11104                if let Some(token) = token.as_ref() {
11105                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11106                }
11107
11108                let request = req_builder
11109                    .header(CONTENT_TYPE, json_mime_type.to_string())
11110                    .header(CONTENT_LENGTH, request_size as u64)
11111                    .body(common::to_body(
11112                        request_value_reader.get_ref().clone().into(),
11113                    ));
11114
11115                client.request(request.unwrap()).await
11116            };
11117
11118            match req_result {
11119                Err(err) => {
11120                    if let common::Retry::After(d) = dlg.http_error(&err) {
11121                        sleep(d).await;
11122                        continue;
11123                    }
11124                    dlg.finished(false);
11125                    return Err(common::Error::HttpError(err));
11126                }
11127                Ok(res) => {
11128                    let (mut parts, body) = res.into_parts();
11129                    let mut body = common::Body::new(body);
11130                    if !parts.status.is_success() {
11131                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11132                        let error = serde_json::from_str(&common::to_string(&bytes));
11133                        let response = common::to_response(parts, bytes.into());
11134
11135                        if let common::Retry::After(d) =
11136                            dlg.http_failure(&response, error.as_ref().ok())
11137                        {
11138                            sleep(d).await;
11139                            continue;
11140                        }
11141
11142                        dlg.finished(false);
11143
11144                        return Err(match error {
11145                            Ok(value) => common::Error::BadRequest(value),
11146                            _ => common::Error::Failure(response),
11147                        });
11148                    }
11149                    let response = {
11150                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11151                        let encoded = common::to_string(&bytes);
11152                        match serde_json::from_str(&encoded) {
11153                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11154                            Err(error) => {
11155                                dlg.response_json_decode_error(&encoded, &error);
11156                                return Err(common::Error::JsonDecodeError(
11157                                    encoded.to_string(),
11158                                    error,
11159                                ));
11160                            }
11161                        }
11162                    };
11163
11164                    dlg.finished(true);
11165                    return Ok(response);
11166                }
11167            }
11168        }
11169    }
11170
11171    ///
11172    /// Sets the *request* property to the given value.
11173    ///
11174    /// Even though the property as already been set when instantiating this call,
11175    /// we provide this method for API completeness.
11176    pub fn request(
11177        mut self,
11178        new_value: TestIamPermissionsRequest,
11179    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {
11180        self._request = new_value;
11181        self
11182    }
11183    /// 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.
11184    ///
11185    /// Sets the *resource* path property to the given value.
11186    ///
11187    /// Even though the property as already been set when instantiating this call,
11188    /// we provide this method for API completeness.
11189    pub fn resource(
11190        mut self,
11191        new_value: &str,
11192    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {
11193        self._resource = new_value.to_string();
11194        self
11195    }
11196    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11197    /// while executing the actual API request.
11198    ///
11199    /// ````text
11200    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11201    /// ````
11202    ///
11203    /// Sets the *delegate* property to the given value.
11204    pub fn delegate(
11205        mut self,
11206        new_value: &'a mut dyn common::Delegate,
11207    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {
11208        self._delegate = Some(new_value);
11209        self
11210    }
11211
11212    /// Set any additional parameter of the query string used in the request.
11213    /// It should be used to set parameters which are not yet available through their own
11214    /// setters.
11215    ///
11216    /// Please note that this method must not be used to set any of the known parameters
11217    /// which have their own setter method. If done anyway, the request will fail.
11218    ///
11219    /// # Additional Parameters
11220    ///
11221    /// * *$.xgafv* (query-string) - V1 error format.
11222    /// * *access_token* (query-string) - OAuth access token.
11223    /// * *alt* (query-string) - Data format for response.
11224    /// * *callback* (query-string) - JSONP
11225    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11226    /// * *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.
11227    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11228    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11229    /// * *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.
11230    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11231    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11232    pub fn param<T>(
11233        mut self,
11234        name: T,
11235        value: T,
11236    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C>
11237    where
11238        T: AsRef<str>,
11239    {
11240        self._additional_params
11241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11242        self
11243    }
11244
11245    /// Identifies the authorization scope for the method you are building.
11246    ///
11247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11248    /// [`Scope::CloudPlatform`].
11249    ///
11250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11251    /// tokens for more than one scope.
11252    ///
11253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11255    /// sufficient, a read-write scope will do as well.
11256    pub fn add_scope<St>(
11257        mut self,
11258        scope: St,
11259    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C>
11260    where
11261        St: AsRef<str>,
11262    {
11263        self._scopes.insert(String::from(scope.as_ref()));
11264        self
11265    }
11266    /// Identifies the authorization scope(s) for the method you are building.
11267    ///
11268    /// See [`Self::add_scope()`] for details.
11269    pub fn add_scopes<I, St>(
11270        mut self,
11271        scopes: I,
11272    ) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C>
11273    where
11274        I: IntoIterator<Item = St>,
11275        St: AsRef<str>,
11276    {
11277        self._scopes
11278            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11279        self
11280    }
11281
11282    /// Removes all scopes, and no default scope will be used either.
11283    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11284    /// for details).
11285    pub fn clear_scopes(mut self) -> ProjectLocationServiceDatabaseTestIamPermissionCall<'a, C> {
11286        self._scopes.clear();
11287        self
11288    }
11289}
11290
11291/// Creates a new MetadataImport in a given project and location.
11292///
11293/// A builder for the *locations.services.metadataImports.create* method supported by a *project* resource.
11294/// It is not used directly, but through a [`ProjectMethods`] instance.
11295///
11296/// # Example
11297///
11298/// Instantiate a resource method builder
11299///
11300/// ```test_harness,no_run
11301/// # extern crate hyper;
11302/// # extern crate hyper_rustls;
11303/// # extern crate google_metastore1_beta as metastore1_beta;
11304/// use metastore1_beta::api::MetadataImport;
11305/// # async fn dox() {
11306/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11307///
11308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11309/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11310/// #     .with_native_roots()
11311/// #     .unwrap()
11312/// #     .https_only()
11313/// #     .enable_http2()
11314/// #     .build();
11315///
11316/// # let executor = hyper_util::rt::TokioExecutor::new();
11317/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11318/// #     secret,
11319/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11320/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11321/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11322/// #     ),
11323/// # ).build().await.unwrap();
11324///
11325/// # let client = hyper_util::client::legacy::Client::builder(
11326/// #     hyper_util::rt::TokioExecutor::new()
11327/// # )
11328/// # .build(
11329/// #     hyper_rustls::HttpsConnectorBuilder::new()
11330/// #         .with_native_roots()
11331/// #         .unwrap()
11332/// #         .https_or_http()
11333/// #         .enable_http2()
11334/// #         .build()
11335/// # );
11336/// # let mut hub = DataprocMetastore::new(client, auth);
11337/// // As the method needs a request, you would usually fill it with the desired information
11338/// // into the respective structure. Some of the parts shown here might not be applicable !
11339/// // Values shown here are possibly random and not representative !
11340/// let mut req = MetadataImport::default();
11341///
11342/// // You can configure optional parameters by calling the respective setters at will, and
11343/// // execute the final call using `doit()`.
11344/// // Values shown here are possibly random and not representative !
11345/// let result = hub.projects().locations_services_metadata_imports_create(req, "parent")
11346///              .request_id("dolor")
11347///              .metadata_import_id("et")
11348///              .doit().await;
11349/// # }
11350/// ```
11351pub struct ProjectLocationServiceMetadataImportCreateCall<'a, C>
11352where
11353    C: 'a,
11354{
11355    hub: &'a DataprocMetastore<C>,
11356    _request: MetadataImport,
11357    _parent: String,
11358    _request_id: Option<String>,
11359    _metadata_import_id: Option<String>,
11360    _delegate: Option<&'a mut dyn common::Delegate>,
11361    _additional_params: HashMap<String, String>,
11362    _scopes: BTreeSet<String>,
11363}
11364
11365impl<'a, C> common::CallBuilder for ProjectLocationServiceMetadataImportCreateCall<'a, C> {}
11366
11367impl<'a, C> ProjectLocationServiceMetadataImportCreateCall<'a, C>
11368where
11369    C: common::Connector,
11370{
11371    /// Perform the operation you have build so far.
11372    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11373        use std::borrow::Cow;
11374        use std::io::{Read, Seek};
11375
11376        use common::{url::Params, ToParts};
11377        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11378
11379        let mut dd = common::DefaultDelegate;
11380        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11381        dlg.begin(common::MethodInfo {
11382            id: "metastore.projects.locations.services.metadataImports.create",
11383            http_method: hyper::Method::POST,
11384        });
11385
11386        for &field in ["alt", "parent", "requestId", "metadataImportId"].iter() {
11387            if self._additional_params.contains_key(field) {
11388                dlg.finished(false);
11389                return Err(common::Error::FieldClash(field));
11390            }
11391        }
11392
11393        let mut params = Params::with_capacity(6 + self._additional_params.len());
11394        params.push("parent", self._parent);
11395        if let Some(value) = self._request_id.as_ref() {
11396            params.push("requestId", value);
11397        }
11398        if let Some(value) = self._metadata_import_id.as_ref() {
11399            params.push("metadataImportId", value);
11400        }
11401
11402        params.extend(self._additional_params.iter());
11403
11404        params.push("alt", "json");
11405        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/metadataImports";
11406        if self._scopes.is_empty() {
11407            self._scopes
11408                .insert(Scope::CloudPlatform.as_ref().to_string());
11409        }
11410
11411        #[allow(clippy::single_element_loop)]
11412        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11413            url = params.uri_replacement(url, param_name, find_this, true);
11414        }
11415        {
11416            let to_remove = ["parent"];
11417            params.remove_params(&to_remove);
11418        }
11419
11420        let url = params.parse_with_url(&url);
11421
11422        let mut json_mime_type = mime::APPLICATION_JSON;
11423        let mut request_value_reader = {
11424            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11425            common::remove_json_null_values(&mut value);
11426            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11427            serde_json::to_writer(&mut dst, &value).unwrap();
11428            dst
11429        };
11430        let request_size = request_value_reader
11431            .seek(std::io::SeekFrom::End(0))
11432            .unwrap();
11433        request_value_reader
11434            .seek(std::io::SeekFrom::Start(0))
11435            .unwrap();
11436
11437        loop {
11438            let token = match self
11439                .hub
11440                .auth
11441                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11442                .await
11443            {
11444                Ok(token) => token,
11445                Err(e) => match dlg.token(e) {
11446                    Ok(token) => token,
11447                    Err(e) => {
11448                        dlg.finished(false);
11449                        return Err(common::Error::MissingToken(e));
11450                    }
11451                },
11452            };
11453            request_value_reader
11454                .seek(std::io::SeekFrom::Start(0))
11455                .unwrap();
11456            let mut req_result = {
11457                let client = &self.hub.client;
11458                dlg.pre_request();
11459                let mut req_builder = hyper::Request::builder()
11460                    .method(hyper::Method::POST)
11461                    .uri(url.as_str())
11462                    .header(USER_AGENT, self.hub._user_agent.clone());
11463
11464                if let Some(token) = token.as_ref() {
11465                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11466                }
11467
11468                let request = req_builder
11469                    .header(CONTENT_TYPE, json_mime_type.to_string())
11470                    .header(CONTENT_LENGTH, request_size as u64)
11471                    .body(common::to_body(
11472                        request_value_reader.get_ref().clone().into(),
11473                    ));
11474
11475                client.request(request.unwrap()).await
11476            };
11477
11478            match req_result {
11479                Err(err) => {
11480                    if let common::Retry::After(d) = dlg.http_error(&err) {
11481                        sleep(d).await;
11482                        continue;
11483                    }
11484                    dlg.finished(false);
11485                    return Err(common::Error::HttpError(err));
11486                }
11487                Ok(res) => {
11488                    let (mut parts, body) = res.into_parts();
11489                    let mut body = common::Body::new(body);
11490                    if !parts.status.is_success() {
11491                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11492                        let error = serde_json::from_str(&common::to_string(&bytes));
11493                        let response = common::to_response(parts, bytes.into());
11494
11495                        if let common::Retry::After(d) =
11496                            dlg.http_failure(&response, error.as_ref().ok())
11497                        {
11498                            sleep(d).await;
11499                            continue;
11500                        }
11501
11502                        dlg.finished(false);
11503
11504                        return Err(match error {
11505                            Ok(value) => common::Error::BadRequest(value),
11506                            _ => common::Error::Failure(response),
11507                        });
11508                    }
11509                    let response = {
11510                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11511                        let encoded = common::to_string(&bytes);
11512                        match serde_json::from_str(&encoded) {
11513                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11514                            Err(error) => {
11515                                dlg.response_json_decode_error(&encoded, &error);
11516                                return Err(common::Error::JsonDecodeError(
11517                                    encoded.to_string(),
11518                                    error,
11519                                ));
11520                            }
11521                        }
11522                    };
11523
11524                    dlg.finished(true);
11525                    return Ok(response);
11526                }
11527            }
11528        }
11529    }
11530
11531    ///
11532    /// Sets the *request* property to the given value.
11533    ///
11534    /// Even though the property as already been set when instantiating this call,
11535    /// we provide this method for API completeness.
11536    pub fn request(
11537        mut self,
11538        new_value: MetadataImport,
11539    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11540        self._request = new_value;
11541        self
11542    }
11543    /// Required. The relative resource name of the service in which to create a metastore import, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
11544    ///
11545    /// Sets the *parent* path property to the given value.
11546    ///
11547    /// Even though the property as already been set when instantiating this call,
11548    /// we provide this method for API completeness.
11549    pub fn parent(
11550        mut self,
11551        new_value: &str,
11552    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11553        self._parent = new_value.to_string();
11554        self
11555    }
11556    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
11557    ///
11558    /// Sets the *request id* query property to the given value.
11559    pub fn request_id(
11560        mut self,
11561        new_value: &str,
11562    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11563        self._request_id = Some(new_value.to_string());
11564        self
11565    }
11566    /// Required. The ID of the metadata import, which is used as the final component of the metadata import's name.This value must be between 1 and 64 characters long, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.
11567    ///
11568    /// Sets the *metadata import id* query property to the given value.
11569    pub fn metadata_import_id(
11570        mut self,
11571        new_value: &str,
11572    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11573        self._metadata_import_id = Some(new_value.to_string());
11574        self
11575    }
11576    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11577    /// while executing the actual API request.
11578    ///
11579    /// ````text
11580    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11581    /// ````
11582    ///
11583    /// Sets the *delegate* property to the given value.
11584    pub fn delegate(
11585        mut self,
11586        new_value: &'a mut dyn common::Delegate,
11587    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11588        self._delegate = Some(new_value);
11589        self
11590    }
11591
11592    /// Set any additional parameter of the query string used in the request.
11593    /// It should be used to set parameters which are not yet available through their own
11594    /// setters.
11595    ///
11596    /// Please note that this method must not be used to set any of the known parameters
11597    /// which have their own setter method. If done anyway, the request will fail.
11598    ///
11599    /// # Additional Parameters
11600    ///
11601    /// * *$.xgafv* (query-string) - V1 error format.
11602    /// * *access_token* (query-string) - OAuth access token.
11603    /// * *alt* (query-string) - Data format for response.
11604    /// * *callback* (query-string) - JSONP
11605    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11606    /// * *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.
11607    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11608    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11609    /// * *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.
11610    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11611    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11612    pub fn param<T>(
11613        mut self,
11614        name: T,
11615        value: T,
11616    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C>
11617    where
11618        T: AsRef<str>,
11619    {
11620        self._additional_params
11621            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11622        self
11623    }
11624
11625    /// Identifies the authorization scope for the method you are building.
11626    ///
11627    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11628    /// [`Scope::CloudPlatform`].
11629    ///
11630    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11631    /// tokens for more than one scope.
11632    ///
11633    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11634    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11635    /// sufficient, a read-write scope will do as well.
11636    pub fn add_scope<St>(
11637        mut self,
11638        scope: St,
11639    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C>
11640    where
11641        St: AsRef<str>,
11642    {
11643        self._scopes.insert(String::from(scope.as_ref()));
11644        self
11645    }
11646    /// Identifies the authorization scope(s) for the method you are building.
11647    ///
11648    /// See [`Self::add_scope()`] for details.
11649    pub fn add_scopes<I, St>(
11650        mut self,
11651        scopes: I,
11652    ) -> ProjectLocationServiceMetadataImportCreateCall<'a, C>
11653    where
11654        I: IntoIterator<Item = St>,
11655        St: AsRef<str>,
11656    {
11657        self._scopes
11658            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11659        self
11660    }
11661
11662    /// Removes all scopes, and no default scope will be used either.
11663    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11664    /// for details).
11665    pub fn clear_scopes(mut self) -> ProjectLocationServiceMetadataImportCreateCall<'a, C> {
11666        self._scopes.clear();
11667        self
11668    }
11669}
11670
11671/// Gets details of a single import.
11672///
11673/// A builder for the *locations.services.metadataImports.get* method supported by a *project* resource.
11674/// It is not used directly, but through a [`ProjectMethods`] instance.
11675///
11676/// # Example
11677///
11678/// Instantiate a resource method builder
11679///
11680/// ```test_harness,no_run
11681/// # extern crate hyper;
11682/// # extern crate hyper_rustls;
11683/// # extern crate google_metastore1_beta as metastore1_beta;
11684/// # async fn dox() {
11685/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11686///
11687/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11688/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11689/// #     .with_native_roots()
11690/// #     .unwrap()
11691/// #     .https_only()
11692/// #     .enable_http2()
11693/// #     .build();
11694///
11695/// # let executor = hyper_util::rt::TokioExecutor::new();
11696/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11697/// #     secret,
11698/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11699/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11700/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11701/// #     ),
11702/// # ).build().await.unwrap();
11703///
11704/// # let client = hyper_util::client::legacy::Client::builder(
11705/// #     hyper_util::rt::TokioExecutor::new()
11706/// # )
11707/// # .build(
11708/// #     hyper_rustls::HttpsConnectorBuilder::new()
11709/// #         .with_native_roots()
11710/// #         .unwrap()
11711/// #         .https_or_http()
11712/// #         .enable_http2()
11713/// #         .build()
11714/// # );
11715/// # let mut hub = DataprocMetastore::new(client, auth);
11716/// // You can configure optional parameters by calling the respective setters at will, and
11717/// // execute the final call using `doit()`.
11718/// // Values shown here are possibly random and not representative !
11719/// let result = hub.projects().locations_services_metadata_imports_get("name")
11720///              .doit().await;
11721/// # }
11722/// ```
11723pub struct ProjectLocationServiceMetadataImportGetCall<'a, C>
11724where
11725    C: 'a,
11726{
11727    hub: &'a DataprocMetastore<C>,
11728    _name: String,
11729    _delegate: Option<&'a mut dyn common::Delegate>,
11730    _additional_params: HashMap<String, String>,
11731    _scopes: BTreeSet<String>,
11732}
11733
11734impl<'a, C> common::CallBuilder for ProjectLocationServiceMetadataImportGetCall<'a, C> {}
11735
11736impl<'a, C> ProjectLocationServiceMetadataImportGetCall<'a, C>
11737where
11738    C: common::Connector,
11739{
11740    /// Perform the operation you have build so far.
11741    pub async fn doit(mut self) -> common::Result<(common::Response, MetadataImport)> {
11742        use std::borrow::Cow;
11743        use std::io::{Read, Seek};
11744
11745        use common::{url::Params, ToParts};
11746        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11747
11748        let mut dd = common::DefaultDelegate;
11749        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11750        dlg.begin(common::MethodInfo {
11751            id: "metastore.projects.locations.services.metadataImports.get",
11752            http_method: hyper::Method::GET,
11753        });
11754
11755        for &field in ["alt", "name"].iter() {
11756            if self._additional_params.contains_key(field) {
11757                dlg.finished(false);
11758                return Err(common::Error::FieldClash(field));
11759            }
11760        }
11761
11762        let mut params = Params::with_capacity(3 + self._additional_params.len());
11763        params.push("name", self._name);
11764
11765        params.extend(self._additional_params.iter());
11766
11767        params.push("alt", "json");
11768        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
11769        if self._scopes.is_empty() {
11770            self._scopes
11771                .insert(Scope::CloudPlatform.as_ref().to_string());
11772        }
11773
11774        #[allow(clippy::single_element_loop)]
11775        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11776            url = params.uri_replacement(url, param_name, find_this, true);
11777        }
11778        {
11779            let to_remove = ["name"];
11780            params.remove_params(&to_remove);
11781        }
11782
11783        let url = params.parse_with_url(&url);
11784
11785        loop {
11786            let token = match self
11787                .hub
11788                .auth
11789                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11790                .await
11791            {
11792                Ok(token) => token,
11793                Err(e) => match dlg.token(e) {
11794                    Ok(token) => token,
11795                    Err(e) => {
11796                        dlg.finished(false);
11797                        return Err(common::Error::MissingToken(e));
11798                    }
11799                },
11800            };
11801            let mut req_result = {
11802                let client = &self.hub.client;
11803                dlg.pre_request();
11804                let mut req_builder = hyper::Request::builder()
11805                    .method(hyper::Method::GET)
11806                    .uri(url.as_str())
11807                    .header(USER_AGENT, self.hub._user_agent.clone());
11808
11809                if let Some(token) = token.as_ref() {
11810                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11811                }
11812
11813                let request = req_builder
11814                    .header(CONTENT_LENGTH, 0_u64)
11815                    .body(common::to_body::<String>(None));
11816
11817                client.request(request.unwrap()).await
11818            };
11819
11820            match req_result {
11821                Err(err) => {
11822                    if let common::Retry::After(d) = dlg.http_error(&err) {
11823                        sleep(d).await;
11824                        continue;
11825                    }
11826                    dlg.finished(false);
11827                    return Err(common::Error::HttpError(err));
11828                }
11829                Ok(res) => {
11830                    let (mut parts, body) = res.into_parts();
11831                    let mut body = common::Body::new(body);
11832                    if !parts.status.is_success() {
11833                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11834                        let error = serde_json::from_str(&common::to_string(&bytes));
11835                        let response = common::to_response(parts, bytes.into());
11836
11837                        if let common::Retry::After(d) =
11838                            dlg.http_failure(&response, error.as_ref().ok())
11839                        {
11840                            sleep(d).await;
11841                            continue;
11842                        }
11843
11844                        dlg.finished(false);
11845
11846                        return Err(match error {
11847                            Ok(value) => common::Error::BadRequest(value),
11848                            _ => common::Error::Failure(response),
11849                        });
11850                    }
11851                    let response = {
11852                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11853                        let encoded = common::to_string(&bytes);
11854                        match serde_json::from_str(&encoded) {
11855                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11856                            Err(error) => {
11857                                dlg.response_json_decode_error(&encoded, &error);
11858                                return Err(common::Error::JsonDecodeError(
11859                                    encoded.to_string(),
11860                                    error,
11861                                ));
11862                            }
11863                        }
11864                    };
11865
11866                    dlg.finished(true);
11867                    return Ok(response);
11868                }
11869            }
11870        }
11871    }
11872
11873    /// Required. The relative resource name of the metadata import to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{import_id}.
11874    ///
11875    /// Sets the *name* path property to the given value.
11876    ///
11877    /// Even though the property as already been set when instantiating this call,
11878    /// we provide this method for API completeness.
11879    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceMetadataImportGetCall<'a, C> {
11880        self._name = new_value.to_string();
11881        self
11882    }
11883    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11884    /// while executing the actual API request.
11885    ///
11886    /// ````text
11887    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11888    /// ````
11889    ///
11890    /// Sets the *delegate* property to the given value.
11891    pub fn delegate(
11892        mut self,
11893        new_value: &'a mut dyn common::Delegate,
11894    ) -> ProjectLocationServiceMetadataImportGetCall<'a, C> {
11895        self._delegate = Some(new_value);
11896        self
11897    }
11898
11899    /// Set any additional parameter of the query string used in the request.
11900    /// It should be used to set parameters which are not yet available through their own
11901    /// setters.
11902    ///
11903    /// Please note that this method must not be used to set any of the known parameters
11904    /// which have their own setter method. If done anyway, the request will fail.
11905    ///
11906    /// # Additional Parameters
11907    ///
11908    /// * *$.xgafv* (query-string) - V1 error format.
11909    /// * *access_token* (query-string) - OAuth access token.
11910    /// * *alt* (query-string) - Data format for response.
11911    /// * *callback* (query-string) - JSONP
11912    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11913    /// * *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.
11914    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11915    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11916    /// * *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.
11917    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11918    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11919    pub fn param<T>(
11920        mut self,
11921        name: T,
11922        value: T,
11923    ) -> ProjectLocationServiceMetadataImportGetCall<'a, C>
11924    where
11925        T: AsRef<str>,
11926    {
11927        self._additional_params
11928            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11929        self
11930    }
11931
11932    /// Identifies the authorization scope for the method you are building.
11933    ///
11934    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11935    /// [`Scope::CloudPlatform`].
11936    ///
11937    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11938    /// tokens for more than one scope.
11939    ///
11940    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11941    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11942    /// sufficient, a read-write scope will do as well.
11943    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceMetadataImportGetCall<'a, C>
11944    where
11945        St: AsRef<str>,
11946    {
11947        self._scopes.insert(String::from(scope.as_ref()));
11948        self
11949    }
11950    /// Identifies the authorization scope(s) for the method you are building.
11951    ///
11952    /// See [`Self::add_scope()`] for details.
11953    pub fn add_scopes<I, St>(
11954        mut self,
11955        scopes: I,
11956    ) -> ProjectLocationServiceMetadataImportGetCall<'a, C>
11957    where
11958        I: IntoIterator<Item = St>,
11959        St: AsRef<str>,
11960    {
11961        self._scopes
11962            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11963        self
11964    }
11965
11966    /// Removes all scopes, and no default scope will be used either.
11967    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11968    /// for details).
11969    pub fn clear_scopes(mut self) -> ProjectLocationServiceMetadataImportGetCall<'a, C> {
11970        self._scopes.clear();
11971        self
11972    }
11973}
11974
11975/// Lists imports in a service.
11976///
11977/// A builder for the *locations.services.metadataImports.list* method supported by a *project* resource.
11978/// It is not used directly, but through a [`ProjectMethods`] instance.
11979///
11980/// # Example
11981///
11982/// Instantiate a resource method builder
11983///
11984/// ```test_harness,no_run
11985/// # extern crate hyper;
11986/// # extern crate hyper_rustls;
11987/// # extern crate google_metastore1_beta as metastore1_beta;
11988/// # async fn dox() {
11989/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11990///
11991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11992/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11993/// #     .with_native_roots()
11994/// #     .unwrap()
11995/// #     .https_only()
11996/// #     .enable_http2()
11997/// #     .build();
11998///
11999/// # let executor = hyper_util::rt::TokioExecutor::new();
12000/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12001/// #     secret,
12002/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12003/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12004/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12005/// #     ),
12006/// # ).build().await.unwrap();
12007///
12008/// # let client = hyper_util::client::legacy::Client::builder(
12009/// #     hyper_util::rt::TokioExecutor::new()
12010/// # )
12011/// # .build(
12012/// #     hyper_rustls::HttpsConnectorBuilder::new()
12013/// #         .with_native_roots()
12014/// #         .unwrap()
12015/// #         .https_or_http()
12016/// #         .enable_http2()
12017/// #         .build()
12018/// # );
12019/// # let mut hub = DataprocMetastore::new(client, auth);
12020/// // You can configure optional parameters by calling the respective setters at will, and
12021/// // execute the final call using `doit()`.
12022/// // Values shown here are possibly random and not representative !
12023/// let result = hub.projects().locations_services_metadata_imports_list("parent")
12024///              .page_token("Stet")
12025///              .page_size(-99)
12026///              .order_by("duo")
12027///              .filter("vero")
12028///              .doit().await;
12029/// # }
12030/// ```
12031pub struct ProjectLocationServiceMetadataImportListCall<'a, C>
12032where
12033    C: 'a,
12034{
12035    hub: &'a DataprocMetastore<C>,
12036    _parent: String,
12037    _page_token: Option<String>,
12038    _page_size: Option<i32>,
12039    _order_by: Option<String>,
12040    _filter: Option<String>,
12041    _delegate: Option<&'a mut dyn common::Delegate>,
12042    _additional_params: HashMap<String, String>,
12043    _scopes: BTreeSet<String>,
12044}
12045
12046impl<'a, C> common::CallBuilder for ProjectLocationServiceMetadataImportListCall<'a, C> {}
12047
12048impl<'a, C> ProjectLocationServiceMetadataImportListCall<'a, C>
12049where
12050    C: common::Connector,
12051{
12052    /// Perform the operation you have build so far.
12053    pub async fn doit(mut self) -> common::Result<(common::Response, ListMetadataImportsResponse)> {
12054        use std::borrow::Cow;
12055        use std::io::{Read, Seek};
12056
12057        use common::{url::Params, ToParts};
12058        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12059
12060        let mut dd = common::DefaultDelegate;
12061        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12062        dlg.begin(common::MethodInfo {
12063            id: "metastore.projects.locations.services.metadataImports.list",
12064            http_method: hyper::Method::GET,
12065        });
12066
12067        for &field in [
12068            "alt",
12069            "parent",
12070            "pageToken",
12071            "pageSize",
12072            "orderBy",
12073            "filter",
12074        ]
12075        .iter()
12076        {
12077            if self._additional_params.contains_key(field) {
12078                dlg.finished(false);
12079                return Err(common::Error::FieldClash(field));
12080            }
12081        }
12082
12083        let mut params = Params::with_capacity(7 + self._additional_params.len());
12084        params.push("parent", self._parent);
12085        if let Some(value) = self._page_token.as_ref() {
12086            params.push("pageToken", value);
12087        }
12088        if let Some(value) = self._page_size.as_ref() {
12089            params.push("pageSize", value.to_string());
12090        }
12091        if let Some(value) = self._order_by.as_ref() {
12092            params.push("orderBy", value);
12093        }
12094        if let Some(value) = self._filter.as_ref() {
12095            params.push("filter", value);
12096        }
12097
12098        params.extend(self._additional_params.iter());
12099
12100        params.push("alt", "json");
12101        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/metadataImports";
12102        if self._scopes.is_empty() {
12103            self._scopes
12104                .insert(Scope::CloudPlatform.as_ref().to_string());
12105        }
12106
12107        #[allow(clippy::single_element_loop)]
12108        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12109            url = params.uri_replacement(url, param_name, find_this, true);
12110        }
12111        {
12112            let to_remove = ["parent"];
12113            params.remove_params(&to_remove);
12114        }
12115
12116        let url = params.parse_with_url(&url);
12117
12118        loop {
12119            let token = match self
12120                .hub
12121                .auth
12122                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12123                .await
12124            {
12125                Ok(token) => token,
12126                Err(e) => match dlg.token(e) {
12127                    Ok(token) => token,
12128                    Err(e) => {
12129                        dlg.finished(false);
12130                        return Err(common::Error::MissingToken(e));
12131                    }
12132                },
12133            };
12134            let mut req_result = {
12135                let client = &self.hub.client;
12136                dlg.pre_request();
12137                let mut req_builder = hyper::Request::builder()
12138                    .method(hyper::Method::GET)
12139                    .uri(url.as_str())
12140                    .header(USER_AGENT, self.hub._user_agent.clone());
12141
12142                if let Some(token) = token.as_ref() {
12143                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12144                }
12145
12146                let request = req_builder
12147                    .header(CONTENT_LENGTH, 0_u64)
12148                    .body(common::to_body::<String>(None));
12149
12150                client.request(request.unwrap()).await
12151            };
12152
12153            match req_result {
12154                Err(err) => {
12155                    if let common::Retry::After(d) = dlg.http_error(&err) {
12156                        sleep(d).await;
12157                        continue;
12158                    }
12159                    dlg.finished(false);
12160                    return Err(common::Error::HttpError(err));
12161                }
12162                Ok(res) => {
12163                    let (mut parts, body) = res.into_parts();
12164                    let mut body = common::Body::new(body);
12165                    if !parts.status.is_success() {
12166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12167                        let error = serde_json::from_str(&common::to_string(&bytes));
12168                        let response = common::to_response(parts, bytes.into());
12169
12170                        if let common::Retry::After(d) =
12171                            dlg.http_failure(&response, error.as_ref().ok())
12172                        {
12173                            sleep(d).await;
12174                            continue;
12175                        }
12176
12177                        dlg.finished(false);
12178
12179                        return Err(match error {
12180                            Ok(value) => common::Error::BadRequest(value),
12181                            _ => common::Error::Failure(response),
12182                        });
12183                    }
12184                    let response = {
12185                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12186                        let encoded = common::to_string(&bytes);
12187                        match serde_json::from_str(&encoded) {
12188                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12189                            Err(error) => {
12190                                dlg.response_json_decode_error(&encoded, &error);
12191                                return Err(common::Error::JsonDecodeError(
12192                                    encoded.to_string(),
12193                                    error,
12194                                ));
12195                            }
12196                        }
12197                    };
12198
12199                    dlg.finished(true);
12200                    return Ok(response);
12201                }
12202            }
12203        }
12204    }
12205
12206    /// Required. The relative resource name of the service whose metadata imports to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports.
12207    ///
12208    /// Sets the *parent* path property to the given value.
12209    ///
12210    /// Even though the property as already been set when instantiating this call,
12211    /// we provide this method for API completeness.
12212    pub fn parent(
12213        mut self,
12214        new_value: &str,
12215    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12216        self._parent = new_value.to_string();
12217        self
12218    }
12219    /// Optional. A page token, received from a previous DataprocMetastore.ListServices call. Provide this token to retrieve the subsequent page.To retrieve the first page, supply an empty page token.When paginating, other parameters provided to DataprocMetastore.ListServices must match the call that provided the page token.
12220    ///
12221    /// Sets the *page token* query property to the given value.
12222    pub fn page_token(
12223        mut self,
12224        new_value: &str,
12225    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12226        self._page_token = Some(new_value.to_string());
12227        self
12228    }
12229    /// Optional. The maximum number of imports to return. The response may contain less than the maximum number. If unspecified, no more than 500 imports are returned. The maximum value is 1000; values above 1000 are changed to 1000.
12230    ///
12231    /// Sets the *page size* query property to the given value.
12232    pub fn page_size(
12233        mut self,
12234        new_value: i32,
12235    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12236        self._page_size = Some(new_value);
12237        self
12238    }
12239    /// Optional. Specify the ordering of results as described in Sorting Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not specified, the results will be sorted in the default order.
12240    ///
12241    /// Sets the *order by* query property to the given value.
12242    pub fn order_by(
12243        mut self,
12244        new_value: &str,
12245    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12246        self._order_by = Some(new_value.to_string());
12247        self
12248    }
12249    /// Optional. The filter to apply to list results.
12250    ///
12251    /// Sets the *filter* query property to the given value.
12252    pub fn filter(
12253        mut self,
12254        new_value: &str,
12255    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12256        self._filter = Some(new_value.to_string());
12257        self
12258    }
12259    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12260    /// while executing the actual API request.
12261    ///
12262    /// ````text
12263    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12264    /// ````
12265    ///
12266    /// Sets the *delegate* property to the given value.
12267    pub fn delegate(
12268        mut self,
12269        new_value: &'a mut dyn common::Delegate,
12270    ) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12271        self._delegate = Some(new_value);
12272        self
12273    }
12274
12275    /// Set any additional parameter of the query string used in the request.
12276    /// It should be used to set parameters which are not yet available through their own
12277    /// setters.
12278    ///
12279    /// Please note that this method must not be used to set any of the known parameters
12280    /// which have their own setter method. If done anyway, the request will fail.
12281    ///
12282    /// # Additional Parameters
12283    ///
12284    /// * *$.xgafv* (query-string) - V1 error format.
12285    /// * *access_token* (query-string) - OAuth access token.
12286    /// * *alt* (query-string) - Data format for response.
12287    /// * *callback* (query-string) - JSONP
12288    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12289    /// * *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.
12290    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12291    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12292    /// * *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.
12293    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12294    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12295    pub fn param<T>(
12296        mut self,
12297        name: T,
12298        value: T,
12299    ) -> ProjectLocationServiceMetadataImportListCall<'a, C>
12300    where
12301        T: AsRef<str>,
12302    {
12303        self._additional_params
12304            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12305        self
12306    }
12307
12308    /// Identifies the authorization scope for the method you are building.
12309    ///
12310    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12311    /// [`Scope::CloudPlatform`].
12312    ///
12313    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12314    /// tokens for more than one scope.
12315    ///
12316    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12317    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12318    /// sufficient, a read-write scope will do as well.
12319    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceMetadataImportListCall<'a, C>
12320    where
12321        St: AsRef<str>,
12322    {
12323        self._scopes.insert(String::from(scope.as_ref()));
12324        self
12325    }
12326    /// Identifies the authorization scope(s) for the method you are building.
12327    ///
12328    /// See [`Self::add_scope()`] for details.
12329    pub fn add_scopes<I, St>(
12330        mut self,
12331        scopes: I,
12332    ) -> ProjectLocationServiceMetadataImportListCall<'a, C>
12333    where
12334        I: IntoIterator<Item = St>,
12335        St: AsRef<str>,
12336    {
12337        self._scopes
12338            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12339        self
12340    }
12341
12342    /// Removes all scopes, and no default scope will be used either.
12343    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12344    /// for details).
12345    pub fn clear_scopes(mut self) -> ProjectLocationServiceMetadataImportListCall<'a, C> {
12346        self._scopes.clear();
12347        self
12348    }
12349}
12350
12351/// Updates a single import. Only the description field of MetadataImport is supported to be updated.
12352///
12353/// A builder for the *locations.services.metadataImports.patch* method supported by a *project* resource.
12354/// It is not used directly, but through a [`ProjectMethods`] instance.
12355///
12356/// # Example
12357///
12358/// Instantiate a resource method builder
12359///
12360/// ```test_harness,no_run
12361/// # extern crate hyper;
12362/// # extern crate hyper_rustls;
12363/// # extern crate google_metastore1_beta as metastore1_beta;
12364/// use metastore1_beta::api::MetadataImport;
12365/// # async fn dox() {
12366/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12367///
12368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12370/// #     .with_native_roots()
12371/// #     .unwrap()
12372/// #     .https_only()
12373/// #     .enable_http2()
12374/// #     .build();
12375///
12376/// # let executor = hyper_util::rt::TokioExecutor::new();
12377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12378/// #     secret,
12379/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12380/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12381/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12382/// #     ),
12383/// # ).build().await.unwrap();
12384///
12385/// # let client = hyper_util::client::legacy::Client::builder(
12386/// #     hyper_util::rt::TokioExecutor::new()
12387/// # )
12388/// # .build(
12389/// #     hyper_rustls::HttpsConnectorBuilder::new()
12390/// #         .with_native_roots()
12391/// #         .unwrap()
12392/// #         .https_or_http()
12393/// #         .enable_http2()
12394/// #         .build()
12395/// # );
12396/// # let mut hub = DataprocMetastore::new(client, auth);
12397/// // As the method needs a request, you would usually fill it with the desired information
12398/// // into the respective structure. Some of the parts shown here might not be applicable !
12399/// // Values shown here are possibly random and not representative !
12400/// let mut req = MetadataImport::default();
12401///
12402/// // You can configure optional parameters by calling the respective setters at will, and
12403/// // execute the final call using `doit()`.
12404/// // Values shown here are possibly random and not representative !
12405/// let result = hub.projects().locations_services_metadata_imports_patch(req, "name")
12406///              .update_mask(FieldMask::new::<&str>(&[]))
12407///              .request_id("invidunt")
12408///              .doit().await;
12409/// # }
12410/// ```
12411pub struct ProjectLocationServiceMetadataImportPatchCall<'a, C>
12412where
12413    C: 'a,
12414{
12415    hub: &'a DataprocMetastore<C>,
12416    _request: MetadataImport,
12417    _name: String,
12418    _update_mask: Option<common::FieldMask>,
12419    _request_id: Option<String>,
12420    _delegate: Option<&'a mut dyn common::Delegate>,
12421    _additional_params: HashMap<String, String>,
12422    _scopes: BTreeSet<String>,
12423}
12424
12425impl<'a, C> common::CallBuilder for ProjectLocationServiceMetadataImportPatchCall<'a, C> {}
12426
12427impl<'a, C> ProjectLocationServiceMetadataImportPatchCall<'a, C>
12428where
12429    C: common::Connector,
12430{
12431    /// Perform the operation you have build so far.
12432    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12433        use std::borrow::Cow;
12434        use std::io::{Read, Seek};
12435
12436        use common::{url::Params, ToParts};
12437        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12438
12439        let mut dd = common::DefaultDelegate;
12440        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12441        dlg.begin(common::MethodInfo {
12442            id: "metastore.projects.locations.services.metadataImports.patch",
12443            http_method: hyper::Method::PATCH,
12444        });
12445
12446        for &field in ["alt", "name", "updateMask", "requestId"].iter() {
12447            if self._additional_params.contains_key(field) {
12448                dlg.finished(false);
12449                return Err(common::Error::FieldClash(field));
12450            }
12451        }
12452
12453        let mut params = Params::with_capacity(6 + self._additional_params.len());
12454        params.push("name", self._name);
12455        if let Some(value) = self._update_mask.as_ref() {
12456            params.push("updateMask", value.to_string());
12457        }
12458        if let Some(value) = self._request_id.as_ref() {
12459            params.push("requestId", value);
12460        }
12461
12462        params.extend(self._additional_params.iter());
12463
12464        params.push("alt", "json");
12465        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
12466        if self._scopes.is_empty() {
12467            self._scopes
12468                .insert(Scope::CloudPlatform.as_ref().to_string());
12469        }
12470
12471        #[allow(clippy::single_element_loop)]
12472        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12473            url = params.uri_replacement(url, param_name, find_this, true);
12474        }
12475        {
12476            let to_remove = ["name"];
12477            params.remove_params(&to_remove);
12478        }
12479
12480        let url = params.parse_with_url(&url);
12481
12482        let mut json_mime_type = mime::APPLICATION_JSON;
12483        let mut request_value_reader = {
12484            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12485            common::remove_json_null_values(&mut value);
12486            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12487            serde_json::to_writer(&mut dst, &value).unwrap();
12488            dst
12489        };
12490        let request_size = request_value_reader
12491            .seek(std::io::SeekFrom::End(0))
12492            .unwrap();
12493        request_value_reader
12494            .seek(std::io::SeekFrom::Start(0))
12495            .unwrap();
12496
12497        loop {
12498            let token = match self
12499                .hub
12500                .auth
12501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12502                .await
12503            {
12504                Ok(token) => token,
12505                Err(e) => match dlg.token(e) {
12506                    Ok(token) => token,
12507                    Err(e) => {
12508                        dlg.finished(false);
12509                        return Err(common::Error::MissingToken(e));
12510                    }
12511                },
12512            };
12513            request_value_reader
12514                .seek(std::io::SeekFrom::Start(0))
12515                .unwrap();
12516            let mut req_result = {
12517                let client = &self.hub.client;
12518                dlg.pre_request();
12519                let mut req_builder = hyper::Request::builder()
12520                    .method(hyper::Method::PATCH)
12521                    .uri(url.as_str())
12522                    .header(USER_AGENT, self.hub._user_agent.clone());
12523
12524                if let Some(token) = token.as_ref() {
12525                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12526                }
12527
12528                let request = req_builder
12529                    .header(CONTENT_TYPE, json_mime_type.to_string())
12530                    .header(CONTENT_LENGTH, request_size as u64)
12531                    .body(common::to_body(
12532                        request_value_reader.get_ref().clone().into(),
12533                    ));
12534
12535                client.request(request.unwrap()).await
12536            };
12537
12538            match req_result {
12539                Err(err) => {
12540                    if let common::Retry::After(d) = dlg.http_error(&err) {
12541                        sleep(d).await;
12542                        continue;
12543                    }
12544                    dlg.finished(false);
12545                    return Err(common::Error::HttpError(err));
12546                }
12547                Ok(res) => {
12548                    let (mut parts, body) = res.into_parts();
12549                    let mut body = common::Body::new(body);
12550                    if !parts.status.is_success() {
12551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12552                        let error = serde_json::from_str(&common::to_string(&bytes));
12553                        let response = common::to_response(parts, bytes.into());
12554
12555                        if let common::Retry::After(d) =
12556                            dlg.http_failure(&response, error.as_ref().ok())
12557                        {
12558                            sleep(d).await;
12559                            continue;
12560                        }
12561
12562                        dlg.finished(false);
12563
12564                        return Err(match error {
12565                            Ok(value) => common::Error::BadRequest(value),
12566                            _ => common::Error::Failure(response),
12567                        });
12568                    }
12569                    let response = {
12570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12571                        let encoded = common::to_string(&bytes);
12572                        match serde_json::from_str(&encoded) {
12573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12574                            Err(error) => {
12575                                dlg.response_json_decode_error(&encoded, &error);
12576                                return Err(common::Error::JsonDecodeError(
12577                                    encoded.to_string(),
12578                                    error,
12579                                ));
12580                            }
12581                        }
12582                    };
12583
12584                    dlg.finished(true);
12585                    return Ok(response);
12586                }
12587            }
12588        }
12589    }
12590
12591    ///
12592    /// Sets the *request* property to the given value.
12593    ///
12594    /// Even though the property as already been set when instantiating this call,
12595    /// we provide this method for API completeness.
12596    pub fn request(
12597        mut self,
12598        new_value: MetadataImport,
12599    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12600        self._request = new_value;
12601        self
12602    }
12603    /// Immutable. Identifier. The relative resource name of the metadata import, of the form:projects/{project_number}/locations/{location_id}/services/{service_id}/metadataImports/{metadata_import_id}.
12604    ///
12605    /// Sets the *name* path property to the given value.
12606    ///
12607    /// Even though the property as already been set when instantiating this call,
12608    /// we provide this method for API completeness.
12609    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12610        self._name = new_value.to_string();
12611        self
12612    }
12613    /// Required. A field mask used to specify the fields to be overwritten in the metadata import resource by the update. Fields specified in the update_mask are relative to the resource (not to the full request). A field is overwritten if it is in the mask.
12614    ///
12615    /// Sets the *update mask* query property to the given value.
12616    pub fn update_mask(
12617        mut self,
12618        new_value: common::FieldMask,
12619    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12620        self._update_mask = Some(new_value);
12621        self
12622    }
12623    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
12624    ///
12625    /// Sets the *request id* query property to the given value.
12626    pub fn request_id(
12627        mut self,
12628        new_value: &str,
12629    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12630        self._request_id = Some(new_value.to_string());
12631        self
12632    }
12633    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12634    /// while executing the actual API request.
12635    ///
12636    /// ````text
12637    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12638    /// ````
12639    ///
12640    /// Sets the *delegate* property to the given value.
12641    pub fn delegate(
12642        mut self,
12643        new_value: &'a mut dyn common::Delegate,
12644    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12645        self._delegate = Some(new_value);
12646        self
12647    }
12648
12649    /// Set any additional parameter of the query string used in the request.
12650    /// It should be used to set parameters which are not yet available through their own
12651    /// setters.
12652    ///
12653    /// Please note that this method must not be used to set any of the known parameters
12654    /// which have their own setter method. If done anyway, the request will fail.
12655    ///
12656    /// # Additional Parameters
12657    ///
12658    /// * *$.xgafv* (query-string) - V1 error format.
12659    /// * *access_token* (query-string) - OAuth access token.
12660    /// * *alt* (query-string) - Data format for response.
12661    /// * *callback* (query-string) - JSONP
12662    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12663    /// * *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.
12664    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12666    /// * *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.
12667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12668    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12669    pub fn param<T>(
12670        mut self,
12671        name: T,
12672        value: T,
12673    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C>
12674    where
12675        T: AsRef<str>,
12676    {
12677        self._additional_params
12678            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12679        self
12680    }
12681
12682    /// Identifies the authorization scope for the method you are building.
12683    ///
12684    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12685    /// [`Scope::CloudPlatform`].
12686    ///
12687    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12688    /// tokens for more than one scope.
12689    ///
12690    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12691    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12692    /// sufficient, a read-write scope will do as well.
12693    pub fn add_scope<St>(
12694        mut self,
12695        scope: St,
12696    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C>
12697    where
12698        St: AsRef<str>,
12699    {
12700        self._scopes.insert(String::from(scope.as_ref()));
12701        self
12702    }
12703    /// Identifies the authorization scope(s) for the method you are building.
12704    ///
12705    /// See [`Self::add_scope()`] for details.
12706    pub fn add_scopes<I, St>(
12707        mut self,
12708        scopes: I,
12709    ) -> ProjectLocationServiceMetadataImportPatchCall<'a, C>
12710    where
12711        I: IntoIterator<Item = St>,
12712        St: AsRef<str>,
12713    {
12714        self._scopes
12715            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12716        self
12717    }
12718
12719    /// Removes all scopes, and no default scope will be used either.
12720    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12721    /// for details).
12722    pub fn clear_scopes(mut self) -> ProjectLocationServiceMetadataImportPatchCall<'a, C> {
12723        self._scopes.clear();
12724        self
12725    }
12726}
12727
12728/// Deletes a single migration execution.
12729///
12730/// A builder for the *locations.services.migrationExecutions.delete* method supported by a *project* resource.
12731/// It is not used directly, but through a [`ProjectMethods`] instance.
12732///
12733/// # Example
12734///
12735/// Instantiate a resource method builder
12736///
12737/// ```test_harness,no_run
12738/// # extern crate hyper;
12739/// # extern crate hyper_rustls;
12740/// # extern crate google_metastore1_beta as metastore1_beta;
12741/// # async fn dox() {
12742/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12743///
12744/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12745/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12746/// #     .with_native_roots()
12747/// #     .unwrap()
12748/// #     .https_only()
12749/// #     .enable_http2()
12750/// #     .build();
12751///
12752/// # let executor = hyper_util::rt::TokioExecutor::new();
12753/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12754/// #     secret,
12755/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12756/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12757/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12758/// #     ),
12759/// # ).build().await.unwrap();
12760///
12761/// # let client = hyper_util::client::legacy::Client::builder(
12762/// #     hyper_util::rt::TokioExecutor::new()
12763/// # )
12764/// # .build(
12765/// #     hyper_rustls::HttpsConnectorBuilder::new()
12766/// #         .with_native_roots()
12767/// #         .unwrap()
12768/// #         .https_or_http()
12769/// #         .enable_http2()
12770/// #         .build()
12771/// # );
12772/// # let mut hub = DataprocMetastore::new(client, auth);
12773/// // You can configure optional parameters by calling the respective setters at will, and
12774/// // execute the final call using `doit()`.
12775/// // Values shown here are possibly random and not representative !
12776/// let result = hub.projects().locations_services_migration_executions_delete("name")
12777///              .request_id("vero")
12778///              .doit().await;
12779/// # }
12780/// ```
12781pub struct ProjectLocationServiceMigrationExecutionDeleteCall<'a, C>
12782where
12783    C: 'a,
12784{
12785    hub: &'a DataprocMetastore<C>,
12786    _name: String,
12787    _request_id: Option<String>,
12788    _delegate: Option<&'a mut dyn common::Delegate>,
12789    _additional_params: HashMap<String, String>,
12790    _scopes: BTreeSet<String>,
12791}
12792
12793impl<'a, C> common::CallBuilder for ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {}
12794
12795impl<'a, C> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C>
12796where
12797    C: common::Connector,
12798{
12799    /// Perform the operation you have build so far.
12800    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12801        use std::borrow::Cow;
12802        use std::io::{Read, Seek};
12803
12804        use common::{url::Params, ToParts};
12805        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12806
12807        let mut dd = common::DefaultDelegate;
12808        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12809        dlg.begin(common::MethodInfo {
12810            id: "metastore.projects.locations.services.migrationExecutions.delete",
12811            http_method: hyper::Method::DELETE,
12812        });
12813
12814        for &field in ["alt", "name", "requestId"].iter() {
12815            if self._additional_params.contains_key(field) {
12816                dlg.finished(false);
12817                return Err(common::Error::FieldClash(field));
12818            }
12819        }
12820
12821        let mut params = Params::with_capacity(4 + self._additional_params.len());
12822        params.push("name", self._name);
12823        if let Some(value) = self._request_id.as_ref() {
12824            params.push("requestId", value);
12825        }
12826
12827        params.extend(self._additional_params.iter());
12828
12829        params.push("alt", "json");
12830        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
12831        if self._scopes.is_empty() {
12832            self._scopes
12833                .insert(Scope::CloudPlatform.as_ref().to_string());
12834        }
12835
12836        #[allow(clippy::single_element_loop)]
12837        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12838            url = params.uri_replacement(url, param_name, find_this, true);
12839        }
12840        {
12841            let to_remove = ["name"];
12842            params.remove_params(&to_remove);
12843        }
12844
12845        let url = params.parse_with_url(&url);
12846
12847        loop {
12848            let token = match self
12849                .hub
12850                .auth
12851                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12852                .await
12853            {
12854                Ok(token) => token,
12855                Err(e) => match dlg.token(e) {
12856                    Ok(token) => token,
12857                    Err(e) => {
12858                        dlg.finished(false);
12859                        return Err(common::Error::MissingToken(e));
12860                    }
12861                },
12862            };
12863            let mut req_result = {
12864                let client = &self.hub.client;
12865                dlg.pre_request();
12866                let mut req_builder = hyper::Request::builder()
12867                    .method(hyper::Method::DELETE)
12868                    .uri(url.as_str())
12869                    .header(USER_AGENT, self.hub._user_agent.clone());
12870
12871                if let Some(token) = token.as_ref() {
12872                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12873                }
12874
12875                let request = req_builder
12876                    .header(CONTENT_LENGTH, 0_u64)
12877                    .body(common::to_body::<String>(None));
12878
12879                client.request(request.unwrap()).await
12880            };
12881
12882            match req_result {
12883                Err(err) => {
12884                    if let common::Retry::After(d) = dlg.http_error(&err) {
12885                        sleep(d).await;
12886                        continue;
12887                    }
12888                    dlg.finished(false);
12889                    return Err(common::Error::HttpError(err));
12890                }
12891                Ok(res) => {
12892                    let (mut parts, body) = res.into_parts();
12893                    let mut body = common::Body::new(body);
12894                    if !parts.status.is_success() {
12895                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12896                        let error = serde_json::from_str(&common::to_string(&bytes));
12897                        let response = common::to_response(parts, bytes.into());
12898
12899                        if let common::Retry::After(d) =
12900                            dlg.http_failure(&response, error.as_ref().ok())
12901                        {
12902                            sleep(d).await;
12903                            continue;
12904                        }
12905
12906                        dlg.finished(false);
12907
12908                        return Err(match error {
12909                            Ok(value) => common::Error::BadRequest(value),
12910                            _ => common::Error::Failure(response),
12911                        });
12912                    }
12913                    let response = {
12914                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12915                        let encoded = common::to_string(&bytes);
12916                        match serde_json::from_str(&encoded) {
12917                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12918                            Err(error) => {
12919                                dlg.response_json_decode_error(&encoded, &error);
12920                                return Err(common::Error::JsonDecodeError(
12921                                    encoded.to_string(),
12922                                    error,
12923                                ));
12924                            }
12925                        }
12926                    };
12927
12928                    dlg.finished(true);
12929                    return Ok(response);
12930                }
12931            }
12932        }
12933    }
12934
12935    /// Required. The relative resource name of the migrationExecution to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions/{migration_execution_id}.
12936    ///
12937    /// Sets the *name* path property to the given value.
12938    ///
12939    /// Even though the property as already been set when instantiating this call,
12940    /// we provide this method for API completeness.
12941    pub fn name(
12942        mut self,
12943        new_value: &str,
12944    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {
12945        self._name = new_value.to_string();
12946        self
12947    }
12948    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
12949    ///
12950    /// Sets the *request id* query property to the given value.
12951    pub fn request_id(
12952        mut self,
12953        new_value: &str,
12954    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {
12955        self._request_id = Some(new_value.to_string());
12956        self
12957    }
12958    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12959    /// while executing the actual API request.
12960    ///
12961    /// ````text
12962    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12963    /// ````
12964    ///
12965    /// Sets the *delegate* property to the given value.
12966    pub fn delegate(
12967        mut self,
12968        new_value: &'a mut dyn common::Delegate,
12969    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {
12970        self._delegate = Some(new_value);
12971        self
12972    }
12973
12974    /// Set any additional parameter of the query string used in the request.
12975    /// It should be used to set parameters which are not yet available through their own
12976    /// setters.
12977    ///
12978    /// Please note that this method must not be used to set any of the known parameters
12979    /// which have their own setter method. If done anyway, the request will fail.
12980    ///
12981    /// # Additional Parameters
12982    ///
12983    /// * *$.xgafv* (query-string) - V1 error format.
12984    /// * *access_token* (query-string) - OAuth access token.
12985    /// * *alt* (query-string) - Data format for response.
12986    /// * *callback* (query-string) - JSONP
12987    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12988    /// * *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.
12989    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12990    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12991    /// * *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.
12992    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12993    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12994    pub fn param<T>(
12995        mut self,
12996        name: T,
12997        value: T,
12998    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C>
12999    where
13000        T: AsRef<str>,
13001    {
13002        self._additional_params
13003            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13004        self
13005    }
13006
13007    /// Identifies the authorization scope for the method you are building.
13008    ///
13009    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13010    /// [`Scope::CloudPlatform`].
13011    ///
13012    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13013    /// tokens for more than one scope.
13014    ///
13015    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13016    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13017    /// sufficient, a read-write scope will do as well.
13018    pub fn add_scope<St>(
13019        mut self,
13020        scope: St,
13021    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C>
13022    where
13023        St: AsRef<str>,
13024    {
13025        self._scopes.insert(String::from(scope.as_ref()));
13026        self
13027    }
13028    /// Identifies the authorization scope(s) for the method you are building.
13029    ///
13030    /// See [`Self::add_scope()`] for details.
13031    pub fn add_scopes<I, St>(
13032        mut self,
13033        scopes: I,
13034    ) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C>
13035    where
13036        I: IntoIterator<Item = St>,
13037        St: AsRef<str>,
13038    {
13039        self._scopes
13040            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13041        self
13042    }
13043
13044    /// Removes all scopes, and no default scope will be used either.
13045    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13046    /// for details).
13047    pub fn clear_scopes(mut self) -> ProjectLocationServiceMigrationExecutionDeleteCall<'a, C> {
13048        self._scopes.clear();
13049        self
13050    }
13051}
13052
13053/// Gets details of a single migration execution.
13054///
13055/// A builder for the *locations.services.migrationExecutions.get* method supported by a *project* resource.
13056/// It is not used directly, but through a [`ProjectMethods`] instance.
13057///
13058/// # Example
13059///
13060/// Instantiate a resource method builder
13061///
13062/// ```test_harness,no_run
13063/// # extern crate hyper;
13064/// # extern crate hyper_rustls;
13065/// # extern crate google_metastore1_beta as metastore1_beta;
13066/// # async fn dox() {
13067/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13068///
13069/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13070/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13071/// #     .with_native_roots()
13072/// #     .unwrap()
13073/// #     .https_only()
13074/// #     .enable_http2()
13075/// #     .build();
13076///
13077/// # let executor = hyper_util::rt::TokioExecutor::new();
13078/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13079/// #     secret,
13080/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13081/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13082/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13083/// #     ),
13084/// # ).build().await.unwrap();
13085///
13086/// # let client = hyper_util::client::legacy::Client::builder(
13087/// #     hyper_util::rt::TokioExecutor::new()
13088/// # )
13089/// # .build(
13090/// #     hyper_rustls::HttpsConnectorBuilder::new()
13091/// #         .with_native_roots()
13092/// #         .unwrap()
13093/// #         .https_or_http()
13094/// #         .enable_http2()
13095/// #         .build()
13096/// # );
13097/// # let mut hub = DataprocMetastore::new(client, auth);
13098/// // You can configure optional parameters by calling the respective setters at will, and
13099/// // execute the final call using `doit()`.
13100/// // Values shown here are possibly random and not representative !
13101/// let result = hub.projects().locations_services_migration_executions_get("name")
13102///              .doit().await;
13103/// # }
13104/// ```
13105pub struct ProjectLocationServiceMigrationExecutionGetCall<'a, C>
13106where
13107    C: 'a,
13108{
13109    hub: &'a DataprocMetastore<C>,
13110    _name: String,
13111    _delegate: Option<&'a mut dyn common::Delegate>,
13112    _additional_params: HashMap<String, String>,
13113    _scopes: BTreeSet<String>,
13114}
13115
13116impl<'a, C> common::CallBuilder for ProjectLocationServiceMigrationExecutionGetCall<'a, C> {}
13117
13118impl<'a, C> ProjectLocationServiceMigrationExecutionGetCall<'a, C>
13119where
13120    C: common::Connector,
13121{
13122    /// Perform the operation you have build so far.
13123    pub async fn doit(mut self) -> common::Result<(common::Response, MigrationExecution)> {
13124        use std::borrow::Cow;
13125        use std::io::{Read, Seek};
13126
13127        use common::{url::Params, ToParts};
13128        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13129
13130        let mut dd = common::DefaultDelegate;
13131        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13132        dlg.begin(common::MethodInfo {
13133            id: "metastore.projects.locations.services.migrationExecutions.get",
13134            http_method: hyper::Method::GET,
13135        });
13136
13137        for &field in ["alt", "name"].iter() {
13138            if self._additional_params.contains_key(field) {
13139                dlg.finished(false);
13140                return Err(common::Error::FieldClash(field));
13141            }
13142        }
13143
13144        let mut params = Params::with_capacity(3 + self._additional_params.len());
13145        params.push("name", self._name);
13146
13147        params.extend(self._additional_params.iter());
13148
13149        params.push("alt", "json");
13150        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
13151        if self._scopes.is_empty() {
13152            self._scopes
13153                .insert(Scope::CloudPlatform.as_ref().to_string());
13154        }
13155
13156        #[allow(clippy::single_element_loop)]
13157        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13158            url = params.uri_replacement(url, param_name, find_this, true);
13159        }
13160        {
13161            let to_remove = ["name"];
13162            params.remove_params(&to_remove);
13163        }
13164
13165        let url = params.parse_with_url(&url);
13166
13167        loop {
13168            let token = match self
13169                .hub
13170                .auth
13171                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13172                .await
13173            {
13174                Ok(token) => token,
13175                Err(e) => match dlg.token(e) {
13176                    Ok(token) => token,
13177                    Err(e) => {
13178                        dlg.finished(false);
13179                        return Err(common::Error::MissingToken(e));
13180                    }
13181                },
13182            };
13183            let mut req_result = {
13184                let client = &self.hub.client;
13185                dlg.pre_request();
13186                let mut req_builder = hyper::Request::builder()
13187                    .method(hyper::Method::GET)
13188                    .uri(url.as_str())
13189                    .header(USER_AGENT, self.hub._user_agent.clone());
13190
13191                if let Some(token) = token.as_ref() {
13192                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13193                }
13194
13195                let request = req_builder
13196                    .header(CONTENT_LENGTH, 0_u64)
13197                    .body(common::to_body::<String>(None));
13198
13199                client.request(request.unwrap()).await
13200            };
13201
13202            match req_result {
13203                Err(err) => {
13204                    if let common::Retry::After(d) = dlg.http_error(&err) {
13205                        sleep(d).await;
13206                        continue;
13207                    }
13208                    dlg.finished(false);
13209                    return Err(common::Error::HttpError(err));
13210                }
13211                Ok(res) => {
13212                    let (mut parts, body) = res.into_parts();
13213                    let mut body = common::Body::new(body);
13214                    if !parts.status.is_success() {
13215                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13216                        let error = serde_json::from_str(&common::to_string(&bytes));
13217                        let response = common::to_response(parts, bytes.into());
13218
13219                        if let common::Retry::After(d) =
13220                            dlg.http_failure(&response, error.as_ref().ok())
13221                        {
13222                            sleep(d).await;
13223                            continue;
13224                        }
13225
13226                        dlg.finished(false);
13227
13228                        return Err(match error {
13229                            Ok(value) => common::Error::BadRequest(value),
13230                            _ => common::Error::Failure(response),
13231                        });
13232                    }
13233                    let response = {
13234                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13235                        let encoded = common::to_string(&bytes);
13236                        match serde_json::from_str(&encoded) {
13237                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13238                            Err(error) => {
13239                                dlg.response_json_decode_error(&encoded, &error);
13240                                return Err(common::Error::JsonDecodeError(
13241                                    encoded.to_string(),
13242                                    error,
13243                                ));
13244                            }
13245                        }
13246                    };
13247
13248                    dlg.finished(true);
13249                    return Ok(response);
13250                }
13251            }
13252        }
13253    }
13254
13255    /// Required. The relative resource name of the migration execution to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions/{migration_execution_id}.
13256    ///
13257    /// Sets the *name* path property to the given value.
13258    ///
13259    /// Even though the property as already been set when instantiating this call,
13260    /// we provide this method for API completeness.
13261    pub fn name(
13262        mut self,
13263        new_value: &str,
13264    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C> {
13265        self._name = new_value.to_string();
13266        self
13267    }
13268    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13269    /// while executing the actual API request.
13270    ///
13271    /// ````text
13272    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13273    /// ````
13274    ///
13275    /// Sets the *delegate* property to the given value.
13276    pub fn delegate(
13277        mut self,
13278        new_value: &'a mut dyn common::Delegate,
13279    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C> {
13280        self._delegate = Some(new_value);
13281        self
13282    }
13283
13284    /// Set any additional parameter of the query string used in the request.
13285    /// It should be used to set parameters which are not yet available through their own
13286    /// setters.
13287    ///
13288    /// Please note that this method must not be used to set any of the known parameters
13289    /// which have their own setter method. If done anyway, the request will fail.
13290    ///
13291    /// # Additional Parameters
13292    ///
13293    /// * *$.xgafv* (query-string) - V1 error format.
13294    /// * *access_token* (query-string) - OAuth access token.
13295    /// * *alt* (query-string) - Data format for response.
13296    /// * *callback* (query-string) - JSONP
13297    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13298    /// * *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.
13299    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13300    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13301    /// * *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.
13302    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13303    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13304    pub fn param<T>(
13305        mut self,
13306        name: T,
13307        value: T,
13308    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C>
13309    where
13310        T: AsRef<str>,
13311    {
13312        self._additional_params
13313            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13314        self
13315    }
13316
13317    /// Identifies the authorization scope for the method you are building.
13318    ///
13319    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13320    /// [`Scope::CloudPlatform`].
13321    ///
13322    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13323    /// tokens for more than one scope.
13324    ///
13325    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13326    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13327    /// sufficient, a read-write scope will do as well.
13328    pub fn add_scope<St>(
13329        mut self,
13330        scope: St,
13331    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C>
13332    where
13333        St: AsRef<str>,
13334    {
13335        self._scopes.insert(String::from(scope.as_ref()));
13336        self
13337    }
13338    /// Identifies the authorization scope(s) for the method you are building.
13339    ///
13340    /// See [`Self::add_scope()`] for details.
13341    pub fn add_scopes<I, St>(
13342        mut self,
13343        scopes: I,
13344    ) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C>
13345    where
13346        I: IntoIterator<Item = St>,
13347        St: AsRef<str>,
13348    {
13349        self._scopes
13350            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13351        self
13352    }
13353
13354    /// Removes all scopes, and no default scope will be used either.
13355    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13356    /// for details).
13357    pub fn clear_scopes(mut self) -> ProjectLocationServiceMigrationExecutionGetCall<'a, C> {
13358        self._scopes.clear();
13359        self
13360    }
13361}
13362
13363/// Lists migration executions on a service.
13364///
13365/// A builder for the *locations.services.migrationExecutions.list* method supported by a *project* resource.
13366/// It is not used directly, but through a [`ProjectMethods`] instance.
13367///
13368/// # Example
13369///
13370/// Instantiate a resource method builder
13371///
13372/// ```test_harness,no_run
13373/// # extern crate hyper;
13374/// # extern crate hyper_rustls;
13375/// # extern crate google_metastore1_beta as metastore1_beta;
13376/// # async fn dox() {
13377/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13378///
13379/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13380/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13381/// #     .with_native_roots()
13382/// #     .unwrap()
13383/// #     .https_only()
13384/// #     .enable_http2()
13385/// #     .build();
13386///
13387/// # let executor = hyper_util::rt::TokioExecutor::new();
13388/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13389/// #     secret,
13390/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13391/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13392/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13393/// #     ),
13394/// # ).build().await.unwrap();
13395///
13396/// # let client = hyper_util::client::legacy::Client::builder(
13397/// #     hyper_util::rt::TokioExecutor::new()
13398/// # )
13399/// # .build(
13400/// #     hyper_rustls::HttpsConnectorBuilder::new()
13401/// #         .with_native_roots()
13402/// #         .unwrap()
13403/// #         .https_or_http()
13404/// #         .enable_http2()
13405/// #         .build()
13406/// # );
13407/// # let mut hub = DataprocMetastore::new(client, auth);
13408/// // You can configure optional parameters by calling the respective setters at will, and
13409/// // execute the final call using `doit()`.
13410/// // Values shown here are possibly random and not representative !
13411/// let result = hub.projects().locations_services_migration_executions_list("parent")
13412///              .page_token("diam")
13413///              .page_size(-61)
13414///              .order_by("ipsum")
13415///              .filter("accusam")
13416///              .doit().await;
13417/// # }
13418/// ```
13419pub struct ProjectLocationServiceMigrationExecutionListCall<'a, C>
13420where
13421    C: 'a,
13422{
13423    hub: &'a DataprocMetastore<C>,
13424    _parent: String,
13425    _page_token: Option<String>,
13426    _page_size: Option<i32>,
13427    _order_by: Option<String>,
13428    _filter: Option<String>,
13429    _delegate: Option<&'a mut dyn common::Delegate>,
13430    _additional_params: HashMap<String, String>,
13431    _scopes: BTreeSet<String>,
13432}
13433
13434impl<'a, C> common::CallBuilder for ProjectLocationServiceMigrationExecutionListCall<'a, C> {}
13435
13436impl<'a, C> ProjectLocationServiceMigrationExecutionListCall<'a, C>
13437where
13438    C: common::Connector,
13439{
13440    /// Perform the operation you have build so far.
13441    pub async fn doit(
13442        mut self,
13443    ) -> common::Result<(common::Response, ListMigrationExecutionsResponse)> {
13444        use std::borrow::Cow;
13445        use std::io::{Read, Seek};
13446
13447        use common::{url::Params, ToParts};
13448        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13449
13450        let mut dd = common::DefaultDelegate;
13451        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13452        dlg.begin(common::MethodInfo {
13453            id: "metastore.projects.locations.services.migrationExecutions.list",
13454            http_method: hyper::Method::GET,
13455        });
13456
13457        for &field in [
13458            "alt",
13459            "parent",
13460            "pageToken",
13461            "pageSize",
13462            "orderBy",
13463            "filter",
13464        ]
13465        .iter()
13466        {
13467            if self._additional_params.contains_key(field) {
13468                dlg.finished(false);
13469                return Err(common::Error::FieldClash(field));
13470            }
13471        }
13472
13473        let mut params = Params::with_capacity(7 + self._additional_params.len());
13474        params.push("parent", self._parent);
13475        if let Some(value) = self._page_token.as_ref() {
13476            params.push("pageToken", value);
13477        }
13478        if let Some(value) = self._page_size.as_ref() {
13479            params.push("pageSize", value.to_string());
13480        }
13481        if let Some(value) = self._order_by.as_ref() {
13482            params.push("orderBy", value);
13483        }
13484        if let Some(value) = self._filter.as_ref() {
13485            params.push("filter", value);
13486        }
13487
13488        params.extend(self._additional_params.iter());
13489
13490        params.push("alt", "json");
13491        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/migrationExecutions";
13492        if self._scopes.is_empty() {
13493            self._scopes
13494                .insert(Scope::CloudPlatform.as_ref().to_string());
13495        }
13496
13497        #[allow(clippy::single_element_loop)]
13498        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13499            url = params.uri_replacement(url, param_name, find_this, true);
13500        }
13501        {
13502            let to_remove = ["parent"];
13503            params.remove_params(&to_remove);
13504        }
13505
13506        let url = params.parse_with_url(&url);
13507
13508        loop {
13509            let token = match self
13510                .hub
13511                .auth
13512                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13513                .await
13514            {
13515                Ok(token) => token,
13516                Err(e) => match dlg.token(e) {
13517                    Ok(token) => token,
13518                    Err(e) => {
13519                        dlg.finished(false);
13520                        return Err(common::Error::MissingToken(e));
13521                    }
13522                },
13523            };
13524            let mut req_result = {
13525                let client = &self.hub.client;
13526                dlg.pre_request();
13527                let mut req_builder = hyper::Request::builder()
13528                    .method(hyper::Method::GET)
13529                    .uri(url.as_str())
13530                    .header(USER_AGENT, self.hub._user_agent.clone());
13531
13532                if let Some(token) = token.as_ref() {
13533                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13534                }
13535
13536                let request = req_builder
13537                    .header(CONTENT_LENGTH, 0_u64)
13538                    .body(common::to_body::<String>(None));
13539
13540                client.request(request.unwrap()).await
13541            };
13542
13543            match req_result {
13544                Err(err) => {
13545                    if let common::Retry::After(d) = dlg.http_error(&err) {
13546                        sleep(d).await;
13547                        continue;
13548                    }
13549                    dlg.finished(false);
13550                    return Err(common::Error::HttpError(err));
13551                }
13552                Ok(res) => {
13553                    let (mut parts, body) = res.into_parts();
13554                    let mut body = common::Body::new(body);
13555                    if !parts.status.is_success() {
13556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13557                        let error = serde_json::from_str(&common::to_string(&bytes));
13558                        let response = common::to_response(parts, bytes.into());
13559
13560                        if let common::Retry::After(d) =
13561                            dlg.http_failure(&response, error.as_ref().ok())
13562                        {
13563                            sleep(d).await;
13564                            continue;
13565                        }
13566
13567                        dlg.finished(false);
13568
13569                        return Err(match error {
13570                            Ok(value) => common::Error::BadRequest(value),
13571                            _ => common::Error::Failure(response),
13572                        });
13573                    }
13574                    let response = {
13575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13576                        let encoded = common::to_string(&bytes);
13577                        match serde_json::from_str(&encoded) {
13578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13579                            Err(error) => {
13580                                dlg.response_json_decode_error(&encoded, &error);
13581                                return Err(common::Error::JsonDecodeError(
13582                                    encoded.to_string(),
13583                                    error,
13584                                ));
13585                            }
13586                        }
13587                    };
13588
13589                    dlg.finished(true);
13590                    return Ok(response);
13591                }
13592            }
13593        }
13594    }
13595
13596    /// Required. The relative resource name of the service whose migration executions to list, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}/migrationExecutions.
13597    ///
13598    /// Sets the *parent* path property to the given value.
13599    ///
13600    /// Even though the property as already been set when instantiating this call,
13601    /// we provide this method for API completeness.
13602    pub fn parent(
13603        mut self,
13604        new_value: &str,
13605    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13606        self._parent = new_value.to_string();
13607        self
13608    }
13609    /// Optional. A page token, received from a previous DataprocMetastore.ListMigrationExecutions call. Provide this token to retrieve the subsequent page.To retrieve the first page, supply an empty page token.When paginating, other parameters provided to DataprocMetastore.ListMigrationExecutions must match the call that provided the page token.
13610    ///
13611    /// Sets the *page token* query property to the given value.
13612    pub fn page_token(
13613        mut self,
13614        new_value: &str,
13615    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13616        self._page_token = Some(new_value.to_string());
13617        self
13618    }
13619    /// Optional. The maximum number of migration executions to return. The response may contain less than the maximum number. If unspecified, no more than 500 migration executions are returned. The maximum value is 1000; values above 1000 are changed to 1000.
13620    ///
13621    /// Sets the *page size* query property to the given value.
13622    pub fn page_size(
13623        mut self,
13624        new_value: i32,
13625    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13626        self._page_size = Some(new_value);
13627        self
13628    }
13629    /// Optional. Specify the ordering of results as described in Sorting Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not specified, the results will be sorted in the default order.
13630    ///
13631    /// Sets the *order by* query property to the given value.
13632    pub fn order_by(
13633        mut self,
13634        new_value: &str,
13635    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13636        self._order_by = Some(new_value.to_string());
13637        self
13638    }
13639    /// Optional. The filter to apply to list results.
13640    ///
13641    /// Sets the *filter* query property to the given value.
13642    pub fn filter(
13643        mut self,
13644        new_value: &str,
13645    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13646        self._filter = Some(new_value.to_string());
13647        self
13648    }
13649    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13650    /// while executing the actual API request.
13651    ///
13652    /// ````text
13653    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13654    /// ````
13655    ///
13656    /// Sets the *delegate* property to the given value.
13657    pub fn delegate(
13658        mut self,
13659        new_value: &'a mut dyn common::Delegate,
13660    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13661        self._delegate = Some(new_value);
13662        self
13663    }
13664
13665    /// Set any additional parameter of the query string used in the request.
13666    /// It should be used to set parameters which are not yet available through their own
13667    /// setters.
13668    ///
13669    /// Please note that this method must not be used to set any of the known parameters
13670    /// which have their own setter method. If done anyway, the request will fail.
13671    ///
13672    /// # Additional Parameters
13673    ///
13674    /// * *$.xgafv* (query-string) - V1 error format.
13675    /// * *access_token* (query-string) - OAuth access token.
13676    /// * *alt* (query-string) - Data format for response.
13677    /// * *callback* (query-string) - JSONP
13678    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13679    /// * *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.
13680    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13681    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13682    /// * *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.
13683    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13684    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13685    pub fn param<T>(
13686        mut self,
13687        name: T,
13688        value: T,
13689    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C>
13690    where
13691        T: AsRef<str>,
13692    {
13693        self._additional_params
13694            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13695        self
13696    }
13697
13698    /// Identifies the authorization scope for the method you are building.
13699    ///
13700    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13701    /// [`Scope::CloudPlatform`].
13702    ///
13703    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13704    /// tokens for more than one scope.
13705    ///
13706    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13707    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13708    /// sufficient, a read-write scope will do as well.
13709    pub fn add_scope<St>(
13710        mut self,
13711        scope: St,
13712    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C>
13713    where
13714        St: AsRef<str>,
13715    {
13716        self._scopes.insert(String::from(scope.as_ref()));
13717        self
13718    }
13719    /// Identifies the authorization scope(s) for the method you are building.
13720    ///
13721    /// See [`Self::add_scope()`] for details.
13722    pub fn add_scopes<I, St>(
13723        mut self,
13724        scopes: I,
13725    ) -> ProjectLocationServiceMigrationExecutionListCall<'a, C>
13726    where
13727        I: IntoIterator<Item = St>,
13728        St: AsRef<str>,
13729    {
13730        self._scopes
13731            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13732        self
13733    }
13734
13735    /// Removes all scopes, and no default scope will be used either.
13736    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13737    /// for details).
13738    pub fn clear_scopes(mut self) -> ProjectLocationServiceMigrationExecutionListCall<'a, C> {
13739        self._scopes.clear();
13740        self
13741    }
13742}
13743
13744/// Alter metadata resource location. The metadata resource can be a database, table, or partition. This functionality only updates the parent directory for the respective metadata resource and does not transfer any existing data to the new location.
13745///
13746/// A builder for the *locations.services.alterLocation* method supported by a *project* resource.
13747/// It is not used directly, but through a [`ProjectMethods`] instance.
13748///
13749/// # Example
13750///
13751/// Instantiate a resource method builder
13752///
13753/// ```test_harness,no_run
13754/// # extern crate hyper;
13755/// # extern crate hyper_rustls;
13756/// # extern crate google_metastore1_beta as metastore1_beta;
13757/// use metastore1_beta::api::AlterMetadataResourceLocationRequest;
13758/// # async fn dox() {
13759/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13760///
13761/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13762/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13763/// #     .with_native_roots()
13764/// #     .unwrap()
13765/// #     .https_only()
13766/// #     .enable_http2()
13767/// #     .build();
13768///
13769/// # let executor = hyper_util::rt::TokioExecutor::new();
13770/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13771/// #     secret,
13772/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13773/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13774/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13775/// #     ),
13776/// # ).build().await.unwrap();
13777///
13778/// # let client = hyper_util::client::legacy::Client::builder(
13779/// #     hyper_util::rt::TokioExecutor::new()
13780/// # )
13781/// # .build(
13782/// #     hyper_rustls::HttpsConnectorBuilder::new()
13783/// #         .with_native_roots()
13784/// #         .unwrap()
13785/// #         .https_or_http()
13786/// #         .enable_http2()
13787/// #         .build()
13788/// # );
13789/// # let mut hub = DataprocMetastore::new(client, auth);
13790/// // As the method needs a request, you would usually fill it with the desired information
13791/// // into the respective structure. Some of the parts shown here might not be applicable !
13792/// // Values shown here are possibly random and not representative !
13793/// let mut req = AlterMetadataResourceLocationRequest::default();
13794///
13795/// // You can configure optional parameters by calling the respective setters at will, and
13796/// // execute the final call using `doit()`.
13797/// // Values shown here are possibly random and not representative !
13798/// let result = hub.projects().locations_services_alter_location(req, "service")
13799///              .doit().await;
13800/// # }
13801/// ```
13802pub struct ProjectLocationServiceAlterLocationCall<'a, C>
13803where
13804    C: 'a,
13805{
13806    hub: &'a DataprocMetastore<C>,
13807    _request: AlterMetadataResourceLocationRequest,
13808    _service: String,
13809    _delegate: Option<&'a mut dyn common::Delegate>,
13810    _additional_params: HashMap<String, String>,
13811    _scopes: BTreeSet<String>,
13812}
13813
13814impl<'a, C> common::CallBuilder for ProjectLocationServiceAlterLocationCall<'a, C> {}
13815
13816impl<'a, C> ProjectLocationServiceAlterLocationCall<'a, C>
13817where
13818    C: common::Connector,
13819{
13820    /// Perform the operation you have build so far.
13821    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13822        use std::borrow::Cow;
13823        use std::io::{Read, Seek};
13824
13825        use common::{url::Params, ToParts};
13826        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13827
13828        let mut dd = common::DefaultDelegate;
13829        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13830        dlg.begin(common::MethodInfo {
13831            id: "metastore.projects.locations.services.alterLocation",
13832            http_method: hyper::Method::POST,
13833        });
13834
13835        for &field in ["alt", "service"].iter() {
13836            if self._additional_params.contains_key(field) {
13837                dlg.finished(false);
13838                return Err(common::Error::FieldClash(field));
13839            }
13840        }
13841
13842        let mut params = Params::with_capacity(4 + self._additional_params.len());
13843        params.push("service", self._service);
13844
13845        params.extend(self._additional_params.iter());
13846
13847        params.push("alt", "json");
13848        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:alterLocation";
13849        if self._scopes.is_empty() {
13850            self._scopes
13851                .insert(Scope::CloudPlatform.as_ref().to_string());
13852        }
13853
13854        #[allow(clippy::single_element_loop)]
13855        for &(find_this, param_name) in [("{+service}", "service")].iter() {
13856            url = params.uri_replacement(url, param_name, find_this, true);
13857        }
13858        {
13859            let to_remove = ["service"];
13860            params.remove_params(&to_remove);
13861        }
13862
13863        let url = params.parse_with_url(&url);
13864
13865        let mut json_mime_type = mime::APPLICATION_JSON;
13866        let mut request_value_reader = {
13867            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13868            common::remove_json_null_values(&mut value);
13869            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13870            serde_json::to_writer(&mut dst, &value).unwrap();
13871            dst
13872        };
13873        let request_size = request_value_reader
13874            .seek(std::io::SeekFrom::End(0))
13875            .unwrap();
13876        request_value_reader
13877            .seek(std::io::SeekFrom::Start(0))
13878            .unwrap();
13879
13880        loop {
13881            let token = match self
13882                .hub
13883                .auth
13884                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13885                .await
13886            {
13887                Ok(token) => token,
13888                Err(e) => match dlg.token(e) {
13889                    Ok(token) => token,
13890                    Err(e) => {
13891                        dlg.finished(false);
13892                        return Err(common::Error::MissingToken(e));
13893                    }
13894                },
13895            };
13896            request_value_reader
13897                .seek(std::io::SeekFrom::Start(0))
13898                .unwrap();
13899            let mut req_result = {
13900                let client = &self.hub.client;
13901                dlg.pre_request();
13902                let mut req_builder = hyper::Request::builder()
13903                    .method(hyper::Method::POST)
13904                    .uri(url.as_str())
13905                    .header(USER_AGENT, self.hub._user_agent.clone());
13906
13907                if let Some(token) = token.as_ref() {
13908                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13909                }
13910
13911                let request = req_builder
13912                    .header(CONTENT_TYPE, json_mime_type.to_string())
13913                    .header(CONTENT_LENGTH, request_size as u64)
13914                    .body(common::to_body(
13915                        request_value_reader.get_ref().clone().into(),
13916                    ));
13917
13918                client.request(request.unwrap()).await
13919            };
13920
13921            match req_result {
13922                Err(err) => {
13923                    if let common::Retry::After(d) = dlg.http_error(&err) {
13924                        sleep(d).await;
13925                        continue;
13926                    }
13927                    dlg.finished(false);
13928                    return Err(common::Error::HttpError(err));
13929                }
13930                Ok(res) => {
13931                    let (mut parts, body) = res.into_parts();
13932                    let mut body = common::Body::new(body);
13933                    if !parts.status.is_success() {
13934                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13935                        let error = serde_json::from_str(&common::to_string(&bytes));
13936                        let response = common::to_response(parts, bytes.into());
13937
13938                        if let common::Retry::After(d) =
13939                            dlg.http_failure(&response, error.as_ref().ok())
13940                        {
13941                            sleep(d).await;
13942                            continue;
13943                        }
13944
13945                        dlg.finished(false);
13946
13947                        return Err(match error {
13948                            Ok(value) => common::Error::BadRequest(value),
13949                            _ => common::Error::Failure(response),
13950                        });
13951                    }
13952                    let response = {
13953                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13954                        let encoded = common::to_string(&bytes);
13955                        match serde_json::from_str(&encoded) {
13956                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13957                            Err(error) => {
13958                                dlg.response_json_decode_error(&encoded, &error);
13959                                return Err(common::Error::JsonDecodeError(
13960                                    encoded.to_string(),
13961                                    error,
13962                                ));
13963                            }
13964                        }
13965                    };
13966
13967                    dlg.finished(true);
13968                    return Ok(response);
13969                }
13970            }
13971        }
13972    }
13973
13974    ///
13975    /// Sets the *request* property to the given value.
13976    ///
13977    /// Even though the property as already been set when instantiating this call,
13978    /// we provide this method for API completeness.
13979    pub fn request(
13980        mut self,
13981        new_value: AlterMetadataResourceLocationRequest,
13982    ) -> ProjectLocationServiceAlterLocationCall<'a, C> {
13983        self._request = new_value;
13984        self
13985    }
13986    /// Required. The relative resource name of the metastore service to mutate metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
13987    ///
13988    /// Sets the *service* path property to the given value.
13989    ///
13990    /// Even though the property as already been set when instantiating this call,
13991    /// we provide this method for API completeness.
13992    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceAlterLocationCall<'a, C> {
13993        self._service = new_value.to_string();
13994        self
13995    }
13996    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13997    /// while executing the actual API request.
13998    ///
13999    /// ````text
14000    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14001    /// ````
14002    ///
14003    /// Sets the *delegate* property to the given value.
14004    pub fn delegate(
14005        mut self,
14006        new_value: &'a mut dyn common::Delegate,
14007    ) -> ProjectLocationServiceAlterLocationCall<'a, C> {
14008        self._delegate = Some(new_value);
14009        self
14010    }
14011
14012    /// Set any additional parameter of the query string used in the request.
14013    /// It should be used to set parameters which are not yet available through their own
14014    /// setters.
14015    ///
14016    /// Please note that this method must not be used to set any of the known parameters
14017    /// which have their own setter method. If done anyway, the request will fail.
14018    ///
14019    /// # Additional Parameters
14020    ///
14021    /// * *$.xgafv* (query-string) - V1 error format.
14022    /// * *access_token* (query-string) - OAuth access token.
14023    /// * *alt* (query-string) - Data format for response.
14024    /// * *callback* (query-string) - JSONP
14025    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14026    /// * *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.
14027    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14028    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14029    /// * *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.
14030    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14031    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14032    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceAlterLocationCall<'a, C>
14033    where
14034        T: AsRef<str>,
14035    {
14036        self._additional_params
14037            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14038        self
14039    }
14040
14041    /// Identifies the authorization scope for the method you are building.
14042    ///
14043    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14044    /// [`Scope::CloudPlatform`].
14045    ///
14046    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14047    /// tokens for more than one scope.
14048    ///
14049    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14050    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14051    /// sufficient, a read-write scope will do as well.
14052    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceAlterLocationCall<'a, C>
14053    where
14054        St: AsRef<str>,
14055    {
14056        self._scopes.insert(String::from(scope.as_ref()));
14057        self
14058    }
14059    /// Identifies the authorization scope(s) for the method you are building.
14060    ///
14061    /// See [`Self::add_scope()`] for details.
14062    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceAlterLocationCall<'a, C>
14063    where
14064        I: IntoIterator<Item = St>,
14065        St: AsRef<str>,
14066    {
14067        self._scopes
14068            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14069        self
14070    }
14071
14072    /// Removes all scopes, and no default scope will be used either.
14073    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14074    /// for details).
14075    pub fn clear_scopes(mut self) -> ProjectLocationServiceAlterLocationCall<'a, C> {
14076        self._scopes.clear();
14077        self
14078    }
14079}
14080
14081/// Alter metadata table properties.
14082///
14083/// A builder for the *locations.services.alterTableProperties* method supported by a *project* resource.
14084/// It is not used directly, but through a [`ProjectMethods`] instance.
14085///
14086/// # Example
14087///
14088/// Instantiate a resource method builder
14089///
14090/// ```test_harness,no_run
14091/// # extern crate hyper;
14092/// # extern crate hyper_rustls;
14093/// # extern crate google_metastore1_beta as metastore1_beta;
14094/// use metastore1_beta::api::AlterTablePropertiesRequest;
14095/// # async fn dox() {
14096/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14097///
14098/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14099/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14100/// #     .with_native_roots()
14101/// #     .unwrap()
14102/// #     .https_only()
14103/// #     .enable_http2()
14104/// #     .build();
14105///
14106/// # let executor = hyper_util::rt::TokioExecutor::new();
14107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14108/// #     secret,
14109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14110/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14111/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14112/// #     ),
14113/// # ).build().await.unwrap();
14114///
14115/// # let client = hyper_util::client::legacy::Client::builder(
14116/// #     hyper_util::rt::TokioExecutor::new()
14117/// # )
14118/// # .build(
14119/// #     hyper_rustls::HttpsConnectorBuilder::new()
14120/// #         .with_native_roots()
14121/// #         .unwrap()
14122/// #         .https_or_http()
14123/// #         .enable_http2()
14124/// #         .build()
14125/// # );
14126/// # let mut hub = DataprocMetastore::new(client, auth);
14127/// // As the method needs a request, you would usually fill it with the desired information
14128/// // into the respective structure. Some of the parts shown here might not be applicable !
14129/// // Values shown here are possibly random and not representative !
14130/// let mut req = AlterTablePropertiesRequest::default();
14131///
14132/// // You can configure optional parameters by calling the respective setters at will, and
14133/// // execute the final call using `doit()`.
14134/// // Values shown here are possibly random and not representative !
14135/// let result = hub.projects().locations_services_alter_table_properties(req, "service")
14136///              .doit().await;
14137/// # }
14138/// ```
14139pub struct ProjectLocationServiceAlterTablePropertyCall<'a, C>
14140where
14141    C: 'a,
14142{
14143    hub: &'a DataprocMetastore<C>,
14144    _request: AlterTablePropertiesRequest,
14145    _service: String,
14146    _delegate: Option<&'a mut dyn common::Delegate>,
14147    _additional_params: HashMap<String, String>,
14148    _scopes: BTreeSet<String>,
14149}
14150
14151impl<'a, C> common::CallBuilder for ProjectLocationServiceAlterTablePropertyCall<'a, C> {}
14152
14153impl<'a, C> ProjectLocationServiceAlterTablePropertyCall<'a, C>
14154where
14155    C: common::Connector,
14156{
14157    /// Perform the operation you have build so far.
14158    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14159        use std::borrow::Cow;
14160        use std::io::{Read, Seek};
14161
14162        use common::{url::Params, ToParts};
14163        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14164
14165        let mut dd = common::DefaultDelegate;
14166        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14167        dlg.begin(common::MethodInfo {
14168            id: "metastore.projects.locations.services.alterTableProperties",
14169            http_method: hyper::Method::POST,
14170        });
14171
14172        for &field in ["alt", "service"].iter() {
14173            if self._additional_params.contains_key(field) {
14174                dlg.finished(false);
14175                return Err(common::Error::FieldClash(field));
14176            }
14177        }
14178
14179        let mut params = Params::with_capacity(4 + self._additional_params.len());
14180        params.push("service", self._service);
14181
14182        params.extend(self._additional_params.iter());
14183
14184        params.push("alt", "json");
14185        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:alterTableProperties";
14186        if self._scopes.is_empty() {
14187            self._scopes
14188                .insert(Scope::CloudPlatform.as_ref().to_string());
14189        }
14190
14191        #[allow(clippy::single_element_loop)]
14192        for &(find_this, param_name) in [("{+service}", "service")].iter() {
14193            url = params.uri_replacement(url, param_name, find_this, true);
14194        }
14195        {
14196            let to_remove = ["service"];
14197            params.remove_params(&to_remove);
14198        }
14199
14200        let url = params.parse_with_url(&url);
14201
14202        let mut json_mime_type = mime::APPLICATION_JSON;
14203        let mut request_value_reader = {
14204            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14205            common::remove_json_null_values(&mut value);
14206            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14207            serde_json::to_writer(&mut dst, &value).unwrap();
14208            dst
14209        };
14210        let request_size = request_value_reader
14211            .seek(std::io::SeekFrom::End(0))
14212            .unwrap();
14213        request_value_reader
14214            .seek(std::io::SeekFrom::Start(0))
14215            .unwrap();
14216
14217        loop {
14218            let token = match self
14219                .hub
14220                .auth
14221                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14222                .await
14223            {
14224                Ok(token) => token,
14225                Err(e) => match dlg.token(e) {
14226                    Ok(token) => token,
14227                    Err(e) => {
14228                        dlg.finished(false);
14229                        return Err(common::Error::MissingToken(e));
14230                    }
14231                },
14232            };
14233            request_value_reader
14234                .seek(std::io::SeekFrom::Start(0))
14235                .unwrap();
14236            let mut req_result = {
14237                let client = &self.hub.client;
14238                dlg.pre_request();
14239                let mut req_builder = hyper::Request::builder()
14240                    .method(hyper::Method::POST)
14241                    .uri(url.as_str())
14242                    .header(USER_AGENT, self.hub._user_agent.clone());
14243
14244                if let Some(token) = token.as_ref() {
14245                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14246                }
14247
14248                let request = req_builder
14249                    .header(CONTENT_TYPE, json_mime_type.to_string())
14250                    .header(CONTENT_LENGTH, request_size as u64)
14251                    .body(common::to_body(
14252                        request_value_reader.get_ref().clone().into(),
14253                    ));
14254
14255                client.request(request.unwrap()).await
14256            };
14257
14258            match req_result {
14259                Err(err) => {
14260                    if let common::Retry::After(d) = dlg.http_error(&err) {
14261                        sleep(d).await;
14262                        continue;
14263                    }
14264                    dlg.finished(false);
14265                    return Err(common::Error::HttpError(err));
14266                }
14267                Ok(res) => {
14268                    let (mut parts, body) = res.into_parts();
14269                    let mut body = common::Body::new(body);
14270                    if !parts.status.is_success() {
14271                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14272                        let error = serde_json::from_str(&common::to_string(&bytes));
14273                        let response = common::to_response(parts, bytes.into());
14274
14275                        if let common::Retry::After(d) =
14276                            dlg.http_failure(&response, error.as_ref().ok())
14277                        {
14278                            sleep(d).await;
14279                            continue;
14280                        }
14281
14282                        dlg.finished(false);
14283
14284                        return Err(match error {
14285                            Ok(value) => common::Error::BadRequest(value),
14286                            _ => common::Error::Failure(response),
14287                        });
14288                    }
14289                    let response = {
14290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14291                        let encoded = common::to_string(&bytes);
14292                        match serde_json::from_str(&encoded) {
14293                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14294                            Err(error) => {
14295                                dlg.response_json_decode_error(&encoded, &error);
14296                                return Err(common::Error::JsonDecodeError(
14297                                    encoded.to_string(),
14298                                    error,
14299                                ));
14300                            }
14301                        }
14302                    };
14303
14304                    dlg.finished(true);
14305                    return Ok(response);
14306                }
14307            }
14308        }
14309    }
14310
14311    ///
14312    /// Sets the *request* property to the given value.
14313    ///
14314    /// Even though the property as already been set when instantiating this call,
14315    /// we provide this method for API completeness.
14316    pub fn request(
14317        mut self,
14318        new_value: AlterTablePropertiesRequest,
14319    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C> {
14320        self._request = new_value;
14321        self
14322    }
14323    /// Required. The relative resource name of the Dataproc Metastore service that's being used to mutate metadata table properties, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
14324    ///
14325    /// Sets the *service* path property to the given value.
14326    ///
14327    /// Even though the property as already been set when instantiating this call,
14328    /// we provide this method for API completeness.
14329    pub fn service(
14330        mut self,
14331        new_value: &str,
14332    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C> {
14333        self._service = new_value.to_string();
14334        self
14335    }
14336    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14337    /// while executing the actual API request.
14338    ///
14339    /// ````text
14340    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14341    /// ````
14342    ///
14343    /// Sets the *delegate* property to the given value.
14344    pub fn delegate(
14345        mut self,
14346        new_value: &'a mut dyn common::Delegate,
14347    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C> {
14348        self._delegate = Some(new_value);
14349        self
14350    }
14351
14352    /// Set any additional parameter of the query string used in the request.
14353    /// It should be used to set parameters which are not yet available through their own
14354    /// setters.
14355    ///
14356    /// Please note that this method must not be used to set any of the known parameters
14357    /// which have their own setter method. If done anyway, the request will fail.
14358    ///
14359    /// # Additional Parameters
14360    ///
14361    /// * *$.xgafv* (query-string) - V1 error format.
14362    /// * *access_token* (query-string) - OAuth access token.
14363    /// * *alt* (query-string) - Data format for response.
14364    /// * *callback* (query-string) - JSONP
14365    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14366    /// * *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.
14367    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14368    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14369    /// * *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.
14370    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14371    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14372    pub fn param<T>(
14373        mut self,
14374        name: T,
14375        value: T,
14376    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C>
14377    where
14378        T: AsRef<str>,
14379    {
14380        self._additional_params
14381            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14382        self
14383    }
14384
14385    /// Identifies the authorization scope for the method you are building.
14386    ///
14387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14388    /// [`Scope::CloudPlatform`].
14389    ///
14390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14391    /// tokens for more than one scope.
14392    ///
14393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14395    /// sufficient, a read-write scope will do as well.
14396    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceAlterTablePropertyCall<'a, C>
14397    where
14398        St: AsRef<str>,
14399    {
14400        self._scopes.insert(String::from(scope.as_ref()));
14401        self
14402    }
14403    /// Identifies the authorization scope(s) for the method you are building.
14404    ///
14405    /// See [`Self::add_scope()`] for details.
14406    pub fn add_scopes<I, St>(
14407        mut self,
14408        scopes: I,
14409    ) -> ProjectLocationServiceAlterTablePropertyCall<'a, C>
14410    where
14411        I: IntoIterator<Item = St>,
14412        St: AsRef<str>,
14413    {
14414        self._scopes
14415            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14416        self
14417    }
14418
14419    /// Removes all scopes, and no default scope will be used either.
14420    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14421    /// for details).
14422    pub fn clear_scopes(mut self) -> ProjectLocationServiceAlterTablePropertyCall<'a, C> {
14423        self._scopes.clear();
14424        self
14425    }
14426}
14427
14428/// Cancels the ongoing Managed Migration process.
14429///
14430/// A builder for the *locations.services.cancelMigration* method supported by a *project* resource.
14431/// It is not used directly, but through a [`ProjectMethods`] instance.
14432///
14433/// # Example
14434///
14435/// Instantiate a resource method builder
14436///
14437/// ```test_harness,no_run
14438/// # extern crate hyper;
14439/// # extern crate hyper_rustls;
14440/// # extern crate google_metastore1_beta as metastore1_beta;
14441/// use metastore1_beta::api::CancelMigrationRequest;
14442/// # async fn dox() {
14443/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14444///
14445/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14446/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14447/// #     .with_native_roots()
14448/// #     .unwrap()
14449/// #     .https_only()
14450/// #     .enable_http2()
14451/// #     .build();
14452///
14453/// # let executor = hyper_util::rt::TokioExecutor::new();
14454/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14455/// #     secret,
14456/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14457/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14458/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14459/// #     ),
14460/// # ).build().await.unwrap();
14461///
14462/// # let client = hyper_util::client::legacy::Client::builder(
14463/// #     hyper_util::rt::TokioExecutor::new()
14464/// # )
14465/// # .build(
14466/// #     hyper_rustls::HttpsConnectorBuilder::new()
14467/// #         .with_native_roots()
14468/// #         .unwrap()
14469/// #         .https_or_http()
14470/// #         .enable_http2()
14471/// #         .build()
14472/// # );
14473/// # let mut hub = DataprocMetastore::new(client, auth);
14474/// // As the method needs a request, you would usually fill it with the desired information
14475/// // into the respective structure. Some of the parts shown here might not be applicable !
14476/// // Values shown here are possibly random and not representative !
14477/// let mut req = CancelMigrationRequest::default();
14478///
14479/// // You can configure optional parameters by calling the respective setters at will, and
14480/// // execute the final call using `doit()`.
14481/// // Values shown here are possibly random and not representative !
14482/// let result = hub.projects().locations_services_cancel_migration(req, "service")
14483///              .doit().await;
14484/// # }
14485/// ```
14486pub struct ProjectLocationServiceCancelMigrationCall<'a, C>
14487where
14488    C: 'a,
14489{
14490    hub: &'a DataprocMetastore<C>,
14491    _request: CancelMigrationRequest,
14492    _service: String,
14493    _delegate: Option<&'a mut dyn common::Delegate>,
14494    _additional_params: HashMap<String, String>,
14495    _scopes: BTreeSet<String>,
14496}
14497
14498impl<'a, C> common::CallBuilder for ProjectLocationServiceCancelMigrationCall<'a, C> {}
14499
14500impl<'a, C> ProjectLocationServiceCancelMigrationCall<'a, C>
14501where
14502    C: common::Connector,
14503{
14504    /// Perform the operation you have build so far.
14505    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14506        use std::borrow::Cow;
14507        use std::io::{Read, Seek};
14508
14509        use common::{url::Params, ToParts};
14510        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14511
14512        let mut dd = common::DefaultDelegate;
14513        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14514        dlg.begin(common::MethodInfo {
14515            id: "metastore.projects.locations.services.cancelMigration",
14516            http_method: hyper::Method::POST,
14517        });
14518
14519        for &field in ["alt", "service"].iter() {
14520            if self._additional_params.contains_key(field) {
14521                dlg.finished(false);
14522                return Err(common::Error::FieldClash(field));
14523            }
14524        }
14525
14526        let mut params = Params::with_capacity(4 + self._additional_params.len());
14527        params.push("service", self._service);
14528
14529        params.extend(self._additional_params.iter());
14530
14531        params.push("alt", "json");
14532        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:cancelMigration";
14533        if self._scopes.is_empty() {
14534            self._scopes
14535                .insert(Scope::CloudPlatform.as_ref().to_string());
14536        }
14537
14538        #[allow(clippy::single_element_loop)]
14539        for &(find_this, param_name) in [("{+service}", "service")].iter() {
14540            url = params.uri_replacement(url, param_name, find_this, true);
14541        }
14542        {
14543            let to_remove = ["service"];
14544            params.remove_params(&to_remove);
14545        }
14546
14547        let url = params.parse_with_url(&url);
14548
14549        let mut json_mime_type = mime::APPLICATION_JSON;
14550        let mut request_value_reader = {
14551            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14552            common::remove_json_null_values(&mut value);
14553            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14554            serde_json::to_writer(&mut dst, &value).unwrap();
14555            dst
14556        };
14557        let request_size = request_value_reader
14558            .seek(std::io::SeekFrom::End(0))
14559            .unwrap();
14560        request_value_reader
14561            .seek(std::io::SeekFrom::Start(0))
14562            .unwrap();
14563
14564        loop {
14565            let token = match self
14566                .hub
14567                .auth
14568                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14569                .await
14570            {
14571                Ok(token) => token,
14572                Err(e) => match dlg.token(e) {
14573                    Ok(token) => token,
14574                    Err(e) => {
14575                        dlg.finished(false);
14576                        return Err(common::Error::MissingToken(e));
14577                    }
14578                },
14579            };
14580            request_value_reader
14581                .seek(std::io::SeekFrom::Start(0))
14582                .unwrap();
14583            let mut req_result = {
14584                let client = &self.hub.client;
14585                dlg.pre_request();
14586                let mut req_builder = hyper::Request::builder()
14587                    .method(hyper::Method::POST)
14588                    .uri(url.as_str())
14589                    .header(USER_AGENT, self.hub._user_agent.clone());
14590
14591                if let Some(token) = token.as_ref() {
14592                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14593                }
14594
14595                let request = req_builder
14596                    .header(CONTENT_TYPE, json_mime_type.to_string())
14597                    .header(CONTENT_LENGTH, request_size as u64)
14598                    .body(common::to_body(
14599                        request_value_reader.get_ref().clone().into(),
14600                    ));
14601
14602                client.request(request.unwrap()).await
14603            };
14604
14605            match req_result {
14606                Err(err) => {
14607                    if let common::Retry::After(d) = dlg.http_error(&err) {
14608                        sleep(d).await;
14609                        continue;
14610                    }
14611                    dlg.finished(false);
14612                    return Err(common::Error::HttpError(err));
14613                }
14614                Ok(res) => {
14615                    let (mut parts, body) = res.into_parts();
14616                    let mut body = common::Body::new(body);
14617                    if !parts.status.is_success() {
14618                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14619                        let error = serde_json::from_str(&common::to_string(&bytes));
14620                        let response = common::to_response(parts, bytes.into());
14621
14622                        if let common::Retry::After(d) =
14623                            dlg.http_failure(&response, error.as_ref().ok())
14624                        {
14625                            sleep(d).await;
14626                            continue;
14627                        }
14628
14629                        dlg.finished(false);
14630
14631                        return Err(match error {
14632                            Ok(value) => common::Error::BadRequest(value),
14633                            _ => common::Error::Failure(response),
14634                        });
14635                    }
14636                    let response = {
14637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14638                        let encoded = common::to_string(&bytes);
14639                        match serde_json::from_str(&encoded) {
14640                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14641                            Err(error) => {
14642                                dlg.response_json_decode_error(&encoded, &error);
14643                                return Err(common::Error::JsonDecodeError(
14644                                    encoded.to_string(),
14645                                    error,
14646                                ));
14647                            }
14648                        }
14649                    };
14650
14651                    dlg.finished(true);
14652                    return Ok(response);
14653                }
14654            }
14655        }
14656    }
14657
14658    ///
14659    /// Sets the *request* property to the given value.
14660    ///
14661    /// Even though the property as already been set when instantiating this call,
14662    /// we provide this method for API completeness.
14663    pub fn request(
14664        mut self,
14665        new_value: CancelMigrationRequest,
14666    ) -> ProjectLocationServiceCancelMigrationCall<'a, C> {
14667        self._request = new_value;
14668        self
14669    }
14670    /// Required. The relative resource name of the metastore service to cancel the ongoing migration to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
14671    ///
14672    /// Sets the *service* path property to the given value.
14673    ///
14674    /// Even though the property as already been set when instantiating this call,
14675    /// we provide this method for API completeness.
14676    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceCancelMigrationCall<'a, C> {
14677        self._service = new_value.to_string();
14678        self
14679    }
14680    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14681    /// while executing the actual API request.
14682    ///
14683    /// ````text
14684    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14685    /// ````
14686    ///
14687    /// Sets the *delegate* property to the given value.
14688    pub fn delegate(
14689        mut self,
14690        new_value: &'a mut dyn common::Delegate,
14691    ) -> ProjectLocationServiceCancelMigrationCall<'a, C> {
14692        self._delegate = Some(new_value);
14693        self
14694    }
14695
14696    /// Set any additional parameter of the query string used in the request.
14697    /// It should be used to set parameters which are not yet available through their own
14698    /// setters.
14699    ///
14700    /// Please note that this method must not be used to set any of the known parameters
14701    /// which have their own setter method. If done anyway, the request will fail.
14702    ///
14703    /// # Additional Parameters
14704    ///
14705    /// * *$.xgafv* (query-string) - V1 error format.
14706    /// * *access_token* (query-string) - OAuth access token.
14707    /// * *alt* (query-string) - Data format for response.
14708    /// * *callback* (query-string) - JSONP
14709    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14710    /// * *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.
14711    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14712    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14713    /// * *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.
14714    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14715    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14716    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceCancelMigrationCall<'a, C>
14717    where
14718        T: AsRef<str>,
14719    {
14720        self._additional_params
14721            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14722        self
14723    }
14724
14725    /// Identifies the authorization scope for the method you are building.
14726    ///
14727    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14728    /// [`Scope::CloudPlatform`].
14729    ///
14730    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14731    /// tokens for more than one scope.
14732    ///
14733    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14734    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14735    /// sufficient, a read-write scope will do as well.
14736    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCancelMigrationCall<'a, C>
14737    where
14738        St: AsRef<str>,
14739    {
14740        self._scopes.insert(String::from(scope.as_ref()));
14741        self
14742    }
14743    /// Identifies the authorization scope(s) for the method you are building.
14744    ///
14745    /// See [`Self::add_scope()`] for details.
14746    pub fn add_scopes<I, St>(
14747        mut self,
14748        scopes: I,
14749    ) -> ProjectLocationServiceCancelMigrationCall<'a, C>
14750    where
14751        I: IntoIterator<Item = St>,
14752        St: AsRef<str>,
14753    {
14754        self._scopes
14755            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14756        self
14757    }
14758
14759    /// Removes all scopes, and no default scope will be used either.
14760    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14761    /// for details).
14762    pub fn clear_scopes(mut self) -> ProjectLocationServiceCancelMigrationCall<'a, C> {
14763        self._scopes.clear();
14764        self
14765    }
14766}
14767
14768/// Completes the managed migration process. The Dataproc Metastore service will switch to using its own backend database after successful migration.
14769///
14770/// A builder for the *locations.services.completeMigration* method supported by a *project* resource.
14771/// It is not used directly, but through a [`ProjectMethods`] instance.
14772///
14773/// # Example
14774///
14775/// Instantiate a resource method builder
14776///
14777/// ```test_harness,no_run
14778/// # extern crate hyper;
14779/// # extern crate hyper_rustls;
14780/// # extern crate google_metastore1_beta as metastore1_beta;
14781/// use metastore1_beta::api::CompleteMigrationRequest;
14782/// # async fn dox() {
14783/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14784///
14785/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14786/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14787/// #     .with_native_roots()
14788/// #     .unwrap()
14789/// #     .https_only()
14790/// #     .enable_http2()
14791/// #     .build();
14792///
14793/// # let executor = hyper_util::rt::TokioExecutor::new();
14794/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14795/// #     secret,
14796/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14797/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14798/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14799/// #     ),
14800/// # ).build().await.unwrap();
14801///
14802/// # let client = hyper_util::client::legacy::Client::builder(
14803/// #     hyper_util::rt::TokioExecutor::new()
14804/// # )
14805/// # .build(
14806/// #     hyper_rustls::HttpsConnectorBuilder::new()
14807/// #         .with_native_roots()
14808/// #         .unwrap()
14809/// #         .https_or_http()
14810/// #         .enable_http2()
14811/// #         .build()
14812/// # );
14813/// # let mut hub = DataprocMetastore::new(client, auth);
14814/// // As the method needs a request, you would usually fill it with the desired information
14815/// // into the respective structure. Some of the parts shown here might not be applicable !
14816/// // Values shown here are possibly random and not representative !
14817/// let mut req = CompleteMigrationRequest::default();
14818///
14819/// // You can configure optional parameters by calling the respective setters at will, and
14820/// // execute the final call using `doit()`.
14821/// // Values shown here are possibly random and not representative !
14822/// let result = hub.projects().locations_services_complete_migration(req, "service")
14823///              .doit().await;
14824/// # }
14825/// ```
14826pub struct ProjectLocationServiceCompleteMigrationCall<'a, C>
14827where
14828    C: 'a,
14829{
14830    hub: &'a DataprocMetastore<C>,
14831    _request: CompleteMigrationRequest,
14832    _service: String,
14833    _delegate: Option<&'a mut dyn common::Delegate>,
14834    _additional_params: HashMap<String, String>,
14835    _scopes: BTreeSet<String>,
14836}
14837
14838impl<'a, C> common::CallBuilder for ProjectLocationServiceCompleteMigrationCall<'a, C> {}
14839
14840impl<'a, C> ProjectLocationServiceCompleteMigrationCall<'a, C>
14841where
14842    C: common::Connector,
14843{
14844    /// Perform the operation you have build so far.
14845    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14846        use std::borrow::Cow;
14847        use std::io::{Read, Seek};
14848
14849        use common::{url::Params, ToParts};
14850        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14851
14852        let mut dd = common::DefaultDelegate;
14853        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14854        dlg.begin(common::MethodInfo {
14855            id: "metastore.projects.locations.services.completeMigration",
14856            http_method: hyper::Method::POST,
14857        });
14858
14859        for &field in ["alt", "service"].iter() {
14860            if self._additional_params.contains_key(field) {
14861                dlg.finished(false);
14862                return Err(common::Error::FieldClash(field));
14863            }
14864        }
14865
14866        let mut params = Params::with_capacity(4 + self._additional_params.len());
14867        params.push("service", self._service);
14868
14869        params.extend(self._additional_params.iter());
14870
14871        params.push("alt", "json");
14872        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:completeMigration";
14873        if self._scopes.is_empty() {
14874            self._scopes
14875                .insert(Scope::CloudPlatform.as_ref().to_string());
14876        }
14877
14878        #[allow(clippy::single_element_loop)]
14879        for &(find_this, param_name) in [("{+service}", "service")].iter() {
14880            url = params.uri_replacement(url, param_name, find_this, true);
14881        }
14882        {
14883            let to_remove = ["service"];
14884            params.remove_params(&to_remove);
14885        }
14886
14887        let url = params.parse_with_url(&url);
14888
14889        let mut json_mime_type = mime::APPLICATION_JSON;
14890        let mut request_value_reader = {
14891            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14892            common::remove_json_null_values(&mut value);
14893            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14894            serde_json::to_writer(&mut dst, &value).unwrap();
14895            dst
14896        };
14897        let request_size = request_value_reader
14898            .seek(std::io::SeekFrom::End(0))
14899            .unwrap();
14900        request_value_reader
14901            .seek(std::io::SeekFrom::Start(0))
14902            .unwrap();
14903
14904        loop {
14905            let token = match self
14906                .hub
14907                .auth
14908                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14909                .await
14910            {
14911                Ok(token) => token,
14912                Err(e) => match dlg.token(e) {
14913                    Ok(token) => token,
14914                    Err(e) => {
14915                        dlg.finished(false);
14916                        return Err(common::Error::MissingToken(e));
14917                    }
14918                },
14919            };
14920            request_value_reader
14921                .seek(std::io::SeekFrom::Start(0))
14922                .unwrap();
14923            let mut req_result = {
14924                let client = &self.hub.client;
14925                dlg.pre_request();
14926                let mut req_builder = hyper::Request::builder()
14927                    .method(hyper::Method::POST)
14928                    .uri(url.as_str())
14929                    .header(USER_AGENT, self.hub._user_agent.clone());
14930
14931                if let Some(token) = token.as_ref() {
14932                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14933                }
14934
14935                let request = req_builder
14936                    .header(CONTENT_TYPE, json_mime_type.to_string())
14937                    .header(CONTENT_LENGTH, request_size as u64)
14938                    .body(common::to_body(
14939                        request_value_reader.get_ref().clone().into(),
14940                    ));
14941
14942                client.request(request.unwrap()).await
14943            };
14944
14945            match req_result {
14946                Err(err) => {
14947                    if let common::Retry::After(d) = dlg.http_error(&err) {
14948                        sleep(d).await;
14949                        continue;
14950                    }
14951                    dlg.finished(false);
14952                    return Err(common::Error::HttpError(err));
14953                }
14954                Ok(res) => {
14955                    let (mut parts, body) = res.into_parts();
14956                    let mut body = common::Body::new(body);
14957                    if !parts.status.is_success() {
14958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14959                        let error = serde_json::from_str(&common::to_string(&bytes));
14960                        let response = common::to_response(parts, bytes.into());
14961
14962                        if let common::Retry::After(d) =
14963                            dlg.http_failure(&response, error.as_ref().ok())
14964                        {
14965                            sleep(d).await;
14966                            continue;
14967                        }
14968
14969                        dlg.finished(false);
14970
14971                        return Err(match error {
14972                            Ok(value) => common::Error::BadRequest(value),
14973                            _ => common::Error::Failure(response),
14974                        });
14975                    }
14976                    let response = {
14977                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14978                        let encoded = common::to_string(&bytes);
14979                        match serde_json::from_str(&encoded) {
14980                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14981                            Err(error) => {
14982                                dlg.response_json_decode_error(&encoded, &error);
14983                                return Err(common::Error::JsonDecodeError(
14984                                    encoded.to_string(),
14985                                    error,
14986                                ));
14987                            }
14988                        }
14989                    };
14990
14991                    dlg.finished(true);
14992                    return Ok(response);
14993                }
14994            }
14995        }
14996    }
14997
14998    ///
14999    /// Sets the *request* property to the given value.
15000    ///
15001    /// Even though the property as already been set when instantiating this call,
15002    /// we provide this method for API completeness.
15003    pub fn request(
15004        mut self,
15005        new_value: CompleteMigrationRequest,
15006    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C> {
15007        self._request = new_value;
15008        self
15009    }
15010    /// Required. The relative resource name of the metastore service to complete the migration to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
15011    ///
15012    /// Sets the *service* path property to the given value.
15013    ///
15014    /// Even though the property as already been set when instantiating this call,
15015    /// we provide this method for API completeness.
15016    pub fn service(
15017        mut self,
15018        new_value: &str,
15019    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C> {
15020        self._service = new_value.to_string();
15021        self
15022    }
15023    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15024    /// while executing the actual API request.
15025    ///
15026    /// ````text
15027    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15028    /// ````
15029    ///
15030    /// Sets the *delegate* property to the given value.
15031    pub fn delegate(
15032        mut self,
15033        new_value: &'a mut dyn common::Delegate,
15034    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C> {
15035        self._delegate = Some(new_value);
15036        self
15037    }
15038
15039    /// Set any additional parameter of the query string used in the request.
15040    /// It should be used to set parameters which are not yet available through their own
15041    /// setters.
15042    ///
15043    /// Please note that this method must not be used to set any of the known parameters
15044    /// which have their own setter method. If done anyway, the request will fail.
15045    ///
15046    /// # Additional Parameters
15047    ///
15048    /// * *$.xgafv* (query-string) - V1 error format.
15049    /// * *access_token* (query-string) - OAuth access token.
15050    /// * *alt* (query-string) - Data format for response.
15051    /// * *callback* (query-string) - JSONP
15052    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15053    /// * *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.
15054    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15055    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15056    /// * *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.
15057    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15058    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15059    pub fn param<T>(
15060        mut self,
15061        name: T,
15062        value: T,
15063    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C>
15064    where
15065        T: AsRef<str>,
15066    {
15067        self._additional_params
15068            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15069        self
15070    }
15071
15072    /// Identifies the authorization scope for the method you are building.
15073    ///
15074    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15075    /// [`Scope::CloudPlatform`].
15076    ///
15077    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15078    /// tokens for more than one scope.
15079    ///
15080    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15081    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15082    /// sufficient, a read-write scope will do as well.
15083    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCompleteMigrationCall<'a, C>
15084    where
15085        St: AsRef<str>,
15086    {
15087        self._scopes.insert(String::from(scope.as_ref()));
15088        self
15089    }
15090    /// Identifies the authorization scope(s) for the method you are building.
15091    ///
15092    /// See [`Self::add_scope()`] for details.
15093    pub fn add_scopes<I, St>(
15094        mut self,
15095        scopes: I,
15096    ) -> ProjectLocationServiceCompleteMigrationCall<'a, C>
15097    where
15098        I: IntoIterator<Item = St>,
15099        St: AsRef<str>,
15100    {
15101        self._scopes
15102            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15103        self
15104    }
15105
15106    /// Removes all scopes, and no default scope will be used either.
15107    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15108    /// for details).
15109    pub fn clear_scopes(mut self) -> ProjectLocationServiceCompleteMigrationCall<'a, C> {
15110        self._scopes.clear();
15111        self
15112    }
15113}
15114
15115/// Creates a metastore service in a project and location.
15116///
15117/// A builder for the *locations.services.create* method supported by a *project* resource.
15118/// It is not used directly, but through a [`ProjectMethods`] instance.
15119///
15120/// # Example
15121///
15122/// Instantiate a resource method builder
15123///
15124/// ```test_harness,no_run
15125/// # extern crate hyper;
15126/// # extern crate hyper_rustls;
15127/// # extern crate google_metastore1_beta as metastore1_beta;
15128/// use metastore1_beta::api::Service;
15129/// # async fn dox() {
15130/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15131///
15132/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15133/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15134/// #     .with_native_roots()
15135/// #     .unwrap()
15136/// #     .https_only()
15137/// #     .enable_http2()
15138/// #     .build();
15139///
15140/// # let executor = hyper_util::rt::TokioExecutor::new();
15141/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15142/// #     secret,
15143/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15144/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15145/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15146/// #     ),
15147/// # ).build().await.unwrap();
15148///
15149/// # let client = hyper_util::client::legacy::Client::builder(
15150/// #     hyper_util::rt::TokioExecutor::new()
15151/// # )
15152/// # .build(
15153/// #     hyper_rustls::HttpsConnectorBuilder::new()
15154/// #         .with_native_roots()
15155/// #         .unwrap()
15156/// #         .https_or_http()
15157/// #         .enable_http2()
15158/// #         .build()
15159/// # );
15160/// # let mut hub = DataprocMetastore::new(client, auth);
15161/// // As the method needs a request, you would usually fill it with the desired information
15162/// // into the respective structure. Some of the parts shown here might not be applicable !
15163/// // Values shown here are possibly random and not representative !
15164/// let mut req = Service::default();
15165///
15166/// // You can configure optional parameters by calling the respective setters at will, and
15167/// // execute the final call using `doit()`.
15168/// // Values shown here are possibly random and not representative !
15169/// let result = hub.projects().locations_services_create(req, "parent")
15170///              .service_id("consetetur")
15171///              .request_id("amet.")
15172///              .doit().await;
15173/// # }
15174/// ```
15175pub struct ProjectLocationServiceCreateCall<'a, C>
15176where
15177    C: 'a,
15178{
15179    hub: &'a DataprocMetastore<C>,
15180    _request: Service,
15181    _parent: String,
15182    _service_id: Option<String>,
15183    _request_id: Option<String>,
15184    _delegate: Option<&'a mut dyn common::Delegate>,
15185    _additional_params: HashMap<String, String>,
15186    _scopes: BTreeSet<String>,
15187}
15188
15189impl<'a, C> common::CallBuilder for ProjectLocationServiceCreateCall<'a, C> {}
15190
15191impl<'a, C> ProjectLocationServiceCreateCall<'a, C>
15192where
15193    C: common::Connector,
15194{
15195    /// Perform the operation you have build so far.
15196    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15197        use std::borrow::Cow;
15198        use std::io::{Read, Seek};
15199
15200        use common::{url::Params, ToParts};
15201        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15202
15203        let mut dd = common::DefaultDelegate;
15204        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15205        dlg.begin(common::MethodInfo {
15206            id: "metastore.projects.locations.services.create",
15207            http_method: hyper::Method::POST,
15208        });
15209
15210        for &field in ["alt", "parent", "serviceId", "requestId"].iter() {
15211            if self._additional_params.contains_key(field) {
15212                dlg.finished(false);
15213                return Err(common::Error::FieldClash(field));
15214            }
15215        }
15216
15217        let mut params = Params::with_capacity(6 + self._additional_params.len());
15218        params.push("parent", self._parent);
15219        if let Some(value) = self._service_id.as_ref() {
15220            params.push("serviceId", value);
15221        }
15222        if let Some(value) = self._request_id.as_ref() {
15223            params.push("requestId", value);
15224        }
15225
15226        params.extend(self._additional_params.iter());
15227
15228        params.push("alt", "json");
15229        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services";
15230        if self._scopes.is_empty() {
15231            self._scopes
15232                .insert(Scope::CloudPlatform.as_ref().to_string());
15233        }
15234
15235        #[allow(clippy::single_element_loop)]
15236        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15237            url = params.uri_replacement(url, param_name, find_this, true);
15238        }
15239        {
15240            let to_remove = ["parent"];
15241            params.remove_params(&to_remove);
15242        }
15243
15244        let url = params.parse_with_url(&url);
15245
15246        let mut json_mime_type = mime::APPLICATION_JSON;
15247        let mut request_value_reader = {
15248            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15249            common::remove_json_null_values(&mut value);
15250            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15251            serde_json::to_writer(&mut dst, &value).unwrap();
15252            dst
15253        };
15254        let request_size = request_value_reader
15255            .seek(std::io::SeekFrom::End(0))
15256            .unwrap();
15257        request_value_reader
15258            .seek(std::io::SeekFrom::Start(0))
15259            .unwrap();
15260
15261        loop {
15262            let token = match self
15263                .hub
15264                .auth
15265                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15266                .await
15267            {
15268                Ok(token) => token,
15269                Err(e) => match dlg.token(e) {
15270                    Ok(token) => token,
15271                    Err(e) => {
15272                        dlg.finished(false);
15273                        return Err(common::Error::MissingToken(e));
15274                    }
15275                },
15276            };
15277            request_value_reader
15278                .seek(std::io::SeekFrom::Start(0))
15279                .unwrap();
15280            let mut req_result = {
15281                let client = &self.hub.client;
15282                dlg.pre_request();
15283                let mut req_builder = hyper::Request::builder()
15284                    .method(hyper::Method::POST)
15285                    .uri(url.as_str())
15286                    .header(USER_AGENT, self.hub._user_agent.clone());
15287
15288                if let Some(token) = token.as_ref() {
15289                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15290                }
15291
15292                let request = req_builder
15293                    .header(CONTENT_TYPE, json_mime_type.to_string())
15294                    .header(CONTENT_LENGTH, request_size as u64)
15295                    .body(common::to_body(
15296                        request_value_reader.get_ref().clone().into(),
15297                    ));
15298
15299                client.request(request.unwrap()).await
15300            };
15301
15302            match req_result {
15303                Err(err) => {
15304                    if let common::Retry::After(d) = dlg.http_error(&err) {
15305                        sleep(d).await;
15306                        continue;
15307                    }
15308                    dlg.finished(false);
15309                    return Err(common::Error::HttpError(err));
15310                }
15311                Ok(res) => {
15312                    let (mut parts, body) = res.into_parts();
15313                    let mut body = common::Body::new(body);
15314                    if !parts.status.is_success() {
15315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15316                        let error = serde_json::from_str(&common::to_string(&bytes));
15317                        let response = common::to_response(parts, bytes.into());
15318
15319                        if let common::Retry::After(d) =
15320                            dlg.http_failure(&response, error.as_ref().ok())
15321                        {
15322                            sleep(d).await;
15323                            continue;
15324                        }
15325
15326                        dlg.finished(false);
15327
15328                        return Err(match error {
15329                            Ok(value) => common::Error::BadRequest(value),
15330                            _ => common::Error::Failure(response),
15331                        });
15332                    }
15333                    let response = {
15334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15335                        let encoded = common::to_string(&bytes);
15336                        match serde_json::from_str(&encoded) {
15337                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15338                            Err(error) => {
15339                                dlg.response_json_decode_error(&encoded, &error);
15340                                return Err(common::Error::JsonDecodeError(
15341                                    encoded.to_string(),
15342                                    error,
15343                                ));
15344                            }
15345                        }
15346                    };
15347
15348                    dlg.finished(true);
15349                    return Ok(response);
15350                }
15351            }
15352        }
15353    }
15354
15355    ///
15356    /// Sets the *request* property to the given value.
15357    ///
15358    /// Even though the property as already been set when instantiating this call,
15359    /// we provide this method for API completeness.
15360    pub fn request(mut self, new_value: Service) -> ProjectLocationServiceCreateCall<'a, C> {
15361        self._request = new_value;
15362        self
15363    }
15364    /// Required. The relative resource name of the location in which to create a metastore service, in the following form:projects/{project_number}/locations/{location_id}.
15365    ///
15366    /// Sets the *parent* path property to the given value.
15367    ///
15368    /// Even though the property as already been set when instantiating this call,
15369    /// we provide this method for API completeness.
15370    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
15371        self._parent = new_value.to_string();
15372        self
15373    }
15374    /// Required. The ID of the metastore service, which is used as the final component of the metastore service's name.This value must be between 2 and 63 characters long inclusive, begin with a letter, end with a letter or number, and consist of alpha-numeric ASCII characters or hyphens.
15375    ///
15376    /// Sets the *service id* query property to the given value.
15377    pub fn service_id(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
15378        self._service_id = Some(new_value.to_string());
15379        self
15380    }
15381    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
15382    ///
15383    /// Sets the *request id* query property to the given value.
15384    pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceCreateCall<'a, C> {
15385        self._request_id = Some(new_value.to_string());
15386        self
15387    }
15388    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15389    /// while executing the actual API request.
15390    ///
15391    /// ````text
15392    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15393    /// ````
15394    ///
15395    /// Sets the *delegate* property to the given value.
15396    pub fn delegate(
15397        mut self,
15398        new_value: &'a mut dyn common::Delegate,
15399    ) -> ProjectLocationServiceCreateCall<'a, C> {
15400        self._delegate = Some(new_value);
15401        self
15402    }
15403
15404    /// Set any additional parameter of the query string used in the request.
15405    /// It should be used to set parameters which are not yet available through their own
15406    /// setters.
15407    ///
15408    /// Please note that this method must not be used to set any of the known parameters
15409    /// which have their own setter method. If done anyway, the request will fail.
15410    ///
15411    /// # Additional Parameters
15412    ///
15413    /// * *$.xgafv* (query-string) - V1 error format.
15414    /// * *access_token* (query-string) - OAuth access token.
15415    /// * *alt* (query-string) - Data format for response.
15416    /// * *callback* (query-string) - JSONP
15417    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15418    /// * *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.
15419    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15420    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15421    /// * *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.
15422    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15423    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15424    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceCreateCall<'a, C>
15425    where
15426        T: AsRef<str>,
15427    {
15428        self._additional_params
15429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15430        self
15431    }
15432
15433    /// Identifies the authorization scope for the method you are building.
15434    ///
15435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15436    /// [`Scope::CloudPlatform`].
15437    ///
15438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15439    /// tokens for more than one scope.
15440    ///
15441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15443    /// sufficient, a read-write scope will do as well.
15444    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceCreateCall<'a, C>
15445    where
15446        St: AsRef<str>,
15447    {
15448        self._scopes.insert(String::from(scope.as_ref()));
15449        self
15450    }
15451    /// Identifies the authorization scope(s) for the method you are building.
15452    ///
15453    /// See [`Self::add_scope()`] for details.
15454    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceCreateCall<'a, C>
15455    where
15456        I: IntoIterator<Item = St>,
15457        St: AsRef<str>,
15458    {
15459        self._scopes
15460            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15461        self
15462    }
15463
15464    /// Removes all scopes, and no default scope will be used either.
15465    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15466    /// for details).
15467    pub fn clear_scopes(mut self) -> ProjectLocationServiceCreateCall<'a, C> {
15468        self._scopes.clear();
15469        self
15470    }
15471}
15472
15473/// Deletes a single service.
15474///
15475/// A builder for the *locations.services.delete* method supported by a *project* resource.
15476/// It is not used directly, but through a [`ProjectMethods`] instance.
15477///
15478/// # Example
15479///
15480/// Instantiate a resource method builder
15481///
15482/// ```test_harness,no_run
15483/// # extern crate hyper;
15484/// # extern crate hyper_rustls;
15485/// # extern crate google_metastore1_beta as metastore1_beta;
15486/// # async fn dox() {
15487/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15488///
15489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15491/// #     .with_native_roots()
15492/// #     .unwrap()
15493/// #     .https_only()
15494/// #     .enable_http2()
15495/// #     .build();
15496///
15497/// # let executor = hyper_util::rt::TokioExecutor::new();
15498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15499/// #     secret,
15500/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15501/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15502/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15503/// #     ),
15504/// # ).build().await.unwrap();
15505///
15506/// # let client = hyper_util::client::legacy::Client::builder(
15507/// #     hyper_util::rt::TokioExecutor::new()
15508/// # )
15509/// # .build(
15510/// #     hyper_rustls::HttpsConnectorBuilder::new()
15511/// #         .with_native_roots()
15512/// #         .unwrap()
15513/// #         .https_or_http()
15514/// #         .enable_http2()
15515/// #         .build()
15516/// # );
15517/// # let mut hub = DataprocMetastore::new(client, auth);
15518/// // You can configure optional parameters by calling the respective setters at will, and
15519/// // execute the final call using `doit()`.
15520/// // Values shown here are possibly random and not representative !
15521/// let result = hub.projects().locations_services_delete("name")
15522///              .request_id("takimata")
15523///              .doit().await;
15524/// # }
15525/// ```
15526pub struct ProjectLocationServiceDeleteCall<'a, C>
15527where
15528    C: 'a,
15529{
15530    hub: &'a DataprocMetastore<C>,
15531    _name: String,
15532    _request_id: Option<String>,
15533    _delegate: Option<&'a mut dyn common::Delegate>,
15534    _additional_params: HashMap<String, String>,
15535    _scopes: BTreeSet<String>,
15536}
15537
15538impl<'a, C> common::CallBuilder for ProjectLocationServiceDeleteCall<'a, C> {}
15539
15540impl<'a, C> ProjectLocationServiceDeleteCall<'a, C>
15541where
15542    C: common::Connector,
15543{
15544    /// Perform the operation you have build so far.
15545    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15546        use std::borrow::Cow;
15547        use std::io::{Read, Seek};
15548
15549        use common::{url::Params, ToParts};
15550        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15551
15552        let mut dd = common::DefaultDelegate;
15553        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15554        dlg.begin(common::MethodInfo {
15555            id: "metastore.projects.locations.services.delete",
15556            http_method: hyper::Method::DELETE,
15557        });
15558
15559        for &field in ["alt", "name", "requestId"].iter() {
15560            if self._additional_params.contains_key(field) {
15561                dlg.finished(false);
15562                return Err(common::Error::FieldClash(field));
15563            }
15564        }
15565
15566        let mut params = Params::with_capacity(4 + self._additional_params.len());
15567        params.push("name", self._name);
15568        if let Some(value) = self._request_id.as_ref() {
15569            params.push("requestId", value);
15570        }
15571
15572        params.extend(self._additional_params.iter());
15573
15574        params.push("alt", "json");
15575        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
15576        if self._scopes.is_empty() {
15577            self._scopes
15578                .insert(Scope::CloudPlatform.as_ref().to_string());
15579        }
15580
15581        #[allow(clippy::single_element_loop)]
15582        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15583            url = params.uri_replacement(url, param_name, find_this, true);
15584        }
15585        {
15586            let to_remove = ["name"];
15587            params.remove_params(&to_remove);
15588        }
15589
15590        let url = params.parse_with_url(&url);
15591
15592        loop {
15593            let token = match self
15594                .hub
15595                .auth
15596                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15597                .await
15598            {
15599                Ok(token) => token,
15600                Err(e) => match dlg.token(e) {
15601                    Ok(token) => token,
15602                    Err(e) => {
15603                        dlg.finished(false);
15604                        return Err(common::Error::MissingToken(e));
15605                    }
15606                },
15607            };
15608            let mut req_result = {
15609                let client = &self.hub.client;
15610                dlg.pre_request();
15611                let mut req_builder = hyper::Request::builder()
15612                    .method(hyper::Method::DELETE)
15613                    .uri(url.as_str())
15614                    .header(USER_AGENT, self.hub._user_agent.clone());
15615
15616                if let Some(token) = token.as_ref() {
15617                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15618                }
15619
15620                let request = req_builder
15621                    .header(CONTENT_LENGTH, 0_u64)
15622                    .body(common::to_body::<String>(None));
15623
15624                client.request(request.unwrap()).await
15625            };
15626
15627            match req_result {
15628                Err(err) => {
15629                    if let common::Retry::After(d) = dlg.http_error(&err) {
15630                        sleep(d).await;
15631                        continue;
15632                    }
15633                    dlg.finished(false);
15634                    return Err(common::Error::HttpError(err));
15635                }
15636                Ok(res) => {
15637                    let (mut parts, body) = res.into_parts();
15638                    let mut body = common::Body::new(body);
15639                    if !parts.status.is_success() {
15640                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15641                        let error = serde_json::from_str(&common::to_string(&bytes));
15642                        let response = common::to_response(parts, bytes.into());
15643
15644                        if let common::Retry::After(d) =
15645                            dlg.http_failure(&response, error.as_ref().ok())
15646                        {
15647                            sleep(d).await;
15648                            continue;
15649                        }
15650
15651                        dlg.finished(false);
15652
15653                        return Err(match error {
15654                            Ok(value) => common::Error::BadRequest(value),
15655                            _ => common::Error::Failure(response),
15656                        });
15657                    }
15658                    let response = {
15659                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15660                        let encoded = common::to_string(&bytes);
15661                        match serde_json::from_str(&encoded) {
15662                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15663                            Err(error) => {
15664                                dlg.response_json_decode_error(&encoded, &error);
15665                                return Err(common::Error::JsonDecodeError(
15666                                    encoded.to_string(),
15667                                    error,
15668                                ));
15669                            }
15670                        }
15671                    };
15672
15673                    dlg.finished(true);
15674                    return Ok(response);
15675                }
15676            }
15677        }
15678    }
15679
15680    /// Required. The relative resource name of the metastore service to delete, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
15681    ///
15682    /// Sets the *name* path property to the given value.
15683    ///
15684    /// Even though the property as already been set when instantiating this call,
15685    /// we provide this method for API completeness.
15686    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
15687        self._name = new_value.to_string();
15688        self
15689    }
15690    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
15691    ///
15692    /// Sets the *request id* query property to the given value.
15693    pub fn request_id(mut self, new_value: &str) -> ProjectLocationServiceDeleteCall<'a, C> {
15694        self._request_id = Some(new_value.to_string());
15695        self
15696    }
15697    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15698    /// while executing the actual API request.
15699    ///
15700    /// ````text
15701    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15702    /// ````
15703    ///
15704    /// Sets the *delegate* property to the given value.
15705    pub fn delegate(
15706        mut self,
15707        new_value: &'a mut dyn common::Delegate,
15708    ) -> ProjectLocationServiceDeleteCall<'a, C> {
15709        self._delegate = Some(new_value);
15710        self
15711    }
15712
15713    /// Set any additional parameter of the query string used in the request.
15714    /// It should be used to set parameters which are not yet available through their own
15715    /// setters.
15716    ///
15717    /// Please note that this method must not be used to set any of the known parameters
15718    /// which have their own setter method. If done anyway, the request will fail.
15719    ///
15720    /// # Additional Parameters
15721    ///
15722    /// * *$.xgafv* (query-string) - V1 error format.
15723    /// * *access_token* (query-string) - OAuth access token.
15724    /// * *alt* (query-string) - Data format for response.
15725    /// * *callback* (query-string) - JSONP
15726    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15727    /// * *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.
15728    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15729    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15730    /// * *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.
15731    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15732    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15733    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceDeleteCall<'a, C>
15734    where
15735        T: AsRef<str>,
15736    {
15737        self._additional_params
15738            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15739        self
15740    }
15741
15742    /// Identifies the authorization scope for the method you are building.
15743    ///
15744    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15745    /// [`Scope::CloudPlatform`].
15746    ///
15747    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15748    /// tokens for more than one scope.
15749    ///
15750    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15751    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15752    /// sufficient, a read-write scope will do as well.
15753    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceDeleteCall<'a, C>
15754    where
15755        St: AsRef<str>,
15756    {
15757        self._scopes.insert(String::from(scope.as_ref()));
15758        self
15759    }
15760    /// Identifies the authorization scope(s) for the method you are building.
15761    ///
15762    /// See [`Self::add_scope()`] for details.
15763    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceDeleteCall<'a, C>
15764    where
15765        I: IntoIterator<Item = St>,
15766        St: AsRef<str>,
15767    {
15768        self._scopes
15769            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15770        self
15771    }
15772
15773    /// Removes all scopes, and no default scope will be used either.
15774    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15775    /// for details).
15776    pub fn clear_scopes(mut self) -> ProjectLocationServiceDeleteCall<'a, C> {
15777        self._scopes.clear();
15778        self
15779    }
15780}
15781
15782/// Exports metadata from a service.
15783///
15784/// A builder for the *locations.services.exportMetadata* method supported by a *project* resource.
15785/// It is not used directly, but through a [`ProjectMethods`] instance.
15786///
15787/// # Example
15788///
15789/// Instantiate a resource method builder
15790///
15791/// ```test_harness,no_run
15792/// # extern crate hyper;
15793/// # extern crate hyper_rustls;
15794/// # extern crate google_metastore1_beta as metastore1_beta;
15795/// use metastore1_beta::api::ExportMetadataRequest;
15796/// # async fn dox() {
15797/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15798///
15799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15801/// #     .with_native_roots()
15802/// #     .unwrap()
15803/// #     .https_only()
15804/// #     .enable_http2()
15805/// #     .build();
15806///
15807/// # let executor = hyper_util::rt::TokioExecutor::new();
15808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15809/// #     secret,
15810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15811/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15812/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15813/// #     ),
15814/// # ).build().await.unwrap();
15815///
15816/// # let client = hyper_util::client::legacy::Client::builder(
15817/// #     hyper_util::rt::TokioExecutor::new()
15818/// # )
15819/// # .build(
15820/// #     hyper_rustls::HttpsConnectorBuilder::new()
15821/// #         .with_native_roots()
15822/// #         .unwrap()
15823/// #         .https_or_http()
15824/// #         .enable_http2()
15825/// #         .build()
15826/// # );
15827/// # let mut hub = DataprocMetastore::new(client, auth);
15828/// // As the method needs a request, you would usually fill it with the desired information
15829/// // into the respective structure. Some of the parts shown here might not be applicable !
15830/// // Values shown here are possibly random and not representative !
15831/// let mut req = ExportMetadataRequest::default();
15832///
15833/// // You can configure optional parameters by calling the respective setters at will, and
15834/// // execute the final call using `doit()`.
15835/// // Values shown here are possibly random and not representative !
15836/// let result = hub.projects().locations_services_export_metadata(req, "service")
15837///              .doit().await;
15838/// # }
15839/// ```
15840pub struct ProjectLocationServiceExportMetadataCall<'a, C>
15841where
15842    C: 'a,
15843{
15844    hub: &'a DataprocMetastore<C>,
15845    _request: ExportMetadataRequest,
15846    _service: String,
15847    _delegate: Option<&'a mut dyn common::Delegate>,
15848    _additional_params: HashMap<String, String>,
15849    _scopes: BTreeSet<String>,
15850}
15851
15852impl<'a, C> common::CallBuilder for ProjectLocationServiceExportMetadataCall<'a, C> {}
15853
15854impl<'a, C> ProjectLocationServiceExportMetadataCall<'a, C>
15855where
15856    C: common::Connector,
15857{
15858    /// Perform the operation you have build so far.
15859    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15860        use std::borrow::Cow;
15861        use std::io::{Read, Seek};
15862
15863        use common::{url::Params, ToParts};
15864        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15865
15866        let mut dd = common::DefaultDelegate;
15867        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15868        dlg.begin(common::MethodInfo {
15869            id: "metastore.projects.locations.services.exportMetadata",
15870            http_method: hyper::Method::POST,
15871        });
15872
15873        for &field in ["alt", "service"].iter() {
15874            if self._additional_params.contains_key(field) {
15875                dlg.finished(false);
15876                return Err(common::Error::FieldClash(field));
15877            }
15878        }
15879
15880        let mut params = Params::with_capacity(4 + self._additional_params.len());
15881        params.push("service", self._service);
15882
15883        params.extend(self._additional_params.iter());
15884
15885        params.push("alt", "json");
15886        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:exportMetadata";
15887        if self._scopes.is_empty() {
15888            self._scopes
15889                .insert(Scope::CloudPlatform.as_ref().to_string());
15890        }
15891
15892        #[allow(clippy::single_element_loop)]
15893        for &(find_this, param_name) in [("{+service}", "service")].iter() {
15894            url = params.uri_replacement(url, param_name, find_this, true);
15895        }
15896        {
15897            let to_remove = ["service"];
15898            params.remove_params(&to_remove);
15899        }
15900
15901        let url = params.parse_with_url(&url);
15902
15903        let mut json_mime_type = mime::APPLICATION_JSON;
15904        let mut request_value_reader = {
15905            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15906            common::remove_json_null_values(&mut value);
15907            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15908            serde_json::to_writer(&mut dst, &value).unwrap();
15909            dst
15910        };
15911        let request_size = request_value_reader
15912            .seek(std::io::SeekFrom::End(0))
15913            .unwrap();
15914        request_value_reader
15915            .seek(std::io::SeekFrom::Start(0))
15916            .unwrap();
15917
15918        loop {
15919            let token = match self
15920                .hub
15921                .auth
15922                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15923                .await
15924            {
15925                Ok(token) => token,
15926                Err(e) => match dlg.token(e) {
15927                    Ok(token) => token,
15928                    Err(e) => {
15929                        dlg.finished(false);
15930                        return Err(common::Error::MissingToken(e));
15931                    }
15932                },
15933            };
15934            request_value_reader
15935                .seek(std::io::SeekFrom::Start(0))
15936                .unwrap();
15937            let mut req_result = {
15938                let client = &self.hub.client;
15939                dlg.pre_request();
15940                let mut req_builder = hyper::Request::builder()
15941                    .method(hyper::Method::POST)
15942                    .uri(url.as_str())
15943                    .header(USER_AGENT, self.hub._user_agent.clone());
15944
15945                if let Some(token) = token.as_ref() {
15946                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15947                }
15948
15949                let request = req_builder
15950                    .header(CONTENT_TYPE, json_mime_type.to_string())
15951                    .header(CONTENT_LENGTH, request_size as u64)
15952                    .body(common::to_body(
15953                        request_value_reader.get_ref().clone().into(),
15954                    ));
15955
15956                client.request(request.unwrap()).await
15957            };
15958
15959            match req_result {
15960                Err(err) => {
15961                    if let common::Retry::After(d) = dlg.http_error(&err) {
15962                        sleep(d).await;
15963                        continue;
15964                    }
15965                    dlg.finished(false);
15966                    return Err(common::Error::HttpError(err));
15967                }
15968                Ok(res) => {
15969                    let (mut parts, body) = res.into_parts();
15970                    let mut body = common::Body::new(body);
15971                    if !parts.status.is_success() {
15972                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15973                        let error = serde_json::from_str(&common::to_string(&bytes));
15974                        let response = common::to_response(parts, bytes.into());
15975
15976                        if let common::Retry::After(d) =
15977                            dlg.http_failure(&response, error.as_ref().ok())
15978                        {
15979                            sleep(d).await;
15980                            continue;
15981                        }
15982
15983                        dlg.finished(false);
15984
15985                        return Err(match error {
15986                            Ok(value) => common::Error::BadRequest(value),
15987                            _ => common::Error::Failure(response),
15988                        });
15989                    }
15990                    let response = {
15991                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15992                        let encoded = common::to_string(&bytes);
15993                        match serde_json::from_str(&encoded) {
15994                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15995                            Err(error) => {
15996                                dlg.response_json_decode_error(&encoded, &error);
15997                                return Err(common::Error::JsonDecodeError(
15998                                    encoded.to_string(),
15999                                    error,
16000                                ));
16001                            }
16002                        }
16003                    };
16004
16005                    dlg.finished(true);
16006                    return Ok(response);
16007                }
16008            }
16009        }
16010    }
16011
16012    ///
16013    /// Sets the *request* property to the given value.
16014    ///
16015    /// Even though the property as already been set when instantiating this call,
16016    /// we provide this method for API completeness.
16017    pub fn request(
16018        mut self,
16019        new_value: ExportMetadataRequest,
16020    ) -> ProjectLocationServiceExportMetadataCall<'a, C> {
16021        self._request = new_value;
16022        self
16023    }
16024    /// Required. The relative resource name of the metastore service to run export, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}.
16025    ///
16026    /// Sets the *service* path property to the given value.
16027    ///
16028    /// Even though the property as already been set when instantiating this call,
16029    /// we provide this method for API completeness.
16030    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceExportMetadataCall<'a, C> {
16031        self._service = new_value.to_string();
16032        self
16033    }
16034    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16035    /// while executing the actual API request.
16036    ///
16037    /// ````text
16038    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16039    /// ````
16040    ///
16041    /// Sets the *delegate* property to the given value.
16042    pub fn delegate(
16043        mut self,
16044        new_value: &'a mut dyn common::Delegate,
16045    ) -> ProjectLocationServiceExportMetadataCall<'a, C> {
16046        self._delegate = Some(new_value);
16047        self
16048    }
16049
16050    /// Set any additional parameter of the query string used in the request.
16051    /// It should be used to set parameters which are not yet available through their own
16052    /// setters.
16053    ///
16054    /// Please note that this method must not be used to set any of the known parameters
16055    /// which have their own setter method. If done anyway, the request will fail.
16056    ///
16057    /// # Additional Parameters
16058    ///
16059    /// * *$.xgafv* (query-string) - V1 error format.
16060    /// * *access_token* (query-string) - OAuth access token.
16061    /// * *alt* (query-string) - Data format for response.
16062    /// * *callback* (query-string) - JSONP
16063    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16064    /// * *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.
16065    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16066    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16067    /// * *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.
16068    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16069    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16070    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceExportMetadataCall<'a, C>
16071    where
16072        T: AsRef<str>,
16073    {
16074        self._additional_params
16075            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16076        self
16077    }
16078
16079    /// Identifies the authorization scope for the method you are building.
16080    ///
16081    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16082    /// [`Scope::CloudPlatform`].
16083    ///
16084    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16085    /// tokens for more than one scope.
16086    ///
16087    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16088    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16089    /// sufficient, a read-write scope will do as well.
16090    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceExportMetadataCall<'a, C>
16091    where
16092        St: AsRef<str>,
16093    {
16094        self._scopes.insert(String::from(scope.as_ref()));
16095        self
16096    }
16097    /// Identifies the authorization scope(s) for the method you are building.
16098    ///
16099    /// See [`Self::add_scope()`] for details.
16100    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceExportMetadataCall<'a, C>
16101    where
16102        I: IntoIterator<Item = St>,
16103        St: AsRef<str>,
16104    {
16105        self._scopes
16106            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16107        self
16108    }
16109
16110    /// Removes all scopes, and no default scope will be used either.
16111    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16112    /// for details).
16113    pub fn clear_scopes(mut self) -> ProjectLocationServiceExportMetadataCall<'a, C> {
16114        self._scopes.clear();
16115        self
16116    }
16117}
16118
16119/// Gets the details of a single service.
16120///
16121/// A builder for the *locations.services.get* method supported by a *project* resource.
16122/// It is not used directly, but through a [`ProjectMethods`] instance.
16123///
16124/// # Example
16125///
16126/// Instantiate a resource method builder
16127///
16128/// ```test_harness,no_run
16129/// # extern crate hyper;
16130/// # extern crate hyper_rustls;
16131/// # extern crate google_metastore1_beta as metastore1_beta;
16132/// # async fn dox() {
16133/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16134///
16135/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16136/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16137/// #     .with_native_roots()
16138/// #     .unwrap()
16139/// #     .https_only()
16140/// #     .enable_http2()
16141/// #     .build();
16142///
16143/// # let executor = hyper_util::rt::TokioExecutor::new();
16144/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16145/// #     secret,
16146/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16147/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16148/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16149/// #     ),
16150/// # ).build().await.unwrap();
16151///
16152/// # let client = hyper_util::client::legacy::Client::builder(
16153/// #     hyper_util::rt::TokioExecutor::new()
16154/// # )
16155/// # .build(
16156/// #     hyper_rustls::HttpsConnectorBuilder::new()
16157/// #         .with_native_roots()
16158/// #         .unwrap()
16159/// #         .https_or_http()
16160/// #         .enable_http2()
16161/// #         .build()
16162/// # );
16163/// # let mut hub = DataprocMetastore::new(client, auth);
16164/// // You can configure optional parameters by calling the respective setters at will, and
16165/// // execute the final call using `doit()`.
16166/// // Values shown here are possibly random and not representative !
16167/// let result = hub.projects().locations_services_get("name")
16168///              .doit().await;
16169/// # }
16170/// ```
16171pub struct ProjectLocationServiceGetCall<'a, C>
16172where
16173    C: 'a,
16174{
16175    hub: &'a DataprocMetastore<C>,
16176    _name: String,
16177    _delegate: Option<&'a mut dyn common::Delegate>,
16178    _additional_params: HashMap<String, String>,
16179    _scopes: BTreeSet<String>,
16180}
16181
16182impl<'a, C> common::CallBuilder for ProjectLocationServiceGetCall<'a, C> {}
16183
16184impl<'a, C> ProjectLocationServiceGetCall<'a, C>
16185where
16186    C: common::Connector,
16187{
16188    /// Perform the operation you have build so far.
16189    pub async fn doit(mut self) -> common::Result<(common::Response, Service)> {
16190        use std::borrow::Cow;
16191        use std::io::{Read, Seek};
16192
16193        use common::{url::Params, ToParts};
16194        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16195
16196        let mut dd = common::DefaultDelegate;
16197        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16198        dlg.begin(common::MethodInfo {
16199            id: "metastore.projects.locations.services.get",
16200            http_method: hyper::Method::GET,
16201        });
16202
16203        for &field in ["alt", "name"].iter() {
16204            if self._additional_params.contains_key(field) {
16205                dlg.finished(false);
16206                return Err(common::Error::FieldClash(field));
16207            }
16208        }
16209
16210        let mut params = Params::with_capacity(3 + self._additional_params.len());
16211        params.push("name", self._name);
16212
16213        params.extend(self._additional_params.iter());
16214
16215        params.push("alt", "json");
16216        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
16217        if self._scopes.is_empty() {
16218            self._scopes
16219                .insert(Scope::CloudPlatform.as_ref().to_string());
16220        }
16221
16222        #[allow(clippy::single_element_loop)]
16223        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16224            url = params.uri_replacement(url, param_name, find_this, true);
16225        }
16226        {
16227            let to_remove = ["name"];
16228            params.remove_params(&to_remove);
16229        }
16230
16231        let url = params.parse_with_url(&url);
16232
16233        loop {
16234            let token = match self
16235                .hub
16236                .auth
16237                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16238                .await
16239            {
16240                Ok(token) => token,
16241                Err(e) => match dlg.token(e) {
16242                    Ok(token) => token,
16243                    Err(e) => {
16244                        dlg.finished(false);
16245                        return Err(common::Error::MissingToken(e));
16246                    }
16247                },
16248            };
16249            let mut req_result = {
16250                let client = &self.hub.client;
16251                dlg.pre_request();
16252                let mut req_builder = hyper::Request::builder()
16253                    .method(hyper::Method::GET)
16254                    .uri(url.as_str())
16255                    .header(USER_AGENT, self.hub._user_agent.clone());
16256
16257                if let Some(token) = token.as_ref() {
16258                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16259                }
16260
16261                let request = req_builder
16262                    .header(CONTENT_LENGTH, 0_u64)
16263                    .body(common::to_body::<String>(None));
16264
16265                client.request(request.unwrap()).await
16266            };
16267
16268            match req_result {
16269                Err(err) => {
16270                    if let common::Retry::After(d) = dlg.http_error(&err) {
16271                        sleep(d).await;
16272                        continue;
16273                    }
16274                    dlg.finished(false);
16275                    return Err(common::Error::HttpError(err));
16276                }
16277                Ok(res) => {
16278                    let (mut parts, body) = res.into_parts();
16279                    let mut body = common::Body::new(body);
16280                    if !parts.status.is_success() {
16281                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16282                        let error = serde_json::from_str(&common::to_string(&bytes));
16283                        let response = common::to_response(parts, bytes.into());
16284
16285                        if let common::Retry::After(d) =
16286                            dlg.http_failure(&response, error.as_ref().ok())
16287                        {
16288                            sleep(d).await;
16289                            continue;
16290                        }
16291
16292                        dlg.finished(false);
16293
16294                        return Err(match error {
16295                            Ok(value) => common::Error::BadRequest(value),
16296                            _ => common::Error::Failure(response),
16297                        });
16298                    }
16299                    let response = {
16300                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16301                        let encoded = common::to_string(&bytes);
16302                        match serde_json::from_str(&encoded) {
16303                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16304                            Err(error) => {
16305                                dlg.response_json_decode_error(&encoded, &error);
16306                                return Err(common::Error::JsonDecodeError(
16307                                    encoded.to_string(),
16308                                    error,
16309                                ));
16310                            }
16311                        }
16312                    };
16313
16314                    dlg.finished(true);
16315                    return Ok(response);
16316                }
16317            }
16318        }
16319    }
16320
16321    /// Required. The relative resource name of the metastore service to retrieve, in the following form:projects/{project_number}/locations/{location_id}/services/{service_id}.
16322    ///
16323    /// Sets the *name* path property to the given value.
16324    ///
16325    /// Even though the property as already been set when instantiating this call,
16326    /// we provide this method for API completeness.
16327    pub fn name(mut self, new_value: &str) -> ProjectLocationServiceGetCall<'a, C> {
16328        self._name = new_value.to_string();
16329        self
16330    }
16331    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16332    /// while executing the actual API request.
16333    ///
16334    /// ````text
16335    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16336    /// ````
16337    ///
16338    /// Sets the *delegate* property to the given value.
16339    pub fn delegate(
16340        mut self,
16341        new_value: &'a mut dyn common::Delegate,
16342    ) -> ProjectLocationServiceGetCall<'a, C> {
16343        self._delegate = Some(new_value);
16344        self
16345    }
16346
16347    /// Set any additional parameter of the query string used in the request.
16348    /// It should be used to set parameters which are not yet available through their own
16349    /// setters.
16350    ///
16351    /// Please note that this method must not be used to set any of the known parameters
16352    /// which have their own setter method. If done anyway, the request will fail.
16353    ///
16354    /// # Additional Parameters
16355    ///
16356    /// * *$.xgafv* (query-string) - V1 error format.
16357    /// * *access_token* (query-string) - OAuth access token.
16358    /// * *alt* (query-string) - Data format for response.
16359    /// * *callback* (query-string) - JSONP
16360    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16361    /// * *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.
16362    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16363    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16364    /// * *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.
16365    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16366    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16367    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetCall<'a, C>
16368    where
16369        T: AsRef<str>,
16370    {
16371        self._additional_params
16372            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16373        self
16374    }
16375
16376    /// Identifies the authorization scope for the method you are building.
16377    ///
16378    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16379    /// [`Scope::CloudPlatform`].
16380    ///
16381    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16382    /// tokens for more than one scope.
16383    ///
16384    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16385    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16386    /// sufficient, a read-write scope will do as well.
16387    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetCall<'a, C>
16388    where
16389        St: AsRef<str>,
16390    {
16391        self._scopes.insert(String::from(scope.as_ref()));
16392        self
16393    }
16394    /// Identifies the authorization scope(s) for the method you are building.
16395    ///
16396    /// See [`Self::add_scope()`] for details.
16397    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetCall<'a, C>
16398    where
16399        I: IntoIterator<Item = St>,
16400        St: AsRef<str>,
16401    {
16402        self._scopes
16403            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16404        self
16405    }
16406
16407    /// Removes all scopes, and no default scope will be used either.
16408    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16409    /// for details).
16410    pub fn clear_scopes(mut self) -> ProjectLocationServiceGetCall<'a, C> {
16411        self._scopes.clear();
16412        self
16413    }
16414}
16415
16416/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
16417///
16418/// A builder for the *locations.services.getIamPolicy* method supported by a *project* resource.
16419/// It is not used directly, but through a [`ProjectMethods`] instance.
16420///
16421/// # Example
16422///
16423/// Instantiate a resource method builder
16424///
16425/// ```test_harness,no_run
16426/// # extern crate hyper;
16427/// # extern crate hyper_rustls;
16428/// # extern crate google_metastore1_beta as metastore1_beta;
16429/// # async fn dox() {
16430/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16431///
16432/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16433/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16434/// #     .with_native_roots()
16435/// #     .unwrap()
16436/// #     .https_only()
16437/// #     .enable_http2()
16438/// #     .build();
16439///
16440/// # let executor = hyper_util::rt::TokioExecutor::new();
16441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16442/// #     secret,
16443/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16444/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16445/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16446/// #     ),
16447/// # ).build().await.unwrap();
16448///
16449/// # let client = hyper_util::client::legacy::Client::builder(
16450/// #     hyper_util::rt::TokioExecutor::new()
16451/// # )
16452/// # .build(
16453/// #     hyper_rustls::HttpsConnectorBuilder::new()
16454/// #         .with_native_roots()
16455/// #         .unwrap()
16456/// #         .https_or_http()
16457/// #         .enable_http2()
16458/// #         .build()
16459/// # );
16460/// # let mut hub = DataprocMetastore::new(client, auth);
16461/// // You can configure optional parameters by calling the respective setters at will, and
16462/// // execute the final call using `doit()`.
16463/// // Values shown here are possibly random and not representative !
16464/// let result = hub.projects().locations_services_get_iam_policy("resource")
16465///              .options_requested_policy_version(-23)
16466///              .doit().await;
16467/// # }
16468/// ```
16469pub struct ProjectLocationServiceGetIamPolicyCall<'a, C>
16470where
16471    C: 'a,
16472{
16473    hub: &'a DataprocMetastore<C>,
16474    _resource: String,
16475    _options_requested_policy_version: Option<i32>,
16476    _delegate: Option<&'a mut dyn common::Delegate>,
16477    _additional_params: HashMap<String, String>,
16478    _scopes: BTreeSet<String>,
16479}
16480
16481impl<'a, C> common::CallBuilder for ProjectLocationServiceGetIamPolicyCall<'a, C> {}
16482
16483impl<'a, C> ProjectLocationServiceGetIamPolicyCall<'a, C>
16484where
16485    C: common::Connector,
16486{
16487    /// Perform the operation you have build so far.
16488    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16489        use std::borrow::Cow;
16490        use std::io::{Read, Seek};
16491
16492        use common::{url::Params, ToParts};
16493        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16494
16495        let mut dd = common::DefaultDelegate;
16496        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16497        dlg.begin(common::MethodInfo {
16498            id: "metastore.projects.locations.services.getIamPolicy",
16499            http_method: hyper::Method::GET,
16500        });
16501
16502        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16503            if self._additional_params.contains_key(field) {
16504                dlg.finished(false);
16505                return Err(common::Error::FieldClash(field));
16506            }
16507        }
16508
16509        let mut params = Params::with_capacity(4 + self._additional_params.len());
16510        params.push("resource", self._resource);
16511        if let Some(value) = self._options_requested_policy_version.as_ref() {
16512            params.push("options.requestedPolicyVersion", value.to_string());
16513        }
16514
16515        params.extend(self._additional_params.iter());
16516
16517        params.push("alt", "json");
16518        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:getIamPolicy";
16519        if self._scopes.is_empty() {
16520            self._scopes
16521                .insert(Scope::CloudPlatform.as_ref().to_string());
16522        }
16523
16524        #[allow(clippy::single_element_loop)]
16525        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16526            url = params.uri_replacement(url, param_name, find_this, true);
16527        }
16528        {
16529            let to_remove = ["resource"];
16530            params.remove_params(&to_remove);
16531        }
16532
16533        let url = params.parse_with_url(&url);
16534
16535        loop {
16536            let token = match self
16537                .hub
16538                .auth
16539                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16540                .await
16541            {
16542                Ok(token) => token,
16543                Err(e) => match dlg.token(e) {
16544                    Ok(token) => token,
16545                    Err(e) => {
16546                        dlg.finished(false);
16547                        return Err(common::Error::MissingToken(e));
16548                    }
16549                },
16550            };
16551            let mut req_result = {
16552                let client = &self.hub.client;
16553                dlg.pre_request();
16554                let mut req_builder = hyper::Request::builder()
16555                    .method(hyper::Method::GET)
16556                    .uri(url.as_str())
16557                    .header(USER_AGENT, self.hub._user_agent.clone());
16558
16559                if let Some(token) = token.as_ref() {
16560                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16561                }
16562
16563                let request = req_builder
16564                    .header(CONTENT_LENGTH, 0_u64)
16565                    .body(common::to_body::<String>(None));
16566
16567                client.request(request.unwrap()).await
16568            };
16569
16570            match req_result {
16571                Err(err) => {
16572                    if let common::Retry::After(d) = dlg.http_error(&err) {
16573                        sleep(d).await;
16574                        continue;
16575                    }
16576                    dlg.finished(false);
16577                    return Err(common::Error::HttpError(err));
16578                }
16579                Ok(res) => {
16580                    let (mut parts, body) = res.into_parts();
16581                    let mut body = common::Body::new(body);
16582                    if !parts.status.is_success() {
16583                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16584                        let error = serde_json::from_str(&common::to_string(&bytes));
16585                        let response = common::to_response(parts, bytes.into());
16586
16587                        if let common::Retry::After(d) =
16588                            dlg.http_failure(&response, error.as_ref().ok())
16589                        {
16590                            sleep(d).await;
16591                            continue;
16592                        }
16593
16594                        dlg.finished(false);
16595
16596                        return Err(match error {
16597                            Ok(value) => common::Error::BadRequest(value),
16598                            _ => common::Error::Failure(response),
16599                        });
16600                    }
16601                    let response = {
16602                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16603                        let encoded = common::to_string(&bytes);
16604                        match serde_json::from_str(&encoded) {
16605                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16606                            Err(error) => {
16607                                dlg.response_json_decode_error(&encoded, &error);
16608                                return Err(common::Error::JsonDecodeError(
16609                                    encoded.to_string(),
16610                                    error,
16611                                ));
16612                            }
16613                        }
16614                    };
16615
16616                    dlg.finished(true);
16617                    return Ok(response);
16618                }
16619            }
16620        }
16621    }
16622
16623    /// 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.
16624    ///
16625    /// Sets the *resource* path property to the given value.
16626    ///
16627    /// Even though the property as already been set when instantiating this call,
16628    /// we provide this method for API completeness.
16629    pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
16630        self._resource = new_value.to_string();
16631        self
16632    }
16633    /// 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).
16634    ///
16635    /// Sets the *options.requested policy version* query property to the given value.
16636    pub fn options_requested_policy_version(
16637        mut self,
16638        new_value: i32,
16639    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
16640        self._options_requested_policy_version = Some(new_value);
16641        self
16642    }
16643    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16644    /// while executing the actual API request.
16645    ///
16646    /// ````text
16647    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16648    /// ````
16649    ///
16650    /// Sets the *delegate* property to the given value.
16651    pub fn delegate(
16652        mut self,
16653        new_value: &'a mut dyn common::Delegate,
16654    ) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
16655        self._delegate = Some(new_value);
16656        self
16657    }
16658
16659    /// Set any additional parameter of the query string used in the request.
16660    /// It should be used to set parameters which are not yet available through their own
16661    /// setters.
16662    ///
16663    /// Please note that this method must not be used to set any of the known parameters
16664    /// which have their own setter method. If done anyway, the request will fail.
16665    ///
16666    /// # Additional Parameters
16667    ///
16668    /// * *$.xgafv* (query-string) - V1 error format.
16669    /// * *access_token* (query-string) - OAuth access token.
16670    /// * *alt* (query-string) - Data format for response.
16671    /// * *callback* (query-string) - JSONP
16672    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16673    /// * *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.
16674    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16675    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16676    /// * *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.
16677    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16678    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16679    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
16680    where
16681        T: AsRef<str>,
16682    {
16683        self._additional_params
16684            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16685        self
16686    }
16687
16688    /// Identifies the authorization scope for the method you are building.
16689    ///
16690    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16691    /// [`Scope::CloudPlatform`].
16692    ///
16693    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16694    /// tokens for more than one scope.
16695    ///
16696    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16697    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16698    /// sufficient, a read-write scope will do as well.
16699    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
16700    where
16701        St: AsRef<str>,
16702    {
16703        self._scopes.insert(String::from(scope.as_ref()));
16704        self
16705    }
16706    /// Identifies the authorization scope(s) for the method you are building.
16707    ///
16708    /// See [`Self::add_scope()`] for details.
16709    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceGetIamPolicyCall<'a, C>
16710    where
16711        I: IntoIterator<Item = St>,
16712        St: AsRef<str>,
16713    {
16714        self._scopes
16715            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16716        self
16717    }
16718
16719    /// Removes all scopes, and no default scope will be used either.
16720    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16721    /// for details).
16722    pub fn clear_scopes(mut self) -> ProjectLocationServiceGetIamPolicyCall<'a, C> {
16723        self._scopes.clear();
16724        self
16725    }
16726}
16727
16728/// Lists services in a project and location.
16729///
16730/// A builder for the *locations.services.list* method supported by a *project* resource.
16731/// It is not used directly, but through a [`ProjectMethods`] instance.
16732///
16733/// # Example
16734///
16735/// Instantiate a resource method builder
16736///
16737/// ```test_harness,no_run
16738/// # extern crate hyper;
16739/// # extern crate hyper_rustls;
16740/// # extern crate google_metastore1_beta as metastore1_beta;
16741/// # async fn dox() {
16742/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16743///
16744/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16745/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16746/// #     .with_native_roots()
16747/// #     .unwrap()
16748/// #     .https_only()
16749/// #     .enable_http2()
16750/// #     .build();
16751///
16752/// # let executor = hyper_util::rt::TokioExecutor::new();
16753/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16754/// #     secret,
16755/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16756/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16757/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16758/// #     ),
16759/// # ).build().await.unwrap();
16760///
16761/// # let client = hyper_util::client::legacy::Client::builder(
16762/// #     hyper_util::rt::TokioExecutor::new()
16763/// # )
16764/// # .build(
16765/// #     hyper_rustls::HttpsConnectorBuilder::new()
16766/// #         .with_native_roots()
16767/// #         .unwrap()
16768/// #         .https_or_http()
16769/// #         .enable_http2()
16770/// #         .build()
16771/// # );
16772/// # let mut hub = DataprocMetastore::new(client, auth);
16773/// // You can configure optional parameters by calling the respective setters at will, and
16774/// // execute the final call using `doit()`.
16775/// // Values shown here are possibly random and not representative !
16776/// let result = hub.projects().locations_services_list("parent")
16777///              .page_token("dolore")
16778///              .page_size(-34)
16779///              .order_by("dolore")
16780///              .filter("voluptua.")
16781///              .doit().await;
16782/// # }
16783/// ```
16784pub struct ProjectLocationServiceListCall<'a, C>
16785where
16786    C: 'a,
16787{
16788    hub: &'a DataprocMetastore<C>,
16789    _parent: String,
16790    _page_token: Option<String>,
16791    _page_size: Option<i32>,
16792    _order_by: Option<String>,
16793    _filter: Option<String>,
16794    _delegate: Option<&'a mut dyn common::Delegate>,
16795    _additional_params: HashMap<String, String>,
16796    _scopes: BTreeSet<String>,
16797}
16798
16799impl<'a, C> common::CallBuilder for ProjectLocationServiceListCall<'a, C> {}
16800
16801impl<'a, C> ProjectLocationServiceListCall<'a, C>
16802where
16803    C: common::Connector,
16804{
16805    /// Perform the operation you have build so far.
16806    pub async fn doit(mut self) -> common::Result<(common::Response, ListServicesResponse)> {
16807        use std::borrow::Cow;
16808        use std::io::{Read, Seek};
16809
16810        use common::{url::Params, ToParts};
16811        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16812
16813        let mut dd = common::DefaultDelegate;
16814        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16815        dlg.begin(common::MethodInfo {
16816            id: "metastore.projects.locations.services.list",
16817            http_method: hyper::Method::GET,
16818        });
16819
16820        for &field in [
16821            "alt",
16822            "parent",
16823            "pageToken",
16824            "pageSize",
16825            "orderBy",
16826            "filter",
16827        ]
16828        .iter()
16829        {
16830            if self._additional_params.contains_key(field) {
16831                dlg.finished(false);
16832                return Err(common::Error::FieldClash(field));
16833            }
16834        }
16835
16836        let mut params = Params::with_capacity(7 + self._additional_params.len());
16837        params.push("parent", self._parent);
16838        if let Some(value) = self._page_token.as_ref() {
16839            params.push("pageToken", value);
16840        }
16841        if let Some(value) = self._page_size.as_ref() {
16842            params.push("pageSize", value.to_string());
16843        }
16844        if let Some(value) = self._order_by.as_ref() {
16845            params.push("orderBy", value);
16846        }
16847        if let Some(value) = self._filter.as_ref() {
16848            params.push("filter", value);
16849        }
16850
16851        params.extend(self._additional_params.iter());
16852
16853        params.push("alt", "json");
16854        let mut url = self.hub._base_url.clone() + "v1beta/{+parent}/services";
16855        if self._scopes.is_empty() {
16856            self._scopes
16857                .insert(Scope::CloudPlatform.as_ref().to_string());
16858        }
16859
16860        #[allow(clippy::single_element_loop)]
16861        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16862            url = params.uri_replacement(url, param_name, find_this, true);
16863        }
16864        {
16865            let to_remove = ["parent"];
16866            params.remove_params(&to_remove);
16867        }
16868
16869        let url = params.parse_with_url(&url);
16870
16871        loop {
16872            let token = match self
16873                .hub
16874                .auth
16875                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16876                .await
16877            {
16878                Ok(token) => token,
16879                Err(e) => match dlg.token(e) {
16880                    Ok(token) => token,
16881                    Err(e) => {
16882                        dlg.finished(false);
16883                        return Err(common::Error::MissingToken(e));
16884                    }
16885                },
16886            };
16887            let mut req_result = {
16888                let client = &self.hub.client;
16889                dlg.pre_request();
16890                let mut req_builder = hyper::Request::builder()
16891                    .method(hyper::Method::GET)
16892                    .uri(url.as_str())
16893                    .header(USER_AGENT, self.hub._user_agent.clone());
16894
16895                if let Some(token) = token.as_ref() {
16896                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16897                }
16898
16899                let request = req_builder
16900                    .header(CONTENT_LENGTH, 0_u64)
16901                    .body(common::to_body::<String>(None));
16902
16903                client.request(request.unwrap()).await
16904            };
16905
16906            match req_result {
16907                Err(err) => {
16908                    if let common::Retry::After(d) = dlg.http_error(&err) {
16909                        sleep(d).await;
16910                        continue;
16911                    }
16912                    dlg.finished(false);
16913                    return Err(common::Error::HttpError(err));
16914                }
16915                Ok(res) => {
16916                    let (mut parts, body) = res.into_parts();
16917                    let mut body = common::Body::new(body);
16918                    if !parts.status.is_success() {
16919                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16920                        let error = serde_json::from_str(&common::to_string(&bytes));
16921                        let response = common::to_response(parts, bytes.into());
16922
16923                        if let common::Retry::After(d) =
16924                            dlg.http_failure(&response, error.as_ref().ok())
16925                        {
16926                            sleep(d).await;
16927                            continue;
16928                        }
16929
16930                        dlg.finished(false);
16931
16932                        return Err(match error {
16933                            Ok(value) => common::Error::BadRequest(value),
16934                            _ => common::Error::Failure(response),
16935                        });
16936                    }
16937                    let response = {
16938                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16939                        let encoded = common::to_string(&bytes);
16940                        match serde_json::from_str(&encoded) {
16941                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16942                            Err(error) => {
16943                                dlg.response_json_decode_error(&encoded, &error);
16944                                return Err(common::Error::JsonDecodeError(
16945                                    encoded.to_string(),
16946                                    error,
16947                                ));
16948                            }
16949                        }
16950                    };
16951
16952                    dlg.finished(true);
16953                    return Ok(response);
16954                }
16955            }
16956        }
16957    }
16958
16959    /// Required. The relative resource name of the location of metastore services to list, in the following form:projects/{project_number}/locations/{location_id}.
16960    ///
16961    /// Sets the *parent* path property to the given value.
16962    ///
16963    /// Even though the property as already been set when instantiating this call,
16964    /// we provide this method for API completeness.
16965    pub fn parent(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
16966        self._parent = new_value.to_string();
16967        self
16968    }
16969    /// Optional. A page token, received from a previous DataprocMetastore.ListServices call. Provide this token to retrieve the subsequent page.To retrieve the first page, supply an empty page token.When paginating, other parameters provided to DataprocMetastore.ListServices must match the call that provided the page token.
16970    ///
16971    /// Sets the *page token* query property to the given value.
16972    pub fn page_token(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
16973        self._page_token = Some(new_value.to_string());
16974        self
16975    }
16976    /// Optional. The maximum number of services to return. The response may contain less than the maximum number. If unspecified, no more than 500 services are returned. The maximum value is 1000; values above 1000 are changed to 1000.
16977    ///
16978    /// Sets the *page size* query property to the given value.
16979    pub fn page_size(mut self, new_value: i32) -> ProjectLocationServiceListCall<'a, C> {
16980        self._page_size = Some(new_value);
16981        self
16982    }
16983    /// Optional. Specify the ordering of results as described in Sorting Order (https://cloud.google.com/apis/design/design_patterns#sorting_order). If not specified, the results will be sorted in the default order.
16984    ///
16985    /// Sets the *order by* query property to the given value.
16986    pub fn order_by(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
16987        self._order_by = Some(new_value.to_string());
16988        self
16989    }
16990    /// Optional. The filter to apply to list results.
16991    ///
16992    /// Sets the *filter* query property to the given value.
16993    pub fn filter(mut self, new_value: &str) -> ProjectLocationServiceListCall<'a, C> {
16994        self._filter = Some(new_value.to_string());
16995        self
16996    }
16997    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16998    /// while executing the actual API request.
16999    ///
17000    /// ````text
17001    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17002    /// ````
17003    ///
17004    /// Sets the *delegate* property to the given value.
17005    pub fn delegate(
17006        mut self,
17007        new_value: &'a mut dyn common::Delegate,
17008    ) -> ProjectLocationServiceListCall<'a, C> {
17009        self._delegate = Some(new_value);
17010        self
17011    }
17012
17013    /// Set any additional parameter of the query string used in the request.
17014    /// It should be used to set parameters which are not yet available through their own
17015    /// setters.
17016    ///
17017    /// Please note that this method must not be used to set any of the known parameters
17018    /// which have their own setter method. If done anyway, the request will fail.
17019    ///
17020    /// # Additional Parameters
17021    ///
17022    /// * *$.xgafv* (query-string) - V1 error format.
17023    /// * *access_token* (query-string) - OAuth access token.
17024    /// * *alt* (query-string) - Data format for response.
17025    /// * *callback* (query-string) - JSONP
17026    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17027    /// * *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.
17028    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17029    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17030    /// * *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.
17031    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17032    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17033    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceListCall<'a, C>
17034    where
17035        T: AsRef<str>,
17036    {
17037        self._additional_params
17038            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17039        self
17040    }
17041
17042    /// Identifies the authorization scope for the method you are building.
17043    ///
17044    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17045    /// [`Scope::CloudPlatform`].
17046    ///
17047    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17048    /// tokens for more than one scope.
17049    ///
17050    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17051    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17052    /// sufficient, a read-write scope will do as well.
17053    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceListCall<'a, C>
17054    where
17055        St: AsRef<str>,
17056    {
17057        self._scopes.insert(String::from(scope.as_ref()));
17058        self
17059    }
17060    /// Identifies the authorization scope(s) for the method you are building.
17061    ///
17062    /// See [`Self::add_scope()`] for details.
17063    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceListCall<'a, C>
17064    where
17065        I: IntoIterator<Item = St>,
17066        St: AsRef<str>,
17067    {
17068        self._scopes
17069            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17070        self
17071    }
17072
17073    /// Removes all scopes, and no default scope will be used either.
17074    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17075    /// for details).
17076    pub fn clear_scopes(mut self) -> ProjectLocationServiceListCall<'a, C> {
17077        self._scopes.clear();
17078        self
17079    }
17080}
17081
17082/// Move a table to another database.
17083///
17084/// A builder for the *locations.services.moveTableToDatabase* method supported by a *project* resource.
17085/// It is not used directly, but through a [`ProjectMethods`] instance.
17086///
17087/// # Example
17088///
17089/// Instantiate a resource method builder
17090///
17091/// ```test_harness,no_run
17092/// # extern crate hyper;
17093/// # extern crate hyper_rustls;
17094/// # extern crate google_metastore1_beta as metastore1_beta;
17095/// use metastore1_beta::api::MoveTableToDatabaseRequest;
17096/// # async fn dox() {
17097/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17098///
17099/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17100/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17101/// #     .with_native_roots()
17102/// #     .unwrap()
17103/// #     .https_only()
17104/// #     .enable_http2()
17105/// #     .build();
17106///
17107/// # let executor = hyper_util::rt::TokioExecutor::new();
17108/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17109/// #     secret,
17110/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17111/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17112/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17113/// #     ),
17114/// # ).build().await.unwrap();
17115///
17116/// # let client = hyper_util::client::legacy::Client::builder(
17117/// #     hyper_util::rt::TokioExecutor::new()
17118/// # )
17119/// # .build(
17120/// #     hyper_rustls::HttpsConnectorBuilder::new()
17121/// #         .with_native_roots()
17122/// #         .unwrap()
17123/// #         .https_or_http()
17124/// #         .enable_http2()
17125/// #         .build()
17126/// # );
17127/// # let mut hub = DataprocMetastore::new(client, auth);
17128/// // As the method needs a request, you would usually fill it with the desired information
17129/// // into the respective structure. Some of the parts shown here might not be applicable !
17130/// // Values shown here are possibly random and not representative !
17131/// let mut req = MoveTableToDatabaseRequest::default();
17132///
17133/// // You can configure optional parameters by calling the respective setters at will, and
17134/// // execute the final call using `doit()`.
17135/// // Values shown here are possibly random and not representative !
17136/// let result = hub.projects().locations_services_move_table_to_database(req, "service")
17137///              .doit().await;
17138/// # }
17139/// ```
17140pub struct ProjectLocationServiceMoveTableToDatabaseCall<'a, C>
17141where
17142    C: 'a,
17143{
17144    hub: &'a DataprocMetastore<C>,
17145    _request: MoveTableToDatabaseRequest,
17146    _service: String,
17147    _delegate: Option<&'a mut dyn common::Delegate>,
17148    _additional_params: HashMap<String, String>,
17149    _scopes: BTreeSet<String>,
17150}
17151
17152impl<'a, C> common::CallBuilder for ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {}
17153
17154impl<'a, C> ProjectLocationServiceMoveTableToDatabaseCall<'a, C>
17155where
17156    C: common::Connector,
17157{
17158    /// Perform the operation you have build so far.
17159    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17160        use std::borrow::Cow;
17161        use std::io::{Read, Seek};
17162
17163        use common::{url::Params, ToParts};
17164        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17165
17166        let mut dd = common::DefaultDelegate;
17167        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17168        dlg.begin(common::MethodInfo {
17169            id: "metastore.projects.locations.services.moveTableToDatabase",
17170            http_method: hyper::Method::POST,
17171        });
17172
17173        for &field in ["alt", "service"].iter() {
17174            if self._additional_params.contains_key(field) {
17175                dlg.finished(false);
17176                return Err(common::Error::FieldClash(field));
17177            }
17178        }
17179
17180        let mut params = Params::with_capacity(4 + self._additional_params.len());
17181        params.push("service", self._service);
17182
17183        params.extend(self._additional_params.iter());
17184
17185        params.push("alt", "json");
17186        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:moveTableToDatabase";
17187        if self._scopes.is_empty() {
17188            self._scopes
17189                .insert(Scope::CloudPlatform.as_ref().to_string());
17190        }
17191
17192        #[allow(clippy::single_element_loop)]
17193        for &(find_this, param_name) in [("{+service}", "service")].iter() {
17194            url = params.uri_replacement(url, param_name, find_this, true);
17195        }
17196        {
17197            let to_remove = ["service"];
17198            params.remove_params(&to_remove);
17199        }
17200
17201        let url = params.parse_with_url(&url);
17202
17203        let mut json_mime_type = mime::APPLICATION_JSON;
17204        let mut request_value_reader = {
17205            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17206            common::remove_json_null_values(&mut value);
17207            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17208            serde_json::to_writer(&mut dst, &value).unwrap();
17209            dst
17210        };
17211        let request_size = request_value_reader
17212            .seek(std::io::SeekFrom::End(0))
17213            .unwrap();
17214        request_value_reader
17215            .seek(std::io::SeekFrom::Start(0))
17216            .unwrap();
17217
17218        loop {
17219            let token = match self
17220                .hub
17221                .auth
17222                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17223                .await
17224            {
17225                Ok(token) => token,
17226                Err(e) => match dlg.token(e) {
17227                    Ok(token) => token,
17228                    Err(e) => {
17229                        dlg.finished(false);
17230                        return Err(common::Error::MissingToken(e));
17231                    }
17232                },
17233            };
17234            request_value_reader
17235                .seek(std::io::SeekFrom::Start(0))
17236                .unwrap();
17237            let mut req_result = {
17238                let client = &self.hub.client;
17239                dlg.pre_request();
17240                let mut req_builder = hyper::Request::builder()
17241                    .method(hyper::Method::POST)
17242                    .uri(url.as_str())
17243                    .header(USER_AGENT, self.hub._user_agent.clone());
17244
17245                if let Some(token) = token.as_ref() {
17246                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17247                }
17248
17249                let request = req_builder
17250                    .header(CONTENT_TYPE, json_mime_type.to_string())
17251                    .header(CONTENT_LENGTH, request_size as u64)
17252                    .body(common::to_body(
17253                        request_value_reader.get_ref().clone().into(),
17254                    ));
17255
17256                client.request(request.unwrap()).await
17257            };
17258
17259            match req_result {
17260                Err(err) => {
17261                    if let common::Retry::After(d) = dlg.http_error(&err) {
17262                        sleep(d).await;
17263                        continue;
17264                    }
17265                    dlg.finished(false);
17266                    return Err(common::Error::HttpError(err));
17267                }
17268                Ok(res) => {
17269                    let (mut parts, body) = res.into_parts();
17270                    let mut body = common::Body::new(body);
17271                    if !parts.status.is_success() {
17272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17273                        let error = serde_json::from_str(&common::to_string(&bytes));
17274                        let response = common::to_response(parts, bytes.into());
17275
17276                        if let common::Retry::After(d) =
17277                            dlg.http_failure(&response, error.as_ref().ok())
17278                        {
17279                            sleep(d).await;
17280                            continue;
17281                        }
17282
17283                        dlg.finished(false);
17284
17285                        return Err(match error {
17286                            Ok(value) => common::Error::BadRequest(value),
17287                            _ => common::Error::Failure(response),
17288                        });
17289                    }
17290                    let response = {
17291                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17292                        let encoded = common::to_string(&bytes);
17293                        match serde_json::from_str(&encoded) {
17294                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17295                            Err(error) => {
17296                                dlg.response_json_decode_error(&encoded, &error);
17297                                return Err(common::Error::JsonDecodeError(
17298                                    encoded.to_string(),
17299                                    error,
17300                                ));
17301                            }
17302                        }
17303                    };
17304
17305                    dlg.finished(true);
17306                    return Ok(response);
17307                }
17308            }
17309        }
17310    }
17311
17312    ///
17313    /// Sets the *request* property to the given value.
17314    ///
17315    /// Even though the property as already been set when instantiating this call,
17316    /// we provide this method for API completeness.
17317    pub fn request(
17318        mut self,
17319        new_value: MoveTableToDatabaseRequest,
17320    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {
17321        self._request = new_value;
17322        self
17323    }
17324    /// Required. The relative resource name of the metastore service to mutate metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
17325    ///
17326    /// Sets the *service* path property to the given value.
17327    ///
17328    /// Even though the property as already been set when instantiating this call,
17329    /// we provide this method for API completeness.
17330    pub fn service(
17331        mut self,
17332        new_value: &str,
17333    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {
17334        self._service = new_value.to_string();
17335        self
17336    }
17337    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17338    /// while executing the actual API request.
17339    ///
17340    /// ````text
17341    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17342    /// ````
17343    ///
17344    /// Sets the *delegate* property to the given value.
17345    pub fn delegate(
17346        mut self,
17347        new_value: &'a mut dyn common::Delegate,
17348    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {
17349        self._delegate = Some(new_value);
17350        self
17351    }
17352
17353    /// Set any additional parameter of the query string used in the request.
17354    /// It should be used to set parameters which are not yet available through their own
17355    /// setters.
17356    ///
17357    /// Please note that this method must not be used to set any of the known parameters
17358    /// which have their own setter method. If done anyway, the request will fail.
17359    ///
17360    /// # Additional Parameters
17361    ///
17362    /// * *$.xgafv* (query-string) - V1 error format.
17363    /// * *access_token* (query-string) - OAuth access token.
17364    /// * *alt* (query-string) - Data format for response.
17365    /// * *callback* (query-string) - JSONP
17366    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17367    /// * *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.
17368    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17369    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17370    /// * *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.
17371    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17372    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17373    pub fn param<T>(
17374        mut self,
17375        name: T,
17376        value: T,
17377    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C>
17378    where
17379        T: AsRef<str>,
17380    {
17381        self._additional_params
17382            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17383        self
17384    }
17385
17386    /// Identifies the authorization scope for the method you are building.
17387    ///
17388    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17389    /// [`Scope::CloudPlatform`].
17390    ///
17391    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17392    /// tokens for more than one scope.
17393    ///
17394    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17395    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17396    /// sufficient, a read-write scope will do as well.
17397    pub fn add_scope<St>(
17398        mut self,
17399        scope: St,
17400    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C>
17401    where
17402        St: AsRef<str>,
17403    {
17404        self._scopes.insert(String::from(scope.as_ref()));
17405        self
17406    }
17407    /// Identifies the authorization scope(s) for the method you are building.
17408    ///
17409    /// See [`Self::add_scope()`] for details.
17410    pub fn add_scopes<I, St>(
17411        mut self,
17412        scopes: I,
17413    ) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C>
17414    where
17415        I: IntoIterator<Item = St>,
17416        St: AsRef<str>,
17417    {
17418        self._scopes
17419            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17420        self
17421    }
17422
17423    /// Removes all scopes, and no default scope will be used either.
17424    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17425    /// for details).
17426    pub fn clear_scopes(mut self) -> ProjectLocationServiceMoveTableToDatabaseCall<'a, C> {
17427        self._scopes.clear();
17428        self
17429    }
17430}
17431
17432/// Updates the parameters of a single service.
17433///
17434/// A builder for the *locations.services.patch* method supported by a *project* resource.
17435/// It is not used directly, but through a [`ProjectMethods`] instance.
17436///
17437/// # Example
17438///
17439/// Instantiate a resource method builder
17440///
17441/// ```test_harness,no_run
17442/// # extern crate hyper;
17443/// # extern crate hyper_rustls;
17444/// # extern crate google_metastore1_beta as metastore1_beta;
17445/// use metastore1_beta::api::Service;
17446/// # async fn dox() {
17447/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17448///
17449/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17450/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17451/// #     .with_native_roots()
17452/// #     .unwrap()
17453/// #     .https_only()
17454/// #     .enable_http2()
17455/// #     .build();
17456///
17457/// # let executor = hyper_util::rt::TokioExecutor::new();
17458/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17459/// #     secret,
17460/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17461/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17462/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17463/// #     ),
17464/// # ).build().await.unwrap();
17465///
17466/// # let client = hyper_util::client::legacy::Client::builder(
17467/// #     hyper_util::rt::TokioExecutor::new()
17468/// # )
17469/// # .build(
17470/// #     hyper_rustls::HttpsConnectorBuilder::new()
17471/// #         .with_native_roots()
17472/// #         .unwrap()
17473/// #         .https_or_http()
17474/// #         .enable_http2()
17475/// #         .build()
17476/// # );
17477/// # let mut hub = DataprocMetastore::new(client, auth);
17478/// // As the method needs a request, you would usually fill it with the desired information
17479/// // into the respective structure. Some of the parts shown here might not be applicable !
17480/// // Values shown here are possibly random and not representative !
17481/// let mut req = Service::default();
17482///
17483/// // You can configure optional parameters by calling the respective setters at will, and
17484/// // execute the final call using `doit()`.
17485/// // Values shown here are possibly random and not representative !
17486/// let result = hub.projects().locations_services_patch(req, "name")
17487///              .update_mask(FieldMask::new::<&str>(&[]))
17488///              .request_id("sadipscing")
17489///              .doit().await;
17490/// # }
17491/// ```
17492pub struct ProjectLocationServicePatchCall<'a, C>
17493where
17494    C: 'a,
17495{
17496    hub: &'a DataprocMetastore<C>,
17497    _request: Service,
17498    _name: String,
17499    _update_mask: Option<common::FieldMask>,
17500    _request_id: Option<String>,
17501    _delegate: Option<&'a mut dyn common::Delegate>,
17502    _additional_params: HashMap<String, String>,
17503    _scopes: BTreeSet<String>,
17504}
17505
17506impl<'a, C> common::CallBuilder for ProjectLocationServicePatchCall<'a, C> {}
17507
17508impl<'a, C> ProjectLocationServicePatchCall<'a, C>
17509where
17510    C: common::Connector,
17511{
17512    /// Perform the operation you have build so far.
17513    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17514        use std::borrow::Cow;
17515        use std::io::{Read, Seek};
17516
17517        use common::{url::Params, ToParts};
17518        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17519
17520        let mut dd = common::DefaultDelegate;
17521        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17522        dlg.begin(common::MethodInfo {
17523            id: "metastore.projects.locations.services.patch",
17524            http_method: hyper::Method::PATCH,
17525        });
17526
17527        for &field in ["alt", "name", "updateMask", "requestId"].iter() {
17528            if self._additional_params.contains_key(field) {
17529                dlg.finished(false);
17530                return Err(common::Error::FieldClash(field));
17531            }
17532        }
17533
17534        let mut params = Params::with_capacity(6 + self._additional_params.len());
17535        params.push("name", self._name);
17536        if let Some(value) = self._update_mask.as_ref() {
17537            params.push("updateMask", value.to_string());
17538        }
17539        if let Some(value) = self._request_id.as_ref() {
17540            params.push("requestId", value);
17541        }
17542
17543        params.extend(self._additional_params.iter());
17544
17545        params.push("alt", "json");
17546        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
17547        if self._scopes.is_empty() {
17548            self._scopes
17549                .insert(Scope::CloudPlatform.as_ref().to_string());
17550        }
17551
17552        #[allow(clippy::single_element_loop)]
17553        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17554            url = params.uri_replacement(url, param_name, find_this, true);
17555        }
17556        {
17557            let to_remove = ["name"];
17558            params.remove_params(&to_remove);
17559        }
17560
17561        let url = params.parse_with_url(&url);
17562
17563        let mut json_mime_type = mime::APPLICATION_JSON;
17564        let mut request_value_reader = {
17565            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17566            common::remove_json_null_values(&mut value);
17567            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17568            serde_json::to_writer(&mut dst, &value).unwrap();
17569            dst
17570        };
17571        let request_size = request_value_reader
17572            .seek(std::io::SeekFrom::End(0))
17573            .unwrap();
17574        request_value_reader
17575            .seek(std::io::SeekFrom::Start(0))
17576            .unwrap();
17577
17578        loop {
17579            let token = match self
17580                .hub
17581                .auth
17582                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17583                .await
17584            {
17585                Ok(token) => token,
17586                Err(e) => match dlg.token(e) {
17587                    Ok(token) => token,
17588                    Err(e) => {
17589                        dlg.finished(false);
17590                        return Err(common::Error::MissingToken(e));
17591                    }
17592                },
17593            };
17594            request_value_reader
17595                .seek(std::io::SeekFrom::Start(0))
17596                .unwrap();
17597            let mut req_result = {
17598                let client = &self.hub.client;
17599                dlg.pre_request();
17600                let mut req_builder = hyper::Request::builder()
17601                    .method(hyper::Method::PATCH)
17602                    .uri(url.as_str())
17603                    .header(USER_AGENT, self.hub._user_agent.clone());
17604
17605                if let Some(token) = token.as_ref() {
17606                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17607                }
17608
17609                let request = req_builder
17610                    .header(CONTENT_TYPE, json_mime_type.to_string())
17611                    .header(CONTENT_LENGTH, request_size as u64)
17612                    .body(common::to_body(
17613                        request_value_reader.get_ref().clone().into(),
17614                    ));
17615
17616                client.request(request.unwrap()).await
17617            };
17618
17619            match req_result {
17620                Err(err) => {
17621                    if let common::Retry::After(d) = dlg.http_error(&err) {
17622                        sleep(d).await;
17623                        continue;
17624                    }
17625                    dlg.finished(false);
17626                    return Err(common::Error::HttpError(err));
17627                }
17628                Ok(res) => {
17629                    let (mut parts, body) = res.into_parts();
17630                    let mut body = common::Body::new(body);
17631                    if !parts.status.is_success() {
17632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17633                        let error = serde_json::from_str(&common::to_string(&bytes));
17634                        let response = common::to_response(parts, bytes.into());
17635
17636                        if let common::Retry::After(d) =
17637                            dlg.http_failure(&response, error.as_ref().ok())
17638                        {
17639                            sleep(d).await;
17640                            continue;
17641                        }
17642
17643                        dlg.finished(false);
17644
17645                        return Err(match error {
17646                            Ok(value) => common::Error::BadRequest(value),
17647                            _ => common::Error::Failure(response),
17648                        });
17649                    }
17650                    let response = {
17651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17652                        let encoded = common::to_string(&bytes);
17653                        match serde_json::from_str(&encoded) {
17654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17655                            Err(error) => {
17656                                dlg.response_json_decode_error(&encoded, &error);
17657                                return Err(common::Error::JsonDecodeError(
17658                                    encoded.to_string(),
17659                                    error,
17660                                ));
17661                            }
17662                        }
17663                    };
17664
17665                    dlg.finished(true);
17666                    return Ok(response);
17667                }
17668            }
17669        }
17670    }
17671
17672    ///
17673    /// Sets the *request* property to the given value.
17674    ///
17675    /// Even though the property as already been set when instantiating this call,
17676    /// we provide this method for API completeness.
17677    pub fn request(mut self, new_value: Service) -> ProjectLocationServicePatchCall<'a, C> {
17678        self._request = new_value;
17679        self
17680    }
17681    /// Immutable. Identifier. The relative resource name of the metastore service, in the following format:projects/{project_number}/locations/{location_id}/services/{service_id}.
17682    ///
17683    /// Sets the *name* path property to the given value.
17684    ///
17685    /// Even though the property as already been set when instantiating this call,
17686    /// we provide this method for API completeness.
17687    pub fn name(mut self, new_value: &str) -> ProjectLocationServicePatchCall<'a, C> {
17688        self._name = new_value.to_string();
17689        self
17690    }
17691    /// Required. A field mask used to specify the fields to be overwritten in the metastore service resource by the update. Fields specified in the update_mask are relative to the resource (not to the full request). A field is overwritten if it is in the mask.
17692    ///
17693    /// Sets the *update mask* query property to the given value.
17694    pub fn update_mask(
17695        mut self,
17696        new_value: common::FieldMask,
17697    ) -> ProjectLocationServicePatchCall<'a, C> {
17698        self._update_mask = Some(new_value);
17699        self
17700    }
17701    /// Optional. A request ID. Specify a unique request ID to allow the server to ignore the request if it has completed. The server will ignore subsequent requests that provide a duplicate request ID for at least 60 minutes after the first request.For example, if an initial request times out, followed by another request with the same request ID, the server ignores the second request to prevent the creation of duplicate commitments.The request ID must be a valid UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) A zero UUID (00000000-0000-0000-0000-000000000000) is not supported.
17702    ///
17703    /// Sets the *request id* query property to the given value.
17704    pub fn request_id(mut self, new_value: &str) -> ProjectLocationServicePatchCall<'a, C> {
17705        self._request_id = Some(new_value.to_string());
17706        self
17707    }
17708    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17709    /// while executing the actual API request.
17710    ///
17711    /// ````text
17712    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17713    /// ````
17714    ///
17715    /// Sets the *delegate* property to the given value.
17716    pub fn delegate(
17717        mut self,
17718        new_value: &'a mut dyn common::Delegate,
17719    ) -> ProjectLocationServicePatchCall<'a, C> {
17720        self._delegate = Some(new_value);
17721        self
17722    }
17723
17724    /// Set any additional parameter of the query string used in the request.
17725    /// It should be used to set parameters which are not yet available through their own
17726    /// setters.
17727    ///
17728    /// Please note that this method must not be used to set any of the known parameters
17729    /// which have their own setter method. If done anyway, the request will fail.
17730    ///
17731    /// # Additional Parameters
17732    ///
17733    /// * *$.xgafv* (query-string) - V1 error format.
17734    /// * *access_token* (query-string) - OAuth access token.
17735    /// * *alt* (query-string) - Data format for response.
17736    /// * *callback* (query-string) - JSONP
17737    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17738    /// * *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.
17739    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17740    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17741    /// * *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.
17742    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17743    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17744    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServicePatchCall<'a, C>
17745    where
17746        T: AsRef<str>,
17747    {
17748        self._additional_params
17749            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17750        self
17751    }
17752
17753    /// Identifies the authorization scope for the method you are building.
17754    ///
17755    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17756    /// [`Scope::CloudPlatform`].
17757    ///
17758    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17759    /// tokens for more than one scope.
17760    ///
17761    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17762    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17763    /// sufficient, a read-write scope will do as well.
17764    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServicePatchCall<'a, C>
17765    where
17766        St: AsRef<str>,
17767    {
17768        self._scopes.insert(String::from(scope.as_ref()));
17769        self
17770    }
17771    /// Identifies the authorization scope(s) for the method you are building.
17772    ///
17773    /// See [`Self::add_scope()`] for details.
17774    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServicePatchCall<'a, C>
17775    where
17776        I: IntoIterator<Item = St>,
17777        St: AsRef<str>,
17778    {
17779        self._scopes
17780            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17781        self
17782    }
17783
17784    /// Removes all scopes, and no default scope will be used either.
17785    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17786    /// for details).
17787    pub fn clear_scopes(mut self) -> ProjectLocationServicePatchCall<'a, C> {
17788        self._scopes.clear();
17789        self
17790    }
17791}
17792
17793/// Query Dataproc Metastore metadata.
17794///
17795/// A builder for the *locations.services.queryMetadata* method supported by a *project* resource.
17796/// It is not used directly, but through a [`ProjectMethods`] instance.
17797///
17798/// # Example
17799///
17800/// Instantiate a resource method builder
17801///
17802/// ```test_harness,no_run
17803/// # extern crate hyper;
17804/// # extern crate hyper_rustls;
17805/// # extern crate google_metastore1_beta as metastore1_beta;
17806/// use metastore1_beta::api::QueryMetadataRequest;
17807/// # async fn dox() {
17808/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17809///
17810/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17811/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17812/// #     .with_native_roots()
17813/// #     .unwrap()
17814/// #     .https_only()
17815/// #     .enable_http2()
17816/// #     .build();
17817///
17818/// # let executor = hyper_util::rt::TokioExecutor::new();
17819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17820/// #     secret,
17821/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17822/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17823/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17824/// #     ),
17825/// # ).build().await.unwrap();
17826///
17827/// # let client = hyper_util::client::legacy::Client::builder(
17828/// #     hyper_util::rt::TokioExecutor::new()
17829/// # )
17830/// # .build(
17831/// #     hyper_rustls::HttpsConnectorBuilder::new()
17832/// #         .with_native_roots()
17833/// #         .unwrap()
17834/// #         .https_or_http()
17835/// #         .enable_http2()
17836/// #         .build()
17837/// # );
17838/// # let mut hub = DataprocMetastore::new(client, auth);
17839/// // As the method needs a request, you would usually fill it with the desired information
17840/// // into the respective structure. Some of the parts shown here might not be applicable !
17841/// // Values shown here are possibly random and not representative !
17842/// let mut req = QueryMetadataRequest::default();
17843///
17844/// // You can configure optional parameters by calling the respective setters at will, and
17845/// // execute the final call using `doit()`.
17846/// // Values shown here are possibly random and not representative !
17847/// let result = hub.projects().locations_services_query_metadata(req, "service")
17848///              .doit().await;
17849/// # }
17850/// ```
17851pub struct ProjectLocationServiceQueryMetadataCall<'a, C>
17852where
17853    C: 'a,
17854{
17855    hub: &'a DataprocMetastore<C>,
17856    _request: QueryMetadataRequest,
17857    _service: String,
17858    _delegate: Option<&'a mut dyn common::Delegate>,
17859    _additional_params: HashMap<String, String>,
17860    _scopes: BTreeSet<String>,
17861}
17862
17863impl<'a, C> common::CallBuilder for ProjectLocationServiceQueryMetadataCall<'a, C> {}
17864
17865impl<'a, C> ProjectLocationServiceQueryMetadataCall<'a, C>
17866where
17867    C: common::Connector,
17868{
17869    /// Perform the operation you have build so far.
17870    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17871        use std::borrow::Cow;
17872        use std::io::{Read, Seek};
17873
17874        use common::{url::Params, ToParts};
17875        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17876
17877        let mut dd = common::DefaultDelegate;
17878        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17879        dlg.begin(common::MethodInfo {
17880            id: "metastore.projects.locations.services.queryMetadata",
17881            http_method: hyper::Method::POST,
17882        });
17883
17884        for &field in ["alt", "service"].iter() {
17885            if self._additional_params.contains_key(field) {
17886                dlg.finished(false);
17887                return Err(common::Error::FieldClash(field));
17888            }
17889        }
17890
17891        let mut params = Params::with_capacity(4 + self._additional_params.len());
17892        params.push("service", self._service);
17893
17894        params.extend(self._additional_params.iter());
17895
17896        params.push("alt", "json");
17897        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:queryMetadata";
17898        if self._scopes.is_empty() {
17899            self._scopes
17900                .insert(Scope::CloudPlatform.as_ref().to_string());
17901        }
17902
17903        #[allow(clippy::single_element_loop)]
17904        for &(find_this, param_name) in [("{+service}", "service")].iter() {
17905            url = params.uri_replacement(url, param_name, find_this, true);
17906        }
17907        {
17908            let to_remove = ["service"];
17909            params.remove_params(&to_remove);
17910        }
17911
17912        let url = params.parse_with_url(&url);
17913
17914        let mut json_mime_type = mime::APPLICATION_JSON;
17915        let mut request_value_reader = {
17916            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17917            common::remove_json_null_values(&mut value);
17918            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17919            serde_json::to_writer(&mut dst, &value).unwrap();
17920            dst
17921        };
17922        let request_size = request_value_reader
17923            .seek(std::io::SeekFrom::End(0))
17924            .unwrap();
17925        request_value_reader
17926            .seek(std::io::SeekFrom::Start(0))
17927            .unwrap();
17928
17929        loop {
17930            let token = match self
17931                .hub
17932                .auth
17933                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17934                .await
17935            {
17936                Ok(token) => token,
17937                Err(e) => match dlg.token(e) {
17938                    Ok(token) => token,
17939                    Err(e) => {
17940                        dlg.finished(false);
17941                        return Err(common::Error::MissingToken(e));
17942                    }
17943                },
17944            };
17945            request_value_reader
17946                .seek(std::io::SeekFrom::Start(0))
17947                .unwrap();
17948            let mut req_result = {
17949                let client = &self.hub.client;
17950                dlg.pre_request();
17951                let mut req_builder = hyper::Request::builder()
17952                    .method(hyper::Method::POST)
17953                    .uri(url.as_str())
17954                    .header(USER_AGENT, self.hub._user_agent.clone());
17955
17956                if let Some(token) = token.as_ref() {
17957                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17958                }
17959
17960                let request = req_builder
17961                    .header(CONTENT_TYPE, json_mime_type.to_string())
17962                    .header(CONTENT_LENGTH, request_size as u64)
17963                    .body(common::to_body(
17964                        request_value_reader.get_ref().clone().into(),
17965                    ));
17966
17967                client.request(request.unwrap()).await
17968            };
17969
17970            match req_result {
17971                Err(err) => {
17972                    if let common::Retry::After(d) = dlg.http_error(&err) {
17973                        sleep(d).await;
17974                        continue;
17975                    }
17976                    dlg.finished(false);
17977                    return Err(common::Error::HttpError(err));
17978                }
17979                Ok(res) => {
17980                    let (mut parts, body) = res.into_parts();
17981                    let mut body = common::Body::new(body);
17982                    if !parts.status.is_success() {
17983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17984                        let error = serde_json::from_str(&common::to_string(&bytes));
17985                        let response = common::to_response(parts, bytes.into());
17986
17987                        if let common::Retry::After(d) =
17988                            dlg.http_failure(&response, error.as_ref().ok())
17989                        {
17990                            sleep(d).await;
17991                            continue;
17992                        }
17993
17994                        dlg.finished(false);
17995
17996                        return Err(match error {
17997                            Ok(value) => common::Error::BadRequest(value),
17998                            _ => common::Error::Failure(response),
17999                        });
18000                    }
18001                    let response = {
18002                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18003                        let encoded = common::to_string(&bytes);
18004                        match serde_json::from_str(&encoded) {
18005                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18006                            Err(error) => {
18007                                dlg.response_json_decode_error(&encoded, &error);
18008                                return Err(common::Error::JsonDecodeError(
18009                                    encoded.to_string(),
18010                                    error,
18011                                ));
18012                            }
18013                        }
18014                    };
18015
18016                    dlg.finished(true);
18017                    return Ok(response);
18018                }
18019            }
18020        }
18021    }
18022
18023    ///
18024    /// Sets the *request* property to the given value.
18025    ///
18026    /// Even though the property as already been set when instantiating this call,
18027    /// we provide this method for API completeness.
18028    pub fn request(
18029        mut self,
18030        new_value: QueryMetadataRequest,
18031    ) -> ProjectLocationServiceQueryMetadataCall<'a, C> {
18032        self._request = new_value;
18033        self
18034    }
18035    /// Required. The relative resource name of the metastore service to query metadata, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
18036    ///
18037    /// Sets the *service* path property to the given value.
18038    ///
18039    /// Even though the property as already been set when instantiating this call,
18040    /// we provide this method for API completeness.
18041    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceQueryMetadataCall<'a, C> {
18042        self._service = new_value.to_string();
18043        self
18044    }
18045    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18046    /// while executing the actual API request.
18047    ///
18048    /// ````text
18049    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18050    /// ````
18051    ///
18052    /// Sets the *delegate* property to the given value.
18053    pub fn delegate(
18054        mut self,
18055        new_value: &'a mut dyn common::Delegate,
18056    ) -> ProjectLocationServiceQueryMetadataCall<'a, C> {
18057        self._delegate = Some(new_value);
18058        self
18059    }
18060
18061    /// Set any additional parameter of the query string used in the request.
18062    /// It should be used to set parameters which are not yet available through their own
18063    /// setters.
18064    ///
18065    /// Please note that this method must not be used to set any of the known parameters
18066    /// which have their own setter method. If done anyway, the request will fail.
18067    ///
18068    /// # Additional Parameters
18069    ///
18070    /// * *$.xgafv* (query-string) - V1 error format.
18071    /// * *access_token* (query-string) - OAuth access token.
18072    /// * *alt* (query-string) - Data format for response.
18073    /// * *callback* (query-string) - JSONP
18074    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18075    /// * *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.
18076    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18077    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18078    /// * *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.
18079    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18080    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18081    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceQueryMetadataCall<'a, C>
18082    where
18083        T: AsRef<str>,
18084    {
18085        self._additional_params
18086            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18087        self
18088    }
18089
18090    /// Identifies the authorization scope for the method you are building.
18091    ///
18092    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18093    /// [`Scope::CloudPlatform`].
18094    ///
18095    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18096    /// tokens for more than one scope.
18097    ///
18098    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18099    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18100    /// sufficient, a read-write scope will do as well.
18101    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceQueryMetadataCall<'a, C>
18102    where
18103        St: AsRef<str>,
18104    {
18105        self._scopes.insert(String::from(scope.as_ref()));
18106        self
18107    }
18108    /// Identifies the authorization scope(s) for the method you are building.
18109    ///
18110    /// See [`Self::add_scope()`] for details.
18111    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceQueryMetadataCall<'a, C>
18112    where
18113        I: IntoIterator<Item = St>,
18114        St: AsRef<str>,
18115    {
18116        self._scopes
18117            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18118        self
18119    }
18120
18121    /// Removes all scopes, and no default scope will be used either.
18122    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18123    /// for details).
18124    pub fn clear_scopes(mut self) -> ProjectLocationServiceQueryMetadataCall<'a, C> {
18125        self._scopes.clear();
18126        self
18127    }
18128}
18129
18130/// Removes the attached IAM policies for a resource
18131///
18132/// A builder for the *locations.services.removeIamPolicy* method supported by a *project* resource.
18133/// It is not used directly, but through a [`ProjectMethods`] instance.
18134///
18135/// # Example
18136///
18137/// Instantiate a resource method builder
18138///
18139/// ```test_harness,no_run
18140/// # extern crate hyper;
18141/// # extern crate hyper_rustls;
18142/// # extern crate google_metastore1_beta as metastore1_beta;
18143/// use metastore1_beta::api::RemoveIamPolicyRequest;
18144/// # async fn dox() {
18145/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18146///
18147/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18148/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18149/// #     .with_native_roots()
18150/// #     .unwrap()
18151/// #     .https_only()
18152/// #     .enable_http2()
18153/// #     .build();
18154///
18155/// # let executor = hyper_util::rt::TokioExecutor::new();
18156/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18157/// #     secret,
18158/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18159/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18160/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18161/// #     ),
18162/// # ).build().await.unwrap();
18163///
18164/// # let client = hyper_util::client::legacy::Client::builder(
18165/// #     hyper_util::rt::TokioExecutor::new()
18166/// # )
18167/// # .build(
18168/// #     hyper_rustls::HttpsConnectorBuilder::new()
18169/// #         .with_native_roots()
18170/// #         .unwrap()
18171/// #         .https_or_http()
18172/// #         .enable_http2()
18173/// #         .build()
18174/// # );
18175/// # let mut hub = DataprocMetastore::new(client, auth);
18176/// // As the method needs a request, you would usually fill it with the desired information
18177/// // into the respective structure. Some of the parts shown here might not be applicable !
18178/// // Values shown here are possibly random and not representative !
18179/// let mut req = RemoveIamPolicyRequest::default();
18180///
18181/// // You can configure optional parameters by calling the respective setters at will, and
18182/// // execute the final call using `doit()`.
18183/// // Values shown here are possibly random and not representative !
18184/// let result = hub.projects().locations_services_remove_iam_policy(req, "resource")
18185///              .doit().await;
18186/// # }
18187/// ```
18188pub struct ProjectLocationServiceRemoveIamPolicyCall<'a, C>
18189where
18190    C: 'a,
18191{
18192    hub: &'a DataprocMetastore<C>,
18193    _request: RemoveIamPolicyRequest,
18194    _resource: String,
18195    _delegate: Option<&'a mut dyn common::Delegate>,
18196    _additional_params: HashMap<String, String>,
18197    _scopes: BTreeSet<String>,
18198}
18199
18200impl<'a, C> common::CallBuilder for ProjectLocationServiceRemoveIamPolicyCall<'a, C> {}
18201
18202impl<'a, C> ProjectLocationServiceRemoveIamPolicyCall<'a, C>
18203where
18204    C: common::Connector,
18205{
18206    /// Perform the operation you have build so far.
18207    pub async fn doit(mut self) -> common::Result<(common::Response, RemoveIamPolicyResponse)> {
18208        use std::borrow::Cow;
18209        use std::io::{Read, Seek};
18210
18211        use common::{url::Params, ToParts};
18212        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18213
18214        let mut dd = common::DefaultDelegate;
18215        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18216        dlg.begin(common::MethodInfo {
18217            id: "metastore.projects.locations.services.removeIamPolicy",
18218            http_method: hyper::Method::POST,
18219        });
18220
18221        for &field in ["alt", "resource"].iter() {
18222            if self._additional_params.contains_key(field) {
18223                dlg.finished(false);
18224                return Err(common::Error::FieldClash(field));
18225            }
18226        }
18227
18228        let mut params = Params::with_capacity(4 + self._additional_params.len());
18229        params.push("resource", self._resource);
18230
18231        params.extend(self._additional_params.iter());
18232
18233        params.push("alt", "json");
18234        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:removeIamPolicy";
18235        if self._scopes.is_empty() {
18236            self._scopes
18237                .insert(Scope::CloudPlatform.as_ref().to_string());
18238        }
18239
18240        #[allow(clippy::single_element_loop)]
18241        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18242            url = params.uri_replacement(url, param_name, find_this, true);
18243        }
18244        {
18245            let to_remove = ["resource"];
18246            params.remove_params(&to_remove);
18247        }
18248
18249        let url = params.parse_with_url(&url);
18250
18251        let mut json_mime_type = mime::APPLICATION_JSON;
18252        let mut request_value_reader = {
18253            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18254            common::remove_json_null_values(&mut value);
18255            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18256            serde_json::to_writer(&mut dst, &value).unwrap();
18257            dst
18258        };
18259        let request_size = request_value_reader
18260            .seek(std::io::SeekFrom::End(0))
18261            .unwrap();
18262        request_value_reader
18263            .seek(std::io::SeekFrom::Start(0))
18264            .unwrap();
18265
18266        loop {
18267            let token = match self
18268                .hub
18269                .auth
18270                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18271                .await
18272            {
18273                Ok(token) => token,
18274                Err(e) => match dlg.token(e) {
18275                    Ok(token) => token,
18276                    Err(e) => {
18277                        dlg.finished(false);
18278                        return Err(common::Error::MissingToken(e));
18279                    }
18280                },
18281            };
18282            request_value_reader
18283                .seek(std::io::SeekFrom::Start(0))
18284                .unwrap();
18285            let mut req_result = {
18286                let client = &self.hub.client;
18287                dlg.pre_request();
18288                let mut req_builder = hyper::Request::builder()
18289                    .method(hyper::Method::POST)
18290                    .uri(url.as_str())
18291                    .header(USER_AGENT, self.hub._user_agent.clone());
18292
18293                if let Some(token) = token.as_ref() {
18294                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18295                }
18296
18297                let request = req_builder
18298                    .header(CONTENT_TYPE, json_mime_type.to_string())
18299                    .header(CONTENT_LENGTH, request_size as u64)
18300                    .body(common::to_body(
18301                        request_value_reader.get_ref().clone().into(),
18302                    ));
18303
18304                client.request(request.unwrap()).await
18305            };
18306
18307            match req_result {
18308                Err(err) => {
18309                    if let common::Retry::After(d) = dlg.http_error(&err) {
18310                        sleep(d).await;
18311                        continue;
18312                    }
18313                    dlg.finished(false);
18314                    return Err(common::Error::HttpError(err));
18315                }
18316                Ok(res) => {
18317                    let (mut parts, body) = res.into_parts();
18318                    let mut body = common::Body::new(body);
18319                    if !parts.status.is_success() {
18320                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18321                        let error = serde_json::from_str(&common::to_string(&bytes));
18322                        let response = common::to_response(parts, bytes.into());
18323
18324                        if let common::Retry::After(d) =
18325                            dlg.http_failure(&response, error.as_ref().ok())
18326                        {
18327                            sleep(d).await;
18328                            continue;
18329                        }
18330
18331                        dlg.finished(false);
18332
18333                        return Err(match error {
18334                            Ok(value) => common::Error::BadRequest(value),
18335                            _ => common::Error::Failure(response),
18336                        });
18337                    }
18338                    let response = {
18339                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18340                        let encoded = common::to_string(&bytes);
18341                        match serde_json::from_str(&encoded) {
18342                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18343                            Err(error) => {
18344                                dlg.response_json_decode_error(&encoded, &error);
18345                                return Err(common::Error::JsonDecodeError(
18346                                    encoded.to_string(),
18347                                    error,
18348                                ));
18349                            }
18350                        }
18351                    };
18352
18353                    dlg.finished(true);
18354                    return Ok(response);
18355                }
18356            }
18357        }
18358    }
18359
18360    ///
18361    /// Sets the *request* property to the given value.
18362    ///
18363    /// Even though the property as already been set when instantiating this call,
18364    /// we provide this method for API completeness.
18365    pub fn request(
18366        mut self,
18367        new_value: RemoveIamPolicyRequest,
18368    ) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C> {
18369        self._request = new_value;
18370        self
18371    }
18372    /// Required. The relative resource name of the dataplane resource to remove IAM policy, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id} or projects/{project_id}/locations/{location_id}/services/{service_id}/databases/{database_id}/tables/{table_id}.
18373    ///
18374    /// Sets the *resource* path property to the given value.
18375    ///
18376    /// Even though the property as already been set when instantiating this call,
18377    /// we provide this method for API completeness.
18378    pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C> {
18379        self._resource = new_value.to_string();
18380        self
18381    }
18382    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18383    /// while executing the actual API request.
18384    ///
18385    /// ````text
18386    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18387    /// ````
18388    ///
18389    /// Sets the *delegate* property to the given value.
18390    pub fn delegate(
18391        mut self,
18392        new_value: &'a mut dyn common::Delegate,
18393    ) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C> {
18394        self._delegate = Some(new_value);
18395        self
18396    }
18397
18398    /// Set any additional parameter of the query string used in the request.
18399    /// It should be used to set parameters which are not yet available through their own
18400    /// setters.
18401    ///
18402    /// Please note that this method must not be used to set any of the known parameters
18403    /// which have their own setter method. If done anyway, the request will fail.
18404    ///
18405    /// # Additional Parameters
18406    ///
18407    /// * *$.xgafv* (query-string) - V1 error format.
18408    /// * *access_token* (query-string) - OAuth access token.
18409    /// * *alt* (query-string) - Data format for response.
18410    /// * *callback* (query-string) - JSONP
18411    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18412    /// * *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.
18413    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18414    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18415    /// * *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.
18416    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18417    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18418    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C>
18419    where
18420        T: AsRef<str>,
18421    {
18422        self._additional_params
18423            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18424        self
18425    }
18426
18427    /// Identifies the authorization scope for the method you are building.
18428    ///
18429    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18430    /// [`Scope::CloudPlatform`].
18431    ///
18432    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18433    /// tokens for more than one scope.
18434    ///
18435    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18436    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18437    /// sufficient, a read-write scope will do as well.
18438    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C>
18439    where
18440        St: AsRef<str>,
18441    {
18442        self._scopes.insert(String::from(scope.as_ref()));
18443        self
18444    }
18445    /// Identifies the authorization scope(s) for the method you are building.
18446    ///
18447    /// See [`Self::add_scope()`] for details.
18448    pub fn add_scopes<I, St>(
18449        mut self,
18450        scopes: I,
18451    ) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C>
18452    where
18453        I: IntoIterator<Item = St>,
18454        St: AsRef<str>,
18455    {
18456        self._scopes
18457            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18458        self
18459    }
18460
18461    /// Removes all scopes, and no default scope will be used either.
18462    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18463    /// for details).
18464    pub fn clear_scopes(mut self) -> ProjectLocationServiceRemoveIamPolicyCall<'a, C> {
18465        self._scopes.clear();
18466        self
18467    }
18468}
18469
18470/// Restores a service from a backup.
18471///
18472/// A builder for the *locations.services.restore* method supported by a *project* resource.
18473/// It is not used directly, but through a [`ProjectMethods`] instance.
18474///
18475/// # Example
18476///
18477/// Instantiate a resource method builder
18478///
18479/// ```test_harness,no_run
18480/// # extern crate hyper;
18481/// # extern crate hyper_rustls;
18482/// # extern crate google_metastore1_beta as metastore1_beta;
18483/// use metastore1_beta::api::RestoreServiceRequest;
18484/// # async fn dox() {
18485/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18486///
18487/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18488/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18489/// #     .with_native_roots()
18490/// #     .unwrap()
18491/// #     .https_only()
18492/// #     .enable_http2()
18493/// #     .build();
18494///
18495/// # let executor = hyper_util::rt::TokioExecutor::new();
18496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18497/// #     secret,
18498/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18499/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18500/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18501/// #     ),
18502/// # ).build().await.unwrap();
18503///
18504/// # let client = hyper_util::client::legacy::Client::builder(
18505/// #     hyper_util::rt::TokioExecutor::new()
18506/// # )
18507/// # .build(
18508/// #     hyper_rustls::HttpsConnectorBuilder::new()
18509/// #         .with_native_roots()
18510/// #         .unwrap()
18511/// #         .https_or_http()
18512/// #         .enable_http2()
18513/// #         .build()
18514/// # );
18515/// # let mut hub = DataprocMetastore::new(client, auth);
18516/// // As the method needs a request, you would usually fill it with the desired information
18517/// // into the respective structure. Some of the parts shown here might not be applicable !
18518/// // Values shown here are possibly random and not representative !
18519/// let mut req = RestoreServiceRequest::default();
18520///
18521/// // You can configure optional parameters by calling the respective setters at will, and
18522/// // execute the final call using `doit()`.
18523/// // Values shown here are possibly random and not representative !
18524/// let result = hub.projects().locations_services_restore(req, "service")
18525///              .doit().await;
18526/// # }
18527/// ```
18528pub struct ProjectLocationServiceRestoreCall<'a, C>
18529where
18530    C: 'a,
18531{
18532    hub: &'a DataprocMetastore<C>,
18533    _request: RestoreServiceRequest,
18534    _service: String,
18535    _delegate: Option<&'a mut dyn common::Delegate>,
18536    _additional_params: HashMap<String, String>,
18537    _scopes: BTreeSet<String>,
18538}
18539
18540impl<'a, C> common::CallBuilder for ProjectLocationServiceRestoreCall<'a, C> {}
18541
18542impl<'a, C> ProjectLocationServiceRestoreCall<'a, C>
18543where
18544    C: common::Connector,
18545{
18546    /// Perform the operation you have build so far.
18547    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18548        use std::borrow::Cow;
18549        use std::io::{Read, Seek};
18550
18551        use common::{url::Params, ToParts};
18552        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18553
18554        let mut dd = common::DefaultDelegate;
18555        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18556        dlg.begin(common::MethodInfo {
18557            id: "metastore.projects.locations.services.restore",
18558            http_method: hyper::Method::POST,
18559        });
18560
18561        for &field in ["alt", "service"].iter() {
18562            if self._additional_params.contains_key(field) {
18563                dlg.finished(false);
18564                return Err(common::Error::FieldClash(field));
18565            }
18566        }
18567
18568        let mut params = Params::with_capacity(4 + self._additional_params.len());
18569        params.push("service", self._service);
18570
18571        params.extend(self._additional_params.iter());
18572
18573        params.push("alt", "json");
18574        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:restore";
18575        if self._scopes.is_empty() {
18576            self._scopes
18577                .insert(Scope::CloudPlatform.as_ref().to_string());
18578        }
18579
18580        #[allow(clippy::single_element_loop)]
18581        for &(find_this, param_name) in [("{+service}", "service")].iter() {
18582            url = params.uri_replacement(url, param_name, find_this, true);
18583        }
18584        {
18585            let to_remove = ["service"];
18586            params.remove_params(&to_remove);
18587        }
18588
18589        let url = params.parse_with_url(&url);
18590
18591        let mut json_mime_type = mime::APPLICATION_JSON;
18592        let mut request_value_reader = {
18593            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18594            common::remove_json_null_values(&mut value);
18595            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18596            serde_json::to_writer(&mut dst, &value).unwrap();
18597            dst
18598        };
18599        let request_size = request_value_reader
18600            .seek(std::io::SeekFrom::End(0))
18601            .unwrap();
18602        request_value_reader
18603            .seek(std::io::SeekFrom::Start(0))
18604            .unwrap();
18605
18606        loop {
18607            let token = match self
18608                .hub
18609                .auth
18610                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18611                .await
18612            {
18613                Ok(token) => token,
18614                Err(e) => match dlg.token(e) {
18615                    Ok(token) => token,
18616                    Err(e) => {
18617                        dlg.finished(false);
18618                        return Err(common::Error::MissingToken(e));
18619                    }
18620                },
18621            };
18622            request_value_reader
18623                .seek(std::io::SeekFrom::Start(0))
18624                .unwrap();
18625            let mut req_result = {
18626                let client = &self.hub.client;
18627                dlg.pre_request();
18628                let mut req_builder = hyper::Request::builder()
18629                    .method(hyper::Method::POST)
18630                    .uri(url.as_str())
18631                    .header(USER_AGENT, self.hub._user_agent.clone());
18632
18633                if let Some(token) = token.as_ref() {
18634                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18635                }
18636
18637                let request = req_builder
18638                    .header(CONTENT_TYPE, json_mime_type.to_string())
18639                    .header(CONTENT_LENGTH, request_size as u64)
18640                    .body(common::to_body(
18641                        request_value_reader.get_ref().clone().into(),
18642                    ));
18643
18644                client.request(request.unwrap()).await
18645            };
18646
18647            match req_result {
18648                Err(err) => {
18649                    if let common::Retry::After(d) = dlg.http_error(&err) {
18650                        sleep(d).await;
18651                        continue;
18652                    }
18653                    dlg.finished(false);
18654                    return Err(common::Error::HttpError(err));
18655                }
18656                Ok(res) => {
18657                    let (mut parts, body) = res.into_parts();
18658                    let mut body = common::Body::new(body);
18659                    if !parts.status.is_success() {
18660                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18661                        let error = serde_json::from_str(&common::to_string(&bytes));
18662                        let response = common::to_response(parts, bytes.into());
18663
18664                        if let common::Retry::After(d) =
18665                            dlg.http_failure(&response, error.as_ref().ok())
18666                        {
18667                            sleep(d).await;
18668                            continue;
18669                        }
18670
18671                        dlg.finished(false);
18672
18673                        return Err(match error {
18674                            Ok(value) => common::Error::BadRequest(value),
18675                            _ => common::Error::Failure(response),
18676                        });
18677                    }
18678                    let response = {
18679                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18680                        let encoded = common::to_string(&bytes);
18681                        match serde_json::from_str(&encoded) {
18682                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18683                            Err(error) => {
18684                                dlg.response_json_decode_error(&encoded, &error);
18685                                return Err(common::Error::JsonDecodeError(
18686                                    encoded.to_string(),
18687                                    error,
18688                                ));
18689                            }
18690                        }
18691                    };
18692
18693                    dlg.finished(true);
18694                    return Ok(response);
18695                }
18696            }
18697        }
18698    }
18699
18700    ///
18701    /// Sets the *request* property to the given value.
18702    ///
18703    /// Even though the property as already been set when instantiating this call,
18704    /// we provide this method for API completeness.
18705    pub fn request(
18706        mut self,
18707        new_value: RestoreServiceRequest,
18708    ) -> ProjectLocationServiceRestoreCall<'a, C> {
18709        self._request = new_value;
18710        self
18711    }
18712    /// Required. The relative resource name of the metastore service to run restore, in the following form:projects/{project_id}/locations/{location_id}/services/{service_id}.
18713    ///
18714    /// Sets the *service* path property to the given value.
18715    ///
18716    /// Even though the property as already been set when instantiating this call,
18717    /// we provide this method for API completeness.
18718    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceRestoreCall<'a, C> {
18719        self._service = new_value.to_string();
18720        self
18721    }
18722    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18723    /// while executing the actual API request.
18724    ///
18725    /// ````text
18726    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18727    /// ````
18728    ///
18729    /// Sets the *delegate* property to the given value.
18730    pub fn delegate(
18731        mut self,
18732        new_value: &'a mut dyn common::Delegate,
18733    ) -> ProjectLocationServiceRestoreCall<'a, C> {
18734        self._delegate = Some(new_value);
18735        self
18736    }
18737
18738    /// Set any additional parameter of the query string used in the request.
18739    /// It should be used to set parameters which are not yet available through their own
18740    /// setters.
18741    ///
18742    /// Please note that this method must not be used to set any of the known parameters
18743    /// which have their own setter method. If done anyway, the request will fail.
18744    ///
18745    /// # Additional Parameters
18746    ///
18747    /// * *$.xgafv* (query-string) - V1 error format.
18748    /// * *access_token* (query-string) - OAuth access token.
18749    /// * *alt* (query-string) - Data format for response.
18750    /// * *callback* (query-string) - JSONP
18751    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18752    /// * *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.
18753    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18754    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18755    /// * *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.
18756    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18757    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18758    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceRestoreCall<'a, C>
18759    where
18760        T: AsRef<str>,
18761    {
18762        self._additional_params
18763            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18764        self
18765    }
18766
18767    /// Identifies the authorization scope for the method you are building.
18768    ///
18769    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18770    /// [`Scope::CloudPlatform`].
18771    ///
18772    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18773    /// tokens for more than one scope.
18774    ///
18775    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18776    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18777    /// sufficient, a read-write scope will do as well.
18778    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceRestoreCall<'a, C>
18779    where
18780        St: AsRef<str>,
18781    {
18782        self._scopes.insert(String::from(scope.as_ref()));
18783        self
18784    }
18785    /// Identifies the authorization scope(s) for the method you are building.
18786    ///
18787    /// See [`Self::add_scope()`] for details.
18788    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceRestoreCall<'a, C>
18789    where
18790        I: IntoIterator<Item = St>,
18791        St: AsRef<str>,
18792    {
18793        self._scopes
18794            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18795        self
18796    }
18797
18798    /// Removes all scopes, and no default scope will be used either.
18799    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18800    /// for details).
18801    pub fn clear_scopes(mut self) -> ProjectLocationServiceRestoreCall<'a, C> {
18802        self._scopes.clear();
18803        self
18804    }
18805}
18806
18807/// Sets the access control policy on the specified resource. Replaces any existing policy.Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
18808///
18809/// A builder for the *locations.services.setIamPolicy* method supported by a *project* resource.
18810/// It is not used directly, but through a [`ProjectMethods`] instance.
18811///
18812/// # Example
18813///
18814/// Instantiate a resource method builder
18815///
18816/// ```test_harness,no_run
18817/// # extern crate hyper;
18818/// # extern crate hyper_rustls;
18819/// # extern crate google_metastore1_beta as metastore1_beta;
18820/// use metastore1_beta::api::SetIamPolicyRequest;
18821/// # async fn dox() {
18822/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18823///
18824/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18825/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18826/// #     .with_native_roots()
18827/// #     .unwrap()
18828/// #     .https_only()
18829/// #     .enable_http2()
18830/// #     .build();
18831///
18832/// # let executor = hyper_util::rt::TokioExecutor::new();
18833/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18834/// #     secret,
18835/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18836/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18837/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18838/// #     ),
18839/// # ).build().await.unwrap();
18840///
18841/// # let client = hyper_util::client::legacy::Client::builder(
18842/// #     hyper_util::rt::TokioExecutor::new()
18843/// # )
18844/// # .build(
18845/// #     hyper_rustls::HttpsConnectorBuilder::new()
18846/// #         .with_native_roots()
18847/// #         .unwrap()
18848/// #         .https_or_http()
18849/// #         .enable_http2()
18850/// #         .build()
18851/// # );
18852/// # let mut hub = DataprocMetastore::new(client, auth);
18853/// // As the method needs a request, you would usually fill it with the desired information
18854/// // into the respective structure. Some of the parts shown here might not be applicable !
18855/// // Values shown here are possibly random and not representative !
18856/// let mut req = SetIamPolicyRequest::default();
18857///
18858/// // You can configure optional parameters by calling the respective setters at will, and
18859/// // execute the final call using `doit()`.
18860/// // Values shown here are possibly random and not representative !
18861/// let result = hub.projects().locations_services_set_iam_policy(req, "resource")
18862///              .doit().await;
18863/// # }
18864/// ```
18865pub struct ProjectLocationServiceSetIamPolicyCall<'a, C>
18866where
18867    C: 'a,
18868{
18869    hub: &'a DataprocMetastore<C>,
18870    _request: SetIamPolicyRequest,
18871    _resource: String,
18872    _delegate: Option<&'a mut dyn common::Delegate>,
18873    _additional_params: HashMap<String, String>,
18874    _scopes: BTreeSet<String>,
18875}
18876
18877impl<'a, C> common::CallBuilder for ProjectLocationServiceSetIamPolicyCall<'a, C> {}
18878
18879impl<'a, C> ProjectLocationServiceSetIamPolicyCall<'a, C>
18880where
18881    C: common::Connector,
18882{
18883    /// Perform the operation you have build so far.
18884    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18885        use std::borrow::Cow;
18886        use std::io::{Read, Seek};
18887
18888        use common::{url::Params, ToParts};
18889        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18890
18891        let mut dd = common::DefaultDelegate;
18892        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18893        dlg.begin(common::MethodInfo {
18894            id: "metastore.projects.locations.services.setIamPolicy",
18895            http_method: hyper::Method::POST,
18896        });
18897
18898        for &field in ["alt", "resource"].iter() {
18899            if self._additional_params.contains_key(field) {
18900                dlg.finished(false);
18901                return Err(common::Error::FieldClash(field));
18902            }
18903        }
18904
18905        let mut params = Params::with_capacity(4 + self._additional_params.len());
18906        params.push("resource", self._resource);
18907
18908        params.extend(self._additional_params.iter());
18909
18910        params.push("alt", "json");
18911        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:setIamPolicy";
18912        if self._scopes.is_empty() {
18913            self._scopes
18914                .insert(Scope::CloudPlatform.as_ref().to_string());
18915        }
18916
18917        #[allow(clippy::single_element_loop)]
18918        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18919            url = params.uri_replacement(url, param_name, find_this, true);
18920        }
18921        {
18922            let to_remove = ["resource"];
18923            params.remove_params(&to_remove);
18924        }
18925
18926        let url = params.parse_with_url(&url);
18927
18928        let mut json_mime_type = mime::APPLICATION_JSON;
18929        let mut request_value_reader = {
18930            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18931            common::remove_json_null_values(&mut value);
18932            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18933            serde_json::to_writer(&mut dst, &value).unwrap();
18934            dst
18935        };
18936        let request_size = request_value_reader
18937            .seek(std::io::SeekFrom::End(0))
18938            .unwrap();
18939        request_value_reader
18940            .seek(std::io::SeekFrom::Start(0))
18941            .unwrap();
18942
18943        loop {
18944            let token = match self
18945                .hub
18946                .auth
18947                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18948                .await
18949            {
18950                Ok(token) => token,
18951                Err(e) => match dlg.token(e) {
18952                    Ok(token) => token,
18953                    Err(e) => {
18954                        dlg.finished(false);
18955                        return Err(common::Error::MissingToken(e));
18956                    }
18957                },
18958            };
18959            request_value_reader
18960                .seek(std::io::SeekFrom::Start(0))
18961                .unwrap();
18962            let mut req_result = {
18963                let client = &self.hub.client;
18964                dlg.pre_request();
18965                let mut req_builder = hyper::Request::builder()
18966                    .method(hyper::Method::POST)
18967                    .uri(url.as_str())
18968                    .header(USER_AGENT, self.hub._user_agent.clone());
18969
18970                if let Some(token) = token.as_ref() {
18971                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18972                }
18973
18974                let request = req_builder
18975                    .header(CONTENT_TYPE, json_mime_type.to_string())
18976                    .header(CONTENT_LENGTH, request_size as u64)
18977                    .body(common::to_body(
18978                        request_value_reader.get_ref().clone().into(),
18979                    ));
18980
18981                client.request(request.unwrap()).await
18982            };
18983
18984            match req_result {
18985                Err(err) => {
18986                    if let common::Retry::After(d) = dlg.http_error(&err) {
18987                        sleep(d).await;
18988                        continue;
18989                    }
18990                    dlg.finished(false);
18991                    return Err(common::Error::HttpError(err));
18992                }
18993                Ok(res) => {
18994                    let (mut parts, body) = res.into_parts();
18995                    let mut body = common::Body::new(body);
18996                    if !parts.status.is_success() {
18997                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18998                        let error = serde_json::from_str(&common::to_string(&bytes));
18999                        let response = common::to_response(parts, bytes.into());
19000
19001                        if let common::Retry::After(d) =
19002                            dlg.http_failure(&response, error.as_ref().ok())
19003                        {
19004                            sleep(d).await;
19005                            continue;
19006                        }
19007
19008                        dlg.finished(false);
19009
19010                        return Err(match error {
19011                            Ok(value) => common::Error::BadRequest(value),
19012                            _ => common::Error::Failure(response),
19013                        });
19014                    }
19015                    let response = {
19016                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19017                        let encoded = common::to_string(&bytes);
19018                        match serde_json::from_str(&encoded) {
19019                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19020                            Err(error) => {
19021                                dlg.response_json_decode_error(&encoded, &error);
19022                                return Err(common::Error::JsonDecodeError(
19023                                    encoded.to_string(),
19024                                    error,
19025                                ));
19026                            }
19027                        }
19028                    };
19029
19030                    dlg.finished(true);
19031                    return Ok(response);
19032                }
19033            }
19034        }
19035    }
19036
19037    ///
19038    /// Sets the *request* property to the given value.
19039    ///
19040    /// Even though the property as already been set when instantiating this call,
19041    /// we provide this method for API completeness.
19042    pub fn request(
19043        mut self,
19044        new_value: SetIamPolicyRequest,
19045    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
19046        self._request = new_value;
19047        self
19048    }
19049    /// 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.
19050    ///
19051    /// Sets the *resource* path property to the given value.
19052    ///
19053    /// Even though the property as already been set when instantiating this call,
19054    /// we provide this method for API completeness.
19055    pub fn resource(mut self, new_value: &str) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
19056        self._resource = new_value.to_string();
19057        self
19058    }
19059    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19060    /// while executing the actual API request.
19061    ///
19062    /// ````text
19063    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19064    /// ````
19065    ///
19066    /// Sets the *delegate* property to the given value.
19067    pub fn delegate(
19068        mut self,
19069        new_value: &'a mut dyn common::Delegate,
19070    ) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
19071        self._delegate = Some(new_value);
19072        self
19073    }
19074
19075    /// Set any additional parameter of the query string used in the request.
19076    /// It should be used to set parameters which are not yet available through their own
19077    /// setters.
19078    ///
19079    /// Please note that this method must not be used to set any of the known parameters
19080    /// which have their own setter method. If done anyway, the request will fail.
19081    ///
19082    /// # Additional Parameters
19083    ///
19084    /// * *$.xgafv* (query-string) - V1 error format.
19085    /// * *access_token* (query-string) - OAuth access token.
19086    /// * *alt* (query-string) - Data format for response.
19087    /// * *callback* (query-string) - JSONP
19088    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19089    /// * *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.
19090    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19091    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19092    /// * *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.
19093    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19094    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19095    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
19096    where
19097        T: AsRef<str>,
19098    {
19099        self._additional_params
19100            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19101        self
19102    }
19103
19104    /// Identifies the authorization scope for the method you are building.
19105    ///
19106    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19107    /// [`Scope::CloudPlatform`].
19108    ///
19109    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19110    /// tokens for more than one scope.
19111    ///
19112    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19113    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19114    /// sufficient, a read-write scope will do as well.
19115    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
19116    where
19117        St: AsRef<str>,
19118    {
19119        self._scopes.insert(String::from(scope.as_ref()));
19120        self
19121    }
19122    /// Identifies the authorization scope(s) for the method you are building.
19123    ///
19124    /// See [`Self::add_scope()`] for details.
19125    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceSetIamPolicyCall<'a, C>
19126    where
19127        I: IntoIterator<Item = St>,
19128        St: AsRef<str>,
19129    {
19130        self._scopes
19131            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19132        self
19133    }
19134
19135    /// Removes all scopes, and no default scope will be used either.
19136    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19137    /// for details).
19138    pub fn clear_scopes(mut self) -> ProjectLocationServiceSetIamPolicyCall<'a, C> {
19139        self._scopes.clear();
19140        self
19141    }
19142}
19143
19144/// Starts the Managed Migration process.
19145///
19146/// A builder for the *locations.services.startMigration* method supported by a *project* resource.
19147/// It is not used directly, but through a [`ProjectMethods`] instance.
19148///
19149/// # Example
19150///
19151/// Instantiate a resource method builder
19152///
19153/// ```test_harness,no_run
19154/// # extern crate hyper;
19155/// # extern crate hyper_rustls;
19156/// # extern crate google_metastore1_beta as metastore1_beta;
19157/// use metastore1_beta::api::StartMigrationRequest;
19158/// # async fn dox() {
19159/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19160///
19161/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19162/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19163/// #     .with_native_roots()
19164/// #     .unwrap()
19165/// #     .https_only()
19166/// #     .enable_http2()
19167/// #     .build();
19168///
19169/// # let executor = hyper_util::rt::TokioExecutor::new();
19170/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19171/// #     secret,
19172/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19173/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19174/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19175/// #     ),
19176/// # ).build().await.unwrap();
19177///
19178/// # let client = hyper_util::client::legacy::Client::builder(
19179/// #     hyper_util::rt::TokioExecutor::new()
19180/// # )
19181/// # .build(
19182/// #     hyper_rustls::HttpsConnectorBuilder::new()
19183/// #         .with_native_roots()
19184/// #         .unwrap()
19185/// #         .https_or_http()
19186/// #         .enable_http2()
19187/// #         .build()
19188/// # );
19189/// # let mut hub = DataprocMetastore::new(client, auth);
19190/// // As the method needs a request, you would usually fill it with the desired information
19191/// // into the respective structure. Some of the parts shown here might not be applicable !
19192/// // Values shown here are possibly random and not representative !
19193/// let mut req = StartMigrationRequest::default();
19194///
19195/// // You can configure optional parameters by calling the respective setters at will, and
19196/// // execute the final call using `doit()`.
19197/// // Values shown here are possibly random and not representative !
19198/// let result = hub.projects().locations_services_start_migration(req, "service")
19199///              .doit().await;
19200/// # }
19201/// ```
19202pub struct ProjectLocationServiceStartMigrationCall<'a, C>
19203where
19204    C: 'a,
19205{
19206    hub: &'a DataprocMetastore<C>,
19207    _request: StartMigrationRequest,
19208    _service: String,
19209    _delegate: Option<&'a mut dyn common::Delegate>,
19210    _additional_params: HashMap<String, String>,
19211    _scopes: BTreeSet<String>,
19212}
19213
19214impl<'a, C> common::CallBuilder for ProjectLocationServiceStartMigrationCall<'a, C> {}
19215
19216impl<'a, C> ProjectLocationServiceStartMigrationCall<'a, C>
19217where
19218    C: common::Connector,
19219{
19220    /// Perform the operation you have build so far.
19221    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19222        use std::borrow::Cow;
19223        use std::io::{Read, Seek};
19224
19225        use common::{url::Params, ToParts};
19226        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19227
19228        let mut dd = common::DefaultDelegate;
19229        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19230        dlg.begin(common::MethodInfo {
19231            id: "metastore.projects.locations.services.startMigration",
19232            http_method: hyper::Method::POST,
19233        });
19234
19235        for &field in ["alt", "service"].iter() {
19236            if self._additional_params.contains_key(field) {
19237                dlg.finished(false);
19238                return Err(common::Error::FieldClash(field));
19239            }
19240        }
19241
19242        let mut params = Params::with_capacity(4 + self._additional_params.len());
19243        params.push("service", self._service);
19244
19245        params.extend(self._additional_params.iter());
19246
19247        params.push("alt", "json");
19248        let mut url = self.hub._base_url.clone() + "v1beta/{+service}:startMigration";
19249        if self._scopes.is_empty() {
19250            self._scopes
19251                .insert(Scope::CloudPlatform.as_ref().to_string());
19252        }
19253
19254        #[allow(clippy::single_element_loop)]
19255        for &(find_this, param_name) in [("{+service}", "service")].iter() {
19256            url = params.uri_replacement(url, param_name, find_this, true);
19257        }
19258        {
19259            let to_remove = ["service"];
19260            params.remove_params(&to_remove);
19261        }
19262
19263        let url = params.parse_with_url(&url);
19264
19265        let mut json_mime_type = mime::APPLICATION_JSON;
19266        let mut request_value_reader = {
19267            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19268            common::remove_json_null_values(&mut value);
19269            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19270            serde_json::to_writer(&mut dst, &value).unwrap();
19271            dst
19272        };
19273        let request_size = request_value_reader
19274            .seek(std::io::SeekFrom::End(0))
19275            .unwrap();
19276        request_value_reader
19277            .seek(std::io::SeekFrom::Start(0))
19278            .unwrap();
19279
19280        loop {
19281            let token = match self
19282                .hub
19283                .auth
19284                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19285                .await
19286            {
19287                Ok(token) => token,
19288                Err(e) => match dlg.token(e) {
19289                    Ok(token) => token,
19290                    Err(e) => {
19291                        dlg.finished(false);
19292                        return Err(common::Error::MissingToken(e));
19293                    }
19294                },
19295            };
19296            request_value_reader
19297                .seek(std::io::SeekFrom::Start(0))
19298                .unwrap();
19299            let mut req_result = {
19300                let client = &self.hub.client;
19301                dlg.pre_request();
19302                let mut req_builder = hyper::Request::builder()
19303                    .method(hyper::Method::POST)
19304                    .uri(url.as_str())
19305                    .header(USER_AGENT, self.hub._user_agent.clone());
19306
19307                if let Some(token) = token.as_ref() {
19308                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19309                }
19310
19311                let request = req_builder
19312                    .header(CONTENT_TYPE, json_mime_type.to_string())
19313                    .header(CONTENT_LENGTH, request_size as u64)
19314                    .body(common::to_body(
19315                        request_value_reader.get_ref().clone().into(),
19316                    ));
19317
19318                client.request(request.unwrap()).await
19319            };
19320
19321            match req_result {
19322                Err(err) => {
19323                    if let common::Retry::After(d) = dlg.http_error(&err) {
19324                        sleep(d).await;
19325                        continue;
19326                    }
19327                    dlg.finished(false);
19328                    return Err(common::Error::HttpError(err));
19329                }
19330                Ok(res) => {
19331                    let (mut parts, body) = res.into_parts();
19332                    let mut body = common::Body::new(body);
19333                    if !parts.status.is_success() {
19334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19335                        let error = serde_json::from_str(&common::to_string(&bytes));
19336                        let response = common::to_response(parts, bytes.into());
19337
19338                        if let common::Retry::After(d) =
19339                            dlg.http_failure(&response, error.as_ref().ok())
19340                        {
19341                            sleep(d).await;
19342                            continue;
19343                        }
19344
19345                        dlg.finished(false);
19346
19347                        return Err(match error {
19348                            Ok(value) => common::Error::BadRequest(value),
19349                            _ => common::Error::Failure(response),
19350                        });
19351                    }
19352                    let response = {
19353                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19354                        let encoded = common::to_string(&bytes);
19355                        match serde_json::from_str(&encoded) {
19356                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19357                            Err(error) => {
19358                                dlg.response_json_decode_error(&encoded, &error);
19359                                return Err(common::Error::JsonDecodeError(
19360                                    encoded.to_string(),
19361                                    error,
19362                                ));
19363                            }
19364                        }
19365                    };
19366
19367                    dlg.finished(true);
19368                    return Ok(response);
19369                }
19370            }
19371        }
19372    }
19373
19374    ///
19375    /// Sets the *request* property to the given value.
19376    ///
19377    /// Even though the property as already been set when instantiating this call,
19378    /// we provide this method for API completeness.
19379    pub fn request(
19380        mut self,
19381        new_value: StartMigrationRequest,
19382    ) -> ProjectLocationServiceStartMigrationCall<'a, C> {
19383        self._request = new_value;
19384        self
19385    }
19386    /// Required. The relative resource name of the metastore service to start migrating to, in the following format:projects/{project_id}/locations/{location_id}/services/{service_id}.
19387    ///
19388    /// Sets the *service* path property to the given value.
19389    ///
19390    /// Even though the property as already been set when instantiating this call,
19391    /// we provide this method for API completeness.
19392    pub fn service(mut self, new_value: &str) -> ProjectLocationServiceStartMigrationCall<'a, C> {
19393        self._service = new_value.to_string();
19394        self
19395    }
19396    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19397    /// while executing the actual API request.
19398    ///
19399    /// ````text
19400    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19401    /// ````
19402    ///
19403    /// Sets the *delegate* property to the given value.
19404    pub fn delegate(
19405        mut self,
19406        new_value: &'a mut dyn common::Delegate,
19407    ) -> ProjectLocationServiceStartMigrationCall<'a, C> {
19408        self._delegate = Some(new_value);
19409        self
19410    }
19411
19412    /// Set any additional parameter of the query string used in the request.
19413    /// It should be used to set parameters which are not yet available through their own
19414    /// setters.
19415    ///
19416    /// Please note that this method must not be used to set any of the known parameters
19417    /// which have their own setter method. If done anyway, the request will fail.
19418    ///
19419    /// # Additional Parameters
19420    ///
19421    /// * *$.xgafv* (query-string) - V1 error format.
19422    /// * *access_token* (query-string) - OAuth access token.
19423    /// * *alt* (query-string) - Data format for response.
19424    /// * *callback* (query-string) - JSONP
19425    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19426    /// * *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.
19427    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19428    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19429    /// * *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.
19430    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19431    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19432    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationServiceStartMigrationCall<'a, C>
19433    where
19434        T: AsRef<str>,
19435    {
19436        self._additional_params
19437            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19438        self
19439    }
19440
19441    /// Identifies the authorization scope for the method you are building.
19442    ///
19443    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19444    /// [`Scope::CloudPlatform`].
19445    ///
19446    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19447    /// tokens for more than one scope.
19448    ///
19449    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19450    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19451    /// sufficient, a read-write scope will do as well.
19452    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceStartMigrationCall<'a, C>
19453    where
19454        St: AsRef<str>,
19455    {
19456        self._scopes.insert(String::from(scope.as_ref()));
19457        self
19458    }
19459    /// Identifies the authorization scope(s) for the method you are building.
19460    ///
19461    /// See [`Self::add_scope()`] for details.
19462    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationServiceStartMigrationCall<'a, C>
19463    where
19464        I: IntoIterator<Item = St>,
19465        St: AsRef<str>,
19466    {
19467        self._scopes
19468            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19469        self
19470    }
19471
19472    /// Removes all scopes, and no default scope will be used either.
19473    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19474    /// for details).
19475    pub fn clear_scopes(mut self) -> ProjectLocationServiceStartMigrationCall<'a, C> {
19476        self._scopes.clear();
19477        self
19478    }
19479}
19480
19481/// 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.
19482///
19483/// A builder for the *locations.services.testIamPermissions* method supported by a *project* resource.
19484/// It is not used directly, but through a [`ProjectMethods`] instance.
19485///
19486/// # Example
19487///
19488/// Instantiate a resource method builder
19489///
19490/// ```test_harness,no_run
19491/// # extern crate hyper;
19492/// # extern crate hyper_rustls;
19493/// # extern crate google_metastore1_beta as metastore1_beta;
19494/// use metastore1_beta::api::TestIamPermissionsRequest;
19495/// # async fn dox() {
19496/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19497///
19498/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19499/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19500/// #     .with_native_roots()
19501/// #     .unwrap()
19502/// #     .https_only()
19503/// #     .enable_http2()
19504/// #     .build();
19505///
19506/// # let executor = hyper_util::rt::TokioExecutor::new();
19507/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19508/// #     secret,
19509/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19510/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19511/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19512/// #     ),
19513/// # ).build().await.unwrap();
19514///
19515/// # let client = hyper_util::client::legacy::Client::builder(
19516/// #     hyper_util::rt::TokioExecutor::new()
19517/// # )
19518/// # .build(
19519/// #     hyper_rustls::HttpsConnectorBuilder::new()
19520/// #         .with_native_roots()
19521/// #         .unwrap()
19522/// #         .https_or_http()
19523/// #         .enable_http2()
19524/// #         .build()
19525/// # );
19526/// # let mut hub = DataprocMetastore::new(client, auth);
19527/// // As the method needs a request, you would usually fill it with the desired information
19528/// // into the respective structure. Some of the parts shown here might not be applicable !
19529/// // Values shown here are possibly random and not representative !
19530/// let mut req = TestIamPermissionsRequest::default();
19531///
19532/// // You can configure optional parameters by calling the respective setters at will, and
19533/// // execute the final call using `doit()`.
19534/// // Values shown here are possibly random and not representative !
19535/// let result = hub.projects().locations_services_test_iam_permissions(req, "resource")
19536///              .doit().await;
19537/// # }
19538/// ```
19539pub struct ProjectLocationServiceTestIamPermissionCall<'a, C>
19540where
19541    C: 'a,
19542{
19543    hub: &'a DataprocMetastore<C>,
19544    _request: TestIamPermissionsRequest,
19545    _resource: String,
19546    _delegate: Option<&'a mut dyn common::Delegate>,
19547    _additional_params: HashMap<String, String>,
19548    _scopes: BTreeSet<String>,
19549}
19550
19551impl<'a, C> common::CallBuilder for ProjectLocationServiceTestIamPermissionCall<'a, C> {}
19552
19553impl<'a, C> ProjectLocationServiceTestIamPermissionCall<'a, C>
19554where
19555    C: common::Connector,
19556{
19557    /// Perform the operation you have build so far.
19558    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
19559        use std::borrow::Cow;
19560        use std::io::{Read, Seek};
19561
19562        use common::{url::Params, ToParts};
19563        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19564
19565        let mut dd = common::DefaultDelegate;
19566        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19567        dlg.begin(common::MethodInfo {
19568            id: "metastore.projects.locations.services.testIamPermissions",
19569            http_method: hyper::Method::POST,
19570        });
19571
19572        for &field in ["alt", "resource"].iter() {
19573            if self._additional_params.contains_key(field) {
19574                dlg.finished(false);
19575                return Err(common::Error::FieldClash(field));
19576            }
19577        }
19578
19579        let mut params = Params::with_capacity(4 + self._additional_params.len());
19580        params.push("resource", self._resource);
19581
19582        params.extend(self._additional_params.iter());
19583
19584        params.push("alt", "json");
19585        let mut url = self.hub._base_url.clone() + "v1beta/{+resource}:testIamPermissions";
19586        if self._scopes.is_empty() {
19587            self._scopes
19588                .insert(Scope::CloudPlatform.as_ref().to_string());
19589        }
19590
19591        #[allow(clippy::single_element_loop)]
19592        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19593            url = params.uri_replacement(url, param_name, find_this, true);
19594        }
19595        {
19596            let to_remove = ["resource"];
19597            params.remove_params(&to_remove);
19598        }
19599
19600        let url = params.parse_with_url(&url);
19601
19602        let mut json_mime_type = mime::APPLICATION_JSON;
19603        let mut request_value_reader = {
19604            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19605            common::remove_json_null_values(&mut value);
19606            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19607            serde_json::to_writer(&mut dst, &value).unwrap();
19608            dst
19609        };
19610        let request_size = request_value_reader
19611            .seek(std::io::SeekFrom::End(0))
19612            .unwrap();
19613        request_value_reader
19614            .seek(std::io::SeekFrom::Start(0))
19615            .unwrap();
19616
19617        loop {
19618            let token = match self
19619                .hub
19620                .auth
19621                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19622                .await
19623            {
19624                Ok(token) => token,
19625                Err(e) => match dlg.token(e) {
19626                    Ok(token) => token,
19627                    Err(e) => {
19628                        dlg.finished(false);
19629                        return Err(common::Error::MissingToken(e));
19630                    }
19631                },
19632            };
19633            request_value_reader
19634                .seek(std::io::SeekFrom::Start(0))
19635                .unwrap();
19636            let mut req_result = {
19637                let client = &self.hub.client;
19638                dlg.pre_request();
19639                let mut req_builder = hyper::Request::builder()
19640                    .method(hyper::Method::POST)
19641                    .uri(url.as_str())
19642                    .header(USER_AGENT, self.hub._user_agent.clone());
19643
19644                if let Some(token) = token.as_ref() {
19645                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19646                }
19647
19648                let request = req_builder
19649                    .header(CONTENT_TYPE, json_mime_type.to_string())
19650                    .header(CONTENT_LENGTH, request_size as u64)
19651                    .body(common::to_body(
19652                        request_value_reader.get_ref().clone().into(),
19653                    ));
19654
19655                client.request(request.unwrap()).await
19656            };
19657
19658            match req_result {
19659                Err(err) => {
19660                    if let common::Retry::After(d) = dlg.http_error(&err) {
19661                        sleep(d).await;
19662                        continue;
19663                    }
19664                    dlg.finished(false);
19665                    return Err(common::Error::HttpError(err));
19666                }
19667                Ok(res) => {
19668                    let (mut parts, body) = res.into_parts();
19669                    let mut body = common::Body::new(body);
19670                    if !parts.status.is_success() {
19671                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19672                        let error = serde_json::from_str(&common::to_string(&bytes));
19673                        let response = common::to_response(parts, bytes.into());
19674
19675                        if let common::Retry::After(d) =
19676                            dlg.http_failure(&response, error.as_ref().ok())
19677                        {
19678                            sleep(d).await;
19679                            continue;
19680                        }
19681
19682                        dlg.finished(false);
19683
19684                        return Err(match error {
19685                            Ok(value) => common::Error::BadRequest(value),
19686                            _ => common::Error::Failure(response),
19687                        });
19688                    }
19689                    let response = {
19690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19691                        let encoded = common::to_string(&bytes);
19692                        match serde_json::from_str(&encoded) {
19693                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19694                            Err(error) => {
19695                                dlg.response_json_decode_error(&encoded, &error);
19696                                return Err(common::Error::JsonDecodeError(
19697                                    encoded.to_string(),
19698                                    error,
19699                                ));
19700                            }
19701                        }
19702                    };
19703
19704                    dlg.finished(true);
19705                    return Ok(response);
19706                }
19707            }
19708        }
19709    }
19710
19711    ///
19712    /// Sets the *request* property to the given value.
19713    ///
19714    /// Even though the property as already been set when instantiating this call,
19715    /// we provide this method for API completeness.
19716    pub fn request(
19717        mut self,
19718        new_value: TestIamPermissionsRequest,
19719    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
19720        self._request = new_value;
19721        self
19722    }
19723    /// 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.
19724    ///
19725    /// Sets the *resource* path property to the given value.
19726    ///
19727    /// Even though the property as already been set when instantiating this call,
19728    /// we provide this method for API completeness.
19729    pub fn resource(
19730        mut self,
19731        new_value: &str,
19732    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
19733        self._resource = new_value.to_string();
19734        self
19735    }
19736    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19737    /// while executing the actual API request.
19738    ///
19739    /// ````text
19740    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19741    /// ````
19742    ///
19743    /// Sets the *delegate* property to the given value.
19744    pub fn delegate(
19745        mut self,
19746        new_value: &'a mut dyn common::Delegate,
19747    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
19748        self._delegate = Some(new_value);
19749        self
19750    }
19751
19752    /// Set any additional parameter of the query string used in the request.
19753    /// It should be used to set parameters which are not yet available through their own
19754    /// setters.
19755    ///
19756    /// Please note that this method must not be used to set any of the known parameters
19757    /// which have their own setter method. If done anyway, the request will fail.
19758    ///
19759    /// # Additional Parameters
19760    ///
19761    /// * *$.xgafv* (query-string) - V1 error format.
19762    /// * *access_token* (query-string) - OAuth access token.
19763    /// * *alt* (query-string) - Data format for response.
19764    /// * *callback* (query-string) - JSONP
19765    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19766    /// * *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.
19767    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19768    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19769    /// * *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.
19770    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19771    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19772    pub fn param<T>(
19773        mut self,
19774        name: T,
19775        value: T,
19776    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
19777    where
19778        T: AsRef<str>,
19779    {
19780        self._additional_params
19781            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19782        self
19783    }
19784
19785    /// Identifies the authorization scope for the method you are building.
19786    ///
19787    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19788    /// [`Scope::CloudPlatform`].
19789    ///
19790    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19791    /// tokens for more than one scope.
19792    ///
19793    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19794    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19795    /// sufficient, a read-write scope will do as well.
19796    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
19797    where
19798        St: AsRef<str>,
19799    {
19800        self._scopes.insert(String::from(scope.as_ref()));
19801        self
19802    }
19803    /// Identifies the authorization scope(s) for the method you are building.
19804    ///
19805    /// See [`Self::add_scope()`] for details.
19806    pub fn add_scopes<I, St>(
19807        mut self,
19808        scopes: I,
19809    ) -> ProjectLocationServiceTestIamPermissionCall<'a, C>
19810    where
19811        I: IntoIterator<Item = St>,
19812        St: AsRef<str>,
19813    {
19814        self._scopes
19815            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19816        self
19817    }
19818
19819    /// Removes all scopes, and no default scope will be used either.
19820    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19821    /// for details).
19822    pub fn clear_scopes(mut self) -> ProjectLocationServiceTestIamPermissionCall<'a, C> {
19823        self._scopes.clear();
19824        self
19825    }
19826}
19827
19828/// Gets information about a location.
19829///
19830/// A builder for the *locations.get* method supported by a *project* resource.
19831/// It is not used directly, but through a [`ProjectMethods`] instance.
19832///
19833/// # Example
19834///
19835/// Instantiate a resource method builder
19836///
19837/// ```test_harness,no_run
19838/// # extern crate hyper;
19839/// # extern crate hyper_rustls;
19840/// # extern crate google_metastore1_beta as metastore1_beta;
19841/// # async fn dox() {
19842/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19843///
19844/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19845/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19846/// #     .with_native_roots()
19847/// #     .unwrap()
19848/// #     .https_only()
19849/// #     .enable_http2()
19850/// #     .build();
19851///
19852/// # let executor = hyper_util::rt::TokioExecutor::new();
19853/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19854/// #     secret,
19855/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19856/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19857/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19858/// #     ),
19859/// # ).build().await.unwrap();
19860///
19861/// # let client = hyper_util::client::legacy::Client::builder(
19862/// #     hyper_util::rt::TokioExecutor::new()
19863/// # )
19864/// # .build(
19865/// #     hyper_rustls::HttpsConnectorBuilder::new()
19866/// #         .with_native_roots()
19867/// #         .unwrap()
19868/// #         .https_or_http()
19869/// #         .enable_http2()
19870/// #         .build()
19871/// # );
19872/// # let mut hub = DataprocMetastore::new(client, auth);
19873/// // You can configure optional parameters by calling the respective setters at will, and
19874/// // execute the final call using `doit()`.
19875/// // Values shown here are possibly random and not representative !
19876/// let result = hub.projects().locations_get("name")
19877///              .doit().await;
19878/// # }
19879/// ```
19880pub struct ProjectLocationGetCall<'a, C>
19881where
19882    C: 'a,
19883{
19884    hub: &'a DataprocMetastore<C>,
19885    _name: String,
19886    _delegate: Option<&'a mut dyn common::Delegate>,
19887    _additional_params: HashMap<String, String>,
19888    _scopes: BTreeSet<String>,
19889}
19890
19891impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
19892
19893impl<'a, C> ProjectLocationGetCall<'a, C>
19894where
19895    C: common::Connector,
19896{
19897    /// Perform the operation you have build so far.
19898    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
19899        use std::borrow::Cow;
19900        use std::io::{Read, Seek};
19901
19902        use common::{url::Params, ToParts};
19903        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19904
19905        let mut dd = common::DefaultDelegate;
19906        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19907        dlg.begin(common::MethodInfo {
19908            id: "metastore.projects.locations.get",
19909            http_method: hyper::Method::GET,
19910        });
19911
19912        for &field in ["alt", "name"].iter() {
19913            if self._additional_params.contains_key(field) {
19914                dlg.finished(false);
19915                return Err(common::Error::FieldClash(field));
19916            }
19917        }
19918
19919        let mut params = Params::with_capacity(3 + self._additional_params.len());
19920        params.push("name", self._name);
19921
19922        params.extend(self._additional_params.iter());
19923
19924        params.push("alt", "json");
19925        let mut url = self.hub._base_url.clone() + "v1beta/{+name}";
19926        if self._scopes.is_empty() {
19927            self._scopes
19928                .insert(Scope::CloudPlatform.as_ref().to_string());
19929        }
19930
19931        #[allow(clippy::single_element_loop)]
19932        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19933            url = params.uri_replacement(url, param_name, find_this, true);
19934        }
19935        {
19936            let to_remove = ["name"];
19937            params.remove_params(&to_remove);
19938        }
19939
19940        let url = params.parse_with_url(&url);
19941
19942        loop {
19943            let token = match self
19944                .hub
19945                .auth
19946                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19947                .await
19948            {
19949                Ok(token) => token,
19950                Err(e) => match dlg.token(e) {
19951                    Ok(token) => token,
19952                    Err(e) => {
19953                        dlg.finished(false);
19954                        return Err(common::Error::MissingToken(e));
19955                    }
19956                },
19957            };
19958            let mut req_result = {
19959                let client = &self.hub.client;
19960                dlg.pre_request();
19961                let mut req_builder = hyper::Request::builder()
19962                    .method(hyper::Method::GET)
19963                    .uri(url.as_str())
19964                    .header(USER_AGENT, self.hub._user_agent.clone());
19965
19966                if let Some(token) = token.as_ref() {
19967                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19968                }
19969
19970                let request = req_builder
19971                    .header(CONTENT_LENGTH, 0_u64)
19972                    .body(common::to_body::<String>(None));
19973
19974                client.request(request.unwrap()).await
19975            };
19976
19977            match req_result {
19978                Err(err) => {
19979                    if let common::Retry::After(d) = dlg.http_error(&err) {
19980                        sleep(d).await;
19981                        continue;
19982                    }
19983                    dlg.finished(false);
19984                    return Err(common::Error::HttpError(err));
19985                }
19986                Ok(res) => {
19987                    let (mut parts, body) = res.into_parts();
19988                    let mut body = common::Body::new(body);
19989                    if !parts.status.is_success() {
19990                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19991                        let error = serde_json::from_str(&common::to_string(&bytes));
19992                        let response = common::to_response(parts, bytes.into());
19993
19994                        if let common::Retry::After(d) =
19995                            dlg.http_failure(&response, error.as_ref().ok())
19996                        {
19997                            sleep(d).await;
19998                            continue;
19999                        }
20000
20001                        dlg.finished(false);
20002
20003                        return Err(match error {
20004                            Ok(value) => common::Error::BadRequest(value),
20005                            _ => common::Error::Failure(response),
20006                        });
20007                    }
20008                    let response = {
20009                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20010                        let encoded = common::to_string(&bytes);
20011                        match serde_json::from_str(&encoded) {
20012                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20013                            Err(error) => {
20014                                dlg.response_json_decode_error(&encoded, &error);
20015                                return Err(common::Error::JsonDecodeError(
20016                                    encoded.to_string(),
20017                                    error,
20018                                ));
20019                            }
20020                        }
20021                    };
20022
20023                    dlg.finished(true);
20024                    return Ok(response);
20025                }
20026            }
20027        }
20028    }
20029
20030    /// Resource name for the location.
20031    ///
20032    /// Sets the *name* path property to the given value.
20033    ///
20034    /// Even though the property as already been set when instantiating this call,
20035    /// we provide this method for API completeness.
20036    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
20037        self._name = new_value.to_string();
20038        self
20039    }
20040    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20041    /// while executing the actual API request.
20042    ///
20043    /// ````text
20044    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20045    /// ````
20046    ///
20047    /// Sets the *delegate* property to the given value.
20048    pub fn delegate(
20049        mut self,
20050        new_value: &'a mut dyn common::Delegate,
20051    ) -> ProjectLocationGetCall<'a, C> {
20052        self._delegate = Some(new_value);
20053        self
20054    }
20055
20056    /// Set any additional parameter of the query string used in the request.
20057    /// It should be used to set parameters which are not yet available through their own
20058    /// setters.
20059    ///
20060    /// Please note that this method must not be used to set any of the known parameters
20061    /// which have their own setter method. If done anyway, the request will fail.
20062    ///
20063    /// # Additional Parameters
20064    ///
20065    /// * *$.xgafv* (query-string) - V1 error format.
20066    /// * *access_token* (query-string) - OAuth access token.
20067    /// * *alt* (query-string) - Data format for response.
20068    /// * *callback* (query-string) - JSONP
20069    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20070    /// * *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.
20071    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20072    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20073    /// * *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.
20074    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20075    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20076    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
20077    where
20078        T: AsRef<str>,
20079    {
20080        self._additional_params
20081            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20082        self
20083    }
20084
20085    /// Identifies the authorization scope for the method you are building.
20086    ///
20087    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20088    /// [`Scope::CloudPlatform`].
20089    ///
20090    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20091    /// tokens for more than one scope.
20092    ///
20093    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20094    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20095    /// sufficient, a read-write scope will do as well.
20096    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
20097    where
20098        St: AsRef<str>,
20099    {
20100        self._scopes.insert(String::from(scope.as_ref()));
20101        self
20102    }
20103    /// Identifies the authorization scope(s) for the method you are building.
20104    ///
20105    /// See [`Self::add_scope()`] for details.
20106    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
20107    where
20108        I: IntoIterator<Item = St>,
20109        St: AsRef<str>,
20110    {
20111        self._scopes
20112            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20113        self
20114    }
20115
20116    /// Removes all scopes, and no default scope will be used either.
20117    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20118    /// for details).
20119    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
20120        self._scopes.clear();
20121        self
20122    }
20123}
20124
20125/// Lists information about the supported locations for this service.
20126///
20127/// A builder for the *locations.list* method supported by a *project* resource.
20128/// It is not used directly, but through a [`ProjectMethods`] instance.
20129///
20130/// # Example
20131///
20132/// Instantiate a resource method builder
20133///
20134/// ```test_harness,no_run
20135/// # extern crate hyper;
20136/// # extern crate hyper_rustls;
20137/// # extern crate google_metastore1_beta as metastore1_beta;
20138/// # async fn dox() {
20139/// # use metastore1_beta::{DataprocMetastore, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20140///
20141/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20142/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20143/// #     .with_native_roots()
20144/// #     .unwrap()
20145/// #     .https_only()
20146/// #     .enable_http2()
20147/// #     .build();
20148///
20149/// # let executor = hyper_util::rt::TokioExecutor::new();
20150/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20151/// #     secret,
20152/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20153/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20154/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20155/// #     ),
20156/// # ).build().await.unwrap();
20157///
20158/// # let client = hyper_util::client::legacy::Client::builder(
20159/// #     hyper_util::rt::TokioExecutor::new()
20160/// # )
20161/// # .build(
20162/// #     hyper_rustls::HttpsConnectorBuilder::new()
20163/// #         .with_native_roots()
20164/// #         .unwrap()
20165/// #         .https_or_http()
20166/// #         .enable_http2()
20167/// #         .build()
20168/// # );
20169/// # let mut hub = DataprocMetastore::new(client, auth);
20170/// // You can configure optional parameters by calling the respective setters at will, and
20171/// // execute the final call using `doit()`.
20172/// // Values shown here are possibly random and not representative !
20173/// let result = hub.projects().locations_list("name")
20174///              .page_token("tempor")
20175///              .page_size(-32)
20176///              .filter("ipsum")
20177///              .add_extra_location_types("et")
20178///              .doit().await;
20179/// # }
20180/// ```
20181pub struct ProjectLocationListCall<'a, C>
20182where
20183    C: 'a,
20184{
20185    hub: &'a DataprocMetastore<C>,
20186    _name: String,
20187    _page_token: Option<String>,
20188    _page_size: Option<i32>,
20189    _filter: Option<String>,
20190    _extra_location_types: Vec<String>,
20191    _delegate: Option<&'a mut dyn common::Delegate>,
20192    _additional_params: HashMap<String, String>,
20193    _scopes: BTreeSet<String>,
20194}
20195
20196impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
20197
20198impl<'a, C> ProjectLocationListCall<'a, C>
20199where
20200    C: common::Connector,
20201{
20202    /// Perform the operation you have build so far.
20203    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
20204        use std::borrow::Cow;
20205        use std::io::{Read, Seek};
20206
20207        use common::{url::Params, ToParts};
20208        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20209
20210        let mut dd = common::DefaultDelegate;
20211        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20212        dlg.begin(common::MethodInfo {
20213            id: "metastore.projects.locations.list",
20214            http_method: hyper::Method::GET,
20215        });
20216
20217        for &field in [
20218            "alt",
20219            "name",
20220            "pageToken",
20221            "pageSize",
20222            "filter",
20223            "extraLocationTypes",
20224        ]
20225        .iter()
20226        {
20227            if self._additional_params.contains_key(field) {
20228                dlg.finished(false);
20229                return Err(common::Error::FieldClash(field));
20230            }
20231        }
20232
20233        let mut params = Params::with_capacity(7 + self._additional_params.len());
20234        params.push("name", self._name);
20235        if let Some(value) = self._page_token.as_ref() {
20236            params.push("pageToken", value);
20237        }
20238        if let Some(value) = self._page_size.as_ref() {
20239            params.push("pageSize", value.to_string());
20240        }
20241        if let Some(value) = self._filter.as_ref() {
20242            params.push("filter", value);
20243        }
20244        if !self._extra_location_types.is_empty() {
20245            for f in self._extra_location_types.iter() {
20246                params.push("extraLocationTypes", f);
20247            }
20248        }
20249
20250        params.extend(self._additional_params.iter());
20251
20252        params.push("alt", "json");
20253        let mut url = self.hub._base_url.clone() + "v1beta/{+name}/locations";
20254        if self._scopes.is_empty() {
20255            self._scopes
20256                .insert(Scope::CloudPlatform.as_ref().to_string());
20257        }
20258
20259        #[allow(clippy::single_element_loop)]
20260        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20261            url = params.uri_replacement(url, param_name, find_this, true);
20262        }
20263        {
20264            let to_remove = ["name"];
20265            params.remove_params(&to_remove);
20266        }
20267
20268        let url = params.parse_with_url(&url);
20269
20270        loop {
20271            let token = match self
20272                .hub
20273                .auth
20274                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20275                .await
20276            {
20277                Ok(token) => token,
20278                Err(e) => match dlg.token(e) {
20279                    Ok(token) => token,
20280                    Err(e) => {
20281                        dlg.finished(false);
20282                        return Err(common::Error::MissingToken(e));
20283                    }
20284                },
20285            };
20286            let mut req_result = {
20287                let client = &self.hub.client;
20288                dlg.pre_request();
20289                let mut req_builder = hyper::Request::builder()
20290                    .method(hyper::Method::GET)
20291                    .uri(url.as_str())
20292                    .header(USER_AGENT, self.hub._user_agent.clone());
20293
20294                if let Some(token) = token.as_ref() {
20295                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20296                }
20297
20298                let request = req_builder
20299                    .header(CONTENT_LENGTH, 0_u64)
20300                    .body(common::to_body::<String>(None));
20301
20302                client.request(request.unwrap()).await
20303            };
20304
20305            match req_result {
20306                Err(err) => {
20307                    if let common::Retry::After(d) = dlg.http_error(&err) {
20308                        sleep(d).await;
20309                        continue;
20310                    }
20311                    dlg.finished(false);
20312                    return Err(common::Error::HttpError(err));
20313                }
20314                Ok(res) => {
20315                    let (mut parts, body) = res.into_parts();
20316                    let mut body = common::Body::new(body);
20317                    if !parts.status.is_success() {
20318                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20319                        let error = serde_json::from_str(&common::to_string(&bytes));
20320                        let response = common::to_response(parts, bytes.into());
20321
20322                        if let common::Retry::After(d) =
20323                            dlg.http_failure(&response, error.as_ref().ok())
20324                        {
20325                            sleep(d).await;
20326                            continue;
20327                        }
20328
20329                        dlg.finished(false);
20330
20331                        return Err(match error {
20332                            Ok(value) => common::Error::BadRequest(value),
20333                            _ => common::Error::Failure(response),
20334                        });
20335                    }
20336                    let response = {
20337                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20338                        let encoded = common::to_string(&bytes);
20339                        match serde_json::from_str(&encoded) {
20340                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20341                            Err(error) => {
20342                                dlg.response_json_decode_error(&encoded, &error);
20343                                return Err(common::Error::JsonDecodeError(
20344                                    encoded.to_string(),
20345                                    error,
20346                                ));
20347                            }
20348                        }
20349                    };
20350
20351                    dlg.finished(true);
20352                    return Ok(response);
20353                }
20354            }
20355        }
20356    }
20357
20358    /// The resource that owns the locations collection, if applicable.
20359    ///
20360    /// Sets the *name* path property to the given value.
20361    ///
20362    /// Even though the property as already been set when instantiating this call,
20363    /// we provide this method for API completeness.
20364    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
20365        self._name = new_value.to_string();
20366        self
20367    }
20368    /// A page token received from the next_page_token field in the response. Send that page token to receive the subsequent page.
20369    ///
20370    /// Sets the *page token* query property to the given value.
20371    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
20372        self._page_token = Some(new_value.to_string());
20373        self
20374    }
20375    /// The maximum number of results to return. If not set, the service selects a default.
20376    ///
20377    /// Sets the *page size* query property to the given value.
20378    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
20379        self._page_size = Some(new_value);
20380        self
20381    }
20382    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in AIP-160 (https://google.aip.dev/160).
20383    ///
20384    /// Sets the *filter* query property to the given value.
20385    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
20386        self._filter = Some(new_value.to_string());
20387        self
20388    }
20389    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
20390    ///
20391    /// Append the given value to the *extra location types* query property.
20392    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
20393    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
20394        self._extra_location_types.push(new_value.to_string());
20395        self
20396    }
20397    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20398    /// while executing the actual API request.
20399    ///
20400    /// ````text
20401    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20402    /// ````
20403    ///
20404    /// Sets the *delegate* property to the given value.
20405    pub fn delegate(
20406        mut self,
20407        new_value: &'a mut dyn common::Delegate,
20408    ) -> ProjectLocationListCall<'a, C> {
20409        self._delegate = Some(new_value);
20410        self
20411    }
20412
20413    /// Set any additional parameter of the query string used in the request.
20414    /// It should be used to set parameters which are not yet available through their own
20415    /// setters.
20416    ///
20417    /// Please note that this method must not be used to set any of the known parameters
20418    /// which have their own setter method. If done anyway, the request will fail.
20419    ///
20420    /// # Additional Parameters
20421    ///
20422    /// * *$.xgafv* (query-string) - V1 error format.
20423    /// * *access_token* (query-string) - OAuth access token.
20424    /// * *alt* (query-string) - Data format for response.
20425    /// * *callback* (query-string) - JSONP
20426    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20427    /// * *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.
20428    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20429    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20430    /// * *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.
20431    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20432    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20433    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
20434    where
20435        T: AsRef<str>,
20436    {
20437        self._additional_params
20438            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20439        self
20440    }
20441
20442    /// Identifies the authorization scope for the method you are building.
20443    ///
20444    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20445    /// [`Scope::CloudPlatform`].
20446    ///
20447    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20448    /// tokens for more than one scope.
20449    ///
20450    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20451    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20452    /// sufficient, a read-write scope will do as well.
20453    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
20454    where
20455        St: AsRef<str>,
20456    {
20457        self._scopes.insert(String::from(scope.as_ref()));
20458        self
20459    }
20460    /// Identifies the authorization scope(s) for the method you are building.
20461    ///
20462    /// See [`Self::add_scope()`] for details.
20463    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
20464    where
20465        I: IntoIterator<Item = St>,
20466        St: AsRef<str>,
20467    {
20468        self._scopes
20469            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20470        self
20471    }
20472
20473    /// Removes all scopes, and no default scope will be used either.
20474    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20475    /// for details).
20476    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
20477        self._scopes.clear();
20478        self
20479    }
20480}