google_datamigration1/
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 DatabaseMigrationService 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_datamigration1 as datamigration1;
49/// use datamigration1::api::ConnectionProfile;
50/// use datamigration1::{Result, Error};
51/// # async fn dox() {
52/// use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = DatabaseMigrationService::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = ConnectionProfile::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
88///              .validate_only(true)
89///              .skip_validation(false)
90///              .request_id("amet")
91///              .connection_profile_id("duo")
92///              .doit().await;
93///
94/// match result {
95///     Err(e) => match e {
96///         // The Error enum provides details about what exactly happened.
97///         // You can also just use its `Debug`, `Display` or `Error` traits
98///          Error::HttpError(_)
99///         |Error::Io(_)
100///         |Error::MissingAPIKey
101///         |Error::MissingToken(_)
102///         |Error::Cancelled
103///         |Error::UploadSizeLimitExceeded(_, _)
104///         |Error::Failure(_)
105///         |Error::BadRequest(_)
106///         |Error::FieldClash(_)
107///         |Error::JsonDecodeError(_, _) => println!("{}", e),
108///     },
109///     Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct DatabaseMigrationService<C> {
115    pub client: common::Client<C>,
116    pub auth: Box<dyn common::GetToken>,
117    _user_agent: String,
118    _base_url: String,
119    _root_url: String,
120}
121
122impl<C> common::Hub for DatabaseMigrationService<C> {}
123
124impl<'a, C> DatabaseMigrationService<C> {
125    pub fn new<A: 'static + common::GetToken>(
126        client: common::Client<C>,
127        auth: A,
128    ) -> DatabaseMigrationService<C> {
129        DatabaseMigrationService {
130            client,
131            auth: Box::new(auth),
132            _user_agent: "google-api-rust-client/6.0.0".to_string(),
133            _base_url: "https://datamigration.googleapis.com/".to_string(),
134            _root_url: "https://datamigration.googleapis.com/".to_string(),
135        }
136    }
137
138    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
139        ProjectMethods { hub: self }
140    }
141
142    /// Set the user-agent header field to use in all requests to the server.
143    /// It defaults to `google-api-rust-client/6.0.0`.
144    ///
145    /// Returns the previously set user-agent.
146    pub fn user_agent(&mut self, agent_name: String) -> String {
147        std::mem::replace(&mut self._user_agent, agent_name)
148    }
149
150    /// Set the base url to use in all requests to the server.
151    /// It defaults to `https://datamigration.googleapis.com/`.
152    ///
153    /// Returns the previously set base url.
154    pub fn base_url(&mut self, new_base_url: String) -> String {
155        std::mem::replace(&mut self._base_url, new_base_url)
156    }
157
158    /// Set the root url to use in all requests to the server.
159    /// It defaults to `https://datamigration.googleapis.com/`.
160    ///
161    /// Returns the previously set root url.
162    pub fn root_url(&mut self, new_root_url: String) -> String {
163        std::mem::replace(&mut self._root_url, new_root_url)
164    }
165}
166
167// ############
168// SCHEMAS ###
169// ##########
170/// Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster.
171///
172/// This type is not used in any activity, and only used as *part* of another schema.
173///
174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
175#[serde_with::serde_as]
176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
177pub struct AlloyDbConnectionProfile {
178    /// Required. The AlloyDB cluster ID that this connection profile is associated with.
179    #[serde(rename = "clusterId")]
180    pub cluster_id: Option<String>,
181    /// Immutable. Metadata used to create the destination AlloyDB cluster.
182    pub settings: Option<AlloyDbSettings>,
183}
184
185impl common::Part for AlloyDbConnectionProfile {}
186
187/// Settings for creating an AlloyDB cluster.
188///
189/// This type is not used in any activity, and only used as *part* of another schema.
190///
191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
192#[serde_with::serde_as]
193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
194pub struct AlloyDbSettings {
195    /// Optional. The database engine major version. This is an optional field. If a database version is not supplied at cluster creation time, then a default database version will be used.
196    #[serde(rename = "databaseVersion")]
197    pub database_version: Option<String>,
198    /// Optional. The encryption config can be specified to encrypt the data disks and other persistent data resources of a cluster with a customer-managed encryption key (CMEK). When this field is not specified, the cluster will then use default encryption scheme to protect the user data.
199    #[serde(rename = "encryptionConfig")]
200    pub encryption_config: Option<EncryptionConfig>,
201    /// Required. Input only. Initial user to setup during cluster creation. Required.
202    #[serde(rename = "initialUser")]
203    pub initial_user: Option<UserPassword>,
204    /// Labels for the AlloyDB cluster created by DMS. An object containing a list of 'key', 'value' pairs.
205    pub labels: Option<HashMap<String, String>>,
206    /// no description provided
207    #[serde(rename = "primaryInstanceSettings")]
208    pub primary_instance_settings: Option<PrimaryInstanceSettings>,
209    /// Required. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. It is specified in the form: "projects/{project_number}/global/networks/{network_id}". This is required to create a cluster.
210    #[serde(rename = "vpcNetwork")]
211    pub vpc_network: Option<String>,
212}
213
214impl common::Part for AlloyDbSettings {}
215
216/// Request message for ‘ApplyConversionWorkspace’ request.
217///
218/// # Activities
219///
220/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
221/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
222///
223/// * [locations conversion workspaces apply projects](ProjectLocationConversionWorkspaceApplyCall) (request)
224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
225#[serde_with::serde_as]
226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
227pub struct ApplyConversionWorkspaceRequest {
228    /// Optional. Specifies whether the conversion workspace is to be committed automatically after the apply.
229    #[serde(rename = "autoCommit")]
230    pub auto_commit: Option<bool>,
231    /// Optional. Fully qualified (Uri) name of the destination connection profile.
232    #[serde(rename = "connectionProfile")]
233    pub connection_profile: Option<String>,
234    /// Optional. Only validates the apply process, but doesn't change the destination database. Only works for PostgreSQL destination connection profile.
235    #[serde(rename = "dryRun")]
236    pub dry_run: Option<bool>,
237    /// Filter which entities to apply. Leaving this field empty will apply all of the entities. Supports Google AIP 160 based filtering.
238    pub filter: Option<String>,
239}
240
241impl common::RequestValue for ApplyConversionWorkspaceRequest {}
242
243/// Apply a hash function on the value.
244///
245/// This type is not used in any activity, and only used as *part* of another schema.
246///
247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
248#[serde_with::serde_as]
249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
250pub struct ApplyHash {
251    /// Optional. Generate UUID from the data's byte array
252    #[serde(rename = "uuidFromBytes")]
253    pub uuid_from_bytes: Option<Empty>,
254}
255
256impl common::Part for ApplyHash {}
257
258/// Details regarding an Apply background job.
259///
260/// This type is not used in any activity, and only used as *part* of another schema.
261///
262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
263#[serde_with::serde_as]
264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
265pub struct ApplyJobDetails {
266    /// Output only. The connection profile which was used for the apply job.
267    #[serde(rename = "connectionProfile")]
268    pub connection_profile: Option<String>,
269    /// Output only. AIP-160 based filter used to specify the entities to apply
270    pub filter: Option<String>,
271}
272
273impl common::Part for ApplyJobDetails {}
274
275/// Set to a specific value (value is converted to fit the target data type)
276///
277/// This type is not used in any activity, and only used as *part* of another schema.
278///
279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
280#[serde_with::serde_as]
281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
282pub struct AssignSpecificValue {
283    /// Required. Specific value to be assigned
284    pub value: Option<String>,
285}
286
287impl common::Part for AssignSpecificValue {}
288
289/// 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.
290///
291/// This type is not used in any activity, and only used as *part* of another schema.
292///
293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
294#[serde_with::serde_as]
295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
296pub struct AuditConfig {
297    /// The configuration for logging of each type of permission.
298    #[serde(rename = "auditLogConfigs")]
299    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
300    /// 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.
301    pub service: Option<String>,
302}
303
304impl common::Part for AuditConfig {}
305
306/// 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.
307///
308/// This type is not used in any activity, and only used as *part* of another schema.
309///
310#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
311#[serde_with::serde_as]
312#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
313pub struct AuditLogConfig {
314    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
315    #[serde(rename = "exemptedMembers")]
316    pub exempted_members: Option<Vec<String>>,
317    /// The log type that this config enables.
318    #[serde(rename = "logType")]
319    pub log_type: Option<String>,
320}
321
322impl common::Part for AuditLogConfig {}
323
324/// Execution log of a background job.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct BackgroundJobLogEntry {
332    /// Output only. Apply job details.
333    #[serde(rename = "applyJobDetails")]
334    pub apply_job_details: Option<ApplyJobDetails>,
335    /// Output only. Job completion comment, such as how many entities were seeded, how many warnings were found during conversion, and similar information.
336    #[serde(rename = "completionComment")]
337    pub completion_comment: Option<String>,
338    /// Output only. Job completion state, i.e. the final state after the job completed.
339    #[serde(rename = "completionState")]
340    pub completion_state: Option<String>,
341    /// Output only. Convert job details.
342    #[serde(rename = "convertJobDetails")]
343    pub convert_job_details: Option<ConvertJobDetails>,
344    /// The timestamp when the background job was finished.
345    #[serde(rename = "finishTime")]
346    pub finish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
347    /// The background job log entry ID.
348    pub id: Option<String>,
349    /// Output only. Import rules job details.
350    #[serde(rename = "importRulesJobDetails")]
351    pub import_rules_job_details: Option<ImportRulesJobDetails>,
352    /// The type of job that was executed.
353    #[serde(rename = "jobType")]
354    pub job_type: Option<String>,
355    /// Output only. Whether the client requested the conversion workspace to be committed after a successful completion of the job.
356    #[serde(rename = "requestAutocommit")]
357    pub request_autocommit: Option<bool>,
358    /// Output only. Seed job details.
359    #[serde(rename = "seedJobDetails")]
360    pub seed_job_details: Option<SeedJobDetails>,
361    /// The timestamp when the background job was started.
362    #[serde(rename = "startTime")]
363    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
364}
365
366impl common::Part for BackgroundJobLogEntry {}
367
368/// Associates `members`, or principals, with a `role`.
369///
370/// This type is not used in any activity, and only used as *part* of another schema.
371///
372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
373#[serde_with::serde_as]
374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
375pub struct Binding {
376    /// 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).
377    pub condition: Option<Expr>,
378    /// 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`.
379    pub members: Option<Vec<String>>,
380    /// 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).
381    pub role: Option<String>,
382}
383
384impl common::Part for Binding {}
385
386/// The request message for Operations.CancelOperation.
387///
388/// # Activities
389///
390/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
391/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
392///
393/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
395#[serde_with::serde_as]
396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
397pub struct CancelOperationRequest {
398    _never_set: Option<bool>,
399}
400
401impl common::RequestValue for CancelOperationRequest {}
402
403/// Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance.
404///
405/// This type is not used in any activity, and only used as *part* of another schema.
406///
407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
408#[serde_with::serde_as]
409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
410pub struct CloudSqlConnectionProfile {
411    /// Output only. The Cloud SQL database instance's additional (outgoing) public IP. Used when the Cloud SQL database availability type is REGIONAL (i.e. multiple zones / highly available).
412    #[serde(rename = "additionalPublicIp")]
413    pub additional_public_ip: Option<String>,
414    /// Output only. The Cloud SQL instance ID that this connection profile is associated with.
415    #[serde(rename = "cloudSqlId")]
416    pub cloud_sql_id: Option<String>,
417    /// Output only. The Cloud SQL database instance's private IP.
418    #[serde(rename = "privateIp")]
419    pub private_ip: Option<String>,
420    /// Output only. The Cloud SQL database instance's public IP.
421    #[serde(rename = "publicIp")]
422    pub public_ip: Option<String>,
423    /// Immutable. Metadata used to create the destination Cloud SQL database.
424    pub settings: Option<CloudSqlSettings>,
425}
426
427impl common::Part for CloudSqlConnectionProfile {}
428
429/// Settings for creating a Cloud SQL database instance.
430///
431/// This type is not used in any activity, and only used as *part* of another schema.
432///
433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
434#[serde_with::serde_as]
435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
436pub struct CloudSqlSettings {
437    /// The activation policy specifies when the instance is activated; it is applicable only when the instance state is 'RUNNABLE'. Valid values: 'ALWAYS': The instance is on, and remains so even in the absence of connection requests. `NEVER`: The instance is off; it is not activated, even if a connection request arrives.
438    #[serde(rename = "activationPolicy")]
439    pub activation_policy: Option<String>,
440    /// [default: ON] If you enable this setting, Cloud SQL checks your available storage every 30 seconds. If the available storage falls below a threshold size, Cloud SQL automatically adds additional storage capacity. If the available storage repeatedly falls below the threshold size, Cloud SQL continues to add storage until it reaches the maximum of 30 TB.
441    #[serde(rename = "autoStorageIncrease")]
442    pub auto_storage_increase: Option<bool>,
443    /// Optional. Availability type. Potential values: * `ZONAL`: The instance serves data from only one zone. Outages in that zone affect data availability. * `REGIONAL`: The instance can serve data from more than one zone in a region (it is highly available).
444    #[serde(rename = "availabilityType")]
445    pub availability_type: Option<String>,
446    /// The KMS key name used for the csql instance.
447    #[serde(rename = "cmekKeyName")]
448    pub cmek_key_name: Option<String>,
449    /// The Cloud SQL default instance level collation.
450    pub collation: Option<String>,
451    /// Optional. Data cache is an optional feature available for Cloud SQL for MySQL Enterprise Plus edition only. For more information on data cache, see [Data cache overview](https://cloud.google.com/sql/help/mysql-data-cache) in Cloud SQL documentation.
452    #[serde(rename = "dataCacheConfig")]
453    pub data_cache_config: Option<DataCacheConfig>,
454    /// The storage capacity available to the database, in GB. The minimum (and default) size is 10GB.
455    #[serde(rename = "dataDiskSizeGb")]
456    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
457    pub data_disk_size_gb: Option<i64>,
458    /// The type of storage: `PD_SSD` (default) or `PD_HDD`.
459    #[serde(rename = "dataDiskType")]
460    pub data_disk_type: Option<String>,
461    /// The database flags passed to the Cloud SQL instance at startup. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
462    #[serde(rename = "databaseFlags")]
463    pub database_flags: Option<HashMap<String, String>>,
464    /// The database engine type and version.
465    #[serde(rename = "databaseVersion")]
466    pub database_version: Option<String>,
467    /// Optional. The edition of the given Cloud SQL instance.
468    pub edition: Option<String>,
469    /// The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled.
470    #[serde(rename = "ipConfig")]
471    pub ip_config: Option<SqlIpConfig>,
472    /// Input only. Initial root password.
473    #[serde(rename = "rootPassword")]
474    pub root_password: Option<String>,
475    /// Output only. Indicates If this connection profile root password is stored.
476    #[serde(rename = "rootPasswordSet")]
477    pub root_password_set: Option<bool>,
478    /// Optional. The Google Cloud Platform zone where the failover Cloud SQL database instance is located. Used when the Cloud SQL database availability type is REGIONAL (i.e. multiple zones / highly available).
479    #[serde(rename = "secondaryZone")]
480    pub secondary_zone: Option<String>,
481    /// The Database Migration Service source connection profile ID, in the format: `projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID`
482    #[serde(rename = "sourceId")]
483    pub source_id: Option<String>,
484    /// The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.
485    #[serde(rename = "storageAutoResizeLimit")]
486    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
487    pub storage_auto_resize_limit: Option<i64>,
488    /// The tier (or machine type) for this instance, for example: `db-n1-standard-1` (MySQL instances) or `db-custom-1-3840` (PostgreSQL instances). For more information, see [Cloud SQL Instance Settings](https://cloud.google.com/sql/docs/mysql/instance-settings).
489    pub tier: Option<String>,
490    /// The resource labels for a Cloud SQL instance to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: `{ "name": "wrench", "mass": "18kg", "count": "3" }`.
491    #[serde(rename = "userLabels")]
492    pub user_labels: Option<HashMap<String, String>>,
493    /// The Google Cloud Platform zone where your Cloud SQL database instance is located.
494    pub zone: Option<String>,
495}
496
497impl common::Part for CloudSqlSettings {}
498
499/// Column is not used as an independent entity, it is retrieved as part of a Table entity.
500///
501/// This type is not used in any activity, and only used as *part* of another schema.
502///
503#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
504#[serde_with::serde_as]
505#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
506pub struct ColumnEntity {
507    /// Is the column of array type.
508    pub array: Option<bool>,
509    /// If the column is array, of which length.
510    #[serde(rename = "arrayLength")]
511    pub array_length: Option<i32>,
512    /// Is the column auto-generated/identity.
513    #[serde(rename = "autoGenerated")]
514    pub auto_generated: Option<bool>,
515    /// Charset override - instead of table level charset.
516    pub charset: Option<String>,
517    /// Collation override - instead of table level collation.
518    pub collation: Option<String>,
519    /// Comment associated with the column.
520    pub comment: Option<String>,
521    /// Custom engine specific features.
522    #[serde(rename = "customFeatures")]
523    pub custom_features: Option<HashMap<String, serde_json::Value>>,
524    /// Column data type.
525    #[serde(rename = "dataType")]
526    pub data_type: Option<String>,
527    /// Default value of the column.
528    #[serde(rename = "defaultValue")]
529    pub default_value: Option<String>,
530    /// Column fractional second precision - used for timestamp based datatypes.
531    #[serde(rename = "fractionalSecondsPrecision")]
532    pub fractional_seconds_precision: Option<i32>,
533    /// Column length - e.g. varchar (50).
534    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
535    pub length: Option<i64>,
536    /// Column name.
537    pub name: Option<String>,
538    /// Is the column nullable.
539    pub nullable: Option<bool>,
540    /// Column order in the table.
541    #[serde(rename = "ordinalPosition")]
542    pub ordinal_position: Option<i32>,
543    /// Column precision - when relevant.
544    pub precision: Option<i32>,
545    /// Column scale - when relevant.
546    pub scale: Option<i32>,
547    /// Specifies the list of values allowed in the column. Only used for set data type.
548    #[serde(rename = "setValues")]
549    pub set_values: Option<Vec<String>>,
550    /// Is the column a UDT.
551    pub udt: Option<bool>,
552}
553
554impl common::Part for ColumnEntity {}
555
556/// Request message for ‘CommitConversionWorkspace’ request.
557///
558/// # Activities
559///
560/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
561/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
562///
563/// * [locations conversion workspaces commit projects](ProjectLocationConversionWorkspaceCommitCall) (request)
564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
565#[serde_with::serde_as]
566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
567pub struct CommitConversionWorkspaceRequest {
568    /// Optional. Optional name of the commit.
569    #[serde(rename = "commitName")]
570    pub commit_name: Option<String>,
571}
572
573impl common::RequestValue for CommitConversionWorkspaceRequest {}
574
575/// Options to configure rule type ConditionalColumnSetValue. The rule is used to transform the data which is being replicated/migrated. The rule filter field can refer to one or more entities. The rule scope can be one of: Column.
576///
577/// This type is not used in any activity, and only used as *part* of another schema.
578///
579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
580#[serde_with::serde_as]
581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
582pub struct ConditionalColumnSetValue {
583    /// Optional. Custom engine specific features.
584    #[serde(rename = "customFeatures")]
585    pub custom_features: Option<HashMap<String, serde_json::Value>>,
586    /// Optional. Optional filter on source column precision and scale. Used for fixed point numbers such as NUMERIC/NUMBER data types.
587    #[serde(rename = "sourceNumericFilter")]
588    pub source_numeric_filter: Option<SourceNumericFilter>,
589    /// Optional. Optional filter on source column length. Used for text based data types like varchar.
590    #[serde(rename = "sourceTextFilter")]
591    pub source_text_filter: Option<SourceTextFilter>,
592    /// Required. Description of data transformation during migration.
593    #[serde(rename = "valueTransformation")]
594    pub value_transformation: Option<ValueTransformation>,
595}
596
597impl common::Part for ConditionalColumnSetValue {}
598
599/// A connection profile definition.
600///
601/// # Activities
602///
603/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
604/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
605///
606/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (request)
607/// * [locations connection profiles get projects](ProjectLocationConnectionProfileGetCall) (response)
608/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (request)
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct ConnectionProfile {
613    /// An AlloyDB cluster connection profile.
614    pub alloydb: Option<AlloyDbConnectionProfile>,
615    /// A CloudSQL database connection profile.
616    pub cloudsql: Option<CloudSqlConnectionProfile>,
617    /// Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
618    #[serde(rename = "createTime")]
619    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
620    /// The connection profile display name.
621    #[serde(rename = "displayName")]
622    pub display_name: Option<String>,
623    /// Output only. The error details in case of state FAILED.
624    pub error: Option<Status>,
625    /// The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`.
626    pub labels: Option<HashMap<String, String>>,
627    /// A MySQL database connection profile.
628    pub mysql: Option<MySqlConnectionProfile>,
629    /// The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
630    pub name: Option<String>,
631    /// An Oracle database connection profile.
632    pub oracle: Option<OracleConnectionProfile>,
633    /// A PostgreSQL database connection profile.
634    pub postgresql: Option<PostgreSqlConnectionProfile>,
635    /// The database provider.
636    pub provider: Option<String>,
637    /// Connection profile for a SQL Server data source.
638    pub sqlserver: Option<SqlServerConnectionProfile>,
639    /// The current connection profile state (e.g. DRAFT, READY, or FAILED).
640    pub state: Option<String>,
641    /// Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
642    #[serde(rename = "updateTime")]
643    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
644}
645
646impl common::RequestValue for ConnectionProfile {}
647impl common::ResponseResult for ConnectionProfile {}
648
649/// Constraint is not used as an independent entity, it is retrieved as part of another entity such as Table or View.
650///
651/// This type is not used in any activity, and only used as *part* of another schema.
652///
653#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
654#[serde_with::serde_as]
655#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
656pub struct ConstraintEntity {
657    /// Custom engine specific features.
658    #[serde(rename = "customFeatures")]
659    pub custom_features: Option<HashMap<String, serde_json::Value>>,
660    /// The name of the table constraint.
661    pub name: Option<String>,
662    /// Reference columns which may be associated with the constraint. For example, if the constraint is a FOREIGN_KEY, this represents the list of full names of referenced columns by the foreign key.
663    #[serde(rename = "referenceColumns")]
664    pub reference_columns: Option<Vec<String>>,
665    /// Reference table which may be associated with the constraint. For example, if the constraint is a FOREIGN_KEY, this represents the list of full name of the referenced table by the foreign key.
666    #[serde(rename = "referenceTable")]
667    pub reference_table: Option<String>,
668    /// Table columns used as part of the Constraint, for example primary key constraint should list the columns which constitutes the key.
669    #[serde(rename = "tableColumns")]
670    pub table_columns: Option<Vec<String>>,
671    /// Table which is associated with the constraint. In case the constraint is defined on a table, this field is left empty as this information is stored in parent_name. However, if constraint is defined on a view, this field stores the table name on which the view is defined.
672    #[serde(rename = "tableName")]
673    pub table_name: Option<String>,
674    /// Type of constraint, for example unique, primary key, foreign key (currently only primary key is supported).
675    #[serde(rename = "type")]
676    pub type_: Option<String>,
677}
678
679impl common::Part for ConstraintEntity {}
680
681/// The main conversion workspace resource entity.
682///
683/// # Activities
684///
685/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
686/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
687///
688/// * [locations conversion workspaces create projects](ProjectLocationConversionWorkspaceCreateCall) (request)
689/// * [locations conversion workspaces get projects](ProjectLocationConversionWorkspaceGetCall) (response)
690/// * [locations conversion workspaces patch projects](ProjectLocationConversionWorkspacePatchCall) (request)
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct ConversionWorkspace {
695    /// Output only. The timestamp when the workspace resource was created.
696    #[serde(rename = "createTime")]
697    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
698    /// Required. The destination engine details.
699    pub destination: Option<DatabaseEngineInfo>,
700    /// Optional. The display name for the workspace.
701    #[serde(rename = "displayName")]
702    pub display_name: Option<String>,
703    /// Optional. A generic list of settings for the workspace. The settings are database pair dependant and can indicate default behavior for the mapping rules engine or turn on or off specific features. Such examples can be: convert_foreign_key_to_interleave=true, skip_triggers=false, ignore_non_table_synonyms=true
704    #[serde(rename = "globalSettings")]
705    pub global_settings: Option<HashMap<String, String>>,
706    /// Output only. Whether the workspace has uncommitted changes (changes which were made after the workspace was committed).
707    #[serde(rename = "hasUncommittedChanges")]
708    pub has_uncommitted_changes: Option<bool>,
709    /// Output only. The latest commit ID.
710    #[serde(rename = "latestCommitId")]
711    pub latest_commit_id: Option<String>,
712    /// Output only. The timestamp when the workspace was committed.
713    #[serde(rename = "latestCommitTime")]
714    pub latest_commit_time: Option<chrono::DateTime<chrono::offset::Utc>>,
715    /// Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
716    pub name: Option<String>,
717    /// Required. The source engine details.
718    pub source: Option<DatabaseEngineInfo>,
719    /// Output only. The timestamp when the workspace resource was last updated.
720    #[serde(rename = "updateTime")]
721    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
722}
723
724impl common::RequestValue for ConversionWorkspace {}
725impl common::ResponseResult for ConversionWorkspace {}
726
727/// A conversion workspace's version.
728///
729/// This type is not used in any activity, and only used as *part* of another schema.
730///
731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
732#[serde_with::serde_as]
733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
734pub struct ConversionWorkspaceInfo {
735    /// The commit ID of the conversion workspace.
736    #[serde(rename = "commitId")]
737    pub commit_id: Option<String>,
738    /// The resource name (URI) of the conversion workspace.
739    pub name: Option<String>,
740}
741
742impl common::Part for ConversionWorkspaceInfo {}
743
744/// Request message for ‘ConvertConversionWorkspace’ request.
745///
746/// # Activities
747///
748/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
749/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
750///
751/// * [locations conversion workspaces convert projects](ProjectLocationConversionWorkspaceConvertCall) (request)
752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
753#[serde_with::serde_as]
754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
755pub struct ConvertConversionWorkspaceRequest {
756    /// Optional. Specifies whether the conversion workspace is to be committed automatically after the conversion.
757    #[serde(rename = "autoCommit")]
758    pub auto_commit: Option<bool>,
759    /// Optional. Automatically convert the full entity path for each entity specified by the filter. For example, if the filter specifies a table, that table schema (and database if there is one) will also be converted.
760    #[serde(rename = "convertFullPath")]
761    pub convert_full_path: Option<bool>,
762    /// Optional. Filter the entities to convert. Leaving this field empty will convert all of the entities. Supports Google AIP-160 style filtering.
763    pub filter: Option<String>,
764}
765
766impl common::RequestValue for ConvertConversionWorkspaceRequest {}
767
768/// Details regarding a Convert background job.
769///
770/// This type is not used in any activity, and only used as *part* of another schema.
771///
772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
773#[serde_with::serde_as]
774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
775pub struct ConvertJobDetails {
776    /// Output only. AIP-160 based filter used to specify the entities to convert
777    pub filter: Option<String>,
778}
779
780impl common::Part for ConvertJobDetails {}
781
782/// Options to configure rule type ConvertROWIDToColumn. The rule is used to add column rowid to destination tables based on an Oracle rowid function/property. The rule filter field can refer to one or more entities. The rule scope can be one of: Table. This rule requires additional filter to be specified beyond the basic rule filter field, which is whether or not to work on tables which already have a primary key defined.
783///
784/// This type is not used in any activity, and only used as *part* of another schema.
785///
786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
787#[serde_with::serde_as]
788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
789pub struct ConvertRowIdToColumn {
790    /// Required. Only work on tables without primary key defined
791    #[serde(rename = "onlyIfNoPrimaryKey")]
792    pub only_if_no_primary_key: Option<bool>,
793}
794
795impl common::Part for ConvertRowIdToColumn {}
796
797/// Data cache is an optional feature available for Cloud SQL for MySQL Enterprise Plus edition only. For more information on data cache, see [Data cache overview](https://cloud.google.com/sql/help/mysql-data-cache) in Cloud SQL documentation.
798///
799/// This type is not used in any activity, and only used as *part* of another schema.
800///
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct DataCacheConfig {
805    /// Optional. Whether data cache is enabled for the instance.
806    #[serde(rename = "dataCacheEnabled")]
807    pub data_cache_enabled: Option<bool>,
808}
809
810impl common::Part for DataCacheConfig {}
811
812/// The type and version of a source or destination database.
813///
814/// This type is not used in any activity, and only used as *part* of another schema.
815///
816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
817#[serde_with::serde_as]
818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
819pub struct DatabaseEngineInfo {
820    /// Required. Engine type.
821    pub engine: Option<String>,
822    /// Required. Engine version, for example "12.c.1".
823    pub version: Option<String>,
824}
825
826impl common::Part for DatabaseEngineInfo {}
827
828/// The base entity type for all the database related entities. The message contains the entity name, the name of its parent, the entity type, and the specific details per entity type.
829///
830/// This type is not used in any activity, and only used as *part* of another schema.
831///
832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
833#[serde_with::serde_as]
834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
835pub struct DatabaseEntity {
836    /// Database.
837    pub database: Option<DatabaseInstanceEntity>,
838    /// Function.
839    #[serde(rename = "databaseFunction")]
840    pub database_function: Option<FunctionEntity>,
841    /// Package.
842    #[serde(rename = "databasePackage")]
843    pub database_package: Option<PackageEntity>,
844    /// Details about the entity DDL script. Multiple DDL scripts are provided for child entities such as a table entity will have one DDL for the table with additional DDLs for each index, constraint and such.
845    #[serde(rename = "entityDdl")]
846    pub entity_ddl: Option<Vec<EntityDdl>>,
847    /// The type of the database entity (table, view, index, ...).
848    #[serde(rename = "entityType")]
849    pub entity_type: Option<String>,
850    /// Details about the various issues found for the entity.
851    pub issues: Option<Vec<EntityIssue>>,
852    /// Details about entity mappings. For source tree entities, this holds the draft entities which were generated by the mapping rules. For draft tree entities, this holds the source entities which were converted to form the draft entity. Destination entities will have no mapping details.
853    pub mappings: Option<Vec<EntityMapping>>,
854    /// Materialized view.
855    #[serde(rename = "materializedView")]
856    pub materialized_view: Option<MaterializedViewEntity>,
857    /// The full name of the parent entity (e.g. schema name).
858    #[serde(rename = "parentEntity")]
859    pub parent_entity: Option<String>,
860    /// Schema.
861    pub schema: Option<SchemaEntity>,
862    /// Sequence.
863    pub sequence: Option<SequenceEntity>,
864    /// The short name (e.g. table name) of the entity.
865    #[serde(rename = "shortName")]
866    pub short_name: Option<String>,
867    /// Stored procedure.
868    #[serde(rename = "storedProcedure")]
869    pub stored_procedure: Option<StoredProcedureEntity>,
870    /// Synonym.
871    pub synonym: Option<SynonymEntity>,
872    /// Table.
873    pub table: Option<TableEntity>,
874    /// The type of tree the entity belongs to.
875    pub tree: Option<String>,
876    /// UDT.
877    pub udt: Option<UDTEntity>,
878    /// View.
879    pub view: Option<ViewEntity>,
880}
881
882impl common::Part for DatabaseEntity {}
883
884/// DatabaseInstance acts as a parent entity to other database entities.
885///
886/// This type is not used in any activity, and only used as *part* of another schema.
887///
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct DatabaseInstanceEntity {
892    /// Custom engine specific features.
893    #[serde(rename = "customFeatures")]
894    pub custom_features: Option<HashMap<String, serde_json::Value>>,
895}
896
897impl common::Part for DatabaseInstanceEntity {}
898
899/// A message defining the database engine and provider.
900///
901/// This type is not used in any activity, and only used as *part* of another schema.
902///
903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
904#[serde_with::serde_as]
905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
906pub struct DatabaseType {
907    /// The database engine.
908    pub engine: Option<String>,
909    /// The database provider.
910    pub provider: Option<String>,
911}
912
913impl common::Part for DatabaseType {}
914
915/// Request message for ‘DemoteDestination’ request.
916///
917/// # Activities
918///
919/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
920/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
921///
922/// * [locations migration jobs demote destination projects](ProjectLocationMigrationJobDemoteDestinationCall) (request)
923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
924#[serde_with::serde_as]
925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
926pub struct DemoteDestinationRequest {
927    _never_set: Option<bool>,
928}
929
930impl common::RequestValue for DemoteDestinationRequest {}
931
932/// Response message for ‘DescribeConversionWorkspaceRevisions’ request.
933///
934/// # Activities
935///
936/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
937/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
938///
939/// * [locations conversion workspaces describe conversion workspace revisions projects](ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall) (response)
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct DescribeConversionWorkspaceRevisionsResponse {
944    /// The list of conversion workspace revisions.
945    pub revisions: Option<Vec<ConversionWorkspace>>,
946}
947
948impl common::ResponseResult for DescribeConversionWorkspaceRevisionsResponse {}
949
950/// Response message for ‘DescribeDatabaseEntities’ request.
951///
952/// # Activities
953///
954/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
955/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
956///
957/// * [locations conversion workspaces describe database entities projects](ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall) (response)
958#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
959#[serde_with::serde_as]
960#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
961pub struct DescribeDatabaseEntitiesResponse {
962    /// The list of database entities for the conversion workspace.
963    #[serde(rename = "databaseEntities")]
964    pub database_entities: Option<Vec<DatabaseEntity>>,
965    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
966    #[serde(rename = "nextPageToken")]
967    pub next_page_token: Option<String>,
968}
969
970impl common::ResponseResult for DescribeDatabaseEntitiesResponse {}
971
972/// Filter based on relation between source value and compare value of type double in ConditionalColumnSetValue
973///
974/// This type is not used in any activity, and only used as *part* of another schema.
975///
976#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
977#[serde_with::serde_as]
978#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
979pub struct DoubleComparisonFilter {
980    /// Required. Double compare value to be used
981    pub value: Option<f64>,
982    /// Required. Relation between source value and compare value
983    #[serde(rename = "valueComparison")]
984    pub value_comparison: Option<String>,
985}
986
987impl common::Part for DoubleComparisonFilter {}
988
989/// Dump flag definition.
990///
991/// This type is not used in any activity, and only used as *part* of another schema.
992///
993#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
994#[serde_with::serde_as]
995#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
996pub struct DumpFlag {
997    /// The name of the flag
998    pub name: Option<String>,
999    /// The value of the flag.
1000    pub value: Option<String>,
1001}
1002
1003impl common::Part for DumpFlag {}
1004
1005/// Dump flags definition.
1006///
1007/// This type is not used in any activity, and only used as *part* of another schema.
1008///
1009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1010#[serde_with::serde_as]
1011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1012pub struct DumpFlags {
1013    /// The flags for the initial dump.
1014    #[serde(rename = "dumpFlags")]
1015    pub dump_flags: Option<Vec<DumpFlag>>,
1016}
1017
1018impl common::Part for DumpFlags {}
1019
1020/// 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); }
1021///
1022/// # Activities
1023///
1024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1026///
1027/// * [locations conversion workspaces mapping rules delete projects](ProjectLocationConversionWorkspaceMappingRuleDeleteCall) (response)
1028/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1029/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1030#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1031#[serde_with::serde_as]
1032#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1033pub struct Empty {
1034    _never_set: Option<bool>,
1035}
1036
1037impl common::ResponseResult for Empty {}
1038
1039/// EncryptionConfig describes the encryption config of a cluster that is encrypted with a CMEK (customer-managed encryption key).
1040///
1041/// This type is not used in any activity, and only used as *part* of another schema.
1042///
1043#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1044#[serde_with::serde_as]
1045#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1046pub struct EncryptionConfig {
1047    /// The fully-qualified resource name of the KMS key. Each Cloud KMS key is regionalized and has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
1048    #[serde(rename = "kmsKeyName")]
1049    pub kms_key_name: Option<String>,
1050}
1051
1052impl common::Part for EncryptionConfig {}
1053
1054/// A single DDL statement for a specific entity
1055///
1056/// This type is not used in any activity, and only used as *part* of another schema.
1057///
1058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1059#[serde_with::serde_as]
1060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1061pub struct EntityDdl {
1062    /// The actual ddl code.
1063    pub ddl: Option<String>,
1064    /// Type of DDL (Create, Alter).
1065    #[serde(rename = "ddlType")]
1066    pub ddl_type: Option<String>,
1067    /// The name of the database entity the ddl refers to.
1068    pub entity: Option<String>,
1069    /// The entity type (if the DDL is for a sub entity).
1070    #[serde(rename = "entityType")]
1071    pub entity_type: Option<String>,
1072    /// EntityIssues found for this ddl.
1073    #[serde(rename = "issueId")]
1074    pub issue_id: Option<Vec<String>>,
1075}
1076
1077impl common::Part for EntityDdl {}
1078
1079/// Issue related to the entity.
1080///
1081/// This type is not used in any activity, and only used as *part* of another schema.
1082///
1083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1084#[serde_with::serde_as]
1085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1086pub struct EntityIssue {
1087    /// Error/Warning code
1088    pub code: Option<String>,
1089    /// The ddl which caused the issue, if relevant.
1090    pub ddl: Option<String>,
1091    /// The entity type (if the DDL is for a sub entity).
1092    #[serde(rename = "entityType")]
1093    pub entity_type: Option<String>,
1094    /// Unique Issue ID.
1095    pub id: Option<String>,
1096    /// Issue detailed message
1097    pub message: Option<String>,
1098    /// The position of the issue found, if relevant.
1099    pub position: Option<Position>,
1100    /// Severity of the issue
1101    pub severity: Option<String>,
1102    /// The type of the issue.
1103    #[serde(rename = "type")]
1104    pub type_: Option<String>,
1105}
1106
1107impl common::Part for EntityIssue {}
1108
1109/// Details of the mappings of a database entity.
1110///
1111/// This type is not used in any activity, and only used as *part* of another schema.
1112///
1113#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1114#[serde_with::serde_as]
1115#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1116pub struct EntityMapping {
1117    /// Target entity full name. The draft entity can also include a column, index or constraint using the same naming notation schema.table.column.
1118    #[serde(rename = "draftEntity")]
1119    pub draft_entity: Option<String>,
1120    /// Type of draft entity.
1121    #[serde(rename = "draftType")]
1122    pub draft_type: Option<String>,
1123    /// Entity mapping log entries. Multiple rules can be effective and contribute changes to a converted entity, such as a rule can handle the entity name, another rule can handle an entity type. In addition, rules which did not change the entity are also logged along with the reason preventing them to do so.
1124    #[serde(rename = "mappingLog")]
1125    pub mapping_log: Option<Vec<EntityMappingLogEntry>>,
1126    /// Source entity full name. The source entity can also be a column, index or constraint using the same naming notation schema.table.column.
1127    #[serde(rename = "sourceEntity")]
1128    pub source_entity: Option<String>,
1129    /// Type of source entity.
1130    #[serde(rename = "sourceType")]
1131    pub source_type: Option<String>,
1132}
1133
1134impl common::Part for EntityMapping {}
1135
1136/// A single record of a rule which was used for a mapping.
1137///
1138/// This type is not used in any activity, and only used as *part* of another schema.
1139///
1140#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1141#[serde_with::serde_as]
1142#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1143pub struct EntityMappingLogEntry {
1144    /// Comment.
1145    #[serde(rename = "mappingComment")]
1146    pub mapping_comment: Option<String>,
1147    /// Which rule caused this log entry.
1148    #[serde(rename = "ruleId")]
1149    pub rule_id: Option<String>,
1150    /// Rule revision ID.
1151    #[serde(rename = "ruleRevisionId")]
1152    pub rule_revision_id: Option<String>,
1153}
1154
1155impl common::Part for EntityMappingLogEntry {}
1156
1157/// Options to configure rule type EntityMove. The rule is used to move an entity to a new schema. The rule filter field can refer to one or more entities. The rule scope can be one of: Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT
1158///
1159/// This type is not used in any activity, and only used as *part* of another schema.
1160///
1161#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1162#[serde_with::serde_as]
1163#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1164pub struct EntityMove {
1165    /// Required. The new schema
1166    #[serde(rename = "newSchema")]
1167    pub new_schema: Option<String>,
1168}
1169
1170impl common::Part for EntityMove {}
1171
1172/// 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.
1173///
1174/// This type is not used in any activity, and only used as *part* of another schema.
1175///
1176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1177#[serde_with::serde_as]
1178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1179pub struct Expr {
1180    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1181    pub description: Option<String>,
1182    /// Textual representation of an expression in Common Expression Language syntax.
1183    pub expression: Option<String>,
1184    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1185    pub location: Option<String>,
1186    /// 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.
1187    pub title: Option<String>,
1188}
1189
1190impl common::Part for Expr {}
1191
1192/// Response message for a ‘FetchStaticIps’ request.
1193///
1194/// # Activities
1195///
1196/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1197/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1198///
1199/// * [locations fetch static ips projects](ProjectLocationFetchStaticIpCall) (response)
1200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1201#[serde_with::serde_as]
1202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1203pub struct FetchStaticIpsResponse {
1204    /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1205    #[serde(rename = "nextPageToken")]
1206    pub next_page_token: Option<String>,
1207    /// List of static IPs.
1208    #[serde(rename = "staticIps")]
1209    pub static_ips: Option<Vec<String>>,
1210}
1211
1212impl common::ResponseResult for FetchStaticIpsResponse {}
1213
1214/// Options to configure rule type FilterTableColumns. The rule is used to filter the list of columns to include or exclude from a table. The rule filter field can refer to one entity. The rule scope can be: Table Only one of the two lists can be specified for the rule.
1215///
1216/// This type is not used in any activity, and only used as *part* of another schema.
1217///
1218#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1219#[serde_with::serde_as]
1220#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1221pub struct FilterTableColumns {
1222    /// Optional. List of columns to be excluded for a particular table.
1223    #[serde(rename = "excludeColumns")]
1224    pub exclude_columns: Option<Vec<String>>,
1225    /// Optional. List of columns to be included for a particular table.
1226    #[serde(rename = "includeColumns")]
1227    pub include_columns: Option<Vec<String>>,
1228}
1229
1230impl common::Part for FilterTableColumns {}
1231
1232/// Forward SSH Tunnel connectivity.
1233///
1234/// This type is not used in any activity, and only used as *part* of another schema.
1235///
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct ForwardSshTunnelConnectivity {
1240    /// Required. Hostname for the SSH tunnel.
1241    pub hostname: Option<String>,
1242    /// Input only. SSH password.
1243    pub password: Option<String>,
1244    /// Port for the SSH tunnel, default value is 22.
1245    pub port: Option<i32>,
1246    /// Input only. SSH private key.
1247    #[serde(rename = "privateKey")]
1248    pub private_key: Option<String>,
1249    /// Required. Username for the SSH tunnel.
1250    pub username: Option<String>,
1251}
1252
1253impl common::Part for ForwardSshTunnelConnectivity {}
1254
1255/// Function's parent is a schema.
1256///
1257/// This type is not used in any activity, and only used as *part* of another schema.
1258///
1259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1260#[serde_with::serde_as]
1261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1262pub struct FunctionEntity {
1263    /// Custom engine specific features.
1264    #[serde(rename = "customFeatures")]
1265    pub custom_features: Option<HashMap<String, serde_json::Value>>,
1266    /// The SQL code which creates the function.
1267    #[serde(rename = "sqlCode")]
1268    pub sql_code: Option<String>,
1269}
1270
1271impl common::Part for FunctionEntity {}
1272
1273/// Request message for ‘GenerateSshScript’ request.
1274///
1275/// # Activities
1276///
1277/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1278/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1279///
1280/// * [locations migration jobs generate ssh script projects](ProjectLocationMigrationJobGenerateSshScriptCall) (request)
1281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1282#[serde_with::serde_as]
1283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1284pub struct GenerateSshScriptRequest {
1285    /// Required. Bastion VM Instance name to use or to create.
1286    pub vm: Option<String>,
1287    /// The VM creation configuration
1288    #[serde(rename = "vmCreationConfig")]
1289    pub vm_creation_config: Option<VmCreationConfig>,
1290    /// The port that will be open on the bastion host.
1291    #[serde(rename = "vmPort")]
1292    pub vm_port: Option<i32>,
1293    /// The VM selection configuration
1294    #[serde(rename = "vmSelectionConfig")]
1295    pub vm_selection_config: Option<VmSelectionConfig>,
1296}
1297
1298impl common::RequestValue for GenerateSshScriptRequest {}
1299
1300/// Request message for ‘GenerateTcpProxyScript’ request.
1301///
1302/// # Activities
1303///
1304/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1305/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1306///
1307/// * [locations migration jobs generate tcp proxy script projects](ProjectLocationMigrationJobGenerateTcpProxyScriptCall) (request)
1308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1309#[serde_with::serde_as]
1310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1311pub struct GenerateTcpProxyScriptRequest {
1312    /// Required. The type of the Compute instance that will host the proxy.
1313    #[serde(rename = "vmMachineType")]
1314    pub vm_machine_type: Option<String>,
1315    /// Required. The name of the Compute instance that will host the proxy.
1316    #[serde(rename = "vmName")]
1317    pub vm_name: Option<String>,
1318    /// Required. The name of the subnet the Compute instance will use for private connectivity. Must be supplied in the form of projects/{project}/regions/{region}/subnetworks/{subnetwork}. Note: the region for the subnet must match the Compute instance region.
1319    #[serde(rename = "vmSubnet")]
1320    pub vm_subnet: Option<String>,
1321    /// Optional. The Google Cloud Platform zone to create the VM in. The fully qualified name of the zone must be specified, including the region name, for example "us-central1-b". If not specified, uses the "-b" zone of the destination Connection Profile's region.
1322    #[serde(rename = "vmZone")]
1323    pub vm_zone: Option<String>,
1324}
1325
1326impl common::RequestValue for GenerateTcpProxyScriptRequest {}
1327
1328/// Request message for ‘ImportMappingRules’ request.
1329///
1330/// # Activities
1331///
1332/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1333/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1334///
1335/// * [locations conversion workspaces mapping rules import projects](ProjectLocationConversionWorkspaceMappingRuleImportCall) (request)
1336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1337#[serde_with::serde_as]
1338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1339pub struct ImportMappingRulesRequest {
1340    /// Required. Should the conversion workspace be committed automatically after the import operation.
1341    #[serde(rename = "autoCommit")]
1342    pub auto_commit: Option<bool>,
1343    /// Required. One or more rules files.
1344    #[serde(rename = "rulesFiles")]
1345    pub rules_files: Option<Vec<RulesFile>>,
1346    /// Required. The format of the rules content file.
1347    #[serde(rename = "rulesFormat")]
1348    pub rules_format: Option<String>,
1349}
1350
1351impl common::RequestValue for ImportMappingRulesRequest {}
1352
1353/// Details regarding an Import Rules background job.
1354///
1355/// This type is not used in any activity, and only used as *part* of another schema.
1356///
1357#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1358#[serde_with::serde_as]
1359#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1360pub struct ImportRulesJobDetails {
1361    /// Output only. The requested file format.
1362    #[serde(rename = "fileFormat")]
1363    pub file_format: Option<String>,
1364    /// Output only. File names used for the import rules job.
1365    pub files: Option<Vec<String>>,
1366}
1367
1368impl common::Part for ImportRulesJobDetails {}
1369
1370/// Index is not used as an independent entity, it is retrieved as part of a Table entity.
1371///
1372/// This type is not used in any activity, and only used as *part* of another schema.
1373///
1374#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1375#[serde_with::serde_as]
1376#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1377pub struct IndexEntity {
1378    /// Custom engine specific features.
1379    #[serde(rename = "customFeatures")]
1380    pub custom_features: Option<HashMap<String, serde_json::Value>>,
1381    /// The name of the index.
1382    pub name: Option<String>,
1383    /// Table columns used as part of the Index, for example B-TREE index should list the columns which constitutes the index.
1384    #[serde(rename = "tableColumns")]
1385    pub table_columns: Option<Vec<String>>,
1386    /// For each table_column, mark whether it's sorting order is ascending (false) or descending (true). If no value is defined, assume all columns are sorted in ascending order. Otherwise, the number of items must match that of table_columns with each value specifying the direction of the matched column by its index.
1387    #[serde(rename = "tableColumnsDescending")]
1388    pub table_columns_descending: Option<Vec<bool>>,
1389    /// Type of index, for example B-TREE.
1390    #[serde(rename = "type")]
1391    pub type_: Option<String>,
1392    /// Boolean value indicating whether the index is unique.
1393    pub unique: Option<bool>,
1394}
1395
1396impl common::Part for IndexEntity {}
1397
1398/// Filter based on relation between source value and compare value of type integer in ConditionalColumnSetValue
1399///
1400/// This type is not used in any activity, and only used as *part* of another schema.
1401///
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct IntComparisonFilter {
1406    /// Required. Integer compare value to be used
1407    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1408    pub value: Option<i64>,
1409    /// Required. Relation between source value and compare value
1410    #[serde(rename = "valueComparison")]
1411    pub value_comparison: Option<String>,
1412}
1413
1414impl common::Part for IntComparisonFilter {}
1415
1416/// Response message for ‘ListConnectionProfiles’ request.
1417///
1418/// # Activities
1419///
1420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1422///
1423/// * [locations connection profiles list projects](ProjectLocationConnectionProfileListCall) (response)
1424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1425#[serde_with::serde_as]
1426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1427pub struct ListConnectionProfilesResponse {
1428    /// The response list of connection profiles.
1429    #[serde(rename = "connectionProfiles")]
1430    pub connection_profiles: Option<Vec<ConnectionProfile>>,
1431    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1432    #[serde(rename = "nextPageToken")]
1433    pub next_page_token: Option<String>,
1434    /// Locations that could not be reached.
1435    pub unreachable: Option<Vec<String>>,
1436}
1437
1438impl common::ResponseResult for ListConnectionProfilesResponse {}
1439
1440/// Response message for ‘ListConversionWorkspaces’ request.
1441///
1442/// # Activities
1443///
1444/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1445/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1446///
1447/// * [locations conversion workspaces list projects](ProjectLocationConversionWorkspaceListCall) (response)
1448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1449#[serde_with::serde_as]
1450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1451pub struct ListConversionWorkspacesResponse {
1452    /// The list of conversion workspace objects.
1453    #[serde(rename = "conversionWorkspaces")]
1454    pub conversion_workspaces: Option<Vec<ConversionWorkspace>>,
1455    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1456    #[serde(rename = "nextPageToken")]
1457    pub next_page_token: Option<String>,
1458    /// Locations that could not be reached.
1459    pub unreachable: Option<Vec<String>>,
1460}
1461
1462impl common::ResponseResult for ListConversionWorkspacesResponse {}
1463
1464/// The response message for Locations.ListLocations.
1465///
1466/// # Activities
1467///
1468/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1469/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1470///
1471/// * [locations list projects](ProjectLocationListCall) (response)
1472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1473#[serde_with::serde_as]
1474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1475pub struct ListLocationsResponse {
1476    /// A list of locations that matches the specified filter in the request.
1477    pub locations: Option<Vec<Location>>,
1478    /// The standard List next-page token.
1479    #[serde(rename = "nextPageToken")]
1480    pub next_page_token: Option<String>,
1481}
1482
1483impl common::ResponseResult for ListLocationsResponse {}
1484
1485/// Response message for ‘ListMappingRulesRequest’ request.
1486///
1487/// # Activities
1488///
1489/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1490/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1491///
1492/// * [locations conversion workspaces mapping rules list projects](ProjectLocationConversionWorkspaceMappingRuleListCall) (response)
1493#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1494#[serde_with::serde_as]
1495#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1496pub struct ListMappingRulesResponse {
1497    /// The list of conversion workspace mapping rules.
1498    #[serde(rename = "mappingRules")]
1499    pub mapping_rules: Option<Vec<MappingRule>>,
1500    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1501    #[serde(rename = "nextPageToken")]
1502    pub next_page_token: Option<String>,
1503}
1504
1505impl common::ResponseResult for ListMappingRulesResponse {}
1506
1507/// Response message for ‘ListMigrationJobs’ request.
1508///
1509/// # Activities
1510///
1511/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1512/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1513///
1514/// * [locations migration jobs list projects](ProjectLocationMigrationJobListCall) (response)
1515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1516#[serde_with::serde_as]
1517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1518pub struct ListMigrationJobsResponse {
1519    /// The list of migration jobs objects.
1520    #[serde(rename = "migrationJobs")]
1521    pub migration_jobs: Option<Vec<MigrationJob>>,
1522    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1523    #[serde(rename = "nextPageToken")]
1524    pub next_page_token: Option<String>,
1525    /// Locations that could not be reached.
1526    pub unreachable: Option<Vec<String>>,
1527}
1528
1529impl common::ResponseResult for ListMigrationJobsResponse {}
1530
1531/// The response message for Operations.ListOperations.
1532///
1533/// # Activities
1534///
1535/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1536/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1537///
1538/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1540#[serde_with::serde_as]
1541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1542pub struct ListOperationsResponse {
1543    /// The standard List next-page token.
1544    #[serde(rename = "nextPageToken")]
1545    pub next_page_token: Option<String>,
1546    /// A list of operations that matches the specified filter in the request.
1547    pub operations: Option<Vec<Operation>>,
1548}
1549
1550impl common::ResponseResult for ListOperationsResponse {}
1551
1552/// Response message for ‘ListPrivateConnections’ request.
1553///
1554/// # Activities
1555///
1556/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1557/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1558///
1559/// * [locations private connections list projects](ProjectLocationPrivateConnectionListCall) (response)
1560#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1561#[serde_with::serde_as]
1562#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1563pub struct ListPrivateConnectionsResponse {
1564    /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1565    #[serde(rename = "nextPageToken")]
1566    pub next_page_token: Option<String>,
1567    /// List of private connections.
1568    #[serde(rename = "privateConnections")]
1569    pub private_connections: Option<Vec<PrivateConnection>>,
1570    /// Locations that could not be reached.
1571    pub unreachable: Option<Vec<String>>,
1572}
1573
1574impl common::ResponseResult for ListPrivateConnectionsResponse {}
1575
1576/// A resource that represents a Google Cloud location.
1577///
1578/// # Activities
1579///
1580/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1581/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1582///
1583/// * [locations get projects](ProjectLocationGetCall) (response)
1584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1585#[serde_with::serde_as]
1586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1587pub struct Location {
1588    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1589    #[serde(rename = "displayName")]
1590    pub display_name: Option<String>,
1591    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1592    pub labels: Option<HashMap<String, String>>,
1593    /// The canonical id for this location. For example: `"us-east1"`.
1594    #[serde(rename = "locationId")]
1595    pub location_id: Option<String>,
1596    /// Service-specific metadata. For example the available capacity at the given location.
1597    pub metadata: Option<HashMap<String, serde_json::Value>>,
1598    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1599    pub name: Option<String>,
1600}
1601
1602impl common::ResponseResult for Location {}
1603
1604/// MachineConfig describes the configuration of a machine.
1605///
1606/// This type is not used in any activity, and only used as *part* of another schema.
1607///
1608#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1609#[serde_with::serde_as]
1610#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1611pub struct MachineConfig {
1612    /// The number of CPU's in the VM instance.
1613    #[serde(rename = "cpuCount")]
1614    pub cpu_count: Option<i32>,
1615}
1616
1617impl common::Part for MachineConfig {}
1618
1619/// Definition of a transformation that is to be applied to a group of entities in the source schema. Several such transformations can be applied to an entity sequentially to define the corresponding entity in the target schema.
1620///
1621/// # Activities
1622///
1623/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1624/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1625///
1626/// * [locations conversion workspaces mapping rules create projects](ProjectLocationConversionWorkspaceMappingRuleCreateCall) (request|response)
1627/// * [locations conversion workspaces mapping rules get projects](ProjectLocationConversionWorkspaceMappingRuleGetCall) (response)
1628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1629#[serde_with::serde_as]
1630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1631pub struct MappingRule {
1632    /// Optional. Rule to specify how the data contained in a column should be transformed (such as trimmed, rounded, etc) provided that the data meets certain criteria.
1633    #[serde(rename = "conditionalColumnSetValue")]
1634    pub conditional_column_set_value: Option<ConditionalColumnSetValue>,
1635    /// Optional. Rule to specify how multiple tables should be converted with an additional rowid column.
1636    #[serde(rename = "convertRowidColumn")]
1637    pub convert_rowid_column: Option<ConvertRowIdToColumn>,
1638    /// Optional. A human readable name
1639    #[serde(rename = "displayName")]
1640    pub display_name: Option<String>,
1641    /// Optional. Rule to specify how multiple entities should be relocated into a different schema.
1642    #[serde(rename = "entityMove")]
1643    pub entity_move: Option<EntityMove>,
1644    /// Required. The rule filter
1645    pub filter: Option<MappingRuleFilter>,
1646    /// Optional. Rule to specify the list of columns to include or exclude from a table.
1647    #[serde(rename = "filterTableColumns")]
1648    pub filter_table_columns: Option<FilterTableColumns>,
1649    /// Optional. Rule to specify how multiple columns should be converted to a different data type.
1650    #[serde(rename = "multiColumnDataTypeChange")]
1651    pub multi_column_data_type_change: Option<MultiColumnDatatypeChange>,
1652    /// Optional. Rule to specify how multiple entities should be renamed.
1653    #[serde(rename = "multiEntityRename")]
1654    pub multi_entity_rename: Option<MultiEntityRename>,
1655    /// Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
1656    pub name: Option<String>,
1657    /// Output only. The timestamp that the revision was created.
1658    #[serde(rename = "revisionCreateTime")]
1659    pub revision_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1660    /// Output only. The revision ID of the mapping rule. A new revision is committed whenever the mapping rule is changed in any way. The format is an 8-character hexadecimal string.
1661    #[serde(rename = "revisionId")]
1662    pub revision_id: Option<String>,
1663    /// Required. The order in which the rule is applied. Lower order rules are applied before higher value rules so they may end up being overridden.
1664    #[serde(rename = "ruleOrder")]
1665    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1666    pub rule_order: Option<i64>,
1667    /// Required. The rule scope
1668    #[serde(rename = "ruleScope")]
1669    pub rule_scope: Option<String>,
1670    /// Optional. Rule to specify the primary key for a table
1671    #[serde(rename = "setTablePrimaryKey")]
1672    pub set_table_primary_key: Option<SetTablePrimaryKey>,
1673    /// Optional. Rule to specify how a single column is converted.
1674    #[serde(rename = "singleColumnChange")]
1675    pub single_column_change: Option<SingleColumnChange>,
1676    /// Optional. Rule to specify how a single entity should be renamed.
1677    #[serde(rename = "singleEntityRename")]
1678    pub single_entity_rename: Option<SingleEntityRename>,
1679    /// Optional. Rule to specify how a single package is converted.
1680    #[serde(rename = "singlePackageChange")]
1681    pub single_package_change: Option<SinglePackageChange>,
1682    /// Optional. Rule to change the sql code for an entity, for example, function, procedure.
1683    #[serde(rename = "sourceSqlChange")]
1684    pub source_sql_change: Option<SourceSqlChange>,
1685    /// Optional. The mapping rule state
1686    pub state: Option<String>,
1687}
1688
1689impl common::RequestValue for MappingRule {}
1690impl common::ResponseResult for MappingRule {}
1691
1692/// A filter defining the entities that a mapping rule should be applied to. When more than one field is specified, the rule is applied only to entities which match all the fields.
1693///
1694/// This type is not used in any activity, and only used as *part* of another schema.
1695///
1696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1697#[serde_with::serde_as]
1698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1699pub struct MappingRuleFilter {
1700    /// Optional. The rule should be applied to specific entities defined by their fully qualified names.
1701    pub entities: Option<Vec<String>>,
1702    /// Optional. The rule should be applied to entities whose non-qualified name contains the given string.
1703    #[serde(rename = "entityNameContains")]
1704    pub entity_name_contains: Option<String>,
1705    /// Optional. The rule should be applied to entities whose non-qualified name starts with the given prefix.
1706    #[serde(rename = "entityNamePrefix")]
1707    pub entity_name_prefix: Option<String>,
1708    /// Optional. The rule should be applied to entities whose non-qualified name ends with the given suffix.
1709    #[serde(rename = "entityNameSuffix")]
1710    pub entity_name_suffix: Option<String>,
1711    /// Optional. The rule should be applied to entities whose parent entity (fully qualified name) matches the given value. For example, if the rule applies to a table entity, the expected value should be a schema (schema). If the rule applies to a column or index entity, the expected value can be either a schema (schema) or a table (schema.table)
1712    #[serde(rename = "parentEntity")]
1713    pub parent_entity: Option<String>,
1714}
1715
1716impl common::Part for MappingRuleFilter {}
1717
1718/// MaterializedView's parent is a schema.
1719///
1720/// This type is not used in any activity, and only used as *part* of another schema.
1721///
1722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1723#[serde_with::serde_as]
1724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1725pub struct MaterializedViewEntity {
1726    /// Custom engine specific features.
1727    #[serde(rename = "customFeatures")]
1728    pub custom_features: Option<HashMap<String, serde_json::Value>>,
1729    /// The SQL code which creates the view.
1730    #[serde(rename = "sqlCode")]
1731    pub sql_code: Option<String>,
1732}
1733
1734impl common::Part for MaterializedViewEntity {}
1735
1736/// Represents a Database Migration Service migration job object.
1737///
1738/// # Activities
1739///
1740/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1741/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1742///
1743/// * [locations migration jobs create projects](ProjectLocationMigrationJobCreateCall) (request)
1744/// * [locations migration jobs get projects](ProjectLocationMigrationJobGetCall) (response)
1745/// * [locations migration jobs patch projects](ProjectLocationMigrationJobPatchCall) (request)
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct MigrationJob {
1750    /// The CMEK (customer-managed encryption key) fully qualified key name used for the migration job. This field supports all migration jobs types except for: * Mysql to Mysql (use the cmek field in the cloudsql connection profile instead). * PostrgeSQL to PostgreSQL (use the cmek field in the cloudsql connection profile instead). * PostgreSQL to AlloyDB (use the kms_key_name field in the alloydb connection profile instead). Each Cloud CMEK key has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]
1751    #[serde(rename = "cmekKeyName")]
1752    pub cmek_key_name: Option<String>,
1753    /// The conversion workspace used by the migration.
1754    #[serde(rename = "conversionWorkspace")]
1755    pub conversion_workspace: Option<ConversionWorkspaceInfo>,
1756    /// Output only. The timestamp when the migration job resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
1757    #[serde(rename = "createTime")]
1758    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1759    /// Required. The resource name (URI) of the destination connection profile.
1760    pub destination: Option<String>,
1761    /// The database engine type and provider of the destination.
1762    #[serde(rename = "destinationDatabase")]
1763    pub destination_database: Option<DatabaseType>,
1764    /// The migration job display name.
1765    #[serde(rename = "displayName")]
1766    pub display_name: Option<String>,
1767    /// The initial dump flags. This field and the "dump_path" field are mutually exclusive.
1768    #[serde(rename = "dumpFlags")]
1769    pub dump_flags: Option<DumpFlags>,
1770    /// The path to the dump file in Google Cloud Storage, in the format: (gs://[BUCKET_NAME]/[OBJECT_NAME]). This field and the "dump_flags" field are mutually exclusive.
1771    #[serde(rename = "dumpPath")]
1772    pub dump_path: Option<String>,
1773    /// Optional. The type of the data dump. Supported for MySQL to CloudSQL for MySQL migrations only.
1774    #[serde(rename = "dumpType")]
1775    pub dump_type: Option<String>,
1776    /// Output only. The duration of the migration job (in seconds). A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
1777    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1778    pub duration: Option<chrono::Duration>,
1779    /// Output only. If the migration job is completed, the time when it was completed.
1780    #[serde(rename = "endTime")]
1781    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1782    /// Output only. The error details in case of state FAILED.
1783    pub error: Option<Status>,
1784    /// This field can be used to select the entities to migrate as part of the migration job. It uses AIP-160 notation to select a subset of the entities configured on the associated conversion-workspace. This field should not be set on migration-jobs that are not associated with a conversion workspace.
1785    pub filter: Option<String>,
1786    /// The resource labels for migration job to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`.
1787    pub labels: Option<HashMap<String, String>>,
1788    /// The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
1789    pub name: Option<String>,
1790    /// Optional. Data dump parallelism settings used by the migration.
1791    #[serde(rename = "performanceConfig")]
1792    pub performance_config: Option<PerformanceConfig>,
1793    /// Output only. The current migration job phase.
1794    pub phase: Option<String>,
1795    /// The details needed to communicate to the source over Reverse SSH tunnel connectivity.
1796    #[serde(rename = "reverseSshConnectivity")]
1797    pub reverse_ssh_connectivity: Option<ReverseSshConnectivity>,
1798    /// Required. The resource name (URI) of the source connection profile.
1799    pub source: Option<String>,
1800    /// The database engine type and provider of the source.
1801    #[serde(rename = "sourceDatabase")]
1802    pub source_database: Option<DatabaseType>,
1803    /// Optional. Configuration for SQL Server homogeneous migration.
1804    #[serde(rename = "sqlserverHomogeneousMigrationJobConfig")]
1805    pub sqlserver_homogeneous_migration_job_config: Option<SqlServerHomogeneousMigrationJobConfig>,
1806    /// The current migration job state.
1807    pub state: Option<String>,
1808    /// static ip connectivity data (default, no additional details needed).
1809    #[serde(rename = "staticIpConnectivity")]
1810    pub static_ip_connectivity: Option<StaticIpConnectivity>,
1811    /// Required. The migration job type.
1812    #[serde(rename = "type")]
1813    pub type_: Option<String>,
1814    /// Output only. The timestamp when the migration job resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".
1815    #[serde(rename = "updateTime")]
1816    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1817    /// The details of the VPC network that the source database is located in.
1818    #[serde(rename = "vpcPeeringConnectivity")]
1819    pub vpc_peering_connectivity: Option<VpcPeeringConnectivity>,
1820}
1821
1822impl common::RequestValue for MigrationJob {}
1823impl common::ResponseResult for MigrationJob {}
1824
1825/// Options to configure rule type MultiColumnDatatypeChange. The rule is used to change the data type and associated properties of multiple columns at once. The rule filter field can refer to one or more entities. The rule scope can be one of:Column. This rule requires additional filters to be specified beyond the basic rule filter field, which is the source data type, but the rule supports additional filtering capabilities such as the minimum and maximum field length. All additional filters which are specified are required to be met in order for the rule to be applied (logical AND between the fields).
1826///
1827/// This type is not used in any activity, and only used as *part* of another schema.
1828///
1829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1830#[serde_with::serde_as]
1831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1832pub struct MultiColumnDatatypeChange {
1833    /// Optional. Custom engine specific features.
1834    #[serde(rename = "customFeatures")]
1835    pub custom_features: Option<HashMap<String, serde_json::Value>>,
1836    /// Required. New data type.
1837    #[serde(rename = "newDataType")]
1838    pub new_data_type: Option<String>,
1839    /// Optional. Column fractional seconds precision - used only for timestamp based datatypes - if not specified and relevant uses the source column fractional seconds precision.
1840    #[serde(rename = "overrideFractionalSecondsPrecision")]
1841    pub override_fractional_seconds_precision: Option<i32>,
1842    /// Optional. Column length - e.g. varchar (50) - if not specified and relevant uses the source column length.
1843    #[serde(rename = "overrideLength")]
1844    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1845    pub override_length: Option<i64>,
1846    /// Optional. Column precision - when relevant - if not specified and relevant uses the source column precision.
1847    #[serde(rename = "overridePrecision")]
1848    pub override_precision: Option<i32>,
1849    /// Optional. Column scale - when relevant - if not specified and relevant uses the source column scale.
1850    #[serde(rename = "overrideScale")]
1851    pub override_scale: Option<i32>,
1852    /// Required. Filter on source data type.
1853    #[serde(rename = "sourceDataTypeFilter")]
1854    pub source_data_type_filter: Option<String>,
1855    /// Optional. Filter for fixed point number data types such as NUMERIC/NUMBER.
1856    #[serde(rename = "sourceNumericFilter")]
1857    pub source_numeric_filter: Option<SourceNumericFilter>,
1858    /// Optional. Filter for text-based data types like varchar.
1859    #[serde(rename = "sourceTextFilter")]
1860    pub source_text_filter: Option<SourceTextFilter>,
1861}
1862
1863impl common::Part for MultiColumnDatatypeChange {}
1864
1865/// Options to configure rule type MultiEntityRename. The rule is used to rename multiple entities. The rule filter field can refer to one or more entities. The rule scope can be one of: Database, Schema, Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT
1866///
1867/// This type is not used in any activity, and only used as *part* of another schema.
1868///
1869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1870#[serde_with::serde_as]
1871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1872pub struct MultiEntityRename {
1873    /// Optional. The pattern used to generate the new entity's name. This pattern must include the characters '{name}', which will be replaced with the name of the original entity. For example, the pattern 't_{name}' for an entity name jobs would be converted to 't_jobs'. If unspecified, the default value for this field is '{name}'
1874    #[serde(rename = "newNamePattern")]
1875    pub new_name_pattern: Option<String>,
1876    /// Optional. Additional transformation that can be done on the source entity name before it is being used by the new_name_pattern, for example lower case. If no transformation is desired, use NO_TRANSFORMATION
1877    #[serde(rename = "sourceNameTransformation")]
1878    pub source_name_transformation: Option<String>,
1879}
1880
1881impl common::Part for MultiEntityRename {}
1882
1883/// Specifies connection parameters required specifically for MySQL databases.
1884///
1885/// This type is not used in any activity, and only used as *part* of another schema.
1886///
1887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1888#[serde_with::serde_as]
1889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1890pub struct MySqlConnectionProfile {
1891    /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
1892    #[serde(rename = "cloudSqlId")]
1893    pub cloud_sql_id: Option<String>,
1894    /// Required. The IP or hostname of the source MySQL database.
1895    pub host: Option<String>,
1896    /// Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service.
1897    pub password: Option<String>,
1898    /// Output only. Indicates If this connection profile password is stored.
1899    #[serde(rename = "passwordSet")]
1900    pub password_set: Option<bool>,
1901    /// Required. The network port of the source MySQL database.
1902    pub port: Option<i32>,
1903    /// SSL configuration for the destination to connect to the source database.
1904    pub ssl: Option<SslConfig>,
1905    /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
1906    pub username: Option<String>,
1907}
1908
1909impl common::Part for MySqlConnectionProfile {}
1910
1911/// This resource represents a long-running operation that is the result of a network API call.
1912///
1913/// # Activities
1914///
1915/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1916/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1917///
1918/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (response)
1919/// * [locations connection profiles delete projects](ProjectLocationConnectionProfileDeleteCall) (response)
1920/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (response)
1921/// * [locations conversion workspaces mapping rules import projects](ProjectLocationConversionWorkspaceMappingRuleImportCall) (response)
1922/// * [locations conversion workspaces apply projects](ProjectLocationConversionWorkspaceApplyCall) (response)
1923/// * [locations conversion workspaces commit projects](ProjectLocationConversionWorkspaceCommitCall) (response)
1924/// * [locations conversion workspaces convert projects](ProjectLocationConversionWorkspaceConvertCall) (response)
1925/// * [locations conversion workspaces create projects](ProjectLocationConversionWorkspaceCreateCall) (response)
1926/// * [locations conversion workspaces delete projects](ProjectLocationConversionWorkspaceDeleteCall) (response)
1927/// * [locations conversion workspaces patch projects](ProjectLocationConversionWorkspacePatchCall) (response)
1928/// * [locations conversion workspaces rollback projects](ProjectLocationConversionWorkspaceRollbackCall) (response)
1929/// * [locations conversion workspaces seed projects](ProjectLocationConversionWorkspaceSeedCall) (response)
1930/// * [locations migration jobs create projects](ProjectLocationMigrationJobCreateCall) (response)
1931/// * [locations migration jobs delete projects](ProjectLocationMigrationJobDeleteCall) (response)
1932/// * [locations migration jobs demote destination projects](ProjectLocationMigrationJobDemoteDestinationCall) (response)
1933/// * [locations migration jobs patch projects](ProjectLocationMigrationJobPatchCall) (response)
1934/// * [locations migration jobs promote projects](ProjectLocationMigrationJobPromoteCall) (response)
1935/// * [locations migration jobs restart projects](ProjectLocationMigrationJobRestartCall) (response)
1936/// * [locations migration jobs resume projects](ProjectLocationMigrationJobResumeCall) (response)
1937/// * [locations migration jobs start projects](ProjectLocationMigrationJobStartCall) (response)
1938/// * [locations migration jobs stop projects](ProjectLocationMigrationJobStopCall) (response)
1939/// * [locations migration jobs verify projects](ProjectLocationMigrationJobVerifyCall) (response)
1940/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1941/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (response)
1942/// * [locations private connections delete projects](ProjectLocationPrivateConnectionDeleteCall) (response)
1943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1944#[serde_with::serde_as]
1945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1946pub struct Operation {
1947    /// 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.
1948    pub done: Option<bool>,
1949    /// The error result of the operation in case of failure or cancellation.
1950    pub error: Option<Status>,
1951    /// 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.
1952    pub metadata: Option<HashMap<String, serde_json::Value>>,
1953    /// 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}`.
1954    pub name: Option<String>,
1955    /// 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`.
1956    pub response: Option<HashMap<String, serde_json::Value>>,
1957}
1958
1959impl common::ResponseResult for Operation {}
1960
1961/// Specifies connection parameters required specifically for Oracle databases.
1962///
1963/// This type is not used in any activity, and only used as *part* of another schema.
1964///
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct OracleConnectionProfile {
1969    /// Required. Database service for the Oracle connection.
1970    #[serde(rename = "databaseService")]
1971    pub database_service: Option<String>,
1972    /// Forward SSH tunnel connectivity.
1973    #[serde(rename = "forwardSshConnectivity")]
1974    pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
1975    /// Required. The IP or hostname of the source Oracle database.
1976    pub host: Option<String>,
1977    /// Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service.
1978    pub password: Option<String>,
1979    /// Output only. Indicates whether a new password is included in the request.
1980    #[serde(rename = "passwordSet")]
1981    pub password_set: Option<bool>,
1982    /// Required. The network port of the source Oracle database.
1983    pub port: Option<i32>,
1984    /// Private connectivity.
1985    #[serde(rename = "privateConnectivity")]
1986    pub private_connectivity: Option<PrivateConnectivity>,
1987    /// SSL configuration for the connection to the source Oracle database. * Only `SERVER_ONLY` configuration is supported for Oracle SSL. * SSL is supported for Oracle versions 12 and above.
1988    pub ssl: Option<SslConfig>,
1989    /// Static Service IP connectivity.
1990    #[serde(rename = "staticServiceIpConnectivity")]
1991    pub static_service_ip_connectivity: Option<StaticServiceIpConnectivity>,
1992    /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
1993    pub username: Option<String>,
1994}
1995
1996impl common::Part for OracleConnectionProfile {}
1997
1998/// Package's parent is a schema.
1999///
2000/// This type is not used in any activity, and only used as *part* of another schema.
2001///
2002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2003#[serde_with::serde_as]
2004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2005pub struct PackageEntity {
2006    /// Custom engine specific features.
2007    #[serde(rename = "customFeatures")]
2008    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2009    /// The SQL code which creates the package body. If the package specification has cursors or subprograms, then the package body is mandatory.
2010    #[serde(rename = "packageBody")]
2011    pub package_body: Option<String>,
2012    /// The SQL code which creates the package.
2013    #[serde(rename = "packageSqlCode")]
2014    pub package_sql_code: Option<String>,
2015}
2016
2017impl common::Part for PackageEntity {}
2018
2019/// Performance configuration definition.
2020///
2021/// This type is not used in any activity, and only used as *part* of another schema.
2022///
2023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2024#[serde_with::serde_as]
2025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2026pub struct PerformanceConfig {
2027    /// Initial dump parallelism level.
2028    #[serde(rename = "dumpParallelLevel")]
2029    pub dump_parallel_level: Option<String>,
2030}
2031
2032impl common::Part for PerformanceConfig {}
2033
2034/// 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/).
2035///
2036/// # Activities
2037///
2038/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2039/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2040///
2041/// * [locations connection profiles get iam policy projects](ProjectLocationConnectionProfileGetIamPolicyCall) (response)
2042/// * [locations connection profiles set iam policy projects](ProjectLocationConnectionProfileSetIamPolicyCall) (response)
2043/// * [locations conversion workspaces get iam policy projects](ProjectLocationConversionWorkspaceGetIamPolicyCall) (response)
2044/// * [locations conversion workspaces set iam policy projects](ProjectLocationConversionWorkspaceSetIamPolicyCall) (response)
2045/// * [locations migration jobs get iam policy projects](ProjectLocationMigrationJobGetIamPolicyCall) (response)
2046/// * [locations migration jobs set iam policy projects](ProjectLocationMigrationJobSetIamPolicyCall) (response)
2047/// * [locations private connections get iam policy projects](ProjectLocationPrivateConnectionGetIamPolicyCall) (response)
2048/// * [locations private connections set iam policy projects](ProjectLocationPrivateConnectionSetIamPolicyCall) (response)
2049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2050#[serde_with::serde_as]
2051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2052pub struct Policy {
2053    /// Specifies cloud audit logging configuration for this policy.
2054    #[serde(rename = "auditConfigs")]
2055    pub audit_configs: Option<Vec<AuditConfig>>,
2056    /// 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`.
2057    pub bindings: Option<Vec<Binding>>,
2058    /// `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.
2059    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2060    pub etag: Option<Vec<u8>>,
2061    /// 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 conditions **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. 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).
2062    pub version: Option<i32>,
2063}
2064
2065impl common::ResponseResult for Policy {}
2066
2067/// Issue position.
2068///
2069/// This type is not used in any activity, and only used as *part* of another schema.
2070///
2071#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2072#[serde_with::serde_as]
2073#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2074pub struct Position {
2075    /// Issue column number
2076    pub column: Option<i32>,
2077    /// Issue length
2078    pub length: Option<i32>,
2079    /// Issue line number
2080    pub line: Option<i32>,
2081    /// Issue offset
2082    pub offset: Option<i32>,
2083}
2084
2085impl common::Part for Position {}
2086
2087/// Specifies connection parameters required specifically for PostgreSQL databases.
2088///
2089/// This type is not used in any activity, and only used as *part* of another schema.
2090///
2091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2092#[serde_with::serde_as]
2093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2094pub struct PostgreSqlConnectionProfile {
2095    /// Optional. If the destination is an AlloyDB database, use this field to provide the AlloyDB cluster ID.
2096    #[serde(rename = "alloydbClusterId")]
2097    pub alloydb_cluster_id: Option<String>,
2098    /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
2099    #[serde(rename = "cloudSqlId")]
2100    pub cloud_sql_id: Option<String>,
2101    /// Required. The IP or hostname of the source PostgreSQL database.
2102    pub host: Option<String>,
2103    /// Output only. If the source is a Cloud SQL database, this field indicates the network architecture it's associated with.
2104    #[serde(rename = "networkArchitecture")]
2105    pub network_architecture: Option<String>,
2106    /// Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service.
2107    pub password: Option<String>,
2108    /// Output only. Indicates If this connection profile password is stored.
2109    #[serde(rename = "passwordSet")]
2110    pub password_set: Option<bool>,
2111    /// Required. The network port of the source PostgreSQL database.
2112    pub port: Option<i32>,
2113    /// Private service connect connectivity.
2114    #[serde(rename = "privateServiceConnectConnectivity")]
2115    pub private_service_connect_connectivity: Option<PrivateServiceConnectConnectivity>,
2116    /// SSL configuration for the destination to connect to the source database.
2117    pub ssl: Option<SslConfig>,
2118    /// Static ip connectivity data (default, no additional details needed).
2119    #[serde(rename = "staticIpConnectivity")]
2120    pub static_ip_connectivity: Option<StaticIpConnectivity>,
2121    /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
2122    pub username: Option<String>,
2123}
2124
2125impl common::Part for PostgreSqlConnectionProfile {}
2126
2127/// Settings for the cluster's primary instance
2128///
2129/// This type is not used in any activity, and only used as *part* of another schema.
2130///
2131#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2132#[serde_with::serde_as]
2133#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2134pub struct PrimaryInstanceSettings {
2135    /// Database flags to pass to AlloyDB when DMS is creating the AlloyDB cluster and instances. See the AlloyDB documentation for how these can be used.
2136    #[serde(rename = "databaseFlags")]
2137    pub database_flags: Option<HashMap<String, String>>,
2138    /// Required. The ID of the AlloyDB primary instance. The ID must satisfy the regex expression "[a-z0-9-]+".
2139    pub id: Option<String>,
2140    /// Labels for the AlloyDB primary instance created by DMS. An object containing a list of 'key', 'value' pairs.
2141    pub labels: Option<HashMap<String, String>>,
2142    /// Configuration for the machines that host the underlying database engine.
2143    #[serde(rename = "machineConfig")]
2144    pub machine_config: Option<MachineConfig>,
2145    /// Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application.
2146    #[serde(rename = "privateIp")]
2147    pub private_ip: Option<String>,
2148}
2149
2150impl common::Part for PrimaryInstanceSettings {}
2151
2152/// The PrivateConnection resource is used to establish private connectivity with the customer’s network.
2153///
2154/// # Activities
2155///
2156/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2157/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2158///
2159/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (request)
2160/// * [locations private connections get projects](ProjectLocationPrivateConnectionGetCall) (response)
2161#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2162#[serde_with::serde_as]
2163#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2164pub struct PrivateConnection {
2165    /// Output only. The create time of the resource.
2166    #[serde(rename = "createTime")]
2167    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2168    /// The private connection display name.
2169    #[serde(rename = "displayName")]
2170    pub display_name: Option<String>,
2171    /// Output only. The error details in case of state FAILED.
2172    pub error: Option<Status>,
2173    /// The resource labels for private connections to use to annotate any related underlying resources such as Compute Engine VMs. An object containing a list of "key": "value" pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`.
2174    pub labels: Option<HashMap<String, String>>,
2175    /// The name of the resource.
2176    pub name: Option<String>,
2177    /// Output only. The state of the private connection.
2178    pub state: Option<String>,
2179    /// Output only. The last update time of the resource.
2180    #[serde(rename = "updateTime")]
2181    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2182    /// VPC peering configuration.
2183    #[serde(rename = "vpcPeeringConfig")]
2184    pub vpc_peering_config: Option<VpcPeeringConfig>,
2185}
2186
2187impl common::RequestValue for PrivateConnection {}
2188impl common::ResponseResult for PrivateConnection {}
2189
2190/// Private Connectivity.
2191///
2192/// This type is not used in any activity, and only used as *part* of another schema.
2193///
2194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2195#[serde_with::serde_as]
2196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2197pub struct PrivateConnectivity {
2198    /// Required. The resource name (URI) of the private connection.
2199    #[serde(rename = "privateConnection")]
2200    pub private_connection: Option<String>,
2201}
2202
2203impl common::Part for PrivateConnectivity {}
2204
2205/// [Private Service Connect connectivity](https://cloud.google.com/vpc/docs/private-service-connect#service-attachments)
2206///
2207/// This type is not used in any activity, and only used as *part* of another schema.
2208///
2209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2210#[serde_with::serde_as]
2211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2212pub struct PrivateServiceConnectConnectivity {
2213    /// Required. A service attachment that exposes a database, and has the following format: projects/{project}/regions/{region}/serviceAttachments/{service_attachment_name}
2214    #[serde(rename = "serviceAttachment")]
2215    pub service_attachment: Option<String>,
2216}
2217
2218impl common::Part for PrivateServiceConnectConnectivity {}
2219
2220/// Request message for ‘PromoteMigrationJob’ request.
2221///
2222/// # Activities
2223///
2224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2226///
2227/// * [locations migration jobs promote projects](ProjectLocationMigrationJobPromoteCall) (request)
2228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2229#[serde_with::serde_as]
2230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2231pub struct PromoteMigrationJobRequest {
2232    _never_set: Option<bool>,
2233}
2234
2235impl common::RequestValue for PromoteMigrationJobRequest {}
2236
2237/// Request message for ‘RestartMigrationJob’ request.
2238///
2239/// # Activities
2240///
2241/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2242/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2243///
2244/// * [locations migration jobs restart projects](ProjectLocationMigrationJobRestartCall) (request)
2245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2246#[serde_with::serde_as]
2247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2248pub struct RestartMigrationJobRequest {
2249    /// Optional. Restart the migration job without running prior configuration verification. Defaults to `false`.
2250    #[serde(rename = "skipValidation")]
2251    pub skip_validation: Option<bool>,
2252}
2253
2254impl common::RequestValue for RestartMigrationJobRequest {}
2255
2256/// Request message for ‘ResumeMigrationJob’ request.
2257///
2258/// # Activities
2259///
2260/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2261/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2262///
2263/// * [locations migration jobs resume projects](ProjectLocationMigrationJobResumeCall) (request)
2264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2265#[serde_with::serde_as]
2266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2267pub struct ResumeMigrationJobRequest {
2268    /// Optional. Resume the migration job without running prior configuration verification. Defaults to `false`.
2269    #[serde(rename = "skipValidation")]
2270    pub skip_validation: Option<bool>,
2271}
2272
2273impl common::RequestValue for ResumeMigrationJobRequest {}
2274
2275/// The details needed to configure a reverse SSH tunnel between the source and destination databases. These details will be used when calling the generateSshScript method (see https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs/generateSshScript) to produce the script that will help set up the reverse SSH tunnel, and to set up the VPC peering between the Cloud SQL private network and the VPC.
2276///
2277/// This type is not used in any activity, and only used as *part* of another schema.
2278///
2279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2280#[serde_with::serde_as]
2281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2282pub struct ReverseSshConnectivity {
2283    /// The name of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2284    pub vm: Option<String>,
2285    /// Required. The IP of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2286    #[serde(rename = "vmIp")]
2287    pub vm_ip: Option<String>,
2288    /// Required. The forwarding port of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2289    #[serde(rename = "vmPort")]
2290    pub vm_port: Option<i32>,
2291    /// The name of the VPC to peer with the Cloud SQL private network.
2292    pub vpc: Option<String>,
2293}
2294
2295impl common::Part for ReverseSshConnectivity {}
2296
2297/// Request message for ‘RollbackConversionWorkspace’ request.
2298///
2299/// # Activities
2300///
2301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2303///
2304/// * [locations conversion workspaces rollback projects](ProjectLocationConversionWorkspaceRollbackCall) (request)
2305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2306#[serde_with::serde_as]
2307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2308pub struct RollbackConversionWorkspaceRequest {
2309    _never_set: Option<bool>,
2310}
2311
2312impl common::RequestValue for RollbackConversionWorkspaceRequest {}
2313
2314/// This allows the data to change scale, for example if the source is 2 digits after the decimal point, specify round to scale value = 2. If for example the value needs to be converted to an integer, use round to scale value = 0.
2315///
2316/// This type is not used in any activity, and only used as *part* of another schema.
2317///
2318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2319#[serde_with::serde_as]
2320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2321pub struct RoundToScale {
2322    /// Required. Scale value to be used
2323    pub scale: Option<i32>,
2324}
2325
2326impl common::Part for RoundToScale {}
2327
2328/// Details of a single rules file.
2329///
2330/// This type is not used in any activity, and only used as *part* of another schema.
2331///
2332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2333#[serde_with::serde_as]
2334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2335pub struct RulesFile {
2336    /// Required. The text content of the rules that needs to be converted.
2337    #[serde(rename = "rulesContent")]
2338    pub rules_content: Option<String>,
2339    /// Required. The filename of the rules that needs to be converted. The filename is used mainly so that future logs of the import rules job contain it, and can therefore be searched by it.
2340    #[serde(rename = "rulesSourceFilename")]
2341    pub rules_source_filename: Option<String>,
2342}
2343
2344impl common::Part for RulesFile {}
2345
2346/// Schema typically has no parent entity, but can have a parent entity DatabaseInstance (for database engines which support it). For some database engines, the terms schema and user can be used interchangeably when they refer to a namespace or a collection of other database entities. Can store additional information which is schema specific.
2347///
2348/// This type is not used in any activity, and only used as *part* of another schema.
2349///
2350#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2351#[serde_with::serde_as]
2352#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2353pub struct SchemaEntity {
2354    /// Custom engine specific features.
2355    #[serde(rename = "customFeatures")]
2356    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2357}
2358
2359impl common::Part for SchemaEntity {}
2360
2361/// Response message for ‘SearchBackgroundJobs’ request.
2362///
2363/// # Activities
2364///
2365/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2366/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2367///
2368/// * [locations conversion workspaces search background jobs projects](ProjectLocationConversionWorkspaceSearchBackgroundJobCall) (response)
2369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2370#[serde_with::serde_as]
2371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2372pub struct SearchBackgroundJobsResponse {
2373    /// The list of conversion workspace mapping rules.
2374    pub jobs: Option<Vec<BackgroundJobLogEntry>>,
2375}
2376
2377impl common::ResponseResult for SearchBackgroundJobsResponse {}
2378
2379/// Request message for ‘SeedConversionWorkspace’ request.
2380///
2381/// # Activities
2382///
2383/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2384/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2385///
2386/// * [locations conversion workspaces seed projects](ProjectLocationConversionWorkspaceSeedCall) (request)
2387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2388#[serde_with::serde_as]
2389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2390pub struct SeedConversionWorkspaceRequest {
2391    /// Should the conversion workspace be committed automatically after the seed operation.
2392    #[serde(rename = "autoCommit")]
2393    pub auto_commit: Option<bool>,
2394    /// Optional. Fully qualified (Uri) name of the destination connection profile.
2395    #[serde(rename = "destinationConnectionProfile")]
2396    pub destination_connection_profile: Option<String>,
2397    /// Optional. Fully qualified (Uri) name of the source connection profile.
2398    #[serde(rename = "sourceConnectionProfile")]
2399    pub source_connection_profile: Option<String>,
2400}
2401
2402impl common::RequestValue for SeedConversionWorkspaceRequest {}
2403
2404/// Details regarding a Seed background job.
2405///
2406/// This type is not used in any activity, and only used as *part* of another schema.
2407///
2408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2409#[serde_with::serde_as]
2410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2411pub struct SeedJobDetails {
2412    /// Output only. The connection profile which was used for the seed job.
2413    #[serde(rename = "connectionProfile")]
2414    pub connection_profile: Option<String>,
2415}
2416
2417impl common::Part for SeedJobDetails {}
2418
2419/// Sequence's parent is a schema.
2420///
2421/// This type is not used in any activity, and only used as *part* of another schema.
2422///
2423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2424#[serde_with::serde_as]
2425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2426pub struct SequenceEntity {
2427    /// Indicates number of entries to cache / precreate.
2428    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2429    pub cache: Option<i64>,
2430    /// Custom engine specific features.
2431    #[serde(rename = "customFeatures")]
2432    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2433    /// Indicates whether the sequence value should cycle through.
2434    pub cycle: Option<bool>,
2435    /// Increment value for the sequence.
2436    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2437    pub increment: Option<i64>,
2438    /// Maximum number for the sequence represented as bytes to accommodate large. numbers
2439    #[serde(rename = "maxValue")]
2440    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2441    pub max_value: Option<Vec<u8>>,
2442    /// Minimum number for the sequence represented as bytes to accommodate large. numbers
2443    #[serde(rename = "minValue")]
2444    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2445    pub min_value: Option<Vec<u8>>,
2446    /// Start number for the sequence represented as bytes to accommodate large. numbers
2447    #[serde(rename = "startValue")]
2448    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2449    pub start_value: Option<Vec<u8>>,
2450}
2451
2452impl common::Part for SequenceEntity {}
2453
2454/// Request message for `SetIamPolicy` method.
2455///
2456/// # Activities
2457///
2458/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2459/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2460///
2461/// * [locations connection profiles set iam policy projects](ProjectLocationConnectionProfileSetIamPolicyCall) (request)
2462/// * [locations conversion workspaces set iam policy projects](ProjectLocationConversionWorkspaceSetIamPolicyCall) (request)
2463/// * [locations migration jobs set iam policy projects](ProjectLocationMigrationJobSetIamPolicyCall) (request)
2464/// * [locations private connections set iam policy projects](ProjectLocationPrivateConnectionSetIamPolicyCall) (request)
2465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2466#[serde_with::serde_as]
2467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2468pub struct SetIamPolicyRequest {
2469    /// 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.
2470    pub policy: Option<Policy>,
2471    /// 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"`
2472    #[serde(rename = "updateMask")]
2473    pub update_mask: Option<common::FieldMask>,
2474}
2475
2476impl common::RequestValue for SetIamPolicyRequest {}
2477
2478/// Options to configure rule type SetTablePrimaryKey. The rule is used to specify the columns and name to configure/alter the primary key of a table. The rule filter field can refer to one entity. The rule scope can be one of: Table.
2479///
2480/// This type is not used in any activity, and only used as *part* of another schema.
2481///
2482#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2483#[serde_with::serde_as]
2484#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2485pub struct SetTablePrimaryKey {
2486    /// Optional. Name for the primary key
2487    #[serde(rename = "primaryKey")]
2488    pub primary_key: Option<String>,
2489    /// Required. List of column names for the primary key
2490    #[serde(rename = "primaryKeyColumns")]
2491    pub primary_key_columns: Option<Vec<String>>,
2492}
2493
2494impl common::Part for SetTablePrimaryKey {}
2495
2496/// Options to configure rule type SingleColumnChange. The rule is used to change the properties of a column. The rule filter field can refer to one entity. The rule scope can be one of: Column. When using this rule, if a field is not specified than the destination column's configuration will be the same as the one in the source column..
2497///
2498/// This type is not used in any activity, and only used as *part* of another schema.
2499///
2500#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2501#[serde_with::serde_as]
2502#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2503pub struct SingleColumnChange {
2504    /// Optional. Is the column of array type.
2505    pub array: Option<bool>,
2506    /// Optional. The length of the array, only relevant if the column type is an array.
2507    #[serde(rename = "arrayLength")]
2508    pub array_length: Option<i32>,
2509    /// Optional. Is the column auto-generated/identity.
2510    #[serde(rename = "autoGenerated")]
2511    pub auto_generated: Option<bool>,
2512    /// Optional. Charset override - instead of table level charset.
2513    pub charset: Option<String>,
2514    /// Optional. Collation override - instead of table level collation.
2515    pub collation: Option<String>,
2516    /// Optional. Comment associated with the column.
2517    pub comment: Option<String>,
2518    /// Optional. Custom engine specific features.
2519    #[serde(rename = "customFeatures")]
2520    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2521    /// Optional. Column data type name.
2522    #[serde(rename = "dataType")]
2523    pub data_type: Option<String>,
2524    /// Optional. Column fractional seconds precision - e.g. 2 as in timestamp (2) - when relevant.
2525    #[serde(rename = "fractionalSecondsPrecision")]
2526    pub fractional_seconds_precision: Option<i32>,
2527    /// Optional. Column length - e.g. 50 as in varchar (50) - when relevant.
2528    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2529    pub length: Option<i64>,
2530    /// Optional. Is the column nullable.
2531    pub nullable: Option<bool>,
2532    /// Optional. Column precision - e.g. 8 as in double (8,2) - when relevant.
2533    pub precision: Option<i32>,
2534    /// Optional. Column scale - e.g. 2 as in double (8,2) - when relevant.
2535    pub scale: Option<i32>,
2536    /// Optional. Specifies the list of values allowed in the column.
2537    #[serde(rename = "setValues")]
2538    pub set_values: Option<Vec<String>>,
2539    /// Optional. Is the column a UDT (User-defined Type).
2540    pub udt: Option<bool>,
2541}
2542
2543impl common::Part for SingleColumnChange {}
2544
2545/// Options to configure rule type SingleEntityRename. The rule is used to rename an entity. The rule filter field can refer to only one entity. The rule scope can be one of: Database, Schema, Table, Column, Constraint, Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT, Synonym
2546///
2547/// This type is not used in any activity, and only used as *part* of another schema.
2548///
2549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2550#[serde_with::serde_as]
2551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2552pub struct SingleEntityRename {
2553    /// Required. The new name of the destination entity
2554    #[serde(rename = "newName")]
2555    pub new_name: Option<String>,
2556}
2557
2558impl common::Part for SingleEntityRename {}
2559
2560/// Options to configure rule type SinglePackageChange. The rule is used to alter the sql code for a package entities. The rule filter field can refer to one entity. The rule scope can be: Package
2561///
2562/// This type is not used in any activity, and only used as *part* of another schema.
2563///
2564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2565#[serde_with::serde_as]
2566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2567pub struct SinglePackageChange {
2568    /// Optional. Sql code for package body
2569    #[serde(rename = "packageBody")]
2570    pub package_body: Option<String>,
2571    /// Optional. Sql code for package description
2572    #[serde(rename = "packageDescription")]
2573    pub package_description: Option<String>,
2574}
2575
2576impl common::Part for SinglePackageChange {}
2577
2578/// Filter for fixed point number data types such as NUMERIC/NUMBER
2579///
2580/// This type is not used in any activity, and only used as *part* of another schema.
2581///
2582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2583#[serde_with::serde_as]
2584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2585pub struct SourceNumericFilter {
2586    /// Required. Enum to set the option defining the datatypes numeric filter has to be applied to
2587    #[serde(rename = "numericFilterOption")]
2588    pub numeric_filter_option: Option<String>,
2589    /// Optional. The filter will match columns with precision smaller than or equal to this number.
2590    #[serde(rename = "sourceMaxPrecisionFilter")]
2591    pub source_max_precision_filter: Option<i32>,
2592    /// Optional. The filter will match columns with scale smaller than or equal to this number.
2593    #[serde(rename = "sourceMaxScaleFilter")]
2594    pub source_max_scale_filter: Option<i32>,
2595    /// Optional. The filter will match columns with precision greater than or equal to this number.
2596    #[serde(rename = "sourceMinPrecisionFilter")]
2597    pub source_min_precision_filter: Option<i32>,
2598    /// Optional. The filter will match columns with scale greater than or equal to this number.
2599    #[serde(rename = "sourceMinScaleFilter")]
2600    pub source_min_scale_filter: Option<i32>,
2601}
2602
2603impl common::Part for SourceNumericFilter {}
2604
2605/// Options to configure rule type SourceSqlChange. The rule is used to alter the sql code for database entities. The rule filter field can refer to one entity. The rule scope can be: StoredProcedure, Function, Trigger, View
2606///
2607/// This type is not used in any activity, and only used as *part* of another schema.
2608///
2609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2610#[serde_with::serde_as]
2611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2612pub struct SourceSqlChange {
2613    /// Required. Sql code for source (stored procedure, function, trigger or view)
2614    #[serde(rename = "sqlCode")]
2615    pub sql_code: Option<String>,
2616}
2617
2618impl common::Part for SourceSqlChange {}
2619
2620/// Filter for text-based data types like varchar.
2621///
2622/// This type is not used in any activity, and only used as *part* of another schema.
2623///
2624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2625#[serde_with::serde_as]
2626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2627pub struct SourceTextFilter {
2628    /// Optional. The filter will match columns with length smaller than or equal to this number.
2629    #[serde(rename = "sourceMaxLengthFilter")]
2630    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2631    pub source_max_length_filter: Option<i64>,
2632    /// Optional. The filter will match columns with length greater than or equal to this number.
2633    #[serde(rename = "sourceMinLengthFilter")]
2634    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2635    pub source_min_length_filter: Option<i64>,
2636}
2637
2638impl common::Part for SourceTextFilter {}
2639
2640/// An entry for an Access Control list.
2641///
2642/// This type is not used in any activity, and only used as *part* of another schema.
2643///
2644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2645#[serde_with::serde_as]
2646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2647pub struct SqlAclEntry {
2648    /// The time when this access control entry expires in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example: `2012-11-15T16:19:00.094Z`.
2649    #[serde(rename = "expireTime")]
2650    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2651    /// A label to identify this entry.
2652    pub label: Option<String>,
2653    /// Input only. The time-to-leave of this access control entry.
2654    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2655    pub ttl: Option<chrono::Duration>,
2656    /// The allowlisted value for the access control list.
2657    pub value: Option<String>,
2658}
2659
2660impl common::Part for SqlAclEntry {}
2661
2662/// IP Management configuration.
2663///
2664/// This type is not used in any activity, and only used as *part* of another schema.
2665///
2666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2667#[serde_with::serde_as]
2668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2669pub struct SqlIpConfig {
2670    /// Optional. The name of the allocated IP address range for the private IP Cloud SQL instance. This name refers to an already allocated IP range address. If set, the instance IP address will be created in the allocated range. Note that this IP address range can't be modified after the instance is created. If you change the VPC when configuring connectivity settings for the migration job, this field is not relevant.
2671    #[serde(rename = "allocatedIpRange")]
2672    pub allocated_ip_range: Option<String>,
2673    /// The list of external networks that are allowed to connect to the instance using the IP. See https://en.wikipedia.org/wiki/CIDR_notation#CIDR_notation, also known as 'slash' notation (e.g. `192.168.100.0/24`).
2674    #[serde(rename = "authorizedNetworks")]
2675    pub authorized_networks: Option<Vec<SqlAclEntry>>,
2676    /// Whether the instance should be assigned an IPv4 address or not.
2677    #[serde(rename = "enableIpv4")]
2678    pub enable_ipv4: Option<bool>,
2679    /// The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, `projects/myProject/global/networks/default`. This setting can be updated, but it cannot be removed after it is set.
2680    #[serde(rename = "privateNetwork")]
2681    pub private_network: Option<String>,
2682    /// Whether SSL connections over IP should be enforced or not.
2683    #[serde(rename = "requireSsl")]
2684    pub require_ssl: Option<bool>,
2685}
2686
2687impl common::Part for SqlIpConfig {}
2688
2689/// Specifies the backup details in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
2690///
2691/// This type is not used in any activity, and only used as *part* of another schema.
2692///
2693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2694#[serde_with::serde_as]
2695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2696pub struct SqlServerBackups {
2697    /// Required. The Cloud Storage bucket that stores backups for all replicated databases.
2698    #[serde(rename = "gcsBucket")]
2699    pub gcs_bucket: Option<String>,
2700    /// Optional. Cloud Storage path inside the bucket that stores backups.
2701    #[serde(rename = "gcsPrefix")]
2702    pub gcs_prefix: Option<String>,
2703}
2704
2705impl common::Part for SqlServerBackups {}
2706
2707/// Specifies connection parameters required specifically for SQL Server databases.
2708///
2709/// This type is not used in any activity, and only used as *part* of another schema.
2710///
2711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2712#[serde_with::serde_as]
2713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2714pub struct SqlServerConnectionProfile {
2715    /// The backup details in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
2716    pub backups: Option<SqlServerBackups>,
2717    /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
2718    #[serde(rename = "cloudSqlId")]
2719    pub cloud_sql_id: Option<String>,
2720    /// Forward SSH tunnel connectivity.
2721    #[serde(rename = "forwardSshConnectivity")]
2722    pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
2723    /// Required. The IP or hostname of the source SQL Server database.
2724    pub host: Option<String>,
2725    /// Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service.
2726    pub password: Option<String>,
2727    /// Output only. Indicates whether a new password is included in the request.
2728    #[serde(rename = "passwordSet")]
2729    pub password_set: Option<bool>,
2730    /// Required. The network port of the source SQL Server database.
2731    pub port: Option<i32>,
2732    /// Private connectivity.
2733    #[serde(rename = "privateConnectivity")]
2734    pub private_connectivity: Option<PrivateConnectivity>,
2735    /// Private Service Connect connectivity.
2736    #[serde(rename = "privateServiceConnectConnectivity")]
2737    pub private_service_connect_connectivity: Option<PrivateServiceConnectConnectivity>,
2738    /// SSL configuration for the destination to connect to the source database.
2739    pub ssl: Option<SslConfig>,
2740    /// Static IP connectivity data (default, no additional details needed).
2741    #[serde(rename = "staticIpConnectivity")]
2742    pub static_ip_connectivity: Option<StaticIpConnectivity>,
2743    /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
2744    pub username: Option<String>,
2745}
2746
2747impl common::Part for SqlServerConnectionProfile {}
2748
2749/// Specifies the backup details for a single database in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
2750///
2751/// This type is not used in any activity, and only used as *part* of another schema.
2752///
2753#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2754#[serde_with::serde_as]
2755#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2756pub struct SqlServerDatabaseBackup {
2757    /// Required. Name of a SQL Server database for which to define backup configuration.
2758    pub database: Option<String>,
2759    /// Optional. Encryption settings for the database. Required if provided database backups are encrypted. Encryption settings include path to certificate, path to certificate private key, and key password.
2760    #[serde(rename = "encryptionOptions")]
2761    pub encryption_options: Option<SqlServerEncryptionOptions>,
2762}
2763
2764impl common::Part for SqlServerDatabaseBackup {}
2765
2766/// Encryption settings for the SQL Server database.
2767///
2768/// This type is not used in any activity, and only used as *part* of another schema.
2769///
2770#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2771#[serde_with::serde_as]
2772#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2773pub struct SqlServerEncryptionOptions {
2774    /// Required. Path to certificate.
2775    #[serde(rename = "certPath")]
2776    pub cert_path: Option<String>,
2777    /// Required. Input only. Private key password.
2778    #[serde(rename = "pvkPassword")]
2779    pub pvk_password: Option<String>,
2780    /// Required. Path to certificate private key.
2781    #[serde(rename = "pvkPath")]
2782    pub pvk_path: Option<String>,
2783}
2784
2785impl common::Part for SqlServerEncryptionOptions {}
2786
2787/// Configuration for homogeneous migration to Cloud SQL for SQL Server.
2788///
2789/// This type is not used in any activity, and only used as *part* of another schema.
2790///
2791#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2792#[serde_with::serde_as]
2793#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2794pub struct SqlServerHomogeneousMigrationJobConfig {
2795    /// Required. Pattern that describes the default backup naming strategy. The specified pattern should ensure lexicographical order of backups. The pattern must define one of the following capture group sets: Capture group set #1 yy/yyyy - year, 2 or 4 digits mm - month number, 1-12 dd - day of month, 1-31 hh - hour of day, 00-23 mi - minutes, 00-59 ss - seconds, 00-59 Example: For backup file TestDB_20230802_155400.trn, use pattern: (?.*)_backup_(?\d{4})(?\d{2})(?\d{2})_(?\d{2})(?\d{2})(?\d{2}).trn Capture group set #2 timestamp - unix timestamp Example: For backup file TestDB.1691448254.trn, use pattern: (?.*)\.(?\d*).trn or (?.*)\.(?\d*).trn
2796    #[serde(rename = "backupFilePattern")]
2797    pub backup_file_pattern: Option<String>,
2798    /// Required. Backup details per database in Cloud Storage.
2799    #[serde(rename = "databaseBackups")]
2800    pub database_backups: Option<Vec<SqlServerDatabaseBackup>>,
2801    /// Optional. Enable differential backups.
2802    #[serde(rename = "useDiffBackup")]
2803    pub use_diff_backup: Option<bool>,
2804}
2805
2806impl common::Part for SqlServerHomogeneousMigrationJobConfig {}
2807
2808/// Response message for ‘GenerateSshScript’ request.
2809///
2810/// # Activities
2811///
2812/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2813/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2814///
2815/// * [locations migration jobs generate ssh script projects](ProjectLocationMigrationJobGenerateSshScriptCall) (response)
2816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2817#[serde_with::serde_as]
2818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2819pub struct SshScript {
2820    /// The ssh configuration script.
2821    pub script: Option<String>,
2822}
2823
2824impl common::ResponseResult for SshScript {}
2825
2826/// SSL configuration information.
2827///
2828/// This type is not used in any activity, and only used as *part* of another schema.
2829///
2830#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2831#[serde_with::serde_as]
2832#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2833pub struct SslConfig {
2834    /// Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. The replica will use this certificate to verify it's connecting to the right host.
2835    #[serde(rename = "caCertificate")]
2836    pub ca_certificate: Option<String>,
2837    /// Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server.If this field is used then the 'client_key' field is mandatory.
2838    #[serde(rename = "clientCertificate")]
2839    pub client_certificate: Option<String>,
2840    /// Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'client_certificate' field is mandatory.
2841    #[serde(rename = "clientKey")]
2842    pub client_key: Option<String>,
2843    /// Output only. The ssl config type according to 'client_key', 'client_certificate' and 'ca_certificate'.
2844    #[serde(rename = "type")]
2845    pub type_: Option<String>,
2846}
2847
2848impl common::Part for SslConfig {}
2849
2850/// Request message for ‘StartMigrationJob’ request.
2851///
2852/// # Activities
2853///
2854/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2855/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2856///
2857/// * [locations migration jobs start projects](ProjectLocationMigrationJobStartCall) (request)
2858#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2859#[serde_with::serde_as]
2860#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2861pub struct StartMigrationJobRequest {
2862    /// Optional. Start the migration job without running prior configuration verification. Defaults to `false`.
2863    #[serde(rename = "skipValidation")]
2864    pub skip_validation: Option<bool>,
2865}
2866
2867impl common::RequestValue for StartMigrationJobRequest {}
2868
2869/// The source database will allow incoming connections from the public IP of the destination database. You can retrieve the public IP of the Cloud SQL instance from the Cloud SQL console or using Cloud SQL APIs. No additional configuration is required.
2870///
2871/// This type is not used in any activity, and only used as *part* of another schema.
2872///
2873#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2874#[serde_with::serde_as]
2875#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2876pub struct StaticIpConnectivity {
2877    _never_set: Option<bool>,
2878}
2879
2880impl common::Part for StaticIpConnectivity {}
2881
2882/// Static IP address connectivity configured on service project.
2883///
2884/// This type is not used in any activity, and only used as *part* of another schema.
2885///
2886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2887#[serde_with::serde_as]
2888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2889pub struct StaticServiceIpConnectivity {
2890    _never_set: Option<bool>,
2891}
2892
2893impl common::Part for StaticServiceIpConnectivity {}
2894
2895/// 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).
2896///
2897/// This type is not used in any activity, and only used as *part* of another schema.
2898///
2899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2900#[serde_with::serde_as]
2901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2902pub struct Status {
2903    /// The status code, which should be an enum value of google.rpc.Code.
2904    pub code: Option<i32>,
2905    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2906    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2907    /// 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.
2908    pub message: Option<String>,
2909}
2910
2911impl common::Part for Status {}
2912
2913/// Request message for ‘StopMigrationJob’ request.
2914///
2915/// # Activities
2916///
2917/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2918/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2919///
2920/// * [locations migration jobs stop projects](ProjectLocationMigrationJobStopCall) (request)
2921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2922#[serde_with::serde_as]
2923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2924pub struct StopMigrationJobRequest {
2925    _never_set: Option<bool>,
2926}
2927
2928impl common::RequestValue for StopMigrationJobRequest {}
2929
2930/// Stored procedure's parent is a schema.
2931///
2932/// This type is not used in any activity, and only used as *part* of another schema.
2933///
2934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2935#[serde_with::serde_as]
2936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2937pub struct StoredProcedureEntity {
2938    /// Custom engine specific features.
2939    #[serde(rename = "customFeatures")]
2940    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2941    /// The SQL code which creates the stored procedure.
2942    #[serde(rename = "sqlCode")]
2943    pub sql_code: Option<String>,
2944}
2945
2946impl common::Part for StoredProcedureEntity {}
2947
2948/// Synonym's parent is a schema.
2949///
2950/// This type is not used in any activity, and only used as *part* of another schema.
2951///
2952#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2953#[serde_with::serde_as]
2954#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2955pub struct SynonymEntity {
2956    /// Custom engine specific features.
2957    #[serde(rename = "customFeatures")]
2958    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2959    /// The name of the entity for which the synonym is being created (the source).
2960    #[serde(rename = "sourceEntity")]
2961    pub source_entity: Option<String>,
2962    /// The type of the entity for which the synonym is being created (usually a table or a sequence).
2963    #[serde(rename = "sourceType")]
2964    pub source_type: Option<String>,
2965}
2966
2967impl common::Part for SynonymEntity {}
2968
2969/// Table's parent is a schema.
2970///
2971/// This type is not used in any activity, and only used as *part* of another schema.
2972///
2973#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2974#[serde_with::serde_as]
2975#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2976pub struct TableEntity {
2977    /// Table columns.
2978    pub columns: Option<Vec<ColumnEntity>>,
2979    /// Comment associated with the table.
2980    pub comment: Option<String>,
2981    /// Table constraints.
2982    pub constraints: Option<Vec<ConstraintEntity>>,
2983    /// Custom engine specific features.
2984    #[serde(rename = "customFeatures")]
2985    pub custom_features: Option<HashMap<String, serde_json::Value>>,
2986    /// Table indices.
2987    pub indices: Option<Vec<IndexEntity>>,
2988    /// Table triggers.
2989    pub triggers: Option<Vec<TriggerEntity>>,
2990}
2991
2992impl common::Part for TableEntity {}
2993
2994/// Response message for ‘GenerateTcpProxyScript’ request.
2995///
2996/// # Activities
2997///
2998/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2999/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3000///
3001/// * [locations migration jobs generate tcp proxy script projects](ProjectLocationMigrationJobGenerateTcpProxyScriptCall) (response)
3002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3003#[serde_with::serde_as]
3004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3005pub struct TcpProxyScript {
3006    /// The TCP Proxy configuration script.
3007    pub script: Option<String>,
3008}
3009
3010impl common::ResponseResult for TcpProxyScript {}
3011
3012/// Request message for `TestIamPermissions` method.
3013///
3014/// # Activities
3015///
3016/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3017/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3018///
3019/// * [locations connection profiles test iam permissions projects](ProjectLocationConnectionProfileTestIamPermissionCall) (request)
3020/// * [locations conversion workspaces test iam permissions projects](ProjectLocationConversionWorkspaceTestIamPermissionCall) (request)
3021/// * [locations migration jobs test iam permissions projects](ProjectLocationMigrationJobTestIamPermissionCall) (request)
3022/// * [locations private connections test iam permissions projects](ProjectLocationPrivateConnectionTestIamPermissionCall) (request)
3023#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3024#[serde_with::serde_as]
3025#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3026pub struct TestIamPermissionsRequest {
3027    /// 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).
3028    pub permissions: Option<Vec<String>>,
3029}
3030
3031impl common::RequestValue for TestIamPermissionsRequest {}
3032
3033/// Response message for `TestIamPermissions` method.
3034///
3035/// # Activities
3036///
3037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3039///
3040/// * [locations connection profiles test iam permissions projects](ProjectLocationConnectionProfileTestIamPermissionCall) (response)
3041/// * [locations conversion workspaces test iam permissions projects](ProjectLocationConversionWorkspaceTestIamPermissionCall) (response)
3042/// * [locations migration jobs test iam permissions projects](ProjectLocationMigrationJobTestIamPermissionCall) (response)
3043/// * [locations private connections test iam permissions projects](ProjectLocationPrivateConnectionTestIamPermissionCall) (response)
3044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3045#[serde_with::serde_as]
3046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3047pub struct TestIamPermissionsResponse {
3048    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3049    pub permissions: Option<Vec<String>>,
3050}
3051
3052impl common::ResponseResult for TestIamPermissionsResponse {}
3053
3054/// Trigger is not used as an independent entity, it is retrieved as part of a Table entity.
3055///
3056/// This type is not used in any activity, and only used as *part* of another schema.
3057///
3058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3059#[serde_with::serde_as]
3060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3061pub struct TriggerEntity {
3062    /// Custom engine specific features.
3063    #[serde(rename = "customFeatures")]
3064    pub custom_features: Option<HashMap<String, serde_json::Value>>,
3065    /// The name of the trigger.
3066    pub name: Option<String>,
3067    /// The SQL code which creates the trigger.
3068    #[serde(rename = "sqlCode")]
3069    pub sql_code: Option<String>,
3070    /// Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH ROW.
3071    #[serde(rename = "triggerType")]
3072    pub trigger_type: Option<String>,
3073    /// The DML, DDL, or database events that fire the trigger, for example INSERT, UPDATE.
3074    #[serde(rename = "triggeringEvents")]
3075    pub triggering_events: Option<Vec<String>>,
3076}
3077
3078impl common::Part for TriggerEntity {}
3079
3080/// UDT's parent is a schema.
3081///
3082/// This type is not used in any activity, and only used as *part* of another schema.
3083///
3084#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3085#[serde_with::serde_as]
3086#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3087pub struct UDTEntity {
3088    /// Custom engine specific features.
3089    #[serde(rename = "customFeatures")]
3090    pub custom_features: Option<HashMap<String, serde_json::Value>>,
3091    /// The SQL code which creates the udt body.
3092    #[serde(rename = "udtBody")]
3093    pub udt_body: Option<String>,
3094    /// The SQL code which creates the udt.
3095    #[serde(rename = "udtSqlCode")]
3096    pub udt_sql_code: Option<String>,
3097}
3098
3099impl common::Part for UDTEntity {}
3100
3101/// The username/password for a database user. Used for specifying initial users at cluster creation time.
3102///
3103/// This type is not used in any activity, and only used as *part* of another schema.
3104///
3105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3106#[serde_with::serde_as]
3107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3108pub struct UserPassword {
3109    /// The initial password for the user.
3110    pub password: Option<String>,
3111    /// Output only. Indicates if the initial_user.password field has been set.
3112    #[serde(rename = "passwordSet")]
3113    pub password_set: Option<bool>,
3114    /// The database username.
3115    pub user: Option<String>,
3116}
3117
3118impl common::Part for UserPassword {}
3119
3120/// A list of values to filter by in ConditionalColumnSetValue
3121///
3122/// This type is not used in any activity, and only used as *part* of another schema.
3123///
3124#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3125#[serde_with::serde_as]
3126#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3127pub struct ValueListFilter {
3128    /// Required. Whether to ignore case when filtering by values. Defaults to false
3129    #[serde(rename = "ignoreCase")]
3130    pub ignore_case: Option<bool>,
3131    /// Required. Indicates whether the filter matches rows with values that are present in the list or those with values not present in it.
3132    #[serde(rename = "valuePresentList")]
3133    pub value_present_list: Option<String>,
3134    /// Required. The list to be used to filter by
3135    pub values: Option<Vec<String>>,
3136}
3137
3138impl common::Part for ValueListFilter {}
3139
3140/// Description of data transformation during migration as part of the ConditionalColumnSetValue.
3141///
3142/// This type is not used in any activity, and only used as *part* of another schema.
3143///
3144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3145#[serde_with::serde_as]
3146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3147pub struct ValueTransformation {
3148    /// Optional. Applies a hash function on the data
3149    #[serde(rename = "applyHash")]
3150    pub apply_hash: Option<ApplyHash>,
3151    /// Optional. Set to max_value - if integer or numeric, will use int.maxvalue, etc
3152    #[serde(rename = "assignMaxValue")]
3153    pub assign_max_value: Option<Empty>,
3154    /// Optional. Set to min_value - if integer or numeric, will use int.minvalue, etc
3155    #[serde(rename = "assignMinValue")]
3156    pub assign_min_value: Option<Empty>,
3157    /// Optional. Set to null
3158    #[serde(rename = "assignNull")]
3159    pub assign_null: Option<Empty>,
3160    /// Optional. Set to a specific value (value is converted to fit the target data type)
3161    #[serde(rename = "assignSpecificValue")]
3162    pub assign_specific_value: Option<AssignSpecificValue>,
3163    /// Optional. Filter on relation between source value and compare value of type double.
3164    #[serde(rename = "doubleComparison")]
3165    pub double_comparison: Option<DoubleComparisonFilter>,
3166    /// Optional. Filter on relation between source value and compare value of type integer.
3167    #[serde(rename = "intComparison")]
3168    pub int_comparison: Option<IntComparisonFilter>,
3169    /// Optional. Value is null
3170    #[serde(rename = "isNull")]
3171    pub is_null: Option<Empty>,
3172    /// Optional. Allows the data to change scale
3173    #[serde(rename = "roundScale")]
3174    pub round_scale: Option<RoundToScale>,
3175    /// Optional. Value is found in the specified list.
3176    #[serde(rename = "valueList")]
3177    pub value_list: Option<ValueListFilter>,
3178}
3179
3180impl common::Part for ValueTransformation {}
3181
3182/// Request message for ‘VerifyMigrationJob’ request.
3183///
3184/// # Activities
3185///
3186/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3187/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3188///
3189/// * [locations migration jobs verify projects](ProjectLocationMigrationJobVerifyCall) (request)
3190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3191#[serde_with::serde_as]
3192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3193pub struct VerifyMigrationJobRequest {
3194    /// Optional. The changed migration job parameters to verify. It will not update the migration job.
3195    #[serde(rename = "migrationJob")]
3196    pub migration_job: Option<MigrationJob>,
3197    /// Optional. Field mask is used to specify the changed fields to be verified. It will not update the migration job.
3198    #[serde(rename = "updateMask")]
3199    pub update_mask: Option<common::FieldMask>,
3200}
3201
3202impl common::RequestValue for VerifyMigrationJobRequest {}
3203
3204/// View's parent is a schema.
3205///
3206/// This type is not used in any activity, and only used as *part* of another schema.
3207///
3208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3209#[serde_with::serde_as]
3210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3211pub struct ViewEntity {
3212    /// View constraints.
3213    pub constraints: Option<Vec<ConstraintEntity>>,
3214    /// Custom engine specific features.
3215    #[serde(rename = "customFeatures")]
3216    pub custom_features: Option<HashMap<String, serde_json::Value>>,
3217    /// The SQL code which creates the view.
3218    #[serde(rename = "sqlCode")]
3219    pub sql_code: Option<String>,
3220}
3221
3222impl common::Part for ViewEntity {}
3223
3224/// VM creation configuration message
3225///
3226/// This type is not used in any activity, and only used as *part* of another schema.
3227///
3228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3229#[serde_with::serde_as]
3230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3231pub struct VmCreationConfig {
3232    /// The subnet name the vm needs to be created in.
3233    pub subnet: Option<String>,
3234    /// Required. VM instance machine type to create.
3235    #[serde(rename = "vmMachineType")]
3236    pub vm_machine_type: Option<String>,
3237    /// The Google Cloud Platform zone to create the VM in.
3238    #[serde(rename = "vmZone")]
3239    pub vm_zone: Option<String>,
3240}
3241
3242impl common::Part for VmCreationConfig {}
3243
3244/// VM selection configuration message
3245///
3246/// This type is not used in any activity, and only used as *part* of another schema.
3247///
3248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3249#[serde_with::serde_as]
3250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3251pub struct VmSelectionConfig {
3252    /// Required. The Google Cloud Platform zone the VM is located.
3253    #[serde(rename = "vmZone")]
3254    pub vm_zone: Option<String>,
3255}
3256
3257impl common::Part for VmSelectionConfig {}
3258
3259/// The VPC peering configuration is used to create VPC peering with the consumer's VPC.
3260///
3261/// This type is not used in any activity, and only used as *part* of another schema.
3262///
3263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3264#[serde_with::serde_as]
3265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3266pub struct VpcPeeringConfig {
3267    /// Required. A free subnet for peering. (CIDR of /29)
3268    pub subnet: Option<String>,
3269    /// Required. Fully qualified name of the VPC that Database Migration Service will peer to.
3270    #[serde(rename = "vpcName")]
3271    pub vpc_name: Option<String>,
3272}
3273
3274impl common::Part for VpcPeeringConfig {}
3275
3276/// The details of the VPC where the source database is located in Google Cloud. We will use this information to set up the VPC peering connection between Cloud SQL and this VPC.
3277///
3278/// This type is not used in any activity, and only used as *part* of another schema.
3279///
3280#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3281#[serde_with::serde_as]
3282#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3283pub struct VpcPeeringConnectivity {
3284    /// The name of the VPC network to peer with the Cloud SQL private network.
3285    pub vpc: Option<String>,
3286}
3287
3288impl common::Part for VpcPeeringConnectivity {}
3289
3290// ###################
3291// MethodBuilders ###
3292// #################
3293
3294/// A builder providing access to all methods supported on *project* resources.
3295/// It is not used directly, but through the [`DatabaseMigrationService`] hub.
3296///
3297/// # Example
3298///
3299/// Instantiate a resource builder
3300///
3301/// ```test_harness,no_run
3302/// extern crate hyper;
3303/// extern crate hyper_rustls;
3304/// extern crate google_datamigration1 as datamigration1;
3305///
3306/// # async fn dox() {
3307/// use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3308///
3309/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3310/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3311///     secret,
3312///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3313/// ).build().await.unwrap();
3314///
3315/// let client = hyper_util::client::legacy::Client::builder(
3316///     hyper_util::rt::TokioExecutor::new()
3317/// )
3318/// .build(
3319///     hyper_rustls::HttpsConnectorBuilder::new()
3320///         .with_native_roots()
3321///         .unwrap()
3322///         .https_or_http()
3323///         .enable_http1()
3324///         .build()
3325/// );
3326/// let mut hub = DatabaseMigrationService::new(client, auth);
3327/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3328/// // like `locations_connection_profiles_create(...)`, `locations_connection_profiles_delete(...)`, `locations_connection_profiles_get(...)`, `locations_connection_profiles_get_iam_policy(...)`, `locations_connection_profiles_list(...)`, `locations_connection_profiles_patch(...)`, `locations_connection_profiles_set_iam_policy(...)`, `locations_connection_profiles_test_iam_permissions(...)`, `locations_conversion_workspaces_apply(...)`, `locations_conversion_workspaces_commit(...)`, `locations_conversion_workspaces_convert(...)`, `locations_conversion_workspaces_create(...)`, `locations_conversion_workspaces_delete(...)`, `locations_conversion_workspaces_describe_conversion_workspace_revisions(...)`, `locations_conversion_workspaces_describe_database_entities(...)`, `locations_conversion_workspaces_get(...)`, `locations_conversion_workspaces_get_iam_policy(...)`, `locations_conversion_workspaces_list(...)`, `locations_conversion_workspaces_mapping_rules_create(...)`, `locations_conversion_workspaces_mapping_rules_delete(...)`, `locations_conversion_workspaces_mapping_rules_get(...)`, `locations_conversion_workspaces_mapping_rules_import(...)`, `locations_conversion_workspaces_mapping_rules_list(...)`, `locations_conversion_workspaces_patch(...)`, `locations_conversion_workspaces_rollback(...)`, `locations_conversion_workspaces_search_background_jobs(...)`, `locations_conversion_workspaces_seed(...)`, `locations_conversion_workspaces_set_iam_policy(...)`, `locations_conversion_workspaces_test_iam_permissions(...)`, `locations_fetch_static_ips(...)`, `locations_get(...)`, `locations_list(...)`, `locations_migration_jobs_create(...)`, `locations_migration_jobs_delete(...)`, `locations_migration_jobs_demote_destination(...)`, `locations_migration_jobs_generate_ssh_script(...)`, `locations_migration_jobs_generate_tcp_proxy_script(...)`, `locations_migration_jobs_get(...)`, `locations_migration_jobs_get_iam_policy(...)`, `locations_migration_jobs_list(...)`, `locations_migration_jobs_patch(...)`, `locations_migration_jobs_promote(...)`, `locations_migration_jobs_restart(...)`, `locations_migration_jobs_resume(...)`, `locations_migration_jobs_set_iam_policy(...)`, `locations_migration_jobs_start(...)`, `locations_migration_jobs_stop(...)`, `locations_migration_jobs_test_iam_permissions(...)`, `locations_migration_jobs_verify(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_private_connections_create(...)`, `locations_private_connections_delete(...)`, `locations_private_connections_get(...)`, `locations_private_connections_get_iam_policy(...)`, `locations_private_connections_list(...)`, `locations_private_connections_set_iam_policy(...)` and `locations_private_connections_test_iam_permissions(...)`
3329/// // to build up your call.
3330/// let rb = hub.projects();
3331/// # }
3332/// ```
3333pub struct ProjectMethods<'a, C>
3334where
3335    C: 'a,
3336{
3337    hub: &'a DatabaseMigrationService<C>,
3338}
3339
3340impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3341
3342impl<'a, C> ProjectMethods<'a, C> {
3343    /// Create a builder to help you perform the following task:
3344    ///
3345    /// Creates a new connection profile in a given project and location.
3346    ///
3347    /// # Arguments
3348    ///
3349    /// * `request` - No description provided.
3350    /// * `parent` - Required. The parent which owns this collection of connection profiles.
3351    pub fn locations_connection_profiles_create(
3352        &self,
3353        request: ConnectionProfile,
3354        parent: &str,
3355    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3356        ProjectLocationConnectionProfileCreateCall {
3357            hub: self.hub,
3358            _request: request,
3359            _parent: parent.to_string(),
3360            _validate_only: Default::default(),
3361            _skip_validation: Default::default(),
3362            _request_id: Default::default(),
3363            _connection_profile_id: Default::default(),
3364            _delegate: Default::default(),
3365            _additional_params: Default::default(),
3366            _scopes: Default::default(),
3367        }
3368    }
3369
3370    /// Create a builder to help you perform the following task:
3371    ///
3372    /// Deletes a single Database Migration Service connection profile. A connection profile can only be deleted if it is not in use by any active migration jobs.
3373    ///
3374    /// # Arguments
3375    ///
3376    /// * `name` - Required. Name of the connection profile resource to delete.
3377    pub fn locations_connection_profiles_delete(
3378        &self,
3379        name: &str,
3380    ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3381        ProjectLocationConnectionProfileDeleteCall {
3382            hub: self.hub,
3383            _name: name.to_string(),
3384            _request_id: Default::default(),
3385            _force: Default::default(),
3386            _delegate: Default::default(),
3387            _additional_params: Default::default(),
3388            _scopes: Default::default(),
3389        }
3390    }
3391
3392    /// Create a builder to help you perform the following task:
3393    ///
3394    /// Gets details of a single connection profile.
3395    ///
3396    /// # Arguments
3397    ///
3398    /// * `name` - Required. Name of the connection profile resource to get.
3399    pub fn locations_connection_profiles_get(
3400        &self,
3401        name: &str,
3402    ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
3403        ProjectLocationConnectionProfileGetCall {
3404            hub: self.hub,
3405            _name: name.to_string(),
3406            _delegate: Default::default(),
3407            _additional_params: Default::default(),
3408            _scopes: Default::default(),
3409        }
3410    }
3411
3412    /// Create a builder to help you perform the following task:
3413    ///
3414    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3415    ///
3416    /// # Arguments
3417    ///
3418    /// * `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.
3419    pub fn locations_connection_profiles_get_iam_policy(
3420        &self,
3421        resource: &str,
3422    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
3423        ProjectLocationConnectionProfileGetIamPolicyCall {
3424            hub: self.hub,
3425            _resource: resource.to_string(),
3426            _options_requested_policy_version: Default::default(),
3427            _delegate: Default::default(),
3428            _additional_params: Default::default(),
3429            _scopes: Default::default(),
3430        }
3431    }
3432
3433    /// Create a builder to help you perform the following task:
3434    ///
3435    /// Retrieves a list of all connection profiles in a given project and location.
3436    ///
3437    /// # Arguments
3438    ///
3439    /// * `parent` - Required. The parent which owns this collection of connection profiles.
3440    pub fn locations_connection_profiles_list(
3441        &self,
3442        parent: &str,
3443    ) -> ProjectLocationConnectionProfileListCall<'a, C> {
3444        ProjectLocationConnectionProfileListCall {
3445            hub: self.hub,
3446            _parent: parent.to_string(),
3447            _page_token: Default::default(),
3448            _page_size: Default::default(),
3449            _order_by: Default::default(),
3450            _filter: Default::default(),
3451            _delegate: Default::default(),
3452            _additional_params: Default::default(),
3453            _scopes: Default::default(),
3454        }
3455    }
3456
3457    /// Create a builder to help you perform the following task:
3458    ///
3459    /// Update the configuration of a single connection profile.
3460    ///
3461    /// # Arguments
3462    ///
3463    /// * `request` - No description provided.
3464    /// * `name` - The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
3465    pub fn locations_connection_profiles_patch(
3466        &self,
3467        request: ConnectionProfile,
3468        name: &str,
3469    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
3470        ProjectLocationConnectionProfilePatchCall {
3471            hub: self.hub,
3472            _request: request,
3473            _name: name.to_string(),
3474            _validate_only: Default::default(),
3475            _update_mask: Default::default(),
3476            _skip_validation: Default::default(),
3477            _request_id: Default::default(),
3478            _delegate: Default::default(),
3479            _additional_params: Default::default(),
3480            _scopes: Default::default(),
3481        }
3482    }
3483
3484    /// Create a builder to help you perform the following task:
3485    ///
3486    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3487    ///
3488    /// # Arguments
3489    ///
3490    /// * `request` - No description provided.
3491    /// * `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.
3492    pub fn locations_connection_profiles_set_iam_policy(
3493        &self,
3494        request: SetIamPolicyRequest,
3495        resource: &str,
3496    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
3497        ProjectLocationConnectionProfileSetIamPolicyCall {
3498            hub: self.hub,
3499            _request: request,
3500            _resource: resource.to_string(),
3501            _delegate: Default::default(),
3502            _additional_params: Default::default(),
3503            _scopes: Default::default(),
3504        }
3505    }
3506
3507    /// Create a builder to help you perform the following task:
3508    ///
3509    /// 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.
3510    ///
3511    /// # Arguments
3512    ///
3513    /// * `request` - No description provided.
3514    /// * `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.
3515    pub fn locations_connection_profiles_test_iam_permissions(
3516        &self,
3517        request: TestIamPermissionsRequest,
3518        resource: &str,
3519    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
3520        ProjectLocationConnectionProfileTestIamPermissionCall {
3521            hub: self.hub,
3522            _request: request,
3523            _resource: resource.to_string(),
3524            _delegate: Default::default(),
3525            _additional_params: Default::default(),
3526            _scopes: Default::default(),
3527        }
3528    }
3529
3530    /// Create a builder to help you perform the following task:
3531    ///
3532    /// Creates a new mapping rule for a given conversion workspace.
3533    ///
3534    /// # Arguments
3535    ///
3536    /// * `request` - No description provided.
3537    /// * `parent` - Required. The parent which owns this collection of mapping rules.
3538    pub fn locations_conversion_workspaces_mapping_rules_create(
3539        &self,
3540        request: MappingRule,
3541        parent: &str,
3542    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
3543        ProjectLocationConversionWorkspaceMappingRuleCreateCall {
3544            hub: self.hub,
3545            _request: request,
3546            _parent: parent.to_string(),
3547            _request_id: Default::default(),
3548            _mapping_rule_id: Default::default(),
3549            _delegate: Default::default(),
3550            _additional_params: Default::default(),
3551            _scopes: Default::default(),
3552        }
3553    }
3554
3555    /// Create a builder to help you perform the following task:
3556    ///
3557    /// Deletes a single mapping rule.
3558    ///
3559    /// # Arguments
3560    ///
3561    /// * `name` - Required. Name of the mapping rule resource to delete.
3562    pub fn locations_conversion_workspaces_mapping_rules_delete(
3563        &self,
3564        name: &str,
3565    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
3566        ProjectLocationConversionWorkspaceMappingRuleDeleteCall {
3567            hub: self.hub,
3568            _name: name.to_string(),
3569            _request_id: Default::default(),
3570            _delegate: Default::default(),
3571            _additional_params: Default::default(),
3572            _scopes: Default::default(),
3573        }
3574    }
3575
3576    /// Create a builder to help you perform the following task:
3577    ///
3578    /// Gets the details of a mapping rule.
3579    ///
3580    /// # Arguments
3581    ///
3582    /// * `name` - Required. Name of the mapping rule resource to get. Example: conversionWorkspaces/123/mappingRules/rule123 In order to retrieve a previous revision of the mapping rule, also provide the revision ID. Example: conversionWorkspace/123/mappingRules/rule123@c7cfa2a8c7cfa2a8c7cfa2a8c7cfa2a8
3583    pub fn locations_conversion_workspaces_mapping_rules_get(
3584        &self,
3585        name: &str,
3586    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
3587        ProjectLocationConversionWorkspaceMappingRuleGetCall {
3588            hub: self.hub,
3589            _name: name.to_string(),
3590            _delegate: Default::default(),
3591            _additional_params: Default::default(),
3592            _scopes: Default::default(),
3593        }
3594    }
3595
3596    /// Create a builder to help you perform the following task:
3597    ///
3598    /// Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files.
3599    ///
3600    /// # Arguments
3601    ///
3602    /// * `request` - No description provided.
3603    /// * `parent` - Required. Name of the conversion workspace resource to import the rules to in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3604    pub fn locations_conversion_workspaces_mapping_rules_import(
3605        &self,
3606        request: ImportMappingRulesRequest,
3607        parent: &str,
3608    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
3609        ProjectLocationConversionWorkspaceMappingRuleImportCall {
3610            hub: self.hub,
3611            _request: request,
3612            _parent: parent.to_string(),
3613            _delegate: Default::default(),
3614            _additional_params: Default::default(),
3615            _scopes: Default::default(),
3616        }
3617    }
3618
3619    /// Create a builder to help you perform the following task:
3620    ///
3621    /// Lists the mapping rules for a specific conversion workspace.
3622    ///
3623    /// # Arguments
3624    ///
3625    /// * `parent` - Required. Name of the conversion workspace resource whose mapping rules are listed in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3626    pub fn locations_conversion_workspaces_mapping_rules_list(
3627        &self,
3628        parent: &str,
3629    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
3630        ProjectLocationConversionWorkspaceMappingRuleListCall {
3631            hub: self.hub,
3632            _parent: parent.to_string(),
3633            _page_token: Default::default(),
3634            _page_size: Default::default(),
3635            _delegate: Default::default(),
3636            _additional_params: Default::default(),
3637            _scopes: Default::default(),
3638        }
3639    }
3640
3641    /// Create a builder to help you perform the following task:
3642    ///
3643    /// Applies draft tree onto a specific destination database.
3644    ///
3645    /// # Arguments
3646    ///
3647    /// * `request` - No description provided.
3648    /// * `name` - Required. The name of the conversion workspace resource for which to apply the draft tree. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3649    pub fn locations_conversion_workspaces_apply(
3650        &self,
3651        request: ApplyConversionWorkspaceRequest,
3652        name: &str,
3653    ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
3654        ProjectLocationConversionWorkspaceApplyCall {
3655            hub: self.hub,
3656            _request: request,
3657            _name: name.to_string(),
3658            _delegate: Default::default(),
3659            _additional_params: Default::default(),
3660            _scopes: Default::default(),
3661        }
3662    }
3663
3664    /// Create a builder to help you perform the following task:
3665    ///
3666    /// Marks all the data in the conversion workspace as committed.
3667    ///
3668    /// # Arguments
3669    ///
3670    /// * `request` - No description provided.
3671    /// * `name` - Required. Name of the conversion workspace resource to commit.
3672    pub fn locations_conversion_workspaces_commit(
3673        &self,
3674        request: CommitConversionWorkspaceRequest,
3675        name: &str,
3676    ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
3677        ProjectLocationConversionWorkspaceCommitCall {
3678            hub: self.hub,
3679            _request: request,
3680            _name: name.to_string(),
3681            _delegate: Default::default(),
3682            _additional_params: Default::default(),
3683            _scopes: Default::default(),
3684        }
3685    }
3686
3687    /// Create a builder to help you perform the following task:
3688    ///
3689    /// Creates a draft tree schema for the destination database.
3690    ///
3691    /// # Arguments
3692    ///
3693    /// * `request` - No description provided.
3694    /// * `name` - Name of the conversion workspace resource to convert in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3695    pub fn locations_conversion_workspaces_convert(
3696        &self,
3697        request: ConvertConversionWorkspaceRequest,
3698        name: &str,
3699    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
3700        ProjectLocationConversionWorkspaceConvertCall {
3701            hub: self.hub,
3702            _request: request,
3703            _name: name.to_string(),
3704            _delegate: Default::default(),
3705            _additional_params: Default::default(),
3706            _scopes: Default::default(),
3707        }
3708    }
3709
3710    /// Create a builder to help you perform the following task:
3711    ///
3712    /// Creates a new conversion workspace in a given project and location.
3713    ///
3714    /// # Arguments
3715    ///
3716    /// * `request` - No description provided.
3717    /// * `parent` - Required. The parent which owns this collection of conversion workspaces.
3718    pub fn locations_conversion_workspaces_create(
3719        &self,
3720        request: ConversionWorkspace,
3721        parent: &str,
3722    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
3723        ProjectLocationConversionWorkspaceCreateCall {
3724            hub: self.hub,
3725            _request: request,
3726            _parent: parent.to_string(),
3727            _request_id: Default::default(),
3728            _conversion_workspace_id: Default::default(),
3729            _delegate: Default::default(),
3730            _additional_params: Default::default(),
3731            _scopes: Default::default(),
3732        }
3733    }
3734
3735    /// Create a builder to help you perform the following task:
3736    ///
3737    /// Deletes a single conversion workspace.
3738    ///
3739    /// # Arguments
3740    ///
3741    /// * `name` - Required. Name of the conversion workspace resource to delete.
3742    pub fn locations_conversion_workspaces_delete(
3743        &self,
3744        name: &str,
3745    ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
3746        ProjectLocationConversionWorkspaceDeleteCall {
3747            hub: self.hub,
3748            _name: name.to_string(),
3749            _request_id: Default::default(),
3750            _force: Default::default(),
3751            _delegate: Default::default(),
3752            _additional_params: Default::default(),
3753            _scopes: Default::default(),
3754        }
3755    }
3756
3757    /// Create a builder to help you perform the following task:
3758    ///
3759    /// Retrieves a list of committed revisions of a specific conversion workspace.
3760    ///
3761    /// # Arguments
3762    ///
3763    /// * `conversionWorkspace` - Required. Name of the conversion workspace resource whose revisions are listed. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3764    pub fn locations_conversion_workspaces_describe_conversion_workspace_revisions(
3765        &self,
3766        conversion_workspace: &str,
3767    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
3768        ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall {
3769            hub: self.hub,
3770            _conversion_workspace: conversion_workspace.to_string(),
3771            _commit_id: Default::default(),
3772            _delegate: Default::default(),
3773            _additional_params: Default::default(),
3774            _scopes: Default::default(),
3775        }
3776    }
3777
3778    /// Create a builder to help you perform the following task:
3779    ///
3780    /// Describes the database entities tree for a specific conversion workspace and a specific tree type. Database entities are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are simple data objects describing the structure of the client database.
3781    ///
3782    /// # Arguments
3783    ///
3784    /// * `conversionWorkspace` - Required. Name of the conversion workspace resource whose database entities are described. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3785    pub fn locations_conversion_workspaces_describe_database_entities(
3786        &self,
3787        conversion_workspace: &str,
3788    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
3789        ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall {
3790            hub: self.hub,
3791            _conversion_workspace: conversion_workspace.to_string(),
3792            _view: Default::default(),
3793            _uncommitted: Default::default(),
3794            _tree: Default::default(),
3795            _page_token: Default::default(),
3796            _page_size: Default::default(),
3797            _filter: Default::default(),
3798            _commit_id: Default::default(),
3799            _delegate: Default::default(),
3800            _additional_params: Default::default(),
3801            _scopes: Default::default(),
3802        }
3803    }
3804
3805    /// Create a builder to help you perform the following task:
3806    ///
3807    /// Gets details of a single conversion workspace.
3808    ///
3809    /// # Arguments
3810    ///
3811    /// * `name` - Required. Name of the conversion workspace resource to get.
3812    pub fn locations_conversion_workspaces_get(
3813        &self,
3814        name: &str,
3815    ) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
3816        ProjectLocationConversionWorkspaceGetCall {
3817            hub: self.hub,
3818            _name: name.to_string(),
3819            _delegate: Default::default(),
3820            _additional_params: Default::default(),
3821            _scopes: Default::default(),
3822        }
3823    }
3824
3825    /// Create a builder to help you perform the following task:
3826    ///
3827    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3828    ///
3829    /// # Arguments
3830    ///
3831    /// * `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.
3832    pub fn locations_conversion_workspaces_get_iam_policy(
3833        &self,
3834        resource: &str,
3835    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
3836        ProjectLocationConversionWorkspaceGetIamPolicyCall {
3837            hub: self.hub,
3838            _resource: resource.to_string(),
3839            _options_requested_policy_version: Default::default(),
3840            _delegate: Default::default(),
3841            _additional_params: Default::default(),
3842            _scopes: Default::default(),
3843        }
3844    }
3845
3846    /// Create a builder to help you perform the following task:
3847    ///
3848    /// Lists conversion workspaces in a given project and location.
3849    ///
3850    /// # Arguments
3851    ///
3852    /// * `parent` - Required. The parent which owns this collection of conversion workspaces.
3853    pub fn locations_conversion_workspaces_list(
3854        &self,
3855        parent: &str,
3856    ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
3857        ProjectLocationConversionWorkspaceListCall {
3858            hub: self.hub,
3859            _parent: parent.to_string(),
3860            _page_token: Default::default(),
3861            _page_size: Default::default(),
3862            _filter: Default::default(),
3863            _delegate: Default::default(),
3864            _additional_params: Default::default(),
3865            _scopes: Default::default(),
3866        }
3867    }
3868
3869    /// Create a builder to help you perform the following task:
3870    ///
3871    /// Updates the parameters of a single conversion workspace.
3872    ///
3873    /// # Arguments
3874    ///
3875    /// * `request` - No description provided.
3876    /// * `name` - Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3877    pub fn locations_conversion_workspaces_patch(
3878        &self,
3879        request: ConversionWorkspace,
3880        name: &str,
3881    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
3882        ProjectLocationConversionWorkspacePatchCall {
3883            hub: self.hub,
3884            _request: request,
3885            _name: name.to_string(),
3886            _update_mask: Default::default(),
3887            _request_id: Default::default(),
3888            _delegate: Default::default(),
3889            _additional_params: Default::default(),
3890            _scopes: Default::default(),
3891        }
3892    }
3893
3894    /// Create a builder to help you perform the following task:
3895    ///
3896    /// Rolls back a conversion workspace to the last committed snapshot.
3897    ///
3898    /// # Arguments
3899    ///
3900    /// * `request` - No description provided.
3901    /// * `name` - Required. Name of the conversion workspace resource to roll back to.
3902    pub fn locations_conversion_workspaces_rollback(
3903        &self,
3904        request: RollbackConversionWorkspaceRequest,
3905        name: &str,
3906    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
3907        ProjectLocationConversionWorkspaceRollbackCall {
3908            hub: self.hub,
3909            _request: request,
3910            _name: name.to_string(),
3911            _delegate: Default::default(),
3912            _additional_params: Default::default(),
3913            _scopes: Default::default(),
3914        }
3915    }
3916
3917    /// Create a builder to help you perform the following task:
3918    ///
3919    /// Searches/lists the background jobs for a specific conversion workspace. The background jobs are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are a way to expose the data plane jobs log.
3920    ///
3921    /// # Arguments
3922    ///
3923    /// * `conversionWorkspace` - Required. Name of the conversion workspace resource whose jobs are listed, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3924    pub fn locations_conversion_workspaces_search_background_jobs(
3925        &self,
3926        conversion_workspace: &str,
3927    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
3928        ProjectLocationConversionWorkspaceSearchBackgroundJobCall {
3929            hub: self.hub,
3930            _conversion_workspace: conversion_workspace.to_string(),
3931            _return_most_recent_per_job_type: Default::default(),
3932            _max_size: Default::default(),
3933            _completed_until_time: Default::default(),
3934            _delegate: Default::default(),
3935            _additional_params: Default::default(),
3936            _scopes: Default::default(),
3937        }
3938    }
3939
3940    /// Create a builder to help you perform the following task:
3941    ///
3942    /// Imports a snapshot of the source database into the conversion workspace.
3943    ///
3944    /// # Arguments
3945    ///
3946    /// * `request` - No description provided.
3947    /// * `name` - Name of the conversion workspace resource to seed with new database structure, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
3948    pub fn locations_conversion_workspaces_seed(
3949        &self,
3950        request: SeedConversionWorkspaceRequest,
3951        name: &str,
3952    ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
3953        ProjectLocationConversionWorkspaceSeedCall {
3954            hub: self.hub,
3955            _request: request,
3956            _name: name.to_string(),
3957            _delegate: Default::default(),
3958            _additional_params: Default::default(),
3959            _scopes: Default::default(),
3960        }
3961    }
3962
3963    /// Create a builder to help you perform the following task:
3964    ///
3965    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3966    ///
3967    /// # Arguments
3968    ///
3969    /// * `request` - No description provided.
3970    /// * `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.
3971    pub fn locations_conversion_workspaces_set_iam_policy(
3972        &self,
3973        request: SetIamPolicyRequest,
3974        resource: &str,
3975    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
3976        ProjectLocationConversionWorkspaceSetIamPolicyCall {
3977            hub: self.hub,
3978            _request: request,
3979            _resource: resource.to_string(),
3980            _delegate: Default::default(),
3981            _additional_params: Default::default(),
3982            _scopes: Default::default(),
3983        }
3984    }
3985
3986    /// Create a builder to help you perform the following task:
3987    ///
3988    /// 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.
3989    ///
3990    /// # Arguments
3991    ///
3992    /// * `request` - No description provided.
3993    /// * `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.
3994    pub fn locations_conversion_workspaces_test_iam_permissions(
3995        &self,
3996        request: TestIamPermissionsRequest,
3997        resource: &str,
3998    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
3999        ProjectLocationConversionWorkspaceTestIamPermissionCall {
4000            hub: self.hub,
4001            _request: request,
4002            _resource: resource.to_string(),
4003            _delegate: Default::default(),
4004            _additional_params: Default::default(),
4005            _scopes: Default::default(),
4006        }
4007    }
4008
4009    /// Create a builder to help you perform the following task:
4010    ///
4011    /// Creates a new migration job in a given project and location.
4012    ///
4013    /// # Arguments
4014    ///
4015    /// * `request` - No description provided.
4016    /// * `parent` - Required. The parent which owns this collection of migration jobs.
4017    pub fn locations_migration_jobs_create(
4018        &self,
4019        request: MigrationJob,
4020        parent: &str,
4021    ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
4022        ProjectLocationMigrationJobCreateCall {
4023            hub: self.hub,
4024            _request: request,
4025            _parent: parent.to_string(),
4026            _request_id: Default::default(),
4027            _migration_job_id: Default::default(),
4028            _delegate: Default::default(),
4029            _additional_params: Default::default(),
4030            _scopes: Default::default(),
4031        }
4032    }
4033
4034    /// Create a builder to help you perform the following task:
4035    ///
4036    /// Deletes a single migration job.
4037    ///
4038    /// # Arguments
4039    ///
4040    /// * `name` - Required. Name of the migration job resource to delete.
4041    pub fn locations_migration_jobs_delete(
4042        &self,
4043        name: &str,
4044    ) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
4045        ProjectLocationMigrationJobDeleteCall {
4046            hub: self.hub,
4047            _name: name.to_string(),
4048            _request_id: Default::default(),
4049            _force: Default::default(),
4050            _delegate: Default::default(),
4051            _additional_params: Default::default(),
4052            _scopes: Default::default(),
4053        }
4054    }
4055
4056    /// Create a builder to help you perform the following task:
4057    ///
4058    /// Demotes the destination database to become a read replica of the source. This is applicable for the following migrations: 1. MySQL to Cloud SQL for MySQL 2. PostgreSQL to Cloud SQL for PostgreSQL 3. PostgreSQL to AlloyDB for PostgreSQL.
4059    ///
4060    /// # Arguments
4061    ///
4062    /// * `request` - No description provided.
4063    /// * `name` - Name of the migration job resource to demote its destination.
4064    pub fn locations_migration_jobs_demote_destination(
4065        &self,
4066        request: DemoteDestinationRequest,
4067        name: &str,
4068    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
4069        ProjectLocationMigrationJobDemoteDestinationCall {
4070            hub: self.hub,
4071            _request: request,
4072            _name: name.to_string(),
4073            _delegate: Default::default(),
4074            _additional_params: Default::default(),
4075            _scopes: Default::default(),
4076        }
4077    }
4078
4079    /// Create a builder to help you perform the following task:
4080    ///
4081    /// Generate a SSH configuration script to configure the reverse SSH connectivity.
4082    ///
4083    /// # Arguments
4084    ///
4085    /// * `request` - No description provided.
4086    /// * `migrationJob` - Name of the migration job resource to generate the SSH script.
4087    pub fn locations_migration_jobs_generate_ssh_script(
4088        &self,
4089        request: GenerateSshScriptRequest,
4090        migration_job: &str,
4091    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
4092        ProjectLocationMigrationJobGenerateSshScriptCall {
4093            hub: self.hub,
4094            _request: request,
4095            _migration_job: migration_job.to_string(),
4096            _delegate: Default::default(),
4097            _additional_params: Default::default(),
4098            _scopes: Default::default(),
4099        }
4100    }
4101
4102    /// Create a builder to help you perform the following task:
4103    ///
4104    /// Generate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
4105    ///
4106    /// # Arguments
4107    ///
4108    /// * `request` - No description provided.
4109    /// * `migrationJob` - Name of the migration job resource to generate the TCP Proxy script.
4110    pub fn locations_migration_jobs_generate_tcp_proxy_script(
4111        &self,
4112        request: GenerateTcpProxyScriptRequest,
4113        migration_job: &str,
4114    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
4115        ProjectLocationMigrationJobGenerateTcpProxyScriptCall {
4116            hub: self.hub,
4117            _request: request,
4118            _migration_job: migration_job.to_string(),
4119            _delegate: Default::default(),
4120            _additional_params: Default::default(),
4121            _scopes: Default::default(),
4122        }
4123    }
4124
4125    /// Create a builder to help you perform the following task:
4126    ///
4127    /// Gets details of a single migration job.
4128    ///
4129    /// # Arguments
4130    ///
4131    /// * `name` - Required. Name of the migration job resource to get.
4132    pub fn locations_migration_jobs_get(
4133        &self,
4134        name: &str,
4135    ) -> ProjectLocationMigrationJobGetCall<'a, C> {
4136        ProjectLocationMigrationJobGetCall {
4137            hub: self.hub,
4138            _name: name.to_string(),
4139            _delegate: Default::default(),
4140            _additional_params: Default::default(),
4141            _scopes: Default::default(),
4142        }
4143    }
4144
4145    /// Create a builder to help you perform the following task:
4146    ///
4147    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4148    ///
4149    /// # Arguments
4150    ///
4151    /// * `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.
4152    pub fn locations_migration_jobs_get_iam_policy(
4153        &self,
4154        resource: &str,
4155    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
4156        ProjectLocationMigrationJobGetIamPolicyCall {
4157            hub: self.hub,
4158            _resource: resource.to_string(),
4159            _options_requested_policy_version: Default::default(),
4160            _delegate: Default::default(),
4161            _additional_params: Default::default(),
4162            _scopes: Default::default(),
4163        }
4164    }
4165
4166    /// Create a builder to help you perform the following task:
4167    ///
4168    /// Lists migration jobs in a given project and location.
4169    ///
4170    /// # Arguments
4171    ///
4172    /// * `parent` - Required. The parent which owns this collection of migrationJobs.
4173    pub fn locations_migration_jobs_list(
4174        &self,
4175        parent: &str,
4176    ) -> ProjectLocationMigrationJobListCall<'a, C> {
4177        ProjectLocationMigrationJobListCall {
4178            hub: self.hub,
4179            _parent: parent.to_string(),
4180            _page_token: Default::default(),
4181            _page_size: Default::default(),
4182            _order_by: Default::default(),
4183            _filter: Default::default(),
4184            _delegate: Default::default(),
4185            _additional_params: Default::default(),
4186            _scopes: Default::default(),
4187        }
4188    }
4189
4190    /// Create a builder to help you perform the following task:
4191    ///
4192    /// Updates the parameters of a single migration job.
4193    ///
4194    /// # Arguments
4195    ///
4196    /// * `request` - No description provided.
4197    /// * `name` - The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
4198    pub fn locations_migration_jobs_patch(
4199        &self,
4200        request: MigrationJob,
4201        name: &str,
4202    ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
4203        ProjectLocationMigrationJobPatchCall {
4204            hub: self.hub,
4205            _request: request,
4206            _name: name.to_string(),
4207            _update_mask: Default::default(),
4208            _request_id: Default::default(),
4209            _delegate: Default::default(),
4210            _additional_params: Default::default(),
4211            _scopes: Default::default(),
4212        }
4213    }
4214
4215    /// Create a builder to help you perform the following task:
4216    ///
4217    /// Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
4218    ///
4219    /// # Arguments
4220    ///
4221    /// * `request` - No description provided.
4222    /// * `name` - Name of the migration job resource to promote.
4223    pub fn locations_migration_jobs_promote(
4224        &self,
4225        request: PromoteMigrationJobRequest,
4226        name: &str,
4227    ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
4228        ProjectLocationMigrationJobPromoteCall {
4229            hub: self.hub,
4230            _request: request,
4231            _name: name.to_string(),
4232            _delegate: Default::default(),
4233            _additional_params: Default::default(),
4234            _scopes: Default::default(),
4235        }
4236    }
4237
4238    /// Create a builder to help you perform the following task:
4239    ///
4240    /// Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
4241    ///
4242    /// # Arguments
4243    ///
4244    /// * `request` - No description provided.
4245    /// * `name` - Name of the migration job resource to restart.
4246    pub fn locations_migration_jobs_restart(
4247        &self,
4248        request: RestartMigrationJobRequest,
4249        name: &str,
4250    ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
4251        ProjectLocationMigrationJobRestartCall {
4252            hub: self.hub,
4253            _request: request,
4254            _name: name.to_string(),
4255            _delegate: Default::default(),
4256            _additional_params: Default::default(),
4257            _scopes: Default::default(),
4258        }
4259    }
4260
4261    /// Create a builder to help you perform the following task:
4262    ///
4263    /// Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
4264    ///
4265    /// # Arguments
4266    ///
4267    /// * `request` - No description provided.
4268    /// * `name` - Name of the migration job resource to resume.
4269    pub fn locations_migration_jobs_resume(
4270        &self,
4271        request: ResumeMigrationJobRequest,
4272        name: &str,
4273    ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
4274        ProjectLocationMigrationJobResumeCall {
4275            hub: self.hub,
4276            _request: request,
4277            _name: name.to_string(),
4278            _delegate: Default::default(),
4279            _additional_params: Default::default(),
4280            _scopes: Default::default(),
4281        }
4282    }
4283
4284    /// Create a builder to help you perform the following task:
4285    ///
4286    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4287    ///
4288    /// # Arguments
4289    ///
4290    /// * `request` - No description provided.
4291    /// * `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.
4292    pub fn locations_migration_jobs_set_iam_policy(
4293        &self,
4294        request: SetIamPolicyRequest,
4295        resource: &str,
4296    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
4297        ProjectLocationMigrationJobSetIamPolicyCall {
4298            hub: self.hub,
4299            _request: request,
4300            _resource: resource.to_string(),
4301            _delegate: Default::default(),
4302            _additional_params: Default::default(),
4303            _scopes: Default::default(),
4304        }
4305    }
4306
4307    /// Create a builder to help you perform the following task:
4308    ///
4309    /// Start an already created migration job.
4310    ///
4311    /// # Arguments
4312    ///
4313    /// * `request` - No description provided.
4314    /// * `name` - Name of the migration job resource to start.
4315    pub fn locations_migration_jobs_start(
4316        &self,
4317        request: StartMigrationJobRequest,
4318        name: &str,
4319    ) -> ProjectLocationMigrationJobStartCall<'a, C> {
4320        ProjectLocationMigrationJobStartCall {
4321            hub: self.hub,
4322            _request: request,
4323            _name: name.to_string(),
4324            _delegate: Default::default(),
4325            _additional_params: Default::default(),
4326            _scopes: Default::default(),
4327        }
4328    }
4329
4330    /// Create a builder to help you perform the following task:
4331    ///
4332    /// Stops a running migration job.
4333    ///
4334    /// # Arguments
4335    ///
4336    /// * `request` - No description provided.
4337    /// * `name` - Name of the migration job resource to stop.
4338    pub fn locations_migration_jobs_stop(
4339        &self,
4340        request: StopMigrationJobRequest,
4341        name: &str,
4342    ) -> ProjectLocationMigrationJobStopCall<'a, C> {
4343        ProjectLocationMigrationJobStopCall {
4344            hub: self.hub,
4345            _request: request,
4346            _name: name.to_string(),
4347            _delegate: Default::default(),
4348            _additional_params: Default::default(),
4349            _scopes: Default::default(),
4350        }
4351    }
4352
4353    /// Create a builder to help you perform the following task:
4354    ///
4355    /// 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.
4356    ///
4357    /// # Arguments
4358    ///
4359    /// * `request` - No description provided.
4360    /// * `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.
4361    pub fn locations_migration_jobs_test_iam_permissions(
4362        &self,
4363        request: TestIamPermissionsRequest,
4364        resource: &str,
4365    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
4366        ProjectLocationMigrationJobTestIamPermissionCall {
4367            hub: self.hub,
4368            _request: request,
4369            _resource: resource.to_string(),
4370            _delegate: Default::default(),
4371            _additional_params: Default::default(),
4372            _scopes: Default::default(),
4373        }
4374    }
4375
4376    /// Create a builder to help you perform the following task:
4377    ///
4378    /// Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.
4379    ///
4380    /// # Arguments
4381    ///
4382    /// * `request` - No description provided.
4383    /// * `name` - Name of the migration job resource to verify.
4384    pub fn locations_migration_jobs_verify(
4385        &self,
4386        request: VerifyMigrationJobRequest,
4387        name: &str,
4388    ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
4389        ProjectLocationMigrationJobVerifyCall {
4390            hub: self.hub,
4391            _request: request,
4392            _name: name.to_string(),
4393            _delegate: Default::default(),
4394            _additional_params: Default::default(),
4395            _scopes: Default::default(),
4396        }
4397    }
4398
4399    /// Create a builder to help you perform the following task:
4400    ///
4401    /// 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`.
4402    ///
4403    /// # Arguments
4404    ///
4405    /// * `request` - No description provided.
4406    /// * `name` - The name of the operation resource to be cancelled.
4407    pub fn locations_operations_cancel(
4408        &self,
4409        request: CancelOperationRequest,
4410        name: &str,
4411    ) -> ProjectLocationOperationCancelCall<'a, C> {
4412        ProjectLocationOperationCancelCall {
4413            hub: self.hub,
4414            _request: request,
4415            _name: name.to_string(),
4416            _delegate: Default::default(),
4417            _additional_params: Default::default(),
4418            _scopes: Default::default(),
4419        }
4420    }
4421
4422    /// Create a builder to help you perform the following task:
4423    ///
4424    /// 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`.
4425    ///
4426    /// # Arguments
4427    ///
4428    /// * `name` - The name of the operation resource to be deleted.
4429    pub fn locations_operations_delete(
4430        &self,
4431        name: &str,
4432    ) -> ProjectLocationOperationDeleteCall<'a, C> {
4433        ProjectLocationOperationDeleteCall {
4434            hub: self.hub,
4435            _name: name.to_string(),
4436            _delegate: Default::default(),
4437            _additional_params: Default::default(),
4438            _scopes: Default::default(),
4439        }
4440    }
4441
4442    /// Create a builder to help you perform the following task:
4443    ///
4444    /// 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.
4445    ///
4446    /// # Arguments
4447    ///
4448    /// * `name` - The name of the operation resource.
4449    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
4450        ProjectLocationOperationGetCall {
4451            hub: self.hub,
4452            _name: name.to_string(),
4453            _delegate: Default::default(),
4454            _additional_params: Default::default(),
4455            _scopes: Default::default(),
4456        }
4457    }
4458
4459    /// Create a builder to help you perform the following task:
4460    ///
4461    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
4462    ///
4463    /// # Arguments
4464    ///
4465    /// * `name` - The name of the operation's parent resource.
4466    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
4467        ProjectLocationOperationListCall {
4468            hub: self.hub,
4469            _name: name.to_string(),
4470            _page_token: Default::default(),
4471            _page_size: Default::default(),
4472            _filter: Default::default(),
4473            _delegate: Default::default(),
4474            _additional_params: Default::default(),
4475            _scopes: Default::default(),
4476        }
4477    }
4478
4479    /// Create a builder to help you perform the following task:
4480    ///
4481    /// Creates a new private connection in a given project and location.
4482    ///
4483    /// # Arguments
4484    ///
4485    /// * `request` - No description provided.
4486    /// * `parent` - Required. The parent that owns the collection of PrivateConnections.
4487    pub fn locations_private_connections_create(
4488        &self,
4489        request: PrivateConnection,
4490        parent: &str,
4491    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
4492        ProjectLocationPrivateConnectionCreateCall {
4493            hub: self.hub,
4494            _request: request,
4495            _parent: parent.to_string(),
4496            _skip_validation: Default::default(),
4497            _request_id: Default::default(),
4498            _private_connection_id: Default::default(),
4499            _delegate: Default::default(),
4500            _additional_params: Default::default(),
4501            _scopes: Default::default(),
4502        }
4503    }
4504
4505    /// Create a builder to help you perform the following task:
4506    ///
4507    /// Deletes a single Database Migration Service private connection.
4508    ///
4509    /// # Arguments
4510    ///
4511    /// * `name` - Required. The name of the private connection to delete.
4512    pub fn locations_private_connections_delete(
4513        &self,
4514        name: &str,
4515    ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
4516        ProjectLocationPrivateConnectionDeleteCall {
4517            hub: self.hub,
4518            _name: name.to_string(),
4519            _request_id: Default::default(),
4520            _delegate: Default::default(),
4521            _additional_params: Default::default(),
4522            _scopes: Default::default(),
4523        }
4524    }
4525
4526    /// Create a builder to help you perform the following task:
4527    ///
4528    /// Gets details of a single private connection.
4529    ///
4530    /// # Arguments
4531    ///
4532    /// * `name` - Required. The name of the private connection to get.
4533    pub fn locations_private_connections_get(
4534        &self,
4535        name: &str,
4536    ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
4537        ProjectLocationPrivateConnectionGetCall {
4538            hub: self.hub,
4539            _name: name.to_string(),
4540            _delegate: Default::default(),
4541            _additional_params: Default::default(),
4542            _scopes: Default::default(),
4543        }
4544    }
4545
4546    /// Create a builder to help you perform the following task:
4547    ///
4548    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4549    ///
4550    /// # Arguments
4551    ///
4552    /// * `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.
4553    pub fn locations_private_connections_get_iam_policy(
4554        &self,
4555        resource: &str,
4556    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
4557        ProjectLocationPrivateConnectionGetIamPolicyCall {
4558            hub: self.hub,
4559            _resource: resource.to_string(),
4560            _options_requested_policy_version: Default::default(),
4561            _delegate: Default::default(),
4562            _additional_params: Default::default(),
4563            _scopes: Default::default(),
4564        }
4565    }
4566
4567    /// Create a builder to help you perform the following task:
4568    ///
4569    /// Retrieves a list of private connections in a given project and location.
4570    ///
4571    /// # Arguments
4572    ///
4573    /// * `parent` - Required. The parent that owns the collection of private connections.
4574    pub fn locations_private_connections_list(
4575        &self,
4576        parent: &str,
4577    ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
4578        ProjectLocationPrivateConnectionListCall {
4579            hub: self.hub,
4580            _parent: parent.to_string(),
4581            _page_token: Default::default(),
4582            _page_size: Default::default(),
4583            _order_by: Default::default(),
4584            _filter: Default::default(),
4585            _delegate: Default::default(),
4586            _additional_params: Default::default(),
4587            _scopes: Default::default(),
4588        }
4589    }
4590
4591    /// Create a builder to help you perform the following task:
4592    ///
4593    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4594    ///
4595    /// # Arguments
4596    ///
4597    /// * `request` - No description provided.
4598    /// * `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.
4599    pub fn locations_private_connections_set_iam_policy(
4600        &self,
4601        request: SetIamPolicyRequest,
4602        resource: &str,
4603    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
4604        ProjectLocationPrivateConnectionSetIamPolicyCall {
4605            hub: self.hub,
4606            _request: request,
4607            _resource: resource.to_string(),
4608            _delegate: Default::default(),
4609            _additional_params: Default::default(),
4610            _scopes: Default::default(),
4611        }
4612    }
4613
4614    /// Create a builder to help you perform the following task:
4615    ///
4616    /// 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.
4617    ///
4618    /// # Arguments
4619    ///
4620    /// * `request` - No description provided.
4621    /// * `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.
4622    pub fn locations_private_connections_test_iam_permissions(
4623        &self,
4624        request: TestIamPermissionsRequest,
4625        resource: &str,
4626    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
4627        ProjectLocationPrivateConnectionTestIamPermissionCall {
4628            hub: self.hub,
4629            _request: request,
4630            _resource: resource.to_string(),
4631            _delegate: Default::default(),
4632            _additional_params: Default::default(),
4633            _scopes: Default::default(),
4634        }
4635    }
4636
4637    /// Create a builder to help you perform the following task:
4638    ///
4639    /// Fetches a set of static IP addresses that need to be allowlisted by the customer when using the static-IP connectivity method.
4640    ///
4641    /// # Arguments
4642    ///
4643    /// * `name` - Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
4644    pub fn locations_fetch_static_ips(
4645        &self,
4646        name: &str,
4647    ) -> ProjectLocationFetchStaticIpCall<'a, C> {
4648        ProjectLocationFetchStaticIpCall {
4649            hub: self.hub,
4650            _name: name.to_string(),
4651            _page_token: Default::default(),
4652            _page_size: Default::default(),
4653            _delegate: Default::default(),
4654            _additional_params: Default::default(),
4655            _scopes: Default::default(),
4656        }
4657    }
4658
4659    /// Create a builder to help you perform the following task:
4660    ///
4661    /// Gets information about a location.
4662    ///
4663    /// # Arguments
4664    ///
4665    /// * `name` - Resource name for the location.
4666    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
4667        ProjectLocationGetCall {
4668            hub: self.hub,
4669            _name: name.to_string(),
4670            _delegate: Default::default(),
4671            _additional_params: Default::default(),
4672            _scopes: Default::default(),
4673        }
4674    }
4675
4676    /// Create a builder to help you perform the following task:
4677    ///
4678    /// Lists information about the supported locations for this service.
4679    ///
4680    /// # Arguments
4681    ///
4682    /// * `name` - The resource that owns the locations collection, if applicable.
4683    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
4684        ProjectLocationListCall {
4685            hub: self.hub,
4686            _name: name.to_string(),
4687            _page_token: Default::default(),
4688            _page_size: Default::default(),
4689            _filter: Default::default(),
4690            _delegate: Default::default(),
4691            _additional_params: Default::default(),
4692            _scopes: Default::default(),
4693        }
4694    }
4695}
4696
4697// ###################
4698// CallBuilders   ###
4699// #################
4700
4701/// Creates a new connection profile in a given project and location.
4702///
4703/// A builder for the *locations.connectionProfiles.create* method supported by a *project* resource.
4704/// It is not used directly, but through a [`ProjectMethods`] instance.
4705///
4706/// # Example
4707///
4708/// Instantiate a resource method builder
4709///
4710/// ```test_harness,no_run
4711/// # extern crate hyper;
4712/// # extern crate hyper_rustls;
4713/// # extern crate google_datamigration1 as datamigration1;
4714/// use datamigration1::api::ConnectionProfile;
4715/// # async fn dox() {
4716/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4717///
4718/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4720/// #     secret,
4721/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4722/// # ).build().await.unwrap();
4723///
4724/// # let client = hyper_util::client::legacy::Client::builder(
4725/// #     hyper_util::rt::TokioExecutor::new()
4726/// # )
4727/// # .build(
4728/// #     hyper_rustls::HttpsConnectorBuilder::new()
4729/// #         .with_native_roots()
4730/// #         .unwrap()
4731/// #         .https_or_http()
4732/// #         .enable_http1()
4733/// #         .build()
4734/// # );
4735/// # let mut hub = DatabaseMigrationService::new(client, auth);
4736/// // As the method needs a request, you would usually fill it with the desired information
4737/// // into the respective structure. Some of the parts shown here might not be applicable !
4738/// // Values shown here are possibly random and not representative !
4739/// let mut req = ConnectionProfile::default();
4740///
4741/// // You can configure optional parameters by calling the respective setters at will, and
4742/// // execute the final call using `doit()`.
4743/// // Values shown here are possibly random and not representative !
4744/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
4745///              .validate_only(false)
4746///              .skip_validation(true)
4747///              .request_id("ipsum")
4748///              .connection_profile_id("ipsum")
4749///              .doit().await;
4750/// # }
4751/// ```
4752pub struct ProjectLocationConnectionProfileCreateCall<'a, C>
4753where
4754    C: 'a,
4755{
4756    hub: &'a DatabaseMigrationService<C>,
4757    _request: ConnectionProfile,
4758    _parent: String,
4759    _validate_only: Option<bool>,
4760    _skip_validation: Option<bool>,
4761    _request_id: Option<String>,
4762    _connection_profile_id: Option<String>,
4763    _delegate: Option<&'a mut dyn common::Delegate>,
4764    _additional_params: HashMap<String, String>,
4765    _scopes: BTreeSet<String>,
4766}
4767
4768impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileCreateCall<'a, C> {}
4769
4770impl<'a, C> ProjectLocationConnectionProfileCreateCall<'a, C>
4771where
4772    C: common::Connector,
4773{
4774    /// Perform the operation you have build so far.
4775    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4776        use std::borrow::Cow;
4777        use std::io::{Read, Seek};
4778
4779        use common::{url::Params, ToParts};
4780        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4781
4782        let mut dd = common::DefaultDelegate;
4783        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4784        dlg.begin(common::MethodInfo {
4785            id: "datamigration.projects.locations.connectionProfiles.create",
4786            http_method: hyper::Method::POST,
4787        });
4788
4789        for &field in [
4790            "alt",
4791            "parent",
4792            "validateOnly",
4793            "skipValidation",
4794            "requestId",
4795            "connectionProfileId",
4796        ]
4797        .iter()
4798        {
4799            if self._additional_params.contains_key(field) {
4800                dlg.finished(false);
4801                return Err(common::Error::FieldClash(field));
4802            }
4803        }
4804
4805        let mut params = Params::with_capacity(8 + self._additional_params.len());
4806        params.push("parent", self._parent);
4807        if let Some(value) = self._validate_only.as_ref() {
4808            params.push("validateOnly", value.to_string());
4809        }
4810        if let Some(value) = self._skip_validation.as_ref() {
4811            params.push("skipValidation", value.to_string());
4812        }
4813        if let Some(value) = self._request_id.as_ref() {
4814            params.push("requestId", value);
4815        }
4816        if let Some(value) = self._connection_profile_id.as_ref() {
4817            params.push("connectionProfileId", value);
4818        }
4819
4820        params.extend(self._additional_params.iter());
4821
4822        params.push("alt", "json");
4823        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
4824        if self._scopes.is_empty() {
4825            self._scopes
4826                .insert(Scope::CloudPlatform.as_ref().to_string());
4827        }
4828
4829        #[allow(clippy::single_element_loop)]
4830        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4831            url = params.uri_replacement(url, param_name, find_this, true);
4832        }
4833        {
4834            let to_remove = ["parent"];
4835            params.remove_params(&to_remove);
4836        }
4837
4838        let url = params.parse_with_url(&url);
4839
4840        let mut json_mime_type = mime::APPLICATION_JSON;
4841        let mut request_value_reader = {
4842            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4843            common::remove_json_null_values(&mut value);
4844            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4845            serde_json::to_writer(&mut dst, &value).unwrap();
4846            dst
4847        };
4848        let request_size = request_value_reader
4849            .seek(std::io::SeekFrom::End(0))
4850            .unwrap();
4851        request_value_reader
4852            .seek(std::io::SeekFrom::Start(0))
4853            .unwrap();
4854
4855        loop {
4856            let token = match self
4857                .hub
4858                .auth
4859                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4860                .await
4861            {
4862                Ok(token) => token,
4863                Err(e) => match dlg.token(e) {
4864                    Ok(token) => token,
4865                    Err(e) => {
4866                        dlg.finished(false);
4867                        return Err(common::Error::MissingToken(e));
4868                    }
4869                },
4870            };
4871            request_value_reader
4872                .seek(std::io::SeekFrom::Start(0))
4873                .unwrap();
4874            let mut req_result = {
4875                let client = &self.hub.client;
4876                dlg.pre_request();
4877                let mut req_builder = hyper::Request::builder()
4878                    .method(hyper::Method::POST)
4879                    .uri(url.as_str())
4880                    .header(USER_AGENT, self.hub._user_agent.clone());
4881
4882                if let Some(token) = token.as_ref() {
4883                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4884                }
4885
4886                let request = req_builder
4887                    .header(CONTENT_TYPE, json_mime_type.to_string())
4888                    .header(CONTENT_LENGTH, request_size as u64)
4889                    .body(common::to_body(
4890                        request_value_reader.get_ref().clone().into(),
4891                    ));
4892
4893                client.request(request.unwrap()).await
4894            };
4895
4896            match req_result {
4897                Err(err) => {
4898                    if let common::Retry::After(d) = dlg.http_error(&err) {
4899                        sleep(d).await;
4900                        continue;
4901                    }
4902                    dlg.finished(false);
4903                    return Err(common::Error::HttpError(err));
4904                }
4905                Ok(res) => {
4906                    let (mut parts, body) = res.into_parts();
4907                    let mut body = common::Body::new(body);
4908                    if !parts.status.is_success() {
4909                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4910                        let error = serde_json::from_str(&common::to_string(&bytes));
4911                        let response = common::to_response(parts, bytes.into());
4912
4913                        if let common::Retry::After(d) =
4914                            dlg.http_failure(&response, error.as_ref().ok())
4915                        {
4916                            sleep(d).await;
4917                            continue;
4918                        }
4919
4920                        dlg.finished(false);
4921
4922                        return Err(match error {
4923                            Ok(value) => common::Error::BadRequest(value),
4924                            _ => common::Error::Failure(response),
4925                        });
4926                    }
4927                    let response = {
4928                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4929                        let encoded = common::to_string(&bytes);
4930                        match serde_json::from_str(&encoded) {
4931                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4932                            Err(error) => {
4933                                dlg.response_json_decode_error(&encoded, &error);
4934                                return Err(common::Error::JsonDecodeError(
4935                                    encoded.to_string(),
4936                                    error,
4937                                ));
4938                            }
4939                        }
4940                    };
4941
4942                    dlg.finished(true);
4943                    return Ok(response);
4944                }
4945            }
4946        }
4947    }
4948
4949    ///
4950    /// Sets the *request* property to the given value.
4951    ///
4952    /// Even though the property as already been set when instantiating this call,
4953    /// we provide this method for API completeness.
4954    pub fn request(
4955        mut self,
4956        new_value: ConnectionProfile,
4957    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4958        self._request = new_value;
4959        self
4960    }
4961    /// Required. The parent which owns this collection of connection profiles.
4962    ///
4963    /// Sets the *parent* path property to the given value.
4964    ///
4965    /// Even though the property as already been set when instantiating this call,
4966    /// we provide this method for API completeness.
4967    pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4968        self._parent = new_value.to_string();
4969        self
4970    }
4971    /// Optional. Only validate the connection profile, but don't create any resources. The default is false. Only supported for Oracle connection profiles.
4972    ///
4973    /// Sets the *validate only* query property to the given value.
4974    pub fn validate_only(
4975        mut self,
4976        new_value: bool,
4977    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4978        self._validate_only = Some(new_value);
4979        self
4980    }
4981    /// Optional. Create the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.
4982    ///
4983    /// Sets the *skip validation* query property to the given value.
4984    pub fn skip_validation(
4985        mut self,
4986        new_value: bool,
4987    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4988        self._skip_validation = Some(new_value);
4989        self
4990    }
4991    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
4992    ///
4993    /// Sets the *request id* query property to the given value.
4994    pub fn request_id(
4995        mut self,
4996        new_value: &str,
4997    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
4998        self._request_id = Some(new_value.to_string());
4999        self
5000    }
5001    /// Required. The connection profile identifier.
5002    ///
5003    /// Sets the *connection profile id* query property to the given value.
5004    pub fn connection_profile_id(
5005        mut self,
5006        new_value: &str,
5007    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5008        self._connection_profile_id = Some(new_value.to_string());
5009        self
5010    }
5011    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5012    /// while executing the actual API request.
5013    ///
5014    /// ````text
5015    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5016    /// ````
5017    ///
5018    /// Sets the *delegate* property to the given value.
5019    pub fn delegate(
5020        mut self,
5021        new_value: &'a mut dyn common::Delegate,
5022    ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5023        self._delegate = Some(new_value);
5024        self
5025    }
5026
5027    /// Set any additional parameter of the query string used in the request.
5028    /// It should be used to set parameters which are not yet available through their own
5029    /// setters.
5030    ///
5031    /// Please note that this method must not be used to set any of the known parameters
5032    /// which have their own setter method. If done anyway, the request will fail.
5033    ///
5034    /// # Additional Parameters
5035    ///
5036    /// * *$.xgafv* (query-string) - V1 error format.
5037    /// * *access_token* (query-string) - OAuth access token.
5038    /// * *alt* (query-string) - Data format for response.
5039    /// * *callback* (query-string) - JSONP
5040    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5041    /// * *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.
5042    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5043    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5044    /// * *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.
5045    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5046    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5047    pub fn param<T>(
5048        mut self,
5049        name: T,
5050        value: T,
5051    ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5052    where
5053        T: AsRef<str>,
5054    {
5055        self._additional_params
5056            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5057        self
5058    }
5059
5060    /// Identifies the authorization scope for the method you are building.
5061    ///
5062    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5063    /// [`Scope::CloudPlatform`].
5064    ///
5065    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5066    /// tokens for more than one scope.
5067    ///
5068    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5069    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5070    /// sufficient, a read-write scope will do as well.
5071    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5072    where
5073        St: AsRef<str>,
5074    {
5075        self._scopes.insert(String::from(scope.as_ref()));
5076        self
5077    }
5078    /// Identifies the authorization scope(s) for the method you are building.
5079    ///
5080    /// See [`Self::add_scope()`] for details.
5081    pub fn add_scopes<I, St>(
5082        mut self,
5083        scopes: I,
5084    ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5085    where
5086        I: IntoIterator<Item = St>,
5087        St: AsRef<str>,
5088    {
5089        self._scopes
5090            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5091        self
5092    }
5093
5094    /// Removes all scopes, and no default scope will be used either.
5095    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5096    /// for details).
5097    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5098        self._scopes.clear();
5099        self
5100    }
5101}
5102
5103/// Deletes a single Database Migration Service connection profile. A connection profile can only be deleted if it is not in use by any active migration jobs.
5104///
5105/// A builder for the *locations.connectionProfiles.delete* method supported by a *project* resource.
5106/// It is not used directly, but through a [`ProjectMethods`] instance.
5107///
5108/// # Example
5109///
5110/// Instantiate a resource method builder
5111///
5112/// ```test_harness,no_run
5113/// # extern crate hyper;
5114/// # extern crate hyper_rustls;
5115/// # extern crate google_datamigration1 as datamigration1;
5116/// # async fn dox() {
5117/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5118///
5119/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5120/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5121/// #     secret,
5122/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5123/// # ).build().await.unwrap();
5124///
5125/// # let client = hyper_util::client::legacy::Client::builder(
5126/// #     hyper_util::rt::TokioExecutor::new()
5127/// # )
5128/// # .build(
5129/// #     hyper_rustls::HttpsConnectorBuilder::new()
5130/// #         .with_native_roots()
5131/// #         .unwrap()
5132/// #         .https_or_http()
5133/// #         .enable_http1()
5134/// #         .build()
5135/// # );
5136/// # let mut hub = DatabaseMigrationService::new(client, auth);
5137/// // You can configure optional parameters by calling the respective setters at will, and
5138/// // execute the final call using `doit()`.
5139/// // Values shown here are possibly random and not representative !
5140/// let result = hub.projects().locations_connection_profiles_delete("name")
5141///              .request_id("gubergren")
5142///              .force(false)
5143///              .doit().await;
5144/// # }
5145/// ```
5146pub struct ProjectLocationConnectionProfileDeleteCall<'a, C>
5147where
5148    C: 'a,
5149{
5150    hub: &'a DatabaseMigrationService<C>,
5151    _name: String,
5152    _request_id: Option<String>,
5153    _force: Option<bool>,
5154    _delegate: Option<&'a mut dyn common::Delegate>,
5155    _additional_params: HashMap<String, String>,
5156    _scopes: BTreeSet<String>,
5157}
5158
5159impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDeleteCall<'a, C> {}
5160
5161impl<'a, C> ProjectLocationConnectionProfileDeleteCall<'a, C>
5162where
5163    C: common::Connector,
5164{
5165    /// Perform the operation you have build so far.
5166    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5167        use std::borrow::Cow;
5168        use std::io::{Read, Seek};
5169
5170        use common::{url::Params, ToParts};
5171        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5172
5173        let mut dd = common::DefaultDelegate;
5174        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5175        dlg.begin(common::MethodInfo {
5176            id: "datamigration.projects.locations.connectionProfiles.delete",
5177            http_method: hyper::Method::DELETE,
5178        });
5179
5180        for &field in ["alt", "name", "requestId", "force"].iter() {
5181            if self._additional_params.contains_key(field) {
5182                dlg.finished(false);
5183                return Err(common::Error::FieldClash(field));
5184            }
5185        }
5186
5187        let mut params = Params::with_capacity(5 + self._additional_params.len());
5188        params.push("name", self._name);
5189        if let Some(value) = self._request_id.as_ref() {
5190            params.push("requestId", value);
5191        }
5192        if let Some(value) = self._force.as_ref() {
5193            params.push("force", value.to_string());
5194        }
5195
5196        params.extend(self._additional_params.iter());
5197
5198        params.push("alt", "json");
5199        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5200        if self._scopes.is_empty() {
5201            self._scopes
5202                .insert(Scope::CloudPlatform.as_ref().to_string());
5203        }
5204
5205        #[allow(clippy::single_element_loop)]
5206        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5207            url = params.uri_replacement(url, param_name, find_this, true);
5208        }
5209        {
5210            let to_remove = ["name"];
5211            params.remove_params(&to_remove);
5212        }
5213
5214        let url = params.parse_with_url(&url);
5215
5216        loop {
5217            let token = match self
5218                .hub
5219                .auth
5220                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5221                .await
5222            {
5223                Ok(token) => token,
5224                Err(e) => match dlg.token(e) {
5225                    Ok(token) => token,
5226                    Err(e) => {
5227                        dlg.finished(false);
5228                        return Err(common::Error::MissingToken(e));
5229                    }
5230                },
5231            };
5232            let mut req_result = {
5233                let client = &self.hub.client;
5234                dlg.pre_request();
5235                let mut req_builder = hyper::Request::builder()
5236                    .method(hyper::Method::DELETE)
5237                    .uri(url.as_str())
5238                    .header(USER_AGENT, self.hub._user_agent.clone());
5239
5240                if let Some(token) = token.as_ref() {
5241                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5242                }
5243
5244                let request = req_builder
5245                    .header(CONTENT_LENGTH, 0_u64)
5246                    .body(common::to_body::<String>(None));
5247
5248                client.request(request.unwrap()).await
5249            };
5250
5251            match req_result {
5252                Err(err) => {
5253                    if let common::Retry::After(d) = dlg.http_error(&err) {
5254                        sleep(d).await;
5255                        continue;
5256                    }
5257                    dlg.finished(false);
5258                    return Err(common::Error::HttpError(err));
5259                }
5260                Ok(res) => {
5261                    let (mut parts, body) = res.into_parts();
5262                    let mut body = common::Body::new(body);
5263                    if !parts.status.is_success() {
5264                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5265                        let error = serde_json::from_str(&common::to_string(&bytes));
5266                        let response = common::to_response(parts, bytes.into());
5267
5268                        if let common::Retry::After(d) =
5269                            dlg.http_failure(&response, error.as_ref().ok())
5270                        {
5271                            sleep(d).await;
5272                            continue;
5273                        }
5274
5275                        dlg.finished(false);
5276
5277                        return Err(match error {
5278                            Ok(value) => common::Error::BadRequest(value),
5279                            _ => common::Error::Failure(response),
5280                        });
5281                    }
5282                    let response = {
5283                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5284                        let encoded = common::to_string(&bytes);
5285                        match serde_json::from_str(&encoded) {
5286                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5287                            Err(error) => {
5288                                dlg.response_json_decode_error(&encoded, &error);
5289                                return Err(common::Error::JsonDecodeError(
5290                                    encoded.to_string(),
5291                                    error,
5292                                ));
5293                            }
5294                        }
5295                    };
5296
5297                    dlg.finished(true);
5298                    return Ok(response);
5299                }
5300            }
5301        }
5302    }
5303
5304    /// Required. Name of the connection profile resource to delete.
5305    ///
5306    /// Sets the *name* path property to the given value.
5307    ///
5308    /// Even though the property as already been set when instantiating this call,
5309    /// we provide this method for API completeness.
5310    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
5311        self._name = new_value.to_string();
5312        self
5313    }
5314    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
5315    ///
5316    /// Sets the *request id* query property to the given value.
5317    pub fn request_id(
5318        mut self,
5319        new_value: &str,
5320    ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
5321        self._request_id = Some(new_value.to_string());
5322        self
5323    }
5324    /// In case of force delete, the CloudSQL replica database is also deleted (only for CloudSQL connection profile).
5325    ///
5326    /// Sets the *force* query property to the given value.
5327    pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
5328        self._force = Some(new_value);
5329        self
5330    }
5331    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5332    /// while executing the actual API request.
5333    ///
5334    /// ````text
5335    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5336    /// ````
5337    ///
5338    /// Sets the *delegate* property to the given value.
5339    pub fn delegate(
5340        mut self,
5341        new_value: &'a mut dyn common::Delegate,
5342    ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
5343        self._delegate = Some(new_value);
5344        self
5345    }
5346
5347    /// Set any additional parameter of the query string used in the request.
5348    /// It should be used to set parameters which are not yet available through their own
5349    /// setters.
5350    ///
5351    /// Please note that this method must not be used to set any of the known parameters
5352    /// which have their own setter method. If done anyway, the request will fail.
5353    ///
5354    /// # Additional Parameters
5355    ///
5356    /// * *$.xgafv* (query-string) - V1 error format.
5357    /// * *access_token* (query-string) - OAuth access token.
5358    /// * *alt* (query-string) - Data format for response.
5359    /// * *callback* (query-string) - JSONP
5360    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5361    /// * *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.
5362    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5363    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5364    /// * *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.
5365    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5366    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5367    pub fn param<T>(
5368        mut self,
5369        name: T,
5370        value: T,
5371    ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
5372    where
5373        T: AsRef<str>,
5374    {
5375        self._additional_params
5376            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5377        self
5378    }
5379
5380    /// Identifies the authorization scope for the method you are building.
5381    ///
5382    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5383    /// [`Scope::CloudPlatform`].
5384    ///
5385    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5386    /// tokens for more than one scope.
5387    ///
5388    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5389    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5390    /// sufficient, a read-write scope will do as well.
5391    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
5392    where
5393        St: AsRef<str>,
5394    {
5395        self._scopes.insert(String::from(scope.as_ref()));
5396        self
5397    }
5398    /// Identifies the authorization scope(s) for the method you are building.
5399    ///
5400    /// See [`Self::add_scope()`] for details.
5401    pub fn add_scopes<I, St>(
5402        mut self,
5403        scopes: I,
5404    ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
5405    where
5406        I: IntoIterator<Item = St>,
5407        St: AsRef<str>,
5408    {
5409        self._scopes
5410            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5411        self
5412    }
5413
5414    /// Removes all scopes, and no default scope will be used either.
5415    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5416    /// for details).
5417    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
5418        self._scopes.clear();
5419        self
5420    }
5421}
5422
5423/// Gets details of a single connection profile.
5424///
5425/// A builder for the *locations.connectionProfiles.get* method supported by a *project* resource.
5426/// It is not used directly, but through a [`ProjectMethods`] instance.
5427///
5428/// # Example
5429///
5430/// Instantiate a resource method builder
5431///
5432/// ```test_harness,no_run
5433/// # extern crate hyper;
5434/// # extern crate hyper_rustls;
5435/// # extern crate google_datamigration1 as datamigration1;
5436/// # async fn dox() {
5437/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5438///
5439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5441/// #     secret,
5442/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5443/// # ).build().await.unwrap();
5444///
5445/// # let client = hyper_util::client::legacy::Client::builder(
5446/// #     hyper_util::rt::TokioExecutor::new()
5447/// # )
5448/// # .build(
5449/// #     hyper_rustls::HttpsConnectorBuilder::new()
5450/// #         .with_native_roots()
5451/// #         .unwrap()
5452/// #         .https_or_http()
5453/// #         .enable_http1()
5454/// #         .build()
5455/// # );
5456/// # let mut hub = DatabaseMigrationService::new(client, auth);
5457/// // You can configure optional parameters by calling the respective setters at will, and
5458/// // execute the final call using `doit()`.
5459/// // Values shown here are possibly random and not representative !
5460/// let result = hub.projects().locations_connection_profiles_get("name")
5461///              .doit().await;
5462/// # }
5463/// ```
5464pub struct ProjectLocationConnectionProfileGetCall<'a, C>
5465where
5466    C: 'a,
5467{
5468    hub: &'a DatabaseMigrationService<C>,
5469    _name: String,
5470    _delegate: Option<&'a mut dyn common::Delegate>,
5471    _additional_params: HashMap<String, String>,
5472    _scopes: BTreeSet<String>,
5473}
5474
5475impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetCall<'a, C> {}
5476
5477impl<'a, C> ProjectLocationConnectionProfileGetCall<'a, C>
5478where
5479    C: common::Connector,
5480{
5481    /// Perform the operation you have build so far.
5482    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionProfile)> {
5483        use std::borrow::Cow;
5484        use std::io::{Read, Seek};
5485
5486        use common::{url::Params, ToParts};
5487        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5488
5489        let mut dd = common::DefaultDelegate;
5490        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5491        dlg.begin(common::MethodInfo {
5492            id: "datamigration.projects.locations.connectionProfiles.get",
5493            http_method: hyper::Method::GET,
5494        });
5495
5496        for &field in ["alt", "name"].iter() {
5497            if self._additional_params.contains_key(field) {
5498                dlg.finished(false);
5499                return Err(common::Error::FieldClash(field));
5500            }
5501        }
5502
5503        let mut params = Params::with_capacity(3 + self._additional_params.len());
5504        params.push("name", self._name);
5505
5506        params.extend(self._additional_params.iter());
5507
5508        params.push("alt", "json");
5509        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5510        if self._scopes.is_empty() {
5511            self._scopes
5512                .insert(Scope::CloudPlatform.as_ref().to_string());
5513        }
5514
5515        #[allow(clippy::single_element_loop)]
5516        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5517            url = params.uri_replacement(url, param_name, find_this, true);
5518        }
5519        {
5520            let to_remove = ["name"];
5521            params.remove_params(&to_remove);
5522        }
5523
5524        let url = params.parse_with_url(&url);
5525
5526        loop {
5527            let token = match self
5528                .hub
5529                .auth
5530                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5531                .await
5532            {
5533                Ok(token) => token,
5534                Err(e) => match dlg.token(e) {
5535                    Ok(token) => token,
5536                    Err(e) => {
5537                        dlg.finished(false);
5538                        return Err(common::Error::MissingToken(e));
5539                    }
5540                },
5541            };
5542            let mut req_result = {
5543                let client = &self.hub.client;
5544                dlg.pre_request();
5545                let mut req_builder = hyper::Request::builder()
5546                    .method(hyper::Method::GET)
5547                    .uri(url.as_str())
5548                    .header(USER_AGENT, self.hub._user_agent.clone());
5549
5550                if let Some(token) = token.as_ref() {
5551                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5552                }
5553
5554                let request = req_builder
5555                    .header(CONTENT_LENGTH, 0_u64)
5556                    .body(common::to_body::<String>(None));
5557
5558                client.request(request.unwrap()).await
5559            };
5560
5561            match req_result {
5562                Err(err) => {
5563                    if let common::Retry::After(d) = dlg.http_error(&err) {
5564                        sleep(d).await;
5565                        continue;
5566                    }
5567                    dlg.finished(false);
5568                    return Err(common::Error::HttpError(err));
5569                }
5570                Ok(res) => {
5571                    let (mut parts, body) = res.into_parts();
5572                    let mut body = common::Body::new(body);
5573                    if !parts.status.is_success() {
5574                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5575                        let error = serde_json::from_str(&common::to_string(&bytes));
5576                        let response = common::to_response(parts, bytes.into());
5577
5578                        if let common::Retry::After(d) =
5579                            dlg.http_failure(&response, error.as_ref().ok())
5580                        {
5581                            sleep(d).await;
5582                            continue;
5583                        }
5584
5585                        dlg.finished(false);
5586
5587                        return Err(match error {
5588                            Ok(value) => common::Error::BadRequest(value),
5589                            _ => common::Error::Failure(response),
5590                        });
5591                    }
5592                    let response = {
5593                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5594                        let encoded = common::to_string(&bytes);
5595                        match serde_json::from_str(&encoded) {
5596                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5597                            Err(error) => {
5598                                dlg.response_json_decode_error(&encoded, &error);
5599                                return Err(common::Error::JsonDecodeError(
5600                                    encoded.to_string(),
5601                                    error,
5602                                ));
5603                            }
5604                        }
5605                    };
5606
5607                    dlg.finished(true);
5608                    return Ok(response);
5609                }
5610            }
5611        }
5612    }
5613
5614    /// Required. Name of the connection profile resource to get.
5615    ///
5616    /// Sets the *name* path property to the given value.
5617    ///
5618    /// Even though the property as already been set when instantiating this call,
5619    /// we provide this method for API completeness.
5620    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5621        self._name = new_value.to_string();
5622        self
5623    }
5624    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5625    /// while executing the actual API request.
5626    ///
5627    /// ````text
5628    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5629    /// ````
5630    ///
5631    /// Sets the *delegate* property to the given value.
5632    pub fn delegate(
5633        mut self,
5634        new_value: &'a mut dyn common::Delegate,
5635    ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5636        self._delegate = Some(new_value);
5637        self
5638    }
5639
5640    /// Set any additional parameter of the query string used in the request.
5641    /// It should be used to set parameters which are not yet available through their own
5642    /// setters.
5643    ///
5644    /// Please note that this method must not be used to set any of the known parameters
5645    /// which have their own setter method. If done anyway, the request will fail.
5646    ///
5647    /// # Additional Parameters
5648    ///
5649    /// * *$.xgafv* (query-string) - V1 error format.
5650    /// * *access_token* (query-string) - OAuth access token.
5651    /// * *alt* (query-string) - Data format for response.
5652    /// * *callback* (query-string) - JSONP
5653    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5654    /// * *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.
5655    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5656    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5657    /// * *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.
5658    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5659    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5660    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileGetCall<'a, C>
5661    where
5662        T: AsRef<str>,
5663    {
5664        self._additional_params
5665            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5666        self
5667    }
5668
5669    /// Identifies the authorization scope for the method you are building.
5670    ///
5671    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5672    /// [`Scope::CloudPlatform`].
5673    ///
5674    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5675    /// tokens for more than one scope.
5676    ///
5677    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5678    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5679    /// sufficient, a read-write scope will do as well.
5680    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileGetCall<'a, C>
5681    where
5682        St: AsRef<str>,
5683    {
5684        self._scopes.insert(String::from(scope.as_ref()));
5685        self
5686    }
5687    /// Identifies the authorization scope(s) for the method you are building.
5688    ///
5689    /// See [`Self::add_scope()`] for details.
5690    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileGetCall<'a, C>
5691    where
5692        I: IntoIterator<Item = St>,
5693        St: AsRef<str>,
5694    {
5695        self._scopes
5696            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5697        self
5698    }
5699
5700    /// Removes all scopes, and no default scope will be used either.
5701    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5702    /// for details).
5703    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetCall<'a, C> {
5704        self._scopes.clear();
5705        self
5706    }
5707}
5708
5709/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5710///
5711/// A builder for the *locations.connectionProfiles.getIamPolicy* method supported by a *project* resource.
5712/// It is not used directly, but through a [`ProjectMethods`] instance.
5713///
5714/// # Example
5715///
5716/// Instantiate a resource method builder
5717///
5718/// ```test_harness,no_run
5719/// # extern crate hyper;
5720/// # extern crate hyper_rustls;
5721/// # extern crate google_datamigration1 as datamigration1;
5722/// # async fn dox() {
5723/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5724///
5725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5726/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5727/// #     secret,
5728/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5729/// # ).build().await.unwrap();
5730///
5731/// # let client = hyper_util::client::legacy::Client::builder(
5732/// #     hyper_util::rt::TokioExecutor::new()
5733/// # )
5734/// # .build(
5735/// #     hyper_rustls::HttpsConnectorBuilder::new()
5736/// #         .with_native_roots()
5737/// #         .unwrap()
5738/// #         .https_or_http()
5739/// #         .enable_http1()
5740/// #         .build()
5741/// # );
5742/// # let mut hub = DatabaseMigrationService::new(client, auth);
5743/// // You can configure optional parameters by calling the respective setters at will, and
5744/// // execute the final call using `doit()`.
5745/// // Values shown here are possibly random and not representative !
5746/// let result = hub.projects().locations_connection_profiles_get_iam_policy("resource")
5747///              .options_requested_policy_version(-86)
5748///              .doit().await;
5749/// # }
5750/// ```
5751pub struct ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
5752where
5753    C: 'a,
5754{
5755    hub: &'a DatabaseMigrationService<C>,
5756    _resource: String,
5757    _options_requested_policy_version: Option<i32>,
5758    _delegate: Option<&'a mut dyn common::Delegate>,
5759    _additional_params: HashMap<String, String>,
5760    _scopes: BTreeSet<String>,
5761}
5762
5763impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {}
5764
5765impl<'a, C> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
5766where
5767    C: common::Connector,
5768{
5769    /// Perform the operation you have build so far.
5770    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5771        use std::borrow::Cow;
5772        use std::io::{Read, Seek};
5773
5774        use common::{url::Params, ToParts};
5775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5776
5777        let mut dd = common::DefaultDelegate;
5778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5779        dlg.begin(common::MethodInfo {
5780            id: "datamigration.projects.locations.connectionProfiles.getIamPolicy",
5781            http_method: hyper::Method::GET,
5782        });
5783
5784        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
5785            if self._additional_params.contains_key(field) {
5786                dlg.finished(false);
5787                return Err(common::Error::FieldClash(field));
5788            }
5789        }
5790
5791        let mut params = Params::with_capacity(4 + self._additional_params.len());
5792        params.push("resource", self._resource);
5793        if let Some(value) = self._options_requested_policy_version.as_ref() {
5794            params.push("options.requestedPolicyVersion", value.to_string());
5795        }
5796
5797        params.extend(self._additional_params.iter());
5798
5799        params.push("alt", "json");
5800        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
5801        if self._scopes.is_empty() {
5802            self._scopes
5803                .insert(Scope::CloudPlatform.as_ref().to_string());
5804        }
5805
5806        #[allow(clippy::single_element_loop)]
5807        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5808            url = params.uri_replacement(url, param_name, find_this, true);
5809        }
5810        {
5811            let to_remove = ["resource"];
5812            params.remove_params(&to_remove);
5813        }
5814
5815        let url = params.parse_with_url(&url);
5816
5817        loop {
5818            let token = match self
5819                .hub
5820                .auth
5821                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5822                .await
5823            {
5824                Ok(token) => token,
5825                Err(e) => match dlg.token(e) {
5826                    Ok(token) => token,
5827                    Err(e) => {
5828                        dlg.finished(false);
5829                        return Err(common::Error::MissingToken(e));
5830                    }
5831                },
5832            };
5833            let mut req_result = {
5834                let client = &self.hub.client;
5835                dlg.pre_request();
5836                let mut req_builder = hyper::Request::builder()
5837                    .method(hyper::Method::GET)
5838                    .uri(url.as_str())
5839                    .header(USER_AGENT, self.hub._user_agent.clone());
5840
5841                if let Some(token) = token.as_ref() {
5842                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5843                }
5844
5845                let request = req_builder
5846                    .header(CONTENT_LENGTH, 0_u64)
5847                    .body(common::to_body::<String>(None));
5848
5849                client.request(request.unwrap()).await
5850            };
5851
5852            match req_result {
5853                Err(err) => {
5854                    if let common::Retry::After(d) = dlg.http_error(&err) {
5855                        sleep(d).await;
5856                        continue;
5857                    }
5858                    dlg.finished(false);
5859                    return Err(common::Error::HttpError(err));
5860                }
5861                Ok(res) => {
5862                    let (mut parts, body) = res.into_parts();
5863                    let mut body = common::Body::new(body);
5864                    if !parts.status.is_success() {
5865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5866                        let error = serde_json::from_str(&common::to_string(&bytes));
5867                        let response = common::to_response(parts, bytes.into());
5868
5869                        if let common::Retry::After(d) =
5870                            dlg.http_failure(&response, error.as_ref().ok())
5871                        {
5872                            sleep(d).await;
5873                            continue;
5874                        }
5875
5876                        dlg.finished(false);
5877
5878                        return Err(match error {
5879                            Ok(value) => common::Error::BadRequest(value),
5880                            _ => common::Error::Failure(response),
5881                        });
5882                    }
5883                    let response = {
5884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5885                        let encoded = common::to_string(&bytes);
5886                        match serde_json::from_str(&encoded) {
5887                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5888                            Err(error) => {
5889                                dlg.response_json_decode_error(&encoded, &error);
5890                                return Err(common::Error::JsonDecodeError(
5891                                    encoded.to_string(),
5892                                    error,
5893                                ));
5894                            }
5895                        }
5896                    };
5897
5898                    dlg.finished(true);
5899                    return Ok(response);
5900                }
5901            }
5902        }
5903    }
5904
5905    /// 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.
5906    ///
5907    /// Sets the *resource* path property to the given value.
5908    ///
5909    /// Even though the property as already been set when instantiating this call,
5910    /// we provide this method for API completeness.
5911    pub fn resource(
5912        mut self,
5913        new_value: &str,
5914    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
5915        self._resource = new_value.to_string();
5916        self
5917    }
5918    /// 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).
5919    ///
5920    /// Sets the *options.requested policy version* query property to the given value.
5921    pub fn options_requested_policy_version(
5922        mut self,
5923        new_value: i32,
5924    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
5925        self._options_requested_policy_version = Some(new_value);
5926        self
5927    }
5928    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5929    /// while executing the actual API request.
5930    ///
5931    /// ````text
5932    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5933    /// ````
5934    ///
5935    /// Sets the *delegate* property to the given value.
5936    pub fn delegate(
5937        mut self,
5938        new_value: &'a mut dyn common::Delegate,
5939    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
5940        self._delegate = Some(new_value);
5941        self
5942    }
5943
5944    /// Set any additional parameter of the query string used in the request.
5945    /// It should be used to set parameters which are not yet available through their own
5946    /// setters.
5947    ///
5948    /// Please note that this method must not be used to set any of the known parameters
5949    /// which have their own setter method. If done anyway, the request will fail.
5950    ///
5951    /// # Additional Parameters
5952    ///
5953    /// * *$.xgafv* (query-string) - V1 error format.
5954    /// * *access_token* (query-string) - OAuth access token.
5955    /// * *alt* (query-string) - Data format for response.
5956    /// * *callback* (query-string) - JSONP
5957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5958    /// * *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.
5959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5961    /// * *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.
5962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5964    pub fn param<T>(
5965        mut self,
5966        name: T,
5967        value: T,
5968    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
5969    where
5970        T: AsRef<str>,
5971    {
5972        self._additional_params
5973            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5974        self
5975    }
5976
5977    /// Identifies the authorization scope for the method you are building.
5978    ///
5979    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5980    /// [`Scope::CloudPlatform`].
5981    ///
5982    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5983    /// tokens for more than one scope.
5984    ///
5985    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5986    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5987    /// sufficient, a read-write scope will do as well.
5988    pub fn add_scope<St>(
5989        mut self,
5990        scope: St,
5991    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
5992    where
5993        St: AsRef<str>,
5994    {
5995        self._scopes.insert(String::from(scope.as_ref()));
5996        self
5997    }
5998    /// Identifies the authorization scope(s) for the method you are building.
5999    ///
6000    /// See [`Self::add_scope()`] for details.
6001    pub fn add_scopes<I, St>(
6002        mut self,
6003        scopes: I,
6004    ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6005    where
6006        I: IntoIterator<Item = St>,
6007        St: AsRef<str>,
6008    {
6009        self._scopes
6010            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6011        self
6012    }
6013
6014    /// Removes all scopes, and no default scope will be used either.
6015    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6016    /// for details).
6017    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
6018        self._scopes.clear();
6019        self
6020    }
6021}
6022
6023/// Retrieves a list of all connection profiles in a given project and location.
6024///
6025/// A builder for the *locations.connectionProfiles.list* method supported by a *project* resource.
6026/// It is not used directly, but through a [`ProjectMethods`] instance.
6027///
6028/// # Example
6029///
6030/// Instantiate a resource method builder
6031///
6032/// ```test_harness,no_run
6033/// # extern crate hyper;
6034/// # extern crate hyper_rustls;
6035/// # extern crate google_datamigration1 as datamigration1;
6036/// # async fn dox() {
6037/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6038///
6039/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6040/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6041/// #     secret,
6042/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6043/// # ).build().await.unwrap();
6044///
6045/// # let client = hyper_util::client::legacy::Client::builder(
6046/// #     hyper_util::rt::TokioExecutor::new()
6047/// # )
6048/// # .build(
6049/// #     hyper_rustls::HttpsConnectorBuilder::new()
6050/// #         .with_native_roots()
6051/// #         .unwrap()
6052/// #         .https_or_http()
6053/// #         .enable_http1()
6054/// #         .build()
6055/// # );
6056/// # let mut hub = DatabaseMigrationService::new(client, auth);
6057/// // You can configure optional parameters by calling the respective setters at will, and
6058/// // execute the final call using `doit()`.
6059/// // Values shown here are possibly random and not representative !
6060/// let result = hub.projects().locations_connection_profiles_list("parent")
6061///              .page_token("duo")
6062///              .page_size(-80)
6063///              .order_by("no")
6064///              .filter("Stet")
6065///              .doit().await;
6066/// # }
6067/// ```
6068pub struct ProjectLocationConnectionProfileListCall<'a, C>
6069where
6070    C: 'a,
6071{
6072    hub: &'a DatabaseMigrationService<C>,
6073    _parent: String,
6074    _page_token: Option<String>,
6075    _page_size: Option<i32>,
6076    _order_by: Option<String>,
6077    _filter: Option<String>,
6078    _delegate: Option<&'a mut dyn common::Delegate>,
6079    _additional_params: HashMap<String, String>,
6080    _scopes: BTreeSet<String>,
6081}
6082
6083impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileListCall<'a, C> {}
6084
6085impl<'a, C> ProjectLocationConnectionProfileListCall<'a, C>
6086where
6087    C: common::Connector,
6088{
6089    /// Perform the operation you have build so far.
6090    pub async fn doit(
6091        mut self,
6092    ) -> common::Result<(common::Response, ListConnectionProfilesResponse)> {
6093        use std::borrow::Cow;
6094        use std::io::{Read, Seek};
6095
6096        use common::{url::Params, ToParts};
6097        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6098
6099        let mut dd = common::DefaultDelegate;
6100        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6101        dlg.begin(common::MethodInfo {
6102            id: "datamigration.projects.locations.connectionProfiles.list",
6103            http_method: hyper::Method::GET,
6104        });
6105
6106        for &field in [
6107            "alt",
6108            "parent",
6109            "pageToken",
6110            "pageSize",
6111            "orderBy",
6112            "filter",
6113        ]
6114        .iter()
6115        {
6116            if self._additional_params.contains_key(field) {
6117                dlg.finished(false);
6118                return Err(common::Error::FieldClash(field));
6119            }
6120        }
6121
6122        let mut params = Params::with_capacity(7 + self._additional_params.len());
6123        params.push("parent", self._parent);
6124        if let Some(value) = self._page_token.as_ref() {
6125            params.push("pageToken", value);
6126        }
6127        if let Some(value) = self._page_size.as_ref() {
6128            params.push("pageSize", value.to_string());
6129        }
6130        if let Some(value) = self._order_by.as_ref() {
6131            params.push("orderBy", value);
6132        }
6133        if let Some(value) = self._filter.as_ref() {
6134            params.push("filter", value);
6135        }
6136
6137        params.extend(self._additional_params.iter());
6138
6139        params.push("alt", "json");
6140        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
6141        if self._scopes.is_empty() {
6142            self._scopes
6143                .insert(Scope::CloudPlatform.as_ref().to_string());
6144        }
6145
6146        #[allow(clippy::single_element_loop)]
6147        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6148            url = params.uri_replacement(url, param_name, find_this, true);
6149        }
6150        {
6151            let to_remove = ["parent"];
6152            params.remove_params(&to_remove);
6153        }
6154
6155        let url = params.parse_with_url(&url);
6156
6157        loop {
6158            let token = match self
6159                .hub
6160                .auth
6161                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6162                .await
6163            {
6164                Ok(token) => token,
6165                Err(e) => match dlg.token(e) {
6166                    Ok(token) => token,
6167                    Err(e) => {
6168                        dlg.finished(false);
6169                        return Err(common::Error::MissingToken(e));
6170                    }
6171                },
6172            };
6173            let mut req_result = {
6174                let client = &self.hub.client;
6175                dlg.pre_request();
6176                let mut req_builder = hyper::Request::builder()
6177                    .method(hyper::Method::GET)
6178                    .uri(url.as_str())
6179                    .header(USER_AGENT, self.hub._user_agent.clone());
6180
6181                if let Some(token) = token.as_ref() {
6182                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6183                }
6184
6185                let request = req_builder
6186                    .header(CONTENT_LENGTH, 0_u64)
6187                    .body(common::to_body::<String>(None));
6188
6189                client.request(request.unwrap()).await
6190            };
6191
6192            match req_result {
6193                Err(err) => {
6194                    if let common::Retry::After(d) = dlg.http_error(&err) {
6195                        sleep(d).await;
6196                        continue;
6197                    }
6198                    dlg.finished(false);
6199                    return Err(common::Error::HttpError(err));
6200                }
6201                Ok(res) => {
6202                    let (mut parts, body) = res.into_parts();
6203                    let mut body = common::Body::new(body);
6204                    if !parts.status.is_success() {
6205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6206                        let error = serde_json::from_str(&common::to_string(&bytes));
6207                        let response = common::to_response(parts, bytes.into());
6208
6209                        if let common::Retry::After(d) =
6210                            dlg.http_failure(&response, error.as_ref().ok())
6211                        {
6212                            sleep(d).await;
6213                            continue;
6214                        }
6215
6216                        dlg.finished(false);
6217
6218                        return Err(match error {
6219                            Ok(value) => common::Error::BadRequest(value),
6220                            _ => common::Error::Failure(response),
6221                        });
6222                    }
6223                    let response = {
6224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6225                        let encoded = common::to_string(&bytes);
6226                        match serde_json::from_str(&encoded) {
6227                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6228                            Err(error) => {
6229                                dlg.response_json_decode_error(&encoded, &error);
6230                                return Err(common::Error::JsonDecodeError(
6231                                    encoded.to_string(),
6232                                    error,
6233                                ));
6234                            }
6235                        }
6236                    };
6237
6238                    dlg.finished(true);
6239                    return Ok(response);
6240                }
6241            }
6242        }
6243    }
6244
6245    /// Required. The parent which owns this collection of connection profiles.
6246    ///
6247    /// Sets the *parent* path property to the given value.
6248    ///
6249    /// Even though the property as already been set when instantiating this call,
6250    /// we provide this method for API completeness.
6251    pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
6252        self._parent = new_value.to_string();
6253        self
6254    }
6255    /// A page token, received from a previous `ListConnectionProfiles` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListConnectionProfiles` must match the call that provided the page token.
6256    ///
6257    /// Sets the *page token* query property to the given value.
6258    pub fn page_token(
6259        mut self,
6260        new_value: &str,
6261    ) -> ProjectLocationConnectionProfileListCall<'a, C> {
6262        self._page_token = Some(new_value.to_string());
6263        self
6264    }
6265    /// The maximum number of connection profiles to return. The service may return fewer than this value. If unspecified, at most 50 connection profiles will be returned. The maximum value is 1000; values above 1000 are coerced to 1000.
6266    ///
6267    /// Sets the *page size* query property to the given value.
6268    pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionProfileListCall<'a, C> {
6269        self._page_size = Some(new_value);
6270        self
6271    }
6272    /// A comma-separated list of fields to order results according to.
6273    ///
6274    /// Sets the *order by* query property to the given value.
6275    pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
6276        self._order_by = Some(new_value.to_string());
6277        self
6278    }
6279    /// A filter expression that filters connection profiles listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list connection profiles created this year by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z**. You can also filter nested fields. For example, you could specify **mySql.username = %lt;my_username%gt;** to list all connection profiles configured to connect with a specific username.
6280    ///
6281    /// Sets the *filter* query property to the given value.
6282    pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
6283        self._filter = Some(new_value.to_string());
6284        self
6285    }
6286    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6287    /// while executing the actual API request.
6288    ///
6289    /// ````text
6290    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6291    /// ````
6292    ///
6293    /// Sets the *delegate* property to the given value.
6294    pub fn delegate(
6295        mut self,
6296        new_value: &'a mut dyn common::Delegate,
6297    ) -> ProjectLocationConnectionProfileListCall<'a, C> {
6298        self._delegate = Some(new_value);
6299        self
6300    }
6301
6302    /// Set any additional parameter of the query string used in the request.
6303    /// It should be used to set parameters which are not yet available through their own
6304    /// setters.
6305    ///
6306    /// Please note that this method must not be used to set any of the known parameters
6307    /// which have their own setter method. If done anyway, the request will fail.
6308    ///
6309    /// # Additional Parameters
6310    ///
6311    /// * *$.xgafv* (query-string) - V1 error format.
6312    /// * *access_token* (query-string) - OAuth access token.
6313    /// * *alt* (query-string) - Data format for response.
6314    /// * *callback* (query-string) - JSONP
6315    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6316    /// * *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.
6317    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6318    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6319    /// * *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.
6320    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6321    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6322    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileListCall<'a, C>
6323    where
6324        T: AsRef<str>,
6325    {
6326        self._additional_params
6327            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6328        self
6329    }
6330
6331    /// Identifies the authorization scope for the method you are building.
6332    ///
6333    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6334    /// [`Scope::CloudPlatform`].
6335    ///
6336    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6337    /// tokens for more than one scope.
6338    ///
6339    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6340    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6341    /// sufficient, a read-write scope will do as well.
6342    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileListCall<'a, C>
6343    where
6344        St: AsRef<str>,
6345    {
6346        self._scopes.insert(String::from(scope.as_ref()));
6347        self
6348    }
6349    /// Identifies the authorization scope(s) for the method you are building.
6350    ///
6351    /// See [`Self::add_scope()`] for details.
6352    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileListCall<'a, C>
6353    where
6354        I: IntoIterator<Item = St>,
6355        St: AsRef<str>,
6356    {
6357        self._scopes
6358            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6359        self
6360    }
6361
6362    /// Removes all scopes, and no default scope will be used either.
6363    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6364    /// for details).
6365    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileListCall<'a, C> {
6366        self._scopes.clear();
6367        self
6368    }
6369}
6370
6371/// Update the configuration of a single connection profile.
6372///
6373/// A builder for the *locations.connectionProfiles.patch* method supported by a *project* resource.
6374/// It is not used directly, but through a [`ProjectMethods`] instance.
6375///
6376/// # Example
6377///
6378/// Instantiate a resource method builder
6379///
6380/// ```test_harness,no_run
6381/// # extern crate hyper;
6382/// # extern crate hyper_rustls;
6383/// # extern crate google_datamigration1 as datamigration1;
6384/// use datamigration1::api::ConnectionProfile;
6385/// # async fn dox() {
6386/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6387///
6388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6390/// #     secret,
6391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6392/// # ).build().await.unwrap();
6393///
6394/// # let client = hyper_util::client::legacy::Client::builder(
6395/// #     hyper_util::rt::TokioExecutor::new()
6396/// # )
6397/// # .build(
6398/// #     hyper_rustls::HttpsConnectorBuilder::new()
6399/// #         .with_native_roots()
6400/// #         .unwrap()
6401/// #         .https_or_http()
6402/// #         .enable_http1()
6403/// #         .build()
6404/// # );
6405/// # let mut hub = DatabaseMigrationService::new(client, auth);
6406/// // As the method needs a request, you would usually fill it with the desired information
6407/// // into the respective structure. Some of the parts shown here might not be applicable !
6408/// // Values shown here are possibly random and not representative !
6409/// let mut req = ConnectionProfile::default();
6410///
6411/// // You can configure optional parameters by calling the respective setters at will, and
6412/// // execute the final call using `doit()`.
6413/// // Values shown here are possibly random and not representative !
6414/// let result = hub.projects().locations_connection_profiles_patch(req, "name")
6415///              .validate_only(true)
6416///              .update_mask(FieldMask::new::<&str>(&[]))
6417///              .skip_validation(true)
6418///              .request_id("vero")
6419///              .doit().await;
6420/// # }
6421/// ```
6422pub struct ProjectLocationConnectionProfilePatchCall<'a, C>
6423where
6424    C: 'a,
6425{
6426    hub: &'a DatabaseMigrationService<C>,
6427    _request: ConnectionProfile,
6428    _name: String,
6429    _validate_only: Option<bool>,
6430    _update_mask: Option<common::FieldMask>,
6431    _skip_validation: Option<bool>,
6432    _request_id: Option<String>,
6433    _delegate: Option<&'a mut dyn common::Delegate>,
6434    _additional_params: HashMap<String, String>,
6435    _scopes: BTreeSet<String>,
6436}
6437
6438impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfilePatchCall<'a, C> {}
6439
6440impl<'a, C> ProjectLocationConnectionProfilePatchCall<'a, C>
6441where
6442    C: common::Connector,
6443{
6444    /// Perform the operation you have build so far.
6445    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6446        use std::borrow::Cow;
6447        use std::io::{Read, Seek};
6448
6449        use common::{url::Params, ToParts};
6450        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6451
6452        let mut dd = common::DefaultDelegate;
6453        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6454        dlg.begin(common::MethodInfo {
6455            id: "datamigration.projects.locations.connectionProfiles.patch",
6456            http_method: hyper::Method::PATCH,
6457        });
6458
6459        for &field in [
6460            "alt",
6461            "name",
6462            "validateOnly",
6463            "updateMask",
6464            "skipValidation",
6465            "requestId",
6466        ]
6467        .iter()
6468        {
6469            if self._additional_params.contains_key(field) {
6470                dlg.finished(false);
6471                return Err(common::Error::FieldClash(field));
6472            }
6473        }
6474
6475        let mut params = Params::with_capacity(8 + self._additional_params.len());
6476        params.push("name", self._name);
6477        if let Some(value) = self._validate_only.as_ref() {
6478            params.push("validateOnly", value.to_string());
6479        }
6480        if let Some(value) = self._update_mask.as_ref() {
6481            params.push("updateMask", value.to_string());
6482        }
6483        if let Some(value) = self._skip_validation.as_ref() {
6484            params.push("skipValidation", value.to_string());
6485        }
6486        if let Some(value) = self._request_id.as_ref() {
6487            params.push("requestId", value);
6488        }
6489
6490        params.extend(self._additional_params.iter());
6491
6492        params.push("alt", "json");
6493        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6494        if self._scopes.is_empty() {
6495            self._scopes
6496                .insert(Scope::CloudPlatform.as_ref().to_string());
6497        }
6498
6499        #[allow(clippy::single_element_loop)]
6500        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6501            url = params.uri_replacement(url, param_name, find_this, true);
6502        }
6503        {
6504            let to_remove = ["name"];
6505            params.remove_params(&to_remove);
6506        }
6507
6508        let url = params.parse_with_url(&url);
6509
6510        let mut json_mime_type = mime::APPLICATION_JSON;
6511        let mut request_value_reader = {
6512            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6513            common::remove_json_null_values(&mut value);
6514            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6515            serde_json::to_writer(&mut dst, &value).unwrap();
6516            dst
6517        };
6518        let request_size = request_value_reader
6519            .seek(std::io::SeekFrom::End(0))
6520            .unwrap();
6521        request_value_reader
6522            .seek(std::io::SeekFrom::Start(0))
6523            .unwrap();
6524
6525        loop {
6526            let token = match self
6527                .hub
6528                .auth
6529                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6530                .await
6531            {
6532                Ok(token) => token,
6533                Err(e) => match dlg.token(e) {
6534                    Ok(token) => token,
6535                    Err(e) => {
6536                        dlg.finished(false);
6537                        return Err(common::Error::MissingToken(e));
6538                    }
6539                },
6540            };
6541            request_value_reader
6542                .seek(std::io::SeekFrom::Start(0))
6543                .unwrap();
6544            let mut req_result = {
6545                let client = &self.hub.client;
6546                dlg.pre_request();
6547                let mut req_builder = hyper::Request::builder()
6548                    .method(hyper::Method::PATCH)
6549                    .uri(url.as_str())
6550                    .header(USER_AGENT, self.hub._user_agent.clone());
6551
6552                if let Some(token) = token.as_ref() {
6553                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6554                }
6555
6556                let request = req_builder
6557                    .header(CONTENT_TYPE, json_mime_type.to_string())
6558                    .header(CONTENT_LENGTH, request_size as u64)
6559                    .body(common::to_body(
6560                        request_value_reader.get_ref().clone().into(),
6561                    ));
6562
6563                client.request(request.unwrap()).await
6564            };
6565
6566            match req_result {
6567                Err(err) => {
6568                    if let common::Retry::After(d) = dlg.http_error(&err) {
6569                        sleep(d).await;
6570                        continue;
6571                    }
6572                    dlg.finished(false);
6573                    return Err(common::Error::HttpError(err));
6574                }
6575                Ok(res) => {
6576                    let (mut parts, body) = res.into_parts();
6577                    let mut body = common::Body::new(body);
6578                    if !parts.status.is_success() {
6579                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6580                        let error = serde_json::from_str(&common::to_string(&bytes));
6581                        let response = common::to_response(parts, bytes.into());
6582
6583                        if let common::Retry::After(d) =
6584                            dlg.http_failure(&response, error.as_ref().ok())
6585                        {
6586                            sleep(d).await;
6587                            continue;
6588                        }
6589
6590                        dlg.finished(false);
6591
6592                        return Err(match error {
6593                            Ok(value) => common::Error::BadRequest(value),
6594                            _ => common::Error::Failure(response),
6595                        });
6596                    }
6597                    let response = {
6598                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6599                        let encoded = common::to_string(&bytes);
6600                        match serde_json::from_str(&encoded) {
6601                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6602                            Err(error) => {
6603                                dlg.response_json_decode_error(&encoded, &error);
6604                                return Err(common::Error::JsonDecodeError(
6605                                    encoded.to_string(),
6606                                    error,
6607                                ));
6608                            }
6609                        }
6610                    };
6611
6612                    dlg.finished(true);
6613                    return Ok(response);
6614                }
6615            }
6616        }
6617    }
6618
6619    ///
6620    /// Sets the *request* property to the given value.
6621    ///
6622    /// Even though the property as already been set when instantiating this call,
6623    /// we provide this method for API completeness.
6624    pub fn request(
6625        mut self,
6626        new_value: ConnectionProfile,
6627    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6628        self._request = new_value;
6629        self
6630    }
6631    /// The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
6632    ///
6633    /// Sets the *name* path property to the given value.
6634    ///
6635    /// Even though the property as already been set when instantiating this call,
6636    /// we provide this method for API completeness.
6637    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6638        self._name = new_value.to_string();
6639        self
6640    }
6641    /// Optional. Only validate the connection profile, but don't update any resources. The default is false. Only supported for Oracle connection profiles.
6642    ///
6643    /// Sets the *validate only* query property to the given value.
6644    pub fn validate_only(
6645        mut self,
6646        new_value: bool,
6647    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6648        self._validate_only = Some(new_value);
6649        self
6650    }
6651    /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
6652    ///
6653    /// Sets the *update mask* query property to the given value.
6654    pub fn update_mask(
6655        mut self,
6656        new_value: common::FieldMask,
6657    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6658        self._update_mask = Some(new_value);
6659        self
6660    }
6661    /// Optional. Update the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.
6662    ///
6663    /// Sets the *skip validation* query property to the given value.
6664    pub fn skip_validation(
6665        mut self,
6666        new_value: bool,
6667    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6668        self._skip_validation = Some(new_value);
6669        self
6670    }
6671    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
6672    ///
6673    /// Sets the *request id* query property to the given value.
6674    pub fn request_id(
6675        mut self,
6676        new_value: &str,
6677    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6678        self._request_id = Some(new_value.to_string());
6679        self
6680    }
6681    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6682    /// while executing the actual API request.
6683    ///
6684    /// ````text
6685    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6686    /// ````
6687    ///
6688    /// Sets the *delegate* property to the given value.
6689    pub fn delegate(
6690        mut self,
6691        new_value: &'a mut dyn common::Delegate,
6692    ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6693        self._delegate = Some(new_value);
6694        self
6695    }
6696
6697    /// Set any additional parameter of the query string used in the request.
6698    /// It should be used to set parameters which are not yet available through their own
6699    /// setters.
6700    ///
6701    /// Please note that this method must not be used to set any of the known parameters
6702    /// which have their own setter method. If done anyway, the request will fail.
6703    ///
6704    /// # Additional Parameters
6705    ///
6706    /// * *$.xgafv* (query-string) - V1 error format.
6707    /// * *access_token* (query-string) - OAuth access token.
6708    /// * *alt* (query-string) - Data format for response.
6709    /// * *callback* (query-string) - JSONP
6710    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6711    /// * *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.
6712    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6713    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6714    /// * *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.
6715    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6716    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6717    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfilePatchCall<'a, C>
6718    where
6719        T: AsRef<str>,
6720    {
6721        self._additional_params
6722            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6723        self
6724    }
6725
6726    /// Identifies the authorization scope for the method you are building.
6727    ///
6728    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6729    /// [`Scope::CloudPlatform`].
6730    ///
6731    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6732    /// tokens for more than one scope.
6733    ///
6734    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6735    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6736    /// sufficient, a read-write scope will do as well.
6737    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfilePatchCall<'a, C>
6738    where
6739        St: AsRef<str>,
6740    {
6741        self._scopes.insert(String::from(scope.as_ref()));
6742        self
6743    }
6744    /// Identifies the authorization scope(s) for the method you are building.
6745    ///
6746    /// See [`Self::add_scope()`] for details.
6747    pub fn add_scopes<I, St>(
6748        mut self,
6749        scopes: I,
6750    ) -> ProjectLocationConnectionProfilePatchCall<'a, C>
6751    where
6752        I: IntoIterator<Item = St>,
6753        St: AsRef<str>,
6754    {
6755        self._scopes
6756            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6757        self
6758    }
6759
6760    /// Removes all scopes, and no default scope will be used either.
6761    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6762    /// for details).
6763    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
6764        self._scopes.clear();
6765        self
6766    }
6767}
6768
6769/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6770///
6771/// A builder for the *locations.connectionProfiles.setIamPolicy* method supported by a *project* resource.
6772/// It is not used directly, but through a [`ProjectMethods`] instance.
6773///
6774/// # Example
6775///
6776/// Instantiate a resource method builder
6777///
6778/// ```test_harness,no_run
6779/// # extern crate hyper;
6780/// # extern crate hyper_rustls;
6781/// # extern crate google_datamigration1 as datamigration1;
6782/// use datamigration1::api::SetIamPolicyRequest;
6783/// # async fn dox() {
6784/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6785///
6786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6788/// #     secret,
6789/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6790/// # ).build().await.unwrap();
6791///
6792/// # let client = hyper_util::client::legacy::Client::builder(
6793/// #     hyper_util::rt::TokioExecutor::new()
6794/// # )
6795/// # .build(
6796/// #     hyper_rustls::HttpsConnectorBuilder::new()
6797/// #         .with_native_roots()
6798/// #         .unwrap()
6799/// #         .https_or_http()
6800/// #         .enable_http1()
6801/// #         .build()
6802/// # );
6803/// # let mut hub = DatabaseMigrationService::new(client, auth);
6804/// // As the method needs a request, you would usually fill it with the desired information
6805/// // into the respective structure. Some of the parts shown here might not be applicable !
6806/// // Values shown here are possibly random and not representative !
6807/// let mut req = SetIamPolicyRequest::default();
6808///
6809/// // You can configure optional parameters by calling the respective setters at will, and
6810/// // execute the final call using `doit()`.
6811/// // Values shown here are possibly random and not representative !
6812/// let result = hub.projects().locations_connection_profiles_set_iam_policy(req, "resource")
6813///              .doit().await;
6814/// # }
6815/// ```
6816pub struct ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
6817where
6818    C: 'a,
6819{
6820    hub: &'a DatabaseMigrationService<C>,
6821    _request: SetIamPolicyRequest,
6822    _resource: String,
6823    _delegate: Option<&'a mut dyn common::Delegate>,
6824    _additional_params: HashMap<String, String>,
6825    _scopes: BTreeSet<String>,
6826}
6827
6828impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {}
6829
6830impl<'a, C> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
6831where
6832    C: common::Connector,
6833{
6834    /// Perform the operation you have build so far.
6835    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6836        use std::borrow::Cow;
6837        use std::io::{Read, Seek};
6838
6839        use common::{url::Params, ToParts};
6840        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6841
6842        let mut dd = common::DefaultDelegate;
6843        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6844        dlg.begin(common::MethodInfo {
6845            id: "datamigration.projects.locations.connectionProfiles.setIamPolicy",
6846            http_method: hyper::Method::POST,
6847        });
6848
6849        for &field in ["alt", "resource"].iter() {
6850            if self._additional_params.contains_key(field) {
6851                dlg.finished(false);
6852                return Err(common::Error::FieldClash(field));
6853            }
6854        }
6855
6856        let mut params = Params::with_capacity(4 + self._additional_params.len());
6857        params.push("resource", self._resource);
6858
6859        params.extend(self._additional_params.iter());
6860
6861        params.push("alt", "json");
6862        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
6863        if self._scopes.is_empty() {
6864            self._scopes
6865                .insert(Scope::CloudPlatform.as_ref().to_string());
6866        }
6867
6868        #[allow(clippy::single_element_loop)]
6869        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6870            url = params.uri_replacement(url, param_name, find_this, true);
6871        }
6872        {
6873            let to_remove = ["resource"];
6874            params.remove_params(&to_remove);
6875        }
6876
6877        let url = params.parse_with_url(&url);
6878
6879        let mut json_mime_type = mime::APPLICATION_JSON;
6880        let mut request_value_reader = {
6881            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6882            common::remove_json_null_values(&mut value);
6883            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6884            serde_json::to_writer(&mut dst, &value).unwrap();
6885            dst
6886        };
6887        let request_size = request_value_reader
6888            .seek(std::io::SeekFrom::End(0))
6889            .unwrap();
6890        request_value_reader
6891            .seek(std::io::SeekFrom::Start(0))
6892            .unwrap();
6893
6894        loop {
6895            let token = match self
6896                .hub
6897                .auth
6898                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6899                .await
6900            {
6901                Ok(token) => token,
6902                Err(e) => match dlg.token(e) {
6903                    Ok(token) => token,
6904                    Err(e) => {
6905                        dlg.finished(false);
6906                        return Err(common::Error::MissingToken(e));
6907                    }
6908                },
6909            };
6910            request_value_reader
6911                .seek(std::io::SeekFrom::Start(0))
6912                .unwrap();
6913            let mut req_result = {
6914                let client = &self.hub.client;
6915                dlg.pre_request();
6916                let mut req_builder = hyper::Request::builder()
6917                    .method(hyper::Method::POST)
6918                    .uri(url.as_str())
6919                    .header(USER_AGENT, self.hub._user_agent.clone());
6920
6921                if let Some(token) = token.as_ref() {
6922                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6923                }
6924
6925                let request = req_builder
6926                    .header(CONTENT_TYPE, json_mime_type.to_string())
6927                    .header(CONTENT_LENGTH, request_size as u64)
6928                    .body(common::to_body(
6929                        request_value_reader.get_ref().clone().into(),
6930                    ));
6931
6932                client.request(request.unwrap()).await
6933            };
6934
6935            match req_result {
6936                Err(err) => {
6937                    if let common::Retry::After(d) = dlg.http_error(&err) {
6938                        sleep(d).await;
6939                        continue;
6940                    }
6941                    dlg.finished(false);
6942                    return Err(common::Error::HttpError(err));
6943                }
6944                Ok(res) => {
6945                    let (mut parts, body) = res.into_parts();
6946                    let mut body = common::Body::new(body);
6947                    if !parts.status.is_success() {
6948                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6949                        let error = serde_json::from_str(&common::to_string(&bytes));
6950                        let response = common::to_response(parts, bytes.into());
6951
6952                        if let common::Retry::After(d) =
6953                            dlg.http_failure(&response, error.as_ref().ok())
6954                        {
6955                            sleep(d).await;
6956                            continue;
6957                        }
6958
6959                        dlg.finished(false);
6960
6961                        return Err(match error {
6962                            Ok(value) => common::Error::BadRequest(value),
6963                            _ => common::Error::Failure(response),
6964                        });
6965                    }
6966                    let response = {
6967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6968                        let encoded = common::to_string(&bytes);
6969                        match serde_json::from_str(&encoded) {
6970                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6971                            Err(error) => {
6972                                dlg.response_json_decode_error(&encoded, &error);
6973                                return Err(common::Error::JsonDecodeError(
6974                                    encoded.to_string(),
6975                                    error,
6976                                ));
6977                            }
6978                        }
6979                    };
6980
6981                    dlg.finished(true);
6982                    return Ok(response);
6983                }
6984            }
6985        }
6986    }
6987
6988    ///
6989    /// Sets the *request* property to the given value.
6990    ///
6991    /// Even though the property as already been set when instantiating this call,
6992    /// we provide this method for API completeness.
6993    pub fn request(
6994        mut self,
6995        new_value: SetIamPolicyRequest,
6996    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
6997        self._request = new_value;
6998        self
6999    }
7000    /// 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.
7001    ///
7002    /// Sets the *resource* path property to the given value.
7003    ///
7004    /// Even though the property as already been set when instantiating this call,
7005    /// we provide this method for API completeness.
7006    pub fn resource(
7007        mut self,
7008        new_value: &str,
7009    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7010        self._resource = new_value.to_string();
7011        self
7012    }
7013    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7014    /// while executing the actual API request.
7015    ///
7016    /// ````text
7017    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7018    /// ````
7019    ///
7020    /// Sets the *delegate* property to the given value.
7021    pub fn delegate(
7022        mut self,
7023        new_value: &'a mut dyn common::Delegate,
7024    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7025        self._delegate = Some(new_value);
7026        self
7027    }
7028
7029    /// Set any additional parameter of the query string used in the request.
7030    /// It should be used to set parameters which are not yet available through their own
7031    /// setters.
7032    ///
7033    /// Please note that this method must not be used to set any of the known parameters
7034    /// which have their own setter method. If done anyway, the request will fail.
7035    ///
7036    /// # Additional Parameters
7037    ///
7038    /// * *$.xgafv* (query-string) - V1 error format.
7039    /// * *access_token* (query-string) - OAuth access token.
7040    /// * *alt* (query-string) - Data format for response.
7041    /// * *callback* (query-string) - JSONP
7042    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7043    /// * *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.
7044    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7045    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7046    /// * *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.
7047    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7048    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7049    pub fn param<T>(
7050        mut self,
7051        name: T,
7052        value: T,
7053    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7054    where
7055        T: AsRef<str>,
7056    {
7057        self._additional_params
7058            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7059        self
7060    }
7061
7062    /// Identifies the authorization scope for the method you are building.
7063    ///
7064    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7065    /// [`Scope::CloudPlatform`].
7066    ///
7067    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7068    /// tokens for more than one scope.
7069    ///
7070    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7071    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7072    /// sufficient, a read-write scope will do as well.
7073    pub fn add_scope<St>(
7074        mut self,
7075        scope: St,
7076    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7077    where
7078        St: AsRef<str>,
7079    {
7080        self._scopes.insert(String::from(scope.as_ref()));
7081        self
7082    }
7083    /// Identifies the authorization scope(s) for the method you are building.
7084    ///
7085    /// See [`Self::add_scope()`] for details.
7086    pub fn add_scopes<I, St>(
7087        mut self,
7088        scopes: I,
7089    ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7090    where
7091        I: IntoIterator<Item = St>,
7092        St: AsRef<str>,
7093    {
7094        self._scopes
7095            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7096        self
7097    }
7098
7099    /// Removes all scopes, and no default scope will be used either.
7100    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7101    /// for details).
7102    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7103        self._scopes.clear();
7104        self
7105    }
7106}
7107
7108/// 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.
7109///
7110/// A builder for the *locations.connectionProfiles.testIamPermissions* method supported by a *project* resource.
7111/// It is not used directly, but through a [`ProjectMethods`] instance.
7112///
7113/// # Example
7114///
7115/// Instantiate a resource method builder
7116///
7117/// ```test_harness,no_run
7118/// # extern crate hyper;
7119/// # extern crate hyper_rustls;
7120/// # extern crate google_datamigration1 as datamigration1;
7121/// use datamigration1::api::TestIamPermissionsRequest;
7122/// # async fn dox() {
7123/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7124///
7125/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7127/// #     secret,
7128/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7129/// # ).build().await.unwrap();
7130///
7131/// # let client = hyper_util::client::legacy::Client::builder(
7132/// #     hyper_util::rt::TokioExecutor::new()
7133/// # )
7134/// # .build(
7135/// #     hyper_rustls::HttpsConnectorBuilder::new()
7136/// #         .with_native_roots()
7137/// #         .unwrap()
7138/// #         .https_or_http()
7139/// #         .enable_http1()
7140/// #         .build()
7141/// # );
7142/// # let mut hub = DatabaseMigrationService::new(client, auth);
7143/// // As the method needs a request, you would usually fill it with the desired information
7144/// // into the respective structure. Some of the parts shown here might not be applicable !
7145/// // Values shown here are possibly random and not representative !
7146/// let mut req = TestIamPermissionsRequest::default();
7147///
7148/// // You can configure optional parameters by calling the respective setters at will, and
7149/// // execute the final call using `doit()`.
7150/// // Values shown here are possibly random and not representative !
7151/// let result = hub.projects().locations_connection_profiles_test_iam_permissions(req, "resource")
7152///              .doit().await;
7153/// # }
7154/// ```
7155pub struct ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7156where
7157    C: 'a,
7158{
7159    hub: &'a DatabaseMigrationService<C>,
7160    _request: TestIamPermissionsRequest,
7161    _resource: String,
7162    _delegate: Option<&'a mut dyn common::Delegate>,
7163    _additional_params: HashMap<String, String>,
7164    _scopes: BTreeSet<String>,
7165}
7166
7167impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {}
7168
7169impl<'a, C> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7170where
7171    C: common::Connector,
7172{
7173    /// Perform the operation you have build so far.
7174    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7175        use std::borrow::Cow;
7176        use std::io::{Read, Seek};
7177
7178        use common::{url::Params, ToParts};
7179        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7180
7181        let mut dd = common::DefaultDelegate;
7182        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7183        dlg.begin(common::MethodInfo {
7184            id: "datamigration.projects.locations.connectionProfiles.testIamPermissions",
7185            http_method: hyper::Method::POST,
7186        });
7187
7188        for &field in ["alt", "resource"].iter() {
7189            if self._additional_params.contains_key(field) {
7190                dlg.finished(false);
7191                return Err(common::Error::FieldClash(field));
7192            }
7193        }
7194
7195        let mut params = Params::with_capacity(4 + self._additional_params.len());
7196        params.push("resource", self._resource);
7197
7198        params.extend(self._additional_params.iter());
7199
7200        params.push("alt", "json");
7201        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
7202        if self._scopes.is_empty() {
7203            self._scopes
7204                .insert(Scope::CloudPlatform.as_ref().to_string());
7205        }
7206
7207        #[allow(clippy::single_element_loop)]
7208        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7209            url = params.uri_replacement(url, param_name, find_this, true);
7210        }
7211        {
7212            let to_remove = ["resource"];
7213            params.remove_params(&to_remove);
7214        }
7215
7216        let url = params.parse_with_url(&url);
7217
7218        let mut json_mime_type = mime::APPLICATION_JSON;
7219        let mut request_value_reader = {
7220            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7221            common::remove_json_null_values(&mut value);
7222            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7223            serde_json::to_writer(&mut dst, &value).unwrap();
7224            dst
7225        };
7226        let request_size = request_value_reader
7227            .seek(std::io::SeekFrom::End(0))
7228            .unwrap();
7229        request_value_reader
7230            .seek(std::io::SeekFrom::Start(0))
7231            .unwrap();
7232
7233        loop {
7234            let token = match self
7235                .hub
7236                .auth
7237                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7238                .await
7239            {
7240                Ok(token) => token,
7241                Err(e) => match dlg.token(e) {
7242                    Ok(token) => token,
7243                    Err(e) => {
7244                        dlg.finished(false);
7245                        return Err(common::Error::MissingToken(e));
7246                    }
7247                },
7248            };
7249            request_value_reader
7250                .seek(std::io::SeekFrom::Start(0))
7251                .unwrap();
7252            let mut req_result = {
7253                let client = &self.hub.client;
7254                dlg.pre_request();
7255                let mut req_builder = hyper::Request::builder()
7256                    .method(hyper::Method::POST)
7257                    .uri(url.as_str())
7258                    .header(USER_AGENT, self.hub._user_agent.clone());
7259
7260                if let Some(token) = token.as_ref() {
7261                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7262                }
7263
7264                let request = req_builder
7265                    .header(CONTENT_TYPE, json_mime_type.to_string())
7266                    .header(CONTENT_LENGTH, request_size as u64)
7267                    .body(common::to_body(
7268                        request_value_reader.get_ref().clone().into(),
7269                    ));
7270
7271                client.request(request.unwrap()).await
7272            };
7273
7274            match req_result {
7275                Err(err) => {
7276                    if let common::Retry::After(d) = dlg.http_error(&err) {
7277                        sleep(d).await;
7278                        continue;
7279                    }
7280                    dlg.finished(false);
7281                    return Err(common::Error::HttpError(err));
7282                }
7283                Ok(res) => {
7284                    let (mut parts, body) = res.into_parts();
7285                    let mut body = common::Body::new(body);
7286                    if !parts.status.is_success() {
7287                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7288                        let error = serde_json::from_str(&common::to_string(&bytes));
7289                        let response = common::to_response(parts, bytes.into());
7290
7291                        if let common::Retry::After(d) =
7292                            dlg.http_failure(&response, error.as_ref().ok())
7293                        {
7294                            sleep(d).await;
7295                            continue;
7296                        }
7297
7298                        dlg.finished(false);
7299
7300                        return Err(match error {
7301                            Ok(value) => common::Error::BadRequest(value),
7302                            _ => common::Error::Failure(response),
7303                        });
7304                    }
7305                    let response = {
7306                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7307                        let encoded = common::to_string(&bytes);
7308                        match serde_json::from_str(&encoded) {
7309                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7310                            Err(error) => {
7311                                dlg.response_json_decode_error(&encoded, &error);
7312                                return Err(common::Error::JsonDecodeError(
7313                                    encoded.to_string(),
7314                                    error,
7315                                ));
7316                            }
7317                        }
7318                    };
7319
7320                    dlg.finished(true);
7321                    return Ok(response);
7322                }
7323            }
7324        }
7325    }
7326
7327    ///
7328    /// Sets the *request* property to the given value.
7329    ///
7330    /// Even though the property as already been set when instantiating this call,
7331    /// we provide this method for API completeness.
7332    pub fn request(
7333        mut self,
7334        new_value: TestIamPermissionsRequest,
7335    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
7336        self._request = new_value;
7337        self
7338    }
7339    /// 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.
7340    ///
7341    /// Sets the *resource* path property to the given value.
7342    ///
7343    /// Even though the property as already been set when instantiating this call,
7344    /// we provide this method for API completeness.
7345    pub fn resource(
7346        mut self,
7347        new_value: &str,
7348    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
7349        self._resource = new_value.to_string();
7350        self
7351    }
7352    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7353    /// while executing the actual API request.
7354    ///
7355    /// ````text
7356    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7357    /// ````
7358    ///
7359    /// Sets the *delegate* property to the given value.
7360    pub fn delegate(
7361        mut self,
7362        new_value: &'a mut dyn common::Delegate,
7363    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
7364        self._delegate = Some(new_value);
7365        self
7366    }
7367
7368    /// Set any additional parameter of the query string used in the request.
7369    /// It should be used to set parameters which are not yet available through their own
7370    /// setters.
7371    ///
7372    /// Please note that this method must not be used to set any of the known parameters
7373    /// which have their own setter method. If done anyway, the request will fail.
7374    ///
7375    /// # Additional Parameters
7376    ///
7377    /// * *$.xgafv* (query-string) - V1 error format.
7378    /// * *access_token* (query-string) - OAuth access token.
7379    /// * *alt* (query-string) - Data format for response.
7380    /// * *callback* (query-string) - JSONP
7381    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7382    /// * *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.
7383    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7384    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7385    /// * *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.
7386    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7387    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7388    pub fn param<T>(
7389        mut self,
7390        name: T,
7391        value: T,
7392    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7393    where
7394        T: AsRef<str>,
7395    {
7396        self._additional_params
7397            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7398        self
7399    }
7400
7401    /// Identifies the authorization scope for the method you are building.
7402    ///
7403    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7404    /// [`Scope::CloudPlatform`].
7405    ///
7406    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7407    /// tokens for more than one scope.
7408    ///
7409    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7410    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7411    /// sufficient, a read-write scope will do as well.
7412    pub fn add_scope<St>(
7413        mut self,
7414        scope: St,
7415    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7416    where
7417        St: AsRef<str>,
7418    {
7419        self._scopes.insert(String::from(scope.as_ref()));
7420        self
7421    }
7422    /// Identifies the authorization scope(s) for the method you are building.
7423    ///
7424    /// See [`Self::add_scope()`] for details.
7425    pub fn add_scopes<I, St>(
7426        mut self,
7427        scopes: I,
7428    ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7429    where
7430        I: IntoIterator<Item = St>,
7431        St: AsRef<str>,
7432    {
7433        self._scopes
7434            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7435        self
7436    }
7437
7438    /// Removes all scopes, and no default scope will be used either.
7439    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7440    /// for details).
7441    pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
7442        self._scopes.clear();
7443        self
7444    }
7445}
7446
7447/// Creates a new mapping rule for a given conversion workspace.
7448///
7449/// A builder for the *locations.conversionWorkspaces.mappingRules.create* method supported by a *project* resource.
7450/// It is not used directly, but through a [`ProjectMethods`] instance.
7451///
7452/// # Example
7453///
7454/// Instantiate a resource method builder
7455///
7456/// ```test_harness,no_run
7457/// # extern crate hyper;
7458/// # extern crate hyper_rustls;
7459/// # extern crate google_datamigration1 as datamigration1;
7460/// use datamigration1::api::MappingRule;
7461/// # async fn dox() {
7462/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7463///
7464/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7465/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7466/// #     secret,
7467/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7468/// # ).build().await.unwrap();
7469///
7470/// # let client = hyper_util::client::legacy::Client::builder(
7471/// #     hyper_util::rt::TokioExecutor::new()
7472/// # )
7473/// # .build(
7474/// #     hyper_rustls::HttpsConnectorBuilder::new()
7475/// #         .with_native_roots()
7476/// #         .unwrap()
7477/// #         .https_or_http()
7478/// #         .enable_http1()
7479/// #         .build()
7480/// # );
7481/// # let mut hub = DatabaseMigrationService::new(client, auth);
7482/// // As the method needs a request, you would usually fill it with the desired information
7483/// // into the respective structure. Some of the parts shown here might not be applicable !
7484/// // Values shown here are possibly random and not representative !
7485/// let mut req = MappingRule::default();
7486///
7487/// // You can configure optional parameters by calling the respective setters at will, and
7488/// // execute the final call using `doit()`.
7489/// // Values shown here are possibly random and not representative !
7490/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_create(req, "parent")
7491///              .request_id("dolore")
7492///              .mapping_rule_id("et")
7493///              .doit().await;
7494/// # }
7495/// ```
7496pub struct ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
7497where
7498    C: 'a,
7499{
7500    hub: &'a DatabaseMigrationService<C>,
7501    _request: MappingRule,
7502    _parent: String,
7503    _request_id: Option<String>,
7504    _mapping_rule_id: Option<String>,
7505    _delegate: Option<&'a mut dyn common::Delegate>,
7506    _additional_params: HashMap<String, String>,
7507    _scopes: BTreeSet<String>,
7508}
7509
7510impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {}
7511
7512impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
7513where
7514    C: common::Connector,
7515{
7516    /// Perform the operation you have build so far.
7517    pub async fn doit(mut self) -> common::Result<(common::Response, MappingRule)> {
7518        use std::borrow::Cow;
7519        use std::io::{Read, Seek};
7520
7521        use common::{url::Params, ToParts};
7522        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7523
7524        let mut dd = common::DefaultDelegate;
7525        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7526        dlg.begin(common::MethodInfo {
7527            id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.create",
7528            http_method: hyper::Method::POST,
7529        });
7530
7531        for &field in ["alt", "parent", "requestId", "mappingRuleId"].iter() {
7532            if self._additional_params.contains_key(field) {
7533                dlg.finished(false);
7534                return Err(common::Error::FieldClash(field));
7535            }
7536        }
7537
7538        let mut params = Params::with_capacity(6 + self._additional_params.len());
7539        params.push("parent", self._parent);
7540        if let Some(value) = self._request_id.as_ref() {
7541            params.push("requestId", value);
7542        }
7543        if let Some(value) = self._mapping_rule_id.as_ref() {
7544            params.push("mappingRuleId", value);
7545        }
7546
7547        params.extend(self._additional_params.iter());
7548
7549        params.push("alt", "json");
7550        let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules";
7551        if self._scopes.is_empty() {
7552            self._scopes
7553                .insert(Scope::CloudPlatform.as_ref().to_string());
7554        }
7555
7556        #[allow(clippy::single_element_loop)]
7557        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7558            url = params.uri_replacement(url, param_name, find_this, true);
7559        }
7560        {
7561            let to_remove = ["parent"];
7562            params.remove_params(&to_remove);
7563        }
7564
7565        let url = params.parse_with_url(&url);
7566
7567        let mut json_mime_type = mime::APPLICATION_JSON;
7568        let mut request_value_reader = {
7569            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7570            common::remove_json_null_values(&mut value);
7571            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7572            serde_json::to_writer(&mut dst, &value).unwrap();
7573            dst
7574        };
7575        let request_size = request_value_reader
7576            .seek(std::io::SeekFrom::End(0))
7577            .unwrap();
7578        request_value_reader
7579            .seek(std::io::SeekFrom::Start(0))
7580            .unwrap();
7581
7582        loop {
7583            let token = match self
7584                .hub
7585                .auth
7586                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7587                .await
7588            {
7589                Ok(token) => token,
7590                Err(e) => match dlg.token(e) {
7591                    Ok(token) => token,
7592                    Err(e) => {
7593                        dlg.finished(false);
7594                        return Err(common::Error::MissingToken(e));
7595                    }
7596                },
7597            };
7598            request_value_reader
7599                .seek(std::io::SeekFrom::Start(0))
7600                .unwrap();
7601            let mut req_result = {
7602                let client = &self.hub.client;
7603                dlg.pre_request();
7604                let mut req_builder = hyper::Request::builder()
7605                    .method(hyper::Method::POST)
7606                    .uri(url.as_str())
7607                    .header(USER_AGENT, self.hub._user_agent.clone());
7608
7609                if let Some(token) = token.as_ref() {
7610                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7611                }
7612
7613                let request = req_builder
7614                    .header(CONTENT_TYPE, json_mime_type.to_string())
7615                    .header(CONTENT_LENGTH, request_size as u64)
7616                    .body(common::to_body(
7617                        request_value_reader.get_ref().clone().into(),
7618                    ));
7619
7620                client.request(request.unwrap()).await
7621            };
7622
7623            match req_result {
7624                Err(err) => {
7625                    if let common::Retry::After(d) = dlg.http_error(&err) {
7626                        sleep(d).await;
7627                        continue;
7628                    }
7629                    dlg.finished(false);
7630                    return Err(common::Error::HttpError(err));
7631                }
7632                Ok(res) => {
7633                    let (mut parts, body) = res.into_parts();
7634                    let mut body = common::Body::new(body);
7635                    if !parts.status.is_success() {
7636                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7637                        let error = serde_json::from_str(&common::to_string(&bytes));
7638                        let response = common::to_response(parts, bytes.into());
7639
7640                        if let common::Retry::After(d) =
7641                            dlg.http_failure(&response, error.as_ref().ok())
7642                        {
7643                            sleep(d).await;
7644                            continue;
7645                        }
7646
7647                        dlg.finished(false);
7648
7649                        return Err(match error {
7650                            Ok(value) => common::Error::BadRequest(value),
7651                            _ => common::Error::Failure(response),
7652                        });
7653                    }
7654                    let response = {
7655                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7656                        let encoded = common::to_string(&bytes);
7657                        match serde_json::from_str(&encoded) {
7658                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7659                            Err(error) => {
7660                                dlg.response_json_decode_error(&encoded, &error);
7661                                return Err(common::Error::JsonDecodeError(
7662                                    encoded.to_string(),
7663                                    error,
7664                                ));
7665                            }
7666                        }
7667                    };
7668
7669                    dlg.finished(true);
7670                    return Ok(response);
7671                }
7672            }
7673        }
7674    }
7675
7676    ///
7677    /// Sets the *request* property to the given value.
7678    ///
7679    /// Even though the property as already been set when instantiating this call,
7680    /// we provide this method for API completeness.
7681    pub fn request(
7682        mut self,
7683        new_value: MappingRule,
7684    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7685        self._request = new_value;
7686        self
7687    }
7688    /// Required. The parent which owns this collection of mapping rules.
7689    ///
7690    /// Sets the *parent* path property to the given value.
7691    ///
7692    /// Even though the property as already been set when instantiating this call,
7693    /// we provide this method for API completeness.
7694    pub fn parent(
7695        mut self,
7696        new_value: &str,
7697    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7698        self._parent = new_value.to_string();
7699        self
7700    }
7701    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
7702    ///
7703    /// Sets the *request id* query property to the given value.
7704    pub fn request_id(
7705        mut self,
7706        new_value: &str,
7707    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7708        self._request_id = Some(new_value.to_string());
7709        self
7710    }
7711    /// Required. The ID of the rule to create.
7712    ///
7713    /// Sets the *mapping rule id* query property to the given value.
7714    pub fn mapping_rule_id(
7715        mut self,
7716        new_value: &str,
7717    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7718        self._mapping_rule_id = Some(new_value.to_string());
7719        self
7720    }
7721    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7722    /// while executing the actual API request.
7723    ///
7724    /// ````text
7725    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7726    /// ````
7727    ///
7728    /// Sets the *delegate* property to the given value.
7729    pub fn delegate(
7730        mut self,
7731        new_value: &'a mut dyn common::Delegate,
7732    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7733        self._delegate = Some(new_value);
7734        self
7735    }
7736
7737    /// Set any additional parameter of the query string used in the request.
7738    /// It should be used to set parameters which are not yet available through their own
7739    /// setters.
7740    ///
7741    /// Please note that this method must not be used to set any of the known parameters
7742    /// which have their own setter method. If done anyway, the request will fail.
7743    ///
7744    /// # Additional Parameters
7745    ///
7746    /// * *$.xgafv* (query-string) - V1 error format.
7747    /// * *access_token* (query-string) - OAuth access token.
7748    /// * *alt* (query-string) - Data format for response.
7749    /// * *callback* (query-string) - JSONP
7750    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7751    /// * *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.
7752    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7753    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7754    /// * *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.
7755    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7756    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7757    pub fn param<T>(
7758        mut self,
7759        name: T,
7760        value: T,
7761    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
7762    where
7763        T: AsRef<str>,
7764    {
7765        self._additional_params
7766            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7767        self
7768    }
7769
7770    /// Identifies the authorization scope for the method you are building.
7771    ///
7772    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7773    /// [`Scope::CloudPlatform`].
7774    ///
7775    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7776    /// tokens for more than one scope.
7777    ///
7778    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7779    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7780    /// sufficient, a read-write scope will do as well.
7781    pub fn add_scope<St>(
7782        mut self,
7783        scope: St,
7784    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
7785    where
7786        St: AsRef<str>,
7787    {
7788        self._scopes.insert(String::from(scope.as_ref()));
7789        self
7790    }
7791    /// Identifies the authorization scope(s) for the method you are building.
7792    ///
7793    /// See [`Self::add_scope()`] for details.
7794    pub fn add_scopes<I, St>(
7795        mut self,
7796        scopes: I,
7797    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
7798    where
7799        I: IntoIterator<Item = St>,
7800        St: AsRef<str>,
7801    {
7802        self._scopes
7803            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7804        self
7805    }
7806
7807    /// Removes all scopes, and no default scope will be used either.
7808    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7809    /// for details).
7810    pub fn clear_scopes(
7811        mut self,
7812    ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
7813        self._scopes.clear();
7814        self
7815    }
7816}
7817
7818/// Deletes a single mapping rule.
7819///
7820/// A builder for the *locations.conversionWorkspaces.mappingRules.delete* method supported by a *project* resource.
7821/// It is not used directly, but through a [`ProjectMethods`] instance.
7822///
7823/// # Example
7824///
7825/// Instantiate a resource method builder
7826///
7827/// ```test_harness,no_run
7828/// # extern crate hyper;
7829/// # extern crate hyper_rustls;
7830/// # extern crate google_datamigration1 as datamigration1;
7831/// # async fn dox() {
7832/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7833///
7834/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7835/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7836/// #     secret,
7837/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7838/// # ).build().await.unwrap();
7839///
7840/// # let client = hyper_util::client::legacy::Client::builder(
7841/// #     hyper_util::rt::TokioExecutor::new()
7842/// # )
7843/// # .build(
7844/// #     hyper_rustls::HttpsConnectorBuilder::new()
7845/// #         .with_native_roots()
7846/// #         .unwrap()
7847/// #         .https_or_http()
7848/// #         .enable_http1()
7849/// #         .build()
7850/// # );
7851/// # let mut hub = DatabaseMigrationService::new(client, auth);
7852/// // You can configure optional parameters by calling the respective setters at will, and
7853/// // execute the final call using `doit()`.
7854/// // Values shown here are possibly random and not representative !
7855/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_delete("name")
7856///              .request_id("amet.")
7857///              .doit().await;
7858/// # }
7859/// ```
7860pub struct ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
7861where
7862    C: 'a,
7863{
7864    hub: &'a DatabaseMigrationService<C>,
7865    _name: String,
7866    _request_id: Option<String>,
7867    _delegate: Option<&'a mut dyn common::Delegate>,
7868    _additional_params: HashMap<String, String>,
7869    _scopes: BTreeSet<String>,
7870}
7871
7872impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {}
7873
7874impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
7875where
7876    C: common::Connector,
7877{
7878    /// Perform the operation you have build so far.
7879    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7880        use std::borrow::Cow;
7881        use std::io::{Read, Seek};
7882
7883        use common::{url::Params, ToParts};
7884        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7885
7886        let mut dd = common::DefaultDelegate;
7887        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7888        dlg.begin(common::MethodInfo {
7889            id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.delete",
7890            http_method: hyper::Method::DELETE,
7891        });
7892
7893        for &field in ["alt", "name", "requestId"].iter() {
7894            if self._additional_params.contains_key(field) {
7895                dlg.finished(false);
7896                return Err(common::Error::FieldClash(field));
7897            }
7898        }
7899
7900        let mut params = Params::with_capacity(4 + self._additional_params.len());
7901        params.push("name", self._name);
7902        if let Some(value) = self._request_id.as_ref() {
7903            params.push("requestId", value);
7904        }
7905
7906        params.extend(self._additional_params.iter());
7907
7908        params.push("alt", "json");
7909        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7910        if self._scopes.is_empty() {
7911            self._scopes
7912                .insert(Scope::CloudPlatform.as_ref().to_string());
7913        }
7914
7915        #[allow(clippy::single_element_loop)]
7916        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7917            url = params.uri_replacement(url, param_name, find_this, true);
7918        }
7919        {
7920            let to_remove = ["name"];
7921            params.remove_params(&to_remove);
7922        }
7923
7924        let url = params.parse_with_url(&url);
7925
7926        loop {
7927            let token = match self
7928                .hub
7929                .auth
7930                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7931                .await
7932            {
7933                Ok(token) => token,
7934                Err(e) => match dlg.token(e) {
7935                    Ok(token) => token,
7936                    Err(e) => {
7937                        dlg.finished(false);
7938                        return Err(common::Error::MissingToken(e));
7939                    }
7940                },
7941            };
7942            let mut req_result = {
7943                let client = &self.hub.client;
7944                dlg.pre_request();
7945                let mut req_builder = hyper::Request::builder()
7946                    .method(hyper::Method::DELETE)
7947                    .uri(url.as_str())
7948                    .header(USER_AGENT, self.hub._user_agent.clone());
7949
7950                if let Some(token) = token.as_ref() {
7951                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7952                }
7953
7954                let request = req_builder
7955                    .header(CONTENT_LENGTH, 0_u64)
7956                    .body(common::to_body::<String>(None));
7957
7958                client.request(request.unwrap()).await
7959            };
7960
7961            match req_result {
7962                Err(err) => {
7963                    if let common::Retry::After(d) = dlg.http_error(&err) {
7964                        sleep(d).await;
7965                        continue;
7966                    }
7967                    dlg.finished(false);
7968                    return Err(common::Error::HttpError(err));
7969                }
7970                Ok(res) => {
7971                    let (mut parts, body) = res.into_parts();
7972                    let mut body = common::Body::new(body);
7973                    if !parts.status.is_success() {
7974                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7975                        let error = serde_json::from_str(&common::to_string(&bytes));
7976                        let response = common::to_response(parts, bytes.into());
7977
7978                        if let common::Retry::After(d) =
7979                            dlg.http_failure(&response, error.as_ref().ok())
7980                        {
7981                            sleep(d).await;
7982                            continue;
7983                        }
7984
7985                        dlg.finished(false);
7986
7987                        return Err(match error {
7988                            Ok(value) => common::Error::BadRequest(value),
7989                            _ => common::Error::Failure(response),
7990                        });
7991                    }
7992                    let response = {
7993                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7994                        let encoded = common::to_string(&bytes);
7995                        match serde_json::from_str(&encoded) {
7996                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7997                            Err(error) => {
7998                                dlg.response_json_decode_error(&encoded, &error);
7999                                return Err(common::Error::JsonDecodeError(
8000                                    encoded.to_string(),
8001                                    error,
8002                                ));
8003                            }
8004                        }
8005                    };
8006
8007                    dlg.finished(true);
8008                    return Ok(response);
8009                }
8010            }
8011        }
8012    }
8013
8014    /// Required. Name of the mapping rule resource to delete.
8015    ///
8016    /// Sets the *name* path property to the given value.
8017    ///
8018    /// Even though the property as already been set when instantiating this call,
8019    /// we provide this method for API completeness.
8020    pub fn name(
8021        mut self,
8022        new_value: &str,
8023    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8024        self._name = new_value.to_string();
8025        self
8026    }
8027    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
8028    ///
8029    /// Sets the *request id* query property to the given value.
8030    pub fn request_id(
8031        mut self,
8032        new_value: &str,
8033    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8034        self._request_id = Some(new_value.to_string());
8035        self
8036    }
8037    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8038    /// while executing the actual API request.
8039    ///
8040    /// ````text
8041    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8042    /// ````
8043    ///
8044    /// Sets the *delegate* property to the given value.
8045    pub fn delegate(
8046        mut self,
8047        new_value: &'a mut dyn common::Delegate,
8048    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8049        self._delegate = Some(new_value);
8050        self
8051    }
8052
8053    /// Set any additional parameter of the query string used in the request.
8054    /// It should be used to set parameters which are not yet available through their own
8055    /// setters.
8056    ///
8057    /// Please note that this method must not be used to set any of the known parameters
8058    /// which have their own setter method. If done anyway, the request will fail.
8059    ///
8060    /// # Additional Parameters
8061    ///
8062    /// * *$.xgafv* (query-string) - V1 error format.
8063    /// * *access_token* (query-string) - OAuth access token.
8064    /// * *alt* (query-string) - Data format for response.
8065    /// * *callback* (query-string) - JSONP
8066    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8067    /// * *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.
8068    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8069    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8070    /// * *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.
8071    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8072    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8073    pub fn param<T>(
8074        mut self,
8075        name: T,
8076        value: T,
8077    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8078    where
8079        T: AsRef<str>,
8080    {
8081        self._additional_params
8082            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8083        self
8084    }
8085
8086    /// Identifies the authorization scope for the method you are building.
8087    ///
8088    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8089    /// [`Scope::CloudPlatform`].
8090    ///
8091    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8092    /// tokens for more than one scope.
8093    ///
8094    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8095    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8096    /// sufficient, a read-write scope will do as well.
8097    pub fn add_scope<St>(
8098        mut self,
8099        scope: St,
8100    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8101    where
8102        St: AsRef<str>,
8103    {
8104        self._scopes.insert(String::from(scope.as_ref()));
8105        self
8106    }
8107    /// Identifies the authorization scope(s) for the method you are building.
8108    ///
8109    /// See [`Self::add_scope()`] for details.
8110    pub fn add_scopes<I, St>(
8111        mut self,
8112        scopes: I,
8113    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8114    where
8115        I: IntoIterator<Item = St>,
8116        St: AsRef<str>,
8117    {
8118        self._scopes
8119            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8120        self
8121    }
8122
8123    /// Removes all scopes, and no default scope will be used either.
8124    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8125    /// for details).
8126    pub fn clear_scopes(
8127        mut self,
8128    ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8129        self._scopes.clear();
8130        self
8131    }
8132}
8133
8134/// Gets the details of a mapping rule.
8135///
8136/// A builder for the *locations.conversionWorkspaces.mappingRules.get* method supported by a *project* resource.
8137/// It is not used directly, but through a [`ProjectMethods`] instance.
8138///
8139/// # Example
8140///
8141/// Instantiate a resource method builder
8142///
8143/// ```test_harness,no_run
8144/// # extern crate hyper;
8145/// # extern crate hyper_rustls;
8146/// # extern crate google_datamigration1 as datamigration1;
8147/// # async fn dox() {
8148/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8149///
8150/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8151/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8152/// #     secret,
8153/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8154/// # ).build().await.unwrap();
8155///
8156/// # let client = hyper_util::client::legacy::Client::builder(
8157/// #     hyper_util::rt::TokioExecutor::new()
8158/// # )
8159/// # .build(
8160/// #     hyper_rustls::HttpsConnectorBuilder::new()
8161/// #         .with_native_roots()
8162/// #         .unwrap()
8163/// #         .https_or_http()
8164/// #         .enable_http1()
8165/// #         .build()
8166/// # );
8167/// # let mut hub = DatabaseMigrationService::new(client, auth);
8168/// // You can configure optional parameters by calling the respective setters at will, and
8169/// // execute the final call using `doit()`.
8170/// // Values shown here are possibly random and not representative !
8171/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_get("name")
8172///              .doit().await;
8173/// # }
8174/// ```
8175pub struct ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
8176where
8177    C: 'a,
8178{
8179    hub: &'a DatabaseMigrationService<C>,
8180    _name: String,
8181    _delegate: Option<&'a mut dyn common::Delegate>,
8182    _additional_params: HashMap<String, String>,
8183    _scopes: BTreeSet<String>,
8184}
8185
8186impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {}
8187
8188impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
8189where
8190    C: common::Connector,
8191{
8192    /// Perform the operation you have build so far.
8193    pub async fn doit(mut self) -> common::Result<(common::Response, MappingRule)> {
8194        use std::borrow::Cow;
8195        use std::io::{Read, Seek};
8196
8197        use common::{url::Params, ToParts};
8198        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8199
8200        let mut dd = common::DefaultDelegate;
8201        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8202        dlg.begin(common::MethodInfo {
8203            id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.get",
8204            http_method: hyper::Method::GET,
8205        });
8206
8207        for &field in ["alt", "name"].iter() {
8208            if self._additional_params.contains_key(field) {
8209                dlg.finished(false);
8210                return Err(common::Error::FieldClash(field));
8211            }
8212        }
8213
8214        let mut params = Params::with_capacity(3 + self._additional_params.len());
8215        params.push("name", self._name);
8216
8217        params.extend(self._additional_params.iter());
8218
8219        params.push("alt", "json");
8220        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8221        if self._scopes.is_empty() {
8222            self._scopes
8223                .insert(Scope::CloudPlatform.as_ref().to_string());
8224        }
8225
8226        #[allow(clippy::single_element_loop)]
8227        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8228            url = params.uri_replacement(url, param_name, find_this, true);
8229        }
8230        {
8231            let to_remove = ["name"];
8232            params.remove_params(&to_remove);
8233        }
8234
8235        let url = params.parse_with_url(&url);
8236
8237        loop {
8238            let token = match self
8239                .hub
8240                .auth
8241                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8242                .await
8243            {
8244                Ok(token) => token,
8245                Err(e) => match dlg.token(e) {
8246                    Ok(token) => token,
8247                    Err(e) => {
8248                        dlg.finished(false);
8249                        return Err(common::Error::MissingToken(e));
8250                    }
8251                },
8252            };
8253            let mut req_result = {
8254                let client = &self.hub.client;
8255                dlg.pre_request();
8256                let mut req_builder = hyper::Request::builder()
8257                    .method(hyper::Method::GET)
8258                    .uri(url.as_str())
8259                    .header(USER_AGENT, self.hub._user_agent.clone());
8260
8261                if let Some(token) = token.as_ref() {
8262                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8263                }
8264
8265                let request = req_builder
8266                    .header(CONTENT_LENGTH, 0_u64)
8267                    .body(common::to_body::<String>(None));
8268
8269                client.request(request.unwrap()).await
8270            };
8271
8272            match req_result {
8273                Err(err) => {
8274                    if let common::Retry::After(d) = dlg.http_error(&err) {
8275                        sleep(d).await;
8276                        continue;
8277                    }
8278                    dlg.finished(false);
8279                    return Err(common::Error::HttpError(err));
8280                }
8281                Ok(res) => {
8282                    let (mut parts, body) = res.into_parts();
8283                    let mut body = common::Body::new(body);
8284                    if !parts.status.is_success() {
8285                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8286                        let error = serde_json::from_str(&common::to_string(&bytes));
8287                        let response = common::to_response(parts, bytes.into());
8288
8289                        if let common::Retry::After(d) =
8290                            dlg.http_failure(&response, error.as_ref().ok())
8291                        {
8292                            sleep(d).await;
8293                            continue;
8294                        }
8295
8296                        dlg.finished(false);
8297
8298                        return Err(match error {
8299                            Ok(value) => common::Error::BadRequest(value),
8300                            _ => common::Error::Failure(response),
8301                        });
8302                    }
8303                    let response = {
8304                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8305                        let encoded = common::to_string(&bytes);
8306                        match serde_json::from_str(&encoded) {
8307                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8308                            Err(error) => {
8309                                dlg.response_json_decode_error(&encoded, &error);
8310                                return Err(common::Error::JsonDecodeError(
8311                                    encoded.to_string(),
8312                                    error,
8313                                ));
8314                            }
8315                        }
8316                    };
8317
8318                    dlg.finished(true);
8319                    return Ok(response);
8320                }
8321            }
8322        }
8323    }
8324
8325    /// Required. Name of the mapping rule resource to get. Example: conversionWorkspaces/123/mappingRules/rule123 In order to retrieve a previous revision of the mapping rule, also provide the revision ID. Example: conversionWorkspace/123/mappingRules/rule123@c7cfa2a8c7cfa2a8c7cfa2a8c7cfa2a8
8326    ///
8327    /// Sets the *name* path property to the given value.
8328    ///
8329    /// Even though the property as already been set when instantiating this call,
8330    /// we provide this method for API completeness.
8331    pub fn name(
8332        mut self,
8333        new_value: &str,
8334    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
8335        self._name = new_value.to_string();
8336        self
8337    }
8338    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8339    /// while executing the actual API request.
8340    ///
8341    /// ````text
8342    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8343    /// ````
8344    ///
8345    /// Sets the *delegate* property to the given value.
8346    pub fn delegate(
8347        mut self,
8348        new_value: &'a mut dyn common::Delegate,
8349    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
8350        self._delegate = Some(new_value);
8351        self
8352    }
8353
8354    /// Set any additional parameter of the query string used in the request.
8355    /// It should be used to set parameters which are not yet available through their own
8356    /// setters.
8357    ///
8358    /// Please note that this method must not be used to set any of the known parameters
8359    /// which have their own setter method. If done anyway, the request will fail.
8360    ///
8361    /// # Additional Parameters
8362    ///
8363    /// * *$.xgafv* (query-string) - V1 error format.
8364    /// * *access_token* (query-string) - OAuth access token.
8365    /// * *alt* (query-string) - Data format for response.
8366    /// * *callback* (query-string) - JSONP
8367    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8368    /// * *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.
8369    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8370    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8371    /// * *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.
8372    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8373    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8374    pub fn param<T>(
8375        mut self,
8376        name: T,
8377        value: T,
8378    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
8379    where
8380        T: AsRef<str>,
8381    {
8382        self._additional_params
8383            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8384        self
8385    }
8386
8387    /// Identifies the authorization scope for the method you are building.
8388    ///
8389    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8390    /// [`Scope::CloudPlatform`].
8391    ///
8392    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8393    /// tokens for more than one scope.
8394    ///
8395    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8396    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8397    /// sufficient, a read-write scope will do as well.
8398    pub fn add_scope<St>(
8399        mut self,
8400        scope: St,
8401    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
8402    where
8403        St: AsRef<str>,
8404    {
8405        self._scopes.insert(String::from(scope.as_ref()));
8406        self
8407    }
8408    /// Identifies the authorization scope(s) for the method you are building.
8409    ///
8410    /// See [`Self::add_scope()`] for details.
8411    pub fn add_scopes<I, St>(
8412        mut self,
8413        scopes: I,
8414    ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
8415    where
8416        I: IntoIterator<Item = St>,
8417        St: AsRef<str>,
8418    {
8419        self._scopes
8420            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8421        self
8422    }
8423
8424    /// Removes all scopes, and no default scope will be used either.
8425    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8426    /// for details).
8427    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
8428        self._scopes.clear();
8429        self
8430    }
8431}
8432
8433/// Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files.
8434///
8435/// A builder for the *locations.conversionWorkspaces.mappingRules.import* method supported by a *project* resource.
8436/// It is not used directly, but through a [`ProjectMethods`] instance.
8437///
8438/// # Example
8439///
8440/// Instantiate a resource method builder
8441///
8442/// ```test_harness,no_run
8443/// # extern crate hyper;
8444/// # extern crate hyper_rustls;
8445/// # extern crate google_datamigration1 as datamigration1;
8446/// use datamigration1::api::ImportMappingRulesRequest;
8447/// # async fn dox() {
8448/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8449///
8450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8452/// #     secret,
8453/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8454/// # ).build().await.unwrap();
8455///
8456/// # let client = hyper_util::client::legacy::Client::builder(
8457/// #     hyper_util::rt::TokioExecutor::new()
8458/// # )
8459/// # .build(
8460/// #     hyper_rustls::HttpsConnectorBuilder::new()
8461/// #         .with_native_roots()
8462/// #         .unwrap()
8463/// #         .https_or_http()
8464/// #         .enable_http1()
8465/// #         .build()
8466/// # );
8467/// # let mut hub = DatabaseMigrationService::new(client, auth);
8468/// // As the method needs a request, you would usually fill it with the desired information
8469/// // into the respective structure. Some of the parts shown here might not be applicable !
8470/// // Values shown here are possibly random and not representative !
8471/// let mut req = ImportMappingRulesRequest::default();
8472///
8473/// // You can configure optional parameters by calling the respective setters at will, and
8474/// // execute the final call using `doit()`.
8475/// // Values shown here are possibly random and not representative !
8476/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_import(req, "parent")
8477///              .doit().await;
8478/// # }
8479/// ```
8480pub struct ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
8481where
8482    C: 'a,
8483{
8484    hub: &'a DatabaseMigrationService<C>,
8485    _request: ImportMappingRulesRequest,
8486    _parent: String,
8487    _delegate: Option<&'a mut dyn common::Delegate>,
8488    _additional_params: HashMap<String, String>,
8489    _scopes: BTreeSet<String>,
8490}
8491
8492impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {}
8493
8494impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
8495where
8496    C: common::Connector,
8497{
8498    /// Perform the operation you have build so far.
8499    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8500        use std::borrow::Cow;
8501        use std::io::{Read, Seek};
8502
8503        use common::{url::Params, ToParts};
8504        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8505
8506        let mut dd = common::DefaultDelegate;
8507        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8508        dlg.begin(common::MethodInfo {
8509            id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.import",
8510            http_method: hyper::Method::POST,
8511        });
8512
8513        for &field in ["alt", "parent"].iter() {
8514            if self._additional_params.contains_key(field) {
8515                dlg.finished(false);
8516                return Err(common::Error::FieldClash(field));
8517            }
8518        }
8519
8520        let mut params = Params::with_capacity(4 + self._additional_params.len());
8521        params.push("parent", self._parent);
8522
8523        params.extend(self._additional_params.iter());
8524
8525        params.push("alt", "json");
8526        let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules:import";
8527        if self._scopes.is_empty() {
8528            self._scopes
8529                .insert(Scope::CloudPlatform.as_ref().to_string());
8530        }
8531
8532        #[allow(clippy::single_element_loop)]
8533        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8534            url = params.uri_replacement(url, param_name, find_this, true);
8535        }
8536        {
8537            let to_remove = ["parent"];
8538            params.remove_params(&to_remove);
8539        }
8540
8541        let url = params.parse_with_url(&url);
8542
8543        let mut json_mime_type = mime::APPLICATION_JSON;
8544        let mut request_value_reader = {
8545            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8546            common::remove_json_null_values(&mut value);
8547            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8548            serde_json::to_writer(&mut dst, &value).unwrap();
8549            dst
8550        };
8551        let request_size = request_value_reader
8552            .seek(std::io::SeekFrom::End(0))
8553            .unwrap();
8554        request_value_reader
8555            .seek(std::io::SeekFrom::Start(0))
8556            .unwrap();
8557
8558        loop {
8559            let token = match self
8560                .hub
8561                .auth
8562                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8563                .await
8564            {
8565                Ok(token) => token,
8566                Err(e) => match dlg.token(e) {
8567                    Ok(token) => token,
8568                    Err(e) => {
8569                        dlg.finished(false);
8570                        return Err(common::Error::MissingToken(e));
8571                    }
8572                },
8573            };
8574            request_value_reader
8575                .seek(std::io::SeekFrom::Start(0))
8576                .unwrap();
8577            let mut req_result = {
8578                let client = &self.hub.client;
8579                dlg.pre_request();
8580                let mut req_builder = hyper::Request::builder()
8581                    .method(hyper::Method::POST)
8582                    .uri(url.as_str())
8583                    .header(USER_AGENT, self.hub._user_agent.clone());
8584
8585                if let Some(token) = token.as_ref() {
8586                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8587                }
8588
8589                let request = req_builder
8590                    .header(CONTENT_TYPE, json_mime_type.to_string())
8591                    .header(CONTENT_LENGTH, request_size as u64)
8592                    .body(common::to_body(
8593                        request_value_reader.get_ref().clone().into(),
8594                    ));
8595
8596                client.request(request.unwrap()).await
8597            };
8598
8599            match req_result {
8600                Err(err) => {
8601                    if let common::Retry::After(d) = dlg.http_error(&err) {
8602                        sleep(d).await;
8603                        continue;
8604                    }
8605                    dlg.finished(false);
8606                    return Err(common::Error::HttpError(err));
8607                }
8608                Ok(res) => {
8609                    let (mut parts, body) = res.into_parts();
8610                    let mut body = common::Body::new(body);
8611                    if !parts.status.is_success() {
8612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8613                        let error = serde_json::from_str(&common::to_string(&bytes));
8614                        let response = common::to_response(parts, bytes.into());
8615
8616                        if let common::Retry::After(d) =
8617                            dlg.http_failure(&response, error.as_ref().ok())
8618                        {
8619                            sleep(d).await;
8620                            continue;
8621                        }
8622
8623                        dlg.finished(false);
8624
8625                        return Err(match error {
8626                            Ok(value) => common::Error::BadRequest(value),
8627                            _ => common::Error::Failure(response),
8628                        });
8629                    }
8630                    let response = {
8631                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8632                        let encoded = common::to_string(&bytes);
8633                        match serde_json::from_str(&encoded) {
8634                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8635                            Err(error) => {
8636                                dlg.response_json_decode_error(&encoded, &error);
8637                                return Err(common::Error::JsonDecodeError(
8638                                    encoded.to_string(),
8639                                    error,
8640                                ));
8641                            }
8642                        }
8643                    };
8644
8645                    dlg.finished(true);
8646                    return Ok(response);
8647                }
8648            }
8649        }
8650    }
8651
8652    ///
8653    /// Sets the *request* property to the given value.
8654    ///
8655    /// Even though the property as already been set when instantiating this call,
8656    /// we provide this method for API completeness.
8657    pub fn request(
8658        mut self,
8659        new_value: ImportMappingRulesRequest,
8660    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
8661        self._request = new_value;
8662        self
8663    }
8664    /// Required. Name of the conversion workspace resource to import the rules to in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
8665    ///
8666    /// Sets the *parent* path property to the given value.
8667    ///
8668    /// Even though the property as already been set when instantiating this call,
8669    /// we provide this method for API completeness.
8670    pub fn parent(
8671        mut self,
8672        new_value: &str,
8673    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
8674        self._parent = new_value.to_string();
8675        self
8676    }
8677    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8678    /// while executing the actual API request.
8679    ///
8680    /// ````text
8681    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8682    /// ````
8683    ///
8684    /// Sets the *delegate* property to the given value.
8685    pub fn delegate(
8686        mut self,
8687        new_value: &'a mut dyn common::Delegate,
8688    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
8689        self._delegate = Some(new_value);
8690        self
8691    }
8692
8693    /// Set any additional parameter of the query string used in the request.
8694    /// It should be used to set parameters which are not yet available through their own
8695    /// setters.
8696    ///
8697    /// Please note that this method must not be used to set any of the known parameters
8698    /// which have their own setter method. If done anyway, the request will fail.
8699    ///
8700    /// # Additional Parameters
8701    ///
8702    /// * *$.xgafv* (query-string) - V1 error format.
8703    /// * *access_token* (query-string) - OAuth access token.
8704    /// * *alt* (query-string) - Data format for response.
8705    /// * *callback* (query-string) - JSONP
8706    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8707    /// * *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.
8708    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8709    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8710    /// * *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.
8711    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8712    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8713    pub fn param<T>(
8714        mut self,
8715        name: T,
8716        value: T,
8717    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
8718    where
8719        T: AsRef<str>,
8720    {
8721        self._additional_params
8722            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8723        self
8724    }
8725
8726    /// Identifies the authorization scope for the method you are building.
8727    ///
8728    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8729    /// [`Scope::CloudPlatform`].
8730    ///
8731    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8732    /// tokens for more than one scope.
8733    ///
8734    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8735    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8736    /// sufficient, a read-write scope will do as well.
8737    pub fn add_scope<St>(
8738        mut self,
8739        scope: St,
8740    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
8741    where
8742        St: AsRef<str>,
8743    {
8744        self._scopes.insert(String::from(scope.as_ref()));
8745        self
8746    }
8747    /// Identifies the authorization scope(s) for the method you are building.
8748    ///
8749    /// See [`Self::add_scope()`] for details.
8750    pub fn add_scopes<I, St>(
8751        mut self,
8752        scopes: I,
8753    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
8754    where
8755        I: IntoIterator<Item = St>,
8756        St: AsRef<str>,
8757    {
8758        self._scopes
8759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8760        self
8761    }
8762
8763    /// Removes all scopes, and no default scope will be used either.
8764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8765    /// for details).
8766    pub fn clear_scopes(
8767        mut self,
8768    ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
8769        self._scopes.clear();
8770        self
8771    }
8772}
8773
8774/// Lists the mapping rules for a specific conversion workspace.
8775///
8776/// A builder for the *locations.conversionWorkspaces.mappingRules.list* method supported by a *project* resource.
8777/// It is not used directly, but through a [`ProjectMethods`] instance.
8778///
8779/// # Example
8780///
8781/// Instantiate a resource method builder
8782///
8783/// ```test_harness,no_run
8784/// # extern crate hyper;
8785/// # extern crate hyper_rustls;
8786/// # extern crate google_datamigration1 as datamigration1;
8787/// # async fn dox() {
8788/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8789///
8790/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8791/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8792/// #     secret,
8793/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8794/// # ).build().await.unwrap();
8795///
8796/// # let client = hyper_util::client::legacy::Client::builder(
8797/// #     hyper_util::rt::TokioExecutor::new()
8798/// # )
8799/// # .build(
8800/// #     hyper_rustls::HttpsConnectorBuilder::new()
8801/// #         .with_native_roots()
8802/// #         .unwrap()
8803/// #         .https_or_http()
8804/// #         .enable_http1()
8805/// #         .build()
8806/// # );
8807/// # let mut hub = DatabaseMigrationService::new(client, auth);
8808/// // You can configure optional parameters by calling the respective setters at will, and
8809/// // execute the final call using `doit()`.
8810/// // Values shown here are possibly random and not representative !
8811/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_list("parent")
8812///              .page_token("et")
8813///              .page_size(-22)
8814///              .doit().await;
8815/// # }
8816/// ```
8817pub struct ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
8818where
8819    C: 'a,
8820{
8821    hub: &'a DatabaseMigrationService<C>,
8822    _parent: String,
8823    _page_token: Option<String>,
8824    _page_size: Option<i32>,
8825    _delegate: Option<&'a mut dyn common::Delegate>,
8826    _additional_params: HashMap<String, String>,
8827    _scopes: BTreeSet<String>,
8828}
8829
8830impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {}
8831
8832impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
8833where
8834    C: common::Connector,
8835{
8836    /// Perform the operation you have build so far.
8837    pub async fn doit(mut self) -> common::Result<(common::Response, ListMappingRulesResponse)> {
8838        use std::borrow::Cow;
8839        use std::io::{Read, Seek};
8840
8841        use common::{url::Params, ToParts};
8842        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8843
8844        let mut dd = common::DefaultDelegate;
8845        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8846        dlg.begin(common::MethodInfo {
8847            id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.list",
8848            http_method: hyper::Method::GET,
8849        });
8850
8851        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8852            if self._additional_params.contains_key(field) {
8853                dlg.finished(false);
8854                return Err(common::Error::FieldClash(field));
8855            }
8856        }
8857
8858        let mut params = Params::with_capacity(5 + self._additional_params.len());
8859        params.push("parent", self._parent);
8860        if let Some(value) = self._page_token.as_ref() {
8861            params.push("pageToken", value);
8862        }
8863        if let Some(value) = self._page_size.as_ref() {
8864            params.push("pageSize", value.to_string());
8865        }
8866
8867        params.extend(self._additional_params.iter());
8868
8869        params.push("alt", "json");
8870        let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules";
8871        if self._scopes.is_empty() {
8872            self._scopes
8873                .insert(Scope::CloudPlatform.as_ref().to_string());
8874        }
8875
8876        #[allow(clippy::single_element_loop)]
8877        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8878            url = params.uri_replacement(url, param_name, find_this, true);
8879        }
8880        {
8881            let to_remove = ["parent"];
8882            params.remove_params(&to_remove);
8883        }
8884
8885        let url = params.parse_with_url(&url);
8886
8887        loop {
8888            let token = match self
8889                .hub
8890                .auth
8891                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8892                .await
8893            {
8894                Ok(token) => token,
8895                Err(e) => match dlg.token(e) {
8896                    Ok(token) => token,
8897                    Err(e) => {
8898                        dlg.finished(false);
8899                        return Err(common::Error::MissingToken(e));
8900                    }
8901                },
8902            };
8903            let mut req_result = {
8904                let client = &self.hub.client;
8905                dlg.pre_request();
8906                let mut req_builder = hyper::Request::builder()
8907                    .method(hyper::Method::GET)
8908                    .uri(url.as_str())
8909                    .header(USER_AGENT, self.hub._user_agent.clone());
8910
8911                if let Some(token) = token.as_ref() {
8912                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8913                }
8914
8915                let request = req_builder
8916                    .header(CONTENT_LENGTH, 0_u64)
8917                    .body(common::to_body::<String>(None));
8918
8919                client.request(request.unwrap()).await
8920            };
8921
8922            match req_result {
8923                Err(err) => {
8924                    if let common::Retry::After(d) = dlg.http_error(&err) {
8925                        sleep(d).await;
8926                        continue;
8927                    }
8928                    dlg.finished(false);
8929                    return Err(common::Error::HttpError(err));
8930                }
8931                Ok(res) => {
8932                    let (mut parts, body) = res.into_parts();
8933                    let mut body = common::Body::new(body);
8934                    if !parts.status.is_success() {
8935                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8936                        let error = serde_json::from_str(&common::to_string(&bytes));
8937                        let response = common::to_response(parts, bytes.into());
8938
8939                        if let common::Retry::After(d) =
8940                            dlg.http_failure(&response, error.as_ref().ok())
8941                        {
8942                            sleep(d).await;
8943                            continue;
8944                        }
8945
8946                        dlg.finished(false);
8947
8948                        return Err(match error {
8949                            Ok(value) => common::Error::BadRequest(value),
8950                            _ => common::Error::Failure(response),
8951                        });
8952                    }
8953                    let response = {
8954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8955                        let encoded = common::to_string(&bytes);
8956                        match serde_json::from_str(&encoded) {
8957                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8958                            Err(error) => {
8959                                dlg.response_json_decode_error(&encoded, &error);
8960                                return Err(common::Error::JsonDecodeError(
8961                                    encoded.to_string(),
8962                                    error,
8963                                ));
8964                            }
8965                        }
8966                    };
8967
8968                    dlg.finished(true);
8969                    return Ok(response);
8970                }
8971            }
8972        }
8973    }
8974
8975    /// Required. Name of the conversion workspace resource whose mapping rules are listed in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
8976    ///
8977    /// Sets the *parent* path property to the given value.
8978    ///
8979    /// Even though the property as already been set when instantiating this call,
8980    /// we provide this method for API completeness.
8981    pub fn parent(
8982        mut self,
8983        new_value: &str,
8984    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
8985        self._parent = new_value.to_string();
8986        self
8987    }
8988    /// The nextPageToken value received in the previous call to mappingRules.list, used in the subsequent request to retrieve the next page of results. On first call this should be left blank. When paginating, all other parameters provided to mappingRules.list must match the call that provided the page token.
8989    ///
8990    /// Sets the *page token* query property to the given value.
8991    pub fn page_token(
8992        mut self,
8993        new_value: &str,
8994    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
8995        self._page_token = Some(new_value.to_string());
8996        self
8997    }
8998    /// The maximum number of rules to return. The service may return fewer than this value.
8999    ///
9000    /// Sets the *page size* query property to the given value.
9001    pub fn page_size(
9002        mut self,
9003        new_value: i32,
9004    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9005        self._page_size = Some(new_value);
9006        self
9007    }
9008    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9009    /// while executing the actual API request.
9010    ///
9011    /// ````text
9012    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9013    /// ````
9014    ///
9015    /// Sets the *delegate* property to the given value.
9016    pub fn delegate(
9017        mut self,
9018        new_value: &'a mut dyn common::Delegate,
9019    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9020        self._delegate = Some(new_value);
9021        self
9022    }
9023
9024    /// Set any additional parameter of the query string used in the request.
9025    /// It should be used to set parameters which are not yet available through their own
9026    /// setters.
9027    ///
9028    /// Please note that this method must not be used to set any of the known parameters
9029    /// which have their own setter method. If done anyway, the request will fail.
9030    ///
9031    /// # Additional Parameters
9032    ///
9033    /// * *$.xgafv* (query-string) - V1 error format.
9034    /// * *access_token* (query-string) - OAuth access token.
9035    /// * *alt* (query-string) - Data format for response.
9036    /// * *callback* (query-string) - JSONP
9037    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9038    /// * *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.
9039    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9040    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9041    /// * *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.
9042    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9043    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9044    pub fn param<T>(
9045        mut self,
9046        name: T,
9047        value: T,
9048    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9049    where
9050        T: AsRef<str>,
9051    {
9052        self._additional_params
9053            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9054        self
9055    }
9056
9057    /// Identifies the authorization scope for the method you are building.
9058    ///
9059    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9060    /// [`Scope::CloudPlatform`].
9061    ///
9062    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9063    /// tokens for more than one scope.
9064    ///
9065    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9066    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9067    /// sufficient, a read-write scope will do as well.
9068    pub fn add_scope<St>(
9069        mut self,
9070        scope: St,
9071    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9072    where
9073        St: AsRef<str>,
9074    {
9075        self._scopes.insert(String::from(scope.as_ref()));
9076        self
9077    }
9078    /// Identifies the authorization scope(s) for the method you are building.
9079    ///
9080    /// See [`Self::add_scope()`] for details.
9081    pub fn add_scopes<I, St>(
9082        mut self,
9083        scopes: I,
9084    ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9085    where
9086        I: IntoIterator<Item = St>,
9087        St: AsRef<str>,
9088    {
9089        self._scopes
9090            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9091        self
9092    }
9093
9094    /// Removes all scopes, and no default scope will be used either.
9095    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9096    /// for details).
9097    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9098        self._scopes.clear();
9099        self
9100    }
9101}
9102
9103/// Applies draft tree onto a specific destination database.
9104///
9105/// A builder for the *locations.conversionWorkspaces.apply* method supported by a *project* resource.
9106/// It is not used directly, but through a [`ProjectMethods`] instance.
9107///
9108/// # Example
9109///
9110/// Instantiate a resource method builder
9111///
9112/// ```test_harness,no_run
9113/// # extern crate hyper;
9114/// # extern crate hyper_rustls;
9115/// # extern crate google_datamigration1 as datamigration1;
9116/// use datamigration1::api::ApplyConversionWorkspaceRequest;
9117/// # async fn dox() {
9118/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9119///
9120/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9121/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9122/// #     secret,
9123/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9124/// # ).build().await.unwrap();
9125///
9126/// # let client = hyper_util::client::legacy::Client::builder(
9127/// #     hyper_util::rt::TokioExecutor::new()
9128/// # )
9129/// # .build(
9130/// #     hyper_rustls::HttpsConnectorBuilder::new()
9131/// #         .with_native_roots()
9132/// #         .unwrap()
9133/// #         .https_or_http()
9134/// #         .enable_http1()
9135/// #         .build()
9136/// # );
9137/// # let mut hub = DatabaseMigrationService::new(client, auth);
9138/// // As the method needs a request, you would usually fill it with the desired information
9139/// // into the respective structure. Some of the parts shown here might not be applicable !
9140/// // Values shown here are possibly random and not representative !
9141/// let mut req = ApplyConversionWorkspaceRequest::default();
9142///
9143/// // You can configure optional parameters by calling the respective setters at will, and
9144/// // execute the final call using `doit()`.
9145/// // Values shown here are possibly random and not representative !
9146/// let result = hub.projects().locations_conversion_workspaces_apply(req, "name")
9147///              .doit().await;
9148/// # }
9149/// ```
9150pub struct ProjectLocationConversionWorkspaceApplyCall<'a, C>
9151where
9152    C: 'a,
9153{
9154    hub: &'a DatabaseMigrationService<C>,
9155    _request: ApplyConversionWorkspaceRequest,
9156    _name: String,
9157    _delegate: Option<&'a mut dyn common::Delegate>,
9158    _additional_params: HashMap<String, String>,
9159    _scopes: BTreeSet<String>,
9160}
9161
9162impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceApplyCall<'a, C> {}
9163
9164impl<'a, C> ProjectLocationConversionWorkspaceApplyCall<'a, C>
9165where
9166    C: common::Connector,
9167{
9168    /// Perform the operation you have build so far.
9169    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9170        use std::borrow::Cow;
9171        use std::io::{Read, Seek};
9172
9173        use common::{url::Params, ToParts};
9174        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9175
9176        let mut dd = common::DefaultDelegate;
9177        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9178        dlg.begin(common::MethodInfo {
9179            id: "datamigration.projects.locations.conversionWorkspaces.apply",
9180            http_method: hyper::Method::POST,
9181        });
9182
9183        for &field in ["alt", "name"].iter() {
9184            if self._additional_params.contains_key(field) {
9185                dlg.finished(false);
9186                return Err(common::Error::FieldClash(field));
9187            }
9188        }
9189
9190        let mut params = Params::with_capacity(4 + self._additional_params.len());
9191        params.push("name", self._name);
9192
9193        params.extend(self._additional_params.iter());
9194
9195        params.push("alt", "json");
9196        let mut url = self.hub._base_url.clone() + "v1/{+name}:apply";
9197        if self._scopes.is_empty() {
9198            self._scopes
9199                .insert(Scope::CloudPlatform.as_ref().to_string());
9200        }
9201
9202        #[allow(clippy::single_element_loop)]
9203        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9204            url = params.uri_replacement(url, param_name, find_this, true);
9205        }
9206        {
9207            let to_remove = ["name"];
9208            params.remove_params(&to_remove);
9209        }
9210
9211        let url = params.parse_with_url(&url);
9212
9213        let mut json_mime_type = mime::APPLICATION_JSON;
9214        let mut request_value_reader = {
9215            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9216            common::remove_json_null_values(&mut value);
9217            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9218            serde_json::to_writer(&mut dst, &value).unwrap();
9219            dst
9220        };
9221        let request_size = request_value_reader
9222            .seek(std::io::SeekFrom::End(0))
9223            .unwrap();
9224        request_value_reader
9225            .seek(std::io::SeekFrom::Start(0))
9226            .unwrap();
9227
9228        loop {
9229            let token = match self
9230                .hub
9231                .auth
9232                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9233                .await
9234            {
9235                Ok(token) => token,
9236                Err(e) => match dlg.token(e) {
9237                    Ok(token) => token,
9238                    Err(e) => {
9239                        dlg.finished(false);
9240                        return Err(common::Error::MissingToken(e));
9241                    }
9242                },
9243            };
9244            request_value_reader
9245                .seek(std::io::SeekFrom::Start(0))
9246                .unwrap();
9247            let mut req_result = {
9248                let client = &self.hub.client;
9249                dlg.pre_request();
9250                let mut req_builder = hyper::Request::builder()
9251                    .method(hyper::Method::POST)
9252                    .uri(url.as_str())
9253                    .header(USER_AGENT, self.hub._user_agent.clone());
9254
9255                if let Some(token) = token.as_ref() {
9256                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9257                }
9258
9259                let request = req_builder
9260                    .header(CONTENT_TYPE, json_mime_type.to_string())
9261                    .header(CONTENT_LENGTH, request_size as u64)
9262                    .body(common::to_body(
9263                        request_value_reader.get_ref().clone().into(),
9264                    ));
9265
9266                client.request(request.unwrap()).await
9267            };
9268
9269            match req_result {
9270                Err(err) => {
9271                    if let common::Retry::After(d) = dlg.http_error(&err) {
9272                        sleep(d).await;
9273                        continue;
9274                    }
9275                    dlg.finished(false);
9276                    return Err(common::Error::HttpError(err));
9277                }
9278                Ok(res) => {
9279                    let (mut parts, body) = res.into_parts();
9280                    let mut body = common::Body::new(body);
9281                    if !parts.status.is_success() {
9282                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9283                        let error = serde_json::from_str(&common::to_string(&bytes));
9284                        let response = common::to_response(parts, bytes.into());
9285
9286                        if let common::Retry::After(d) =
9287                            dlg.http_failure(&response, error.as_ref().ok())
9288                        {
9289                            sleep(d).await;
9290                            continue;
9291                        }
9292
9293                        dlg.finished(false);
9294
9295                        return Err(match error {
9296                            Ok(value) => common::Error::BadRequest(value),
9297                            _ => common::Error::Failure(response),
9298                        });
9299                    }
9300                    let response = {
9301                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9302                        let encoded = common::to_string(&bytes);
9303                        match serde_json::from_str(&encoded) {
9304                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9305                            Err(error) => {
9306                                dlg.response_json_decode_error(&encoded, &error);
9307                                return Err(common::Error::JsonDecodeError(
9308                                    encoded.to_string(),
9309                                    error,
9310                                ));
9311                            }
9312                        }
9313                    };
9314
9315                    dlg.finished(true);
9316                    return Ok(response);
9317                }
9318            }
9319        }
9320    }
9321
9322    ///
9323    /// Sets the *request* property to the given value.
9324    ///
9325    /// Even though the property as already been set when instantiating this call,
9326    /// we provide this method for API completeness.
9327    pub fn request(
9328        mut self,
9329        new_value: ApplyConversionWorkspaceRequest,
9330    ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
9331        self._request = new_value;
9332        self
9333    }
9334    /// Required. The name of the conversion workspace resource for which to apply the draft tree. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
9335    ///
9336    /// Sets the *name* path property to the given value.
9337    ///
9338    /// Even though the property as already been set when instantiating this call,
9339    /// we provide this method for API completeness.
9340    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
9341        self._name = new_value.to_string();
9342        self
9343    }
9344    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9345    /// while executing the actual API request.
9346    ///
9347    /// ````text
9348    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9349    /// ````
9350    ///
9351    /// Sets the *delegate* property to the given value.
9352    pub fn delegate(
9353        mut self,
9354        new_value: &'a mut dyn common::Delegate,
9355    ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
9356        self._delegate = Some(new_value);
9357        self
9358    }
9359
9360    /// Set any additional parameter of the query string used in the request.
9361    /// It should be used to set parameters which are not yet available through their own
9362    /// setters.
9363    ///
9364    /// Please note that this method must not be used to set any of the known parameters
9365    /// which have their own setter method. If done anyway, the request will fail.
9366    ///
9367    /// # Additional Parameters
9368    ///
9369    /// * *$.xgafv* (query-string) - V1 error format.
9370    /// * *access_token* (query-string) - OAuth access token.
9371    /// * *alt* (query-string) - Data format for response.
9372    /// * *callback* (query-string) - JSONP
9373    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9374    /// * *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.
9375    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9376    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9377    /// * *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.
9378    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9379    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9380    pub fn param<T>(
9381        mut self,
9382        name: T,
9383        value: T,
9384    ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
9385    where
9386        T: AsRef<str>,
9387    {
9388        self._additional_params
9389            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9390        self
9391    }
9392
9393    /// Identifies the authorization scope for the method you are building.
9394    ///
9395    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9396    /// [`Scope::CloudPlatform`].
9397    ///
9398    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9399    /// tokens for more than one scope.
9400    ///
9401    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9402    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9403    /// sufficient, a read-write scope will do as well.
9404    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
9405    where
9406        St: AsRef<str>,
9407    {
9408        self._scopes.insert(String::from(scope.as_ref()));
9409        self
9410    }
9411    /// Identifies the authorization scope(s) for the method you are building.
9412    ///
9413    /// See [`Self::add_scope()`] for details.
9414    pub fn add_scopes<I, St>(
9415        mut self,
9416        scopes: I,
9417    ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
9418    where
9419        I: IntoIterator<Item = St>,
9420        St: AsRef<str>,
9421    {
9422        self._scopes
9423            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9424        self
9425    }
9426
9427    /// Removes all scopes, and no default scope will be used either.
9428    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9429    /// for details).
9430    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
9431        self._scopes.clear();
9432        self
9433    }
9434}
9435
9436/// Marks all the data in the conversion workspace as committed.
9437///
9438/// A builder for the *locations.conversionWorkspaces.commit* method supported by a *project* resource.
9439/// It is not used directly, but through a [`ProjectMethods`] instance.
9440///
9441/// # Example
9442///
9443/// Instantiate a resource method builder
9444///
9445/// ```test_harness,no_run
9446/// # extern crate hyper;
9447/// # extern crate hyper_rustls;
9448/// # extern crate google_datamigration1 as datamigration1;
9449/// use datamigration1::api::CommitConversionWorkspaceRequest;
9450/// # async fn dox() {
9451/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9452///
9453/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9454/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9455/// #     secret,
9456/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9457/// # ).build().await.unwrap();
9458///
9459/// # let client = hyper_util::client::legacy::Client::builder(
9460/// #     hyper_util::rt::TokioExecutor::new()
9461/// # )
9462/// # .build(
9463/// #     hyper_rustls::HttpsConnectorBuilder::new()
9464/// #         .with_native_roots()
9465/// #         .unwrap()
9466/// #         .https_or_http()
9467/// #         .enable_http1()
9468/// #         .build()
9469/// # );
9470/// # let mut hub = DatabaseMigrationService::new(client, auth);
9471/// // As the method needs a request, you would usually fill it with the desired information
9472/// // into the respective structure. Some of the parts shown here might not be applicable !
9473/// // Values shown here are possibly random and not representative !
9474/// let mut req = CommitConversionWorkspaceRequest::default();
9475///
9476/// // You can configure optional parameters by calling the respective setters at will, and
9477/// // execute the final call using `doit()`.
9478/// // Values shown here are possibly random and not representative !
9479/// let result = hub.projects().locations_conversion_workspaces_commit(req, "name")
9480///              .doit().await;
9481/// # }
9482/// ```
9483pub struct ProjectLocationConversionWorkspaceCommitCall<'a, C>
9484where
9485    C: 'a,
9486{
9487    hub: &'a DatabaseMigrationService<C>,
9488    _request: CommitConversionWorkspaceRequest,
9489    _name: String,
9490    _delegate: Option<&'a mut dyn common::Delegate>,
9491    _additional_params: HashMap<String, String>,
9492    _scopes: BTreeSet<String>,
9493}
9494
9495impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceCommitCall<'a, C> {}
9496
9497impl<'a, C> ProjectLocationConversionWorkspaceCommitCall<'a, C>
9498where
9499    C: common::Connector,
9500{
9501    /// Perform the operation you have build so far.
9502    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9503        use std::borrow::Cow;
9504        use std::io::{Read, Seek};
9505
9506        use common::{url::Params, ToParts};
9507        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9508
9509        let mut dd = common::DefaultDelegate;
9510        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9511        dlg.begin(common::MethodInfo {
9512            id: "datamigration.projects.locations.conversionWorkspaces.commit",
9513            http_method: hyper::Method::POST,
9514        });
9515
9516        for &field in ["alt", "name"].iter() {
9517            if self._additional_params.contains_key(field) {
9518                dlg.finished(false);
9519                return Err(common::Error::FieldClash(field));
9520            }
9521        }
9522
9523        let mut params = Params::with_capacity(4 + self._additional_params.len());
9524        params.push("name", self._name);
9525
9526        params.extend(self._additional_params.iter());
9527
9528        params.push("alt", "json");
9529        let mut url = self.hub._base_url.clone() + "v1/{+name}:commit";
9530        if self._scopes.is_empty() {
9531            self._scopes
9532                .insert(Scope::CloudPlatform.as_ref().to_string());
9533        }
9534
9535        #[allow(clippy::single_element_loop)]
9536        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9537            url = params.uri_replacement(url, param_name, find_this, true);
9538        }
9539        {
9540            let to_remove = ["name"];
9541            params.remove_params(&to_remove);
9542        }
9543
9544        let url = params.parse_with_url(&url);
9545
9546        let mut json_mime_type = mime::APPLICATION_JSON;
9547        let mut request_value_reader = {
9548            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9549            common::remove_json_null_values(&mut value);
9550            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9551            serde_json::to_writer(&mut dst, &value).unwrap();
9552            dst
9553        };
9554        let request_size = request_value_reader
9555            .seek(std::io::SeekFrom::End(0))
9556            .unwrap();
9557        request_value_reader
9558            .seek(std::io::SeekFrom::Start(0))
9559            .unwrap();
9560
9561        loop {
9562            let token = match self
9563                .hub
9564                .auth
9565                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9566                .await
9567            {
9568                Ok(token) => token,
9569                Err(e) => match dlg.token(e) {
9570                    Ok(token) => token,
9571                    Err(e) => {
9572                        dlg.finished(false);
9573                        return Err(common::Error::MissingToken(e));
9574                    }
9575                },
9576            };
9577            request_value_reader
9578                .seek(std::io::SeekFrom::Start(0))
9579                .unwrap();
9580            let mut req_result = {
9581                let client = &self.hub.client;
9582                dlg.pre_request();
9583                let mut req_builder = hyper::Request::builder()
9584                    .method(hyper::Method::POST)
9585                    .uri(url.as_str())
9586                    .header(USER_AGENT, self.hub._user_agent.clone());
9587
9588                if let Some(token) = token.as_ref() {
9589                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9590                }
9591
9592                let request = req_builder
9593                    .header(CONTENT_TYPE, json_mime_type.to_string())
9594                    .header(CONTENT_LENGTH, request_size as u64)
9595                    .body(common::to_body(
9596                        request_value_reader.get_ref().clone().into(),
9597                    ));
9598
9599                client.request(request.unwrap()).await
9600            };
9601
9602            match req_result {
9603                Err(err) => {
9604                    if let common::Retry::After(d) = dlg.http_error(&err) {
9605                        sleep(d).await;
9606                        continue;
9607                    }
9608                    dlg.finished(false);
9609                    return Err(common::Error::HttpError(err));
9610                }
9611                Ok(res) => {
9612                    let (mut parts, body) = res.into_parts();
9613                    let mut body = common::Body::new(body);
9614                    if !parts.status.is_success() {
9615                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9616                        let error = serde_json::from_str(&common::to_string(&bytes));
9617                        let response = common::to_response(parts, bytes.into());
9618
9619                        if let common::Retry::After(d) =
9620                            dlg.http_failure(&response, error.as_ref().ok())
9621                        {
9622                            sleep(d).await;
9623                            continue;
9624                        }
9625
9626                        dlg.finished(false);
9627
9628                        return Err(match error {
9629                            Ok(value) => common::Error::BadRequest(value),
9630                            _ => common::Error::Failure(response),
9631                        });
9632                    }
9633                    let response = {
9634                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9635                        let encoded = common::to_string(&bytes);
9636                        match serde_json::from_str(&encoded) {
9637                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9638                            Err(error) => {
9639                                dlg.response_json_decode_error(&encoded, &error);
9640                                return Err(common::Error::JsonDecodeError(
9641                                    encoded.to_string(),
9642                                    error,
9643                                ));
9644                            }
9645                        }
9646                    };
9647
9648                    dlg.finished(true);
9649                    return Ok(response);
9650                }
9651            }
9652        }
9653    }
9654
9655    ///
9656    /// Sets the *request* property to the given value.
9657    ///
9658    /// Even though the property as already been set when instantiating this call,
9659    /// we provide this method for API completeness.
9660    pub fn request(
9661        mut self,
9662        new_value: CommitConversionWorkspaceRequest,
9663    ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
9664        self._request = new_value;
9665        self
9666    }
9667    /// Required. Name of the conversion workspace resource to commit.
9668    ///
9669    /// Sets the *name* path property to the given value.
9670    ///
9671    /// Even though the property as already been set when instantiating this call,
9672    /// we provide this method for API completeness.
9673    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
9674        self._name = new_value.to_string();
9675        self
9676    }
9677    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9678    /// while executing the actual API request.
9679    ///
9680    /// ````text
9681    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9682    /// ````
9683    ///
9684    /// Sets the *delegate* property to the given value.
9685    pub fn delegate(
9686        mut self,
9687        new_value: &'a mut dyn common::Delegate,
9688    ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
9689        self._delegate = Some(new_value);
9690        self
9691    }
9692
9693    /// Set any additional parameter of the query string used in the request.
9694    /// It should be used to set parameters which are not yet available through their own
9695    /// setters.
9696    ///
9697    /// Please note that this method must not be used to set any of the known parameters
9698    /// which have their own setter method. If done anyway, the request will fail.
9699    ///
9700    /// # Additional Parameters
9701    ///
9702    /// * *$.xgafv* (query-string) - V1 error format.
9703    /// * *access_token* (query-string) - OAuth access token.
9704    /// * *alt* (query-string) - Data format for response.
9705    /// * *callback* (query-string) - JSONP
9706    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9707    /// * *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.
9708    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9709    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9710    /// * *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.
9711    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9712    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9713    pub fn param<T>(
9714        mut self,
9715        name: T,
9716        value: T,
9717    ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
9718    where
9719        T: AsRef<str>,
9720    {
9721        self._additional_params
9722            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9723        self
9724    }
9725
9726    /// Identifies the authorization scope for the method you are building.
9727    ///
9728    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9729    /// [`Scope::CloudPlatform`].
9730    ///
9731    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9732    /// tokens for more than one scope.
9733    ///
9734    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9735    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9736    /// sufficient, a read-write scope will do as well.
9737    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
9738    where
9739        St: AsRef<str>,
9740    {
9741        self._scopes.insert(String::from(scope.as_ref()));
9742        self
9743    }
9744    /// Identifies the authorization scope(s) for the method you are building.
9745    ///
9746    /// See [`Self::add_scope()`] for details.
9747    pub fn add_scopes<I, St>(
9748        mut self,
9749        scopes: I,
9750    ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
9751    where
9752        I: IntoIterator<Item = St>,
9753        St: AsRef<str>,
9754    {
9755        self._scopes
9756            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9757        self
9758    }
9759
9760    /// Removes all scopes, and no default scope will be used either.
9761    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9762    /// for details).
9763    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
9764        self._scopes.clear();
9765        self
9766    }
9767}
9768
9769/// Creates a draft tree schema for the destination database.
9770///
9771/// A builder for the *locations.conversionWorkspaces.convert* method supported by a *project* resource.
9772/// It is not used directly, but through a [`ProjectMethods`] instance.
9773///
9774/// # Example
9775///
9776/// Instantiate a resource method builder
9777///
9778/// ```test_harness,no_run
9779/// # extern crate hyper;
9780/// # extern crate hyper_rustls;
9781/// # extern crate google_datamigration1 as datamigration1;
9782/// use datamigration1::api::ConvertConversionWorkspaceRequest;
9783/// # async fn dox() {
9784/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9785///
9786/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9788/// #     secret,
9789/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9790/// # ).build().await.unwrap();
9791///
9792/// # let client = hyper_util::client::legacy::Client::builder(
9793/// #     hyper_util::rt::TokioExecutor::new()
9794/// # )
9795/// # .build(
9796/// #     hyper_rustls::HttpsConnectorBuilder::new()
9797/// #         .with_native_roots()
9798/// #         .unwrap()
9799/// #         .https_or_http()
9800/// #         .enable_http1()
9801/// #         .build()
9802/// # );
9803/// # let mut hub = DatabaseMigrationService::new(client, auth);
9804/// // As the method needs a request, you would usually fill it with the desired information
9805/// // into the respective structure. Some of the parts shown here might not be applicable !
9806/// // Values shown here are possibly random and not representative !
9807/// let mut req = ConvertConversionWorkspaceRequest::default();
9808///
9809/// // You can configure optional parameters by calling the respective setters at will, and
9810/// // execute the final call using `doit()`.
9811/// // Values shown here are possibly random and not representative !
9812/// let result = hub.projects().locations_conversion_workspaces_convert(req, "name")
9813///              .doit().await;
9814/// # }
9815/// ```
9816pub struct ProjectLocationConversionWorkspaceConvertCall<'a, C>
9817where
9818    C: 'a,
9819{
9820    hub: &'a DatabaseMigrationService<C>,
9821    _request: ConvertConversionWorkspaceRequest,
9822    _name: String,
9823    _delegate: Option<&'a mut dyn common::Delegate>,
9824    _additional_params: HashMap<String, String>,
9825    _scopes: BTreeSet<String>,
9826}
9827
9828impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceConvertCall<'a, C> {}
9829
9830impl<'a, C> ProjectLocationConversionWorkspaceConvertCall<'a, C>
9831where
9832    C: common::Connector,
9833{
9834    /// Perform the operation you have build so far.
9835    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9836        use std::borrow::Cow;
9837        use std::io::{Read, Seek};
9838
9839        use common::{url::Params, ToParts};
9840        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9841
9842        let mut dd = common::DefaultDelegate;
9843        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9844        dlg.begin(common::MethodInfo {
9845            id: "datamigration.projects.locations.conversionWorkspaces.convert",
9846            http_method: hyper::Method::POST,
9847        });
9848
9849        for &field in ["alt", "name"].iter() {
9850            if self._additional_params.contains_key(field) {
9851                dlg.finished(false);
9852                return Err(common::Error::FieldClash(field));
9853            }
9854        }
9855
9856        let mut params = Params::with_capacity(4 + self._additional_params.len());
9857        params.push("name", self._name);
9858
9859        params.extend(self._additional_params.iter());
9860
9861        params.push("alt", "json");
9862        let mut url = self.hub._base_url.clone() + "v1/{+name}:convert";
9863        if self._scopes.is_empty() {
9864            self._scopes
9865                .insert(Scope::CloudPlatform.as_ref().to_string());
9866        }
9867
9868        #[allow(clippy::single_element_loop)]
9869        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9870            url = params.uri_replacement(url, param_name, find_this, true);
9871        }
9872        {
9873            let to_remove = ["name"];
9874            params.remove_params(&to_remove);
9875        }
9876
9877        let url = params.parse_with_url(&url);
9878
9879        let mut json_mime_type = mime::APPLICATION_JSON;
9880        let mut request_value_reader = {
9881            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9882            common::remove_json_null_values(&mut value);
9883            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9884            serde_json::to_writer(&mut dst, &value).unwrap();
9885            dst
9886        };
9887        let request_size = request_value_reader
9888            .seek(std::io::SeekFrom::End(0))
9889            .unwrap();
9890        request_value_reader
9891            .seek(std::io::SeekFrom::Start(0))
9892            .unwrap();
9893
9894        loop {
9895            let token = match self
9896                .hub
9897                .auth
9898                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9899                .await
9900            {
9901                Ok(token) => token,
9902                Err(e) => match dlg.token(e) {
9903                    Ok(token) => token,
9904                    Err(e) => {
9905                        dlg.finished(false);
9906                        return Err(common::Error::MissingToken(e));
9907                    }
9908                },
9909            };
9910            request_value_reader
9911                .seek(std::io::SeekFrom::Start(0))
9912                .unwrap();
9913            let mut req_result = {
9914                let client = &self.hub.client;
9915                dlg.pre_request();
9916                let mut req_builder = hyper::Request::builder()
9917                    .method(hyper::Method::POST)
9918                    .uri(url.as_str())
9919                    .header(USER_AGENT, self.hub._user_agent.clone());
9920
9921                if let Some(token) = token.as_ref() {
9922                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9923                }
9924
9925                let request = req_builder
9926                    .header(CONTENT_TYPE, json_mime_type.to_string())
9927                    .header(CONTENT_LENGTH, request_size as u64)
9928                    .body(common::to_body(
9929                        request_value_reader.get_ref().clone().into(),
9930                    ));
9931
9932                client.request(request.unwrap()).await
9933            };
9934
9935            match req_result {
9936                Err(err) => {
9937                    if let common::Retry::After(d) = dlg.http_error(&err) {
9938                        sleep(d).await;
9939                        continue;
9940                    }
9941                    dlg.finished(false);
9942                    return Err(common::Error::HttpError(err));
9943                }
9944                Ok(res) => {
9945                    let (mut parts, body) = res.into_parts();
9946                    let mut body = common::Body::new(body);
9947                    if !parts.status.is_success() {
9948                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9949                        let error = serde_json::from_str(&common::to_string(&bytes));
9950                        let response = common::to_response(parts, bytes.into());
9951
9952                        if let common::Retry::After(d) =
9953                            dlg.http_failure(&response, error.as_ref().ok())
9954                        {
9955                            sleep(d).await;
9956                            continue;
9957                        }
9958
9959                        dlg.finished(false);
9960
9961                        return Err(match error {
9962                            Ok(value) => common::Error::BadRequest(value),
9963                            _ => common::Error::Failure(response),
9964                        });
9965                    }
9966                    let response = {
9967                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9968                        let encoded = common::to_string(&bytes);
9969                        match serde_json::from_str(&encoded) {
9970                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9971                            Err(error) => {
9972                                dlg.response_json_decode_error(&encoded, &error);
9973                                return Err(common::Error::JsonDecodeError(
9974                                    encoded.to_string(),
9975                                    error,
9976                                ));
9977                            }
9978                        }
9979                    };
9980
9981                    dlg.finished(true);
9982                    return Ok(response);
9983                }
9984            }
9985        }
9986    }
9987
9988    ///
9989    /// Sets the *request* property to the given value.
9990    ///
9991    /// Even though the property as already been set when instantiating this call,
9992    /// we provide this method for API completeness.
9993    pub fn request(
9994        mut self,
9995        new_value: ConvertConversionWorkspaceRequest,
9996    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
9997        self._request = new_value;
9998        self
9999    }
10000    /// Name of the conversion workspace resource to convert in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
10001    ///
10002    /// Sets the *name* path property to the given value.
10003    ///
10004    /// Even though the property as already been set when instantiating this call,
10005    /// we provide this method for API completeness.
10006    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10007        self._name = new_value.to_string();
10008        self
10009    }
10010    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10011    /// while executing the actual API request.
10012    ///
10013    /// ````text
10014    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10015    /// ````
10016    ///
10017    /// Sets the *delegate* property to the given value.
10018    pub fn delegate(
10019        mut self,
10020        new_value: &'a mut dyn common::Delegate,
10021    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10022        self._delegate = Some(new_value);
10023        self
10024    }
10025
10026    /// Set any additional parameter of the query string used in the request.
10027    /// It should be used to set parameters which are not yet available through their own
10028    /// setters.
10029    ///
10030    /// Please note that this method must not be used to set any of the known parameters
10031    /// which have their own setter method. If done anyway, the request will fail.
10032    ///
10033    /// # Additional Parameters
10034    ///
10035    /// * *$.xgafv* (query-string) - V1 error format.
10036    /// * *access_token* (query-string) - OAuth access token.
10037    /// * *alt* (query-string) - Data format for response.
10038    /// * *callback* (query-string) - JSONP
10039    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10040    /// * *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.
10041    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10042    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10043    /// * *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.
10044    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10045    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10046    pub fn param<T>(
10047        mut self,
10048        name: T,
10049        value: T,
10050    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10051    where
10052        T: AsRef<str>,
10053    {
10054        self._additional_params
10055            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10056        self
10057    }
10058
10059    /// Identifies the authorization scope for the method you are building.
10060    ///
10061    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10062    /// [`Scope::CloudPlatform`].
10063    ///
10064    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10065    /// tokens for more than one scope.
10066    ///
10067    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10068    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10069    /// sufficient, a read-write scope will do as well.
10070    pub fn add_scope<St>(
10071        mut self,
10072        scope: St,
10073    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10074    where
10075        St: AsRef<str>,
10076    {
10077        self._scopes.insert(String::from(scope.as_ref()));
10078        self
10079    }
10080    /// Identifies the authorization scope(s) for the method you are building.
10081    ///
10082    /// See [`Self::add_scope()`] for details.
10083    pub fn add_scopes<I, St>(
10084        mut self,
10085        scopes: I,
10086    ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10087    where
10088        I: IntoIterator<Item = St>,
10089        St: AsRef<str>,
10090    {
10091        self._scopes
10092            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10093        self
10094    }
10095
10096    /// Removes all scopes, and no default scope will be used either.
10097    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10098    /// for details).
10099    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10100        self._scopes.clear();
10101        self
10102    }
10103}
10104
10105/// Creates a new conversion workspace in a given project and location.
10106///
10107/// A builder for the *locations.conversionWorkspaces.create* method supported by a *project* resource.
10108/// It is not used directly, but through a [`ProjectMethods`] instance.
10109///
10110/// # Example
10111///
10112/// Instantiate a resource method builder
10113///
10114/// ```test_harness,no_run
10115/// # extern crate hyper;
10116/// # extern crate hyper_rustls;
10117/// # extern crate google_datamigration1 as datamigration1;
10118/// use datamigration1::api::ConversionWorkspace;
10119/// # async fn dox() {
10120/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10121///
10122/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10123/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10124/// #     secret,
10125/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10126/// # ).build().await.unwrap();
10127///
10128/// # let client = hyper_util::client::legacy::Client::builder(
10129/// #     hyper_util::rt::TokioExecutor::new()
10130/// # )
10131/// # .build(
10132/// #     hyper_rustls::HttpsConnectorBuilder::new()
10133/// #         .with_native_roots()
10134/// #         .unwrap()
10135/// #         .https_or_http()
10136/// #         .enable_http1()
10137/// #         .build()
10138/// # );
10139/// # let mut hub = DatabaseMigrationService::new(client, auth);
10140/// // As the method needs a request, you would usually fill it with the desired information
10141/// // into the respective structure. Some of the parts shown here might not be applicable !
10142/// // Values shown here are possibly random and not representative !
10143/// let mut req = ConversionWorkspace::default();
10144///
10145/// // You can configure optional parameters by calling the respective setters at will, and
10146/// // execute the final call using `doit()`.
10147/// // Values shown here are possibly random and not representative !
10148/// let result = hub.projects().locations_conversion_workspaces_create(req, "parent")
10149///              .request_id("vero")
10150///              .conversion_workspace_id("vero")
10151///              .doit().await;
10152/// # }
10153/// ```
10154pub struct ProjectLocationConversionWorkspaceCreateCall<'a, C>
10155where
10156    C: 'a,
10157{
10158    hub: &'a DatabaseMigrationService<C>,
10159    _request: ConversionWorkspace,
10160    _parent: String,
10161    _request_id: Option<String>,
10162    _conversion_workspace_id: Option<String>,
10163    _delegate: Option<&'a mut dyn common::Delegate>,
10164    _additional_params: HashMap<String, String>,
10165    _scopes: BTreeSet<String>,
10166}
10167
10168impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceCreateCall<'a, C> {}
10169
10170impl<'a, C> ProjectLocationConversionWorkspaceCreateCall<'a, C>
10171where
10172    C: common::Connector,
10173{
10174    /// Perform the operation you have build so far.
10175    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10176        use std::borrow::Cow;
10177        use std::io::{Read, Seek};
10178
10179        use common::{url::Params, ToParts};
10180        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10181
10182        let mut dd = common::DefaultDelegate;
10183        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10184        dlg.begin(common::MethodInfo {
10185            id: "datamigration.projects.locations.conversionWorkspaces.create",
10186            http_method: hyper::Method::POST,
10187        });
10188
10189        for &field in ["alt", "parent", "requestId", "conversionWorkspaceId"].iter() {
10190            if self._additional_params.contains_key(field) {
10191                dlg.finished(false);
10192                return Err(common::Error::FieldClash(field));
10193            }
10194        }
10195
10196        let mut params = Params::with_capacity(6 + self._additional_params.len());
10197        params.push("parent", self._parent);
10198        if let Some(value) = self._request_id.as_ref() {
10199            params.push("requestId", value);
10200        }
10201        if let Some(value) = self._conversion_workspace_id.as_ref() {
10202            params.push("conversionWorkspaceId", value);
10203        }
10204
10205        params.extend(self._additional_params.iter());
10206
10207        params.push("alt", "json");
10208        let mut url = self.hub._base_url.clone() + "v1/{+parent}/conversionWorkspaces";
10209        if self._scopes.is_empty() {
10210            self._scopes
10211                .insert(Scope::CloudPlatform.as_ref().to_string());
10212        }
10213
10214        #[allow(clippy::single_element_loop)]
10215        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10216            url = params.uri_replacement(url, param_name, find_this, true);
10217        }
10218        {
10219            let to_remove = ["parent"];
10220            params.remove_params(&to_remove);
10221        }
10222
10223        let url = params.parse_with_url(&url);
10224
10225        let mut json_mime_type = mime::APPLICATION_JSON;
10226        let mut request_value_reader = {
10227            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10228            common::remove_json_null_values(&mut value);
10229            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10230            serde_json::to_writer(&mut dst, &value).unwrap();
10231            dst
10232        };
10233        let request_size = request_value_reader
10234            .seek(std::io::SeekFrom::End(0))
10235            .unwrap();
10236        request_value_reader
10237            .seek(std::io::SeekFrom::Start(0))
10238            .unwrap();
10239
10240        loop {
10241            let token = match self
10242                .hub
10243                .auth
10244                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10245                .await
10246            {
10247                Ok(token) => token,
10248                Err(e) => match dlg.token(e) {
10249                    Ok(token) => token,
10250                    Err(e) => {
10251                        dlg.finished(false);
10252                        return Err(common::Error::MissingToken(e));
10253                    }
10254                },
10255            };
10256            request_value_reader
10257                .seek(std::io::SeekFrom::Start(0))
10258                .unwrap();
10259            let mut req_result = {
10260                let client = &self.hub.client;
10261                dlg.pre_request();
10262                let mut req_builder = hyper::Request::builder()
10263                    .method(hyper::Method::POST)
10264                    .uri(url.as_str())
10265                    .header(USER_AGENT, self.hub._user_agent.clone());
10266
10267                if let Some(token) = token.as_ref() {
10268                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10269                }
10270
10271                let request = req_builder
10272                    .header(CONTENT_TYPE, json_mime_type.to_string())
10273                    .header(CONTENT_LENGTH, request_size as u64)
10274                    .body(common::to_body(
10275                        request_value_reader.get_ref().clone().into(),
10276                    ));
10277
10278                client.request(request.unwrap()).await
10279            };
10280
10281            match req_result {
10282                Err(err) => {
10283                    if let common::Retry::After(d) = dlg.http_error(&err) {
10284                        sleep(d).await;
10285                        continue;
10286                    }
10287                    dlg.finished(false);
10288                    return Err(common::Error::HttpError(err));
10289                }
10290                Ok(res) => {
10291                    let (mut parts, body) = res.into_parts();
10292                    let mut body = common::Body::new(body);
10293                    if !parts.status.is_success() {
10294                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10295                        let error = serde_json::from_str(&common::to_string(&bytes));
10296                        let response = common::to_response(parts, bytes.into());
10297
10298                        if let common::Retry::After(d) =
10299                            dlg.http_failure(&response, error.as_ref().ok())
10300                        {
10301                            sleep(d).await;
10302                            continue;
10303                        }
10304
10305                        dlg.finished(false);
10306
10307                        return Err(match error {
10308                            Ok(value) => common::Error::BadRequest(value),
10309                            _ => common::Error::Failure(response),
10310                        });
10311                    }
10312                    let response = {
10313                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10314                        let encoded = common::to_string(&bytes);
10315                        match serde_json::from_str(&encoded) {
10316                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10317                            Err(error) => {
10318                                dlg.response_json_decode_error(&encoded, &error);
10319                                return Err(common::Error::JsonDecodeError(
10320                                    encoded.to_string(),
10321                                    error,
10322                                ));
10323                            }
10324                        }
10325                    };
10326
10327                    dlg.finished(true);
10328                    return Ok(response);
10329                }
10330            }
10331        }
10332    }
10333
10334    ///
10335    /// Sets the *request* property to the given value.
10336    ///
10337    /// Even though the property as already been set when instantiating this call,
10338    /// we provide this method for API completeness.
10339    pub fn request(
10340        mut self,
10341        new_value: ConversionWorkspace,
10342    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10343        self._request = new_value;
10344        self
10345    }
10346    /// Required. The parent which owns this collection of conversion workspaces.
10347    ///
10348    /// Sets the *parent* path property to the given value.
10349    ///
10350    /// Even though the property as already been set when instantiating this call,
10351    /// we provide this method for API completeness.
10352    pub fn parent(
10353        mut self,
10354        new_value: &str,
10355    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10356        self._parent = new_value.to_string();
10357        self
10358    }
10359    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
10360    ///
10361    /// Sets the *request id* query property to the given value.
10362    pub fn request_id(
10363        mut self,
10364        new_value: &str,
10365    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10366        self._request_id = Some(new_value.to_string());
10367        self
10368    }
10369    /// Required. The ID of the conversion workspace to create.
10370    ///
10371    /// Sets the *conversion workspace id* query property to the given value.
10372    pub fn conversion_workspace_id(
10373        mut self,
10374        new_value: &str,
10375    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10376        self._conversion_workspace_id = Some(new_value.to_string());
10377        self
10378    }
10379    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10380    /// while executing the actual API request.
10381    ///
10382    /// ````text
10383    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10384    /// ````
10385    ///
10386    /// Sets the *delegate* property to the given value.
10387    pub fn delegate(
10388        mut self,
10389        new_value: &'a mut dyn common::Delegate,
10390    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10391        self._delegate = Some(new_value);
10392        self
10393    }
10394
10395    /// Set any additional parameter of the query string used in the request.
10396    /// It should be used to set parameters which are not yet available through their own
10397    /// setters.
10398    ///
10399    /// Please note that this method must not be used to set any of the known parameters
10400    /// which have their own setter method. If done anyway, the request will fail.
10401    ///
10402    /// # Additional Parameters
10403    ///
10404    /// * *$.xgafv* (query-string) - V1 error format.
10405    /// * *access_token* (query-string) - OAuth access token.
10406    /// * *alt* (query-string) - Data format for response.
10407    /// * *callback* (query-string) - JSONP
10408    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10409    /// * *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.
10410    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10411    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10412    /// * *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.
10413    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10414    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10415    pub fn param<T>(
10416        mut self,
10417        name: T,
10418        value: T,
10419    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
10420    where
10421        T: AsRef<str>,
10422    {
10423        self._additional_params
10424            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10425        self
10426    }
10427
10428    /// Identifies the authorization scope for the method you are building.
10429    ///
10430    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10431    /// [`Scope::CloudPlatform`].
10432    ///
10433    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10434    /// tokens for more than one scope.
10435    ///
10436    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10437    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10438    /// sufficient, a read-write scope will do as well.
10439    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
10440    where
10441        St: AsRef<str>,
10442    {
10443        self._scopes.insert(String::from(scope.as_ref()));
10444        self
10445    }
10446    /// Identifies the authorization scope(s) for the method you are building.
10447    ///
10448    /// See [`Self::add_scope()`] for details.
10449    pub fn add_scopes<I, St>(
10450        mut self,
10451        scopes: I,
10452    ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
10453    where
10454        I: IntoIterator<Item = St>,
10455        St: AsRef<str>,
10456    {
10457        self._scopes
10458            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10459        self
10460    }
10461
10462    /// Removes all scopes, and no default scope will be used either.
10463    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10464    /// for details).
10465    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
10466        self._scopes.clear();
10467        self
10468    }
10469}
10470
10471/// Deletes a single conversion workspace.
10472///
10473/// A builder for the *locations.conversionWorkspaces.delete* method supported by a *project* resource.
10474/// It is not used directly, but through a [`ProjectMethods`] instance.
10475///
10476/// # Example
10477///
10478/// Instantiate a resource method builder
10479///
10480/// ```test_harness,no_run
10481/// # extern crate hyper;
10482/// # extern crate hyper_rustls;
10483/// # extern crate google_datamigration1 as datamigration1;
10484/// # async fn dox() {
10485/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10486///
10487/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10489/// #     secret,
10490/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10491/// # ).build().await.unwrap();
10492///
10493/// # let client = hyper_util::client::legacy::Client::builder(
10494/// #     hyper_util::rt::TokioExecutor::new()
10495/// # )
10496/// # .build(
10497/// #     hyper_rustls::HttpsConnectorBuilder::new()
10498/// #         .with_native_roots()
10499/// #         .unwrap()
10500/// #         .https_or_http()
10501/// #         .enable_http1()
10502/// #         .build()
10503/// # );
10504/// # let mut hub = DatabaseMigrationService::new(client, auth);
10505/// // You can configure optional parameters by calling the respective setters at will, and
10506/// // execute the final call using `doit()`.
10507/// // Values shown here are possibly random and not representative !
10508/// let result = hub.projects().locations_conversion_workspaces_delete("name")
10509///              .request_id("Stet")
10510///              .force(false)
10511///              .doit().await;
10512/// # }
10513/// ```
10514pub struct ProjectLocationConversionWorkspaceDeleteCall<'a, C>
10515where
10516    C: 'a,
10517{
10518    hub: &'a DatabaseMigrationService<C>,
10519    _name: String,
10520    _request_id: Option<String>,
10521    _force: Option<bool>,
10522    _delegate: Option<&'a mut dyn common::Delegate>,
10523    _additional_params: HashMap<String, String>,
10524    _scopes: BTreeSet<String>,
10525}
10526
10527impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceDeleteCall<'a, C> {}
10528
10529impl<'a, C> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
10530where
10531    C: common::Connector,
10532{
10533    /// Perform the operation you have build so far.
10534    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10535        use std::borrow::Cow;
10536        use std::io::{Read, Seek};
10537
10538        use common::{url::Params, ToParts};
10539        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10540
10541        let mut dd = common::DefaultDelegate;
10542        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10543        dlg.begin(common::MethodInfo {
10544            id: "datamigration.projects.locations.conversionWorkspaces.delete",
10545            http_method: hyper::Method::DELETE,
10546        });
10547
10548        for &field in ["alt", "name", "requestId", "force"].iter() {
10549            if self._additional_params.contains_key(field) {
10550                dlg.finished(false);
10551                return Err(common::Error::FieldClash(field));
10552            }
10553        }
10554
10555        let mut params = Params::with_capacity(5 + self._additional_params.len());
10556        params.push("name", self._name);
10557        if let Some(value) = self._request_id.as_ref() {
10558            params.push("requestId", value);
10559        }
10560        if let Some(value) = self._force.as_ref() {
10561            params.push("force", value.to_string());
10562        }
10563
10564        params.extend(self._additional_params.iter());
10565
10566        params.push("alt", "json");
10567        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10568        if self._scopes.is_empty() {
10569            self._scopes
10570                .insert(Scope::CloudPlatform.as_ref().to_string());
10571        }
10572
10573        #[allow(clippy::single_element_loop)]
10574        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10575            url = params.uri_replacement(url, param_name, find_this, true);
10576        }
10577        {
10578            let to_remove = ["name"];
10579            params.remove_params(&to_remove);
10580        }
10581
10582        let url = params.parse_with_url(&url);
10583
10584        loop {
10585            let token = match self
10586                .hub
10587                .auth
10588                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10589                .await
10590            {
10591                Ok(token) => token,
10592                Err(e) => match dlg.token(e) {
10593                    Ok(token) => token,
10594                    Err(e) => {
10595                        dlg.finished(false);
10596                        return Err(common::Error::MissingToken(e));
10597                    }
10598                },
10599            };
10600            let mut req_result = {
10601                let client = &self.hub.client;
10602                dlg.pre_request();
10603                let mut req_builder = hyper::Request::builder()
10604                    .method(hyper::Method::DELETE)
10605                    .uri(url.as_str())
10606                    .header(USER_AGENT, self.hub._user_agent.clone());
10607
10608                if let Some(token) = token.as_ref() {
10609                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10610                }
10611
10612                let request = req_builder
10613                    .header(CONTENT_LENGTH, 0_u64)
10614                    .body(common::to_body::<String>(None));
10615
10616                client.request(request.unwrap()).await
10617            };
10618
10619            match req_result {
10620                Err(err) => {
10621                    if let common::Retry::After(d) = dlg.http_error(&err) {
10622                        sleep(d).await;
10623                        continue;
10624                    }
10625                    dlg.finished(false);
10626                    return Err(common::Error::HttpError(err));
10627                }
10628                Ok(res) => {
10629                    let (mut parts, body) = res.into_parts();
10630                    let mut body = common::Body::new(body);
10631                    if !parts.status.is_success() {
10632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10633                        let error = serde_json::from_str(&common::to_string(&bytes));
10634                        let response = common::to_response(parts, bytes.into());
10635
10636                        if let common::Retry::After(d) =
10637                            dlg.http_failure(&response, error.as_ref().ok())
10638                        {
10639                            sleep(d).await;
10640                            continue;
10641                        }
10642
10643                        dlg.finished(false);
10644
10645                        return Err(match error {
10646                            Ok(value) => common::Error::BadRequest(value),
10647                            _ => common::Error::Failure(response),
10648                        });
10649                    }
10650                    let response = {
10651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10652                        let encoded = common::to_string(&bytes);
10653                        match serde_json::from_str(&encoded) {
10654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10655                            Err(error) => {
10656                                dlg.response_json_decode_error(&encoded, &error);
10657                                return Err(common::Error::JsonDecodeError(
10658                                    encoded.to_string(),
10659                                    error,
10660                                ));
10661                            }
10662                        }
10663                    };
10664
10665                    dlg.finished(true);
10666                    return Ok(response);
10667                }
10668            }
10669        }
10670    }
10671
10672    /// Required. Name of the conversion workspace resource to delete.
10673    ///
10674    /// Sets the *name* path property to the given value.
10675    ///
10676    /// Even though the property as already been set when instantiating this call,
10677    /// we provide this method for API completeness.
10678    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
10679        self._name = new_value.to_string();
10680        self
10681    }
10682    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
10683    ///
10684    /// Sets the *request id* query property to the given value.
10685    pub fn request_id(
10686        mut self,
10687        new_value: &str,
10688    ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
10689        self._request_id = Some(new_value.to_string());
10690        self
10691    }
10692    /// Force delete the conversion workspace, even if there's a running migration that is using the workspace.
10693    ///
10694    /// Sets the *force* query property to the given value.
10695    pub fn force(mut self, new_value: bool) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
10696        self._force = Some(new_value);
10697        self
10698    }
10699    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10700    /// while executing the actual API request.
10701    ///
10702    /// ````text
10703    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10704    /// ````
10705    ///
10706    /// Sets the *delegate* property to the given value.
10707    pub fn delegate(
10708        mut self,
10709        new_value: &'a mut dyn common::Delegate,
10710    ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
10711        self._delegate = Some(new_value);
10712        self
10713    }
10714
10715    /// Set any additional parameter of the query string used in the request.
10716    /// It should be used to set parameters which are not yet available through their own
10717    /// setters.
10718    ///
10719    /// Please note that this method must not be used to set any of the known parameters
10720    /// which have their own setter method. If done anyway, the request will fail.
10721    ///
10722    /// # Additional Parameters
10723    ///
10724    /// * *$.xgafv* (query-string) - V1 error format.
10725    /// * *access_token* (query-string) - OAuth access token.
10726    /// * *alt* (query-string) - Data format for response.
10727    /// * *callback* (query-string) - JSONP
10728    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10729    /// * *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.
10730    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10731    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10732    /// * *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.
10733    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10734    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10735    pub fn param<T>(
10736        mut self,
10737        name: T,
10738        value: T,
10739    ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
10740    where
10741        T: AsRef<str>,
10742    {
10743        self._additional_params
10744            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10745        self
10746    }
10747
10748    /// Identifies the authorization scope for the method you are building.
10749    ///
10750    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10751    /// [`Scope::CloudPlatform`].
10752    ///
10753    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10754    /// tokens for more than one scope.
10755    ///
10756    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10757    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10758    /// sufficient, a read-write scope will do as well.
10759    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
10760    where
10761        St: AsRef<str>,
10762    {
10763        self._scopes.insert(String::from(scope.as_ref()));
10764        self
10765    }
10766    /// Identifies the authorization scope(s) for the method you are building.
10767    ///
10768    /// See [`Self::add_scope()`] for details.
10769    pub fn add_scopes<I, St>(
10770        mut self,
10771        scopes: I,
10772    ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
10773    where
10774        I: IntoIterator<Item = St>,
10775        St: AsRef<str>,
10776    {
10777        self._scopes
10778            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10779        self
10780    }
10781
10782    /// Removes all scopes, and no default scope will be used either.
10783    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10784    /// for details).
10785    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
10786        self._scopes.clear();
10787        self
10788    }
10789}
10790
10791/// Retrieves a list of committed revisions of a specific conversion workspace.
10792///
10793/// A builder for the *locations.conversionWorkspaces.describeConversionWorkspaceRevisions* method supported by a *project* resource.
10794/// It is not used directly, but through a [`ProjectMethods`] instance.
10795///
10796/// # Example
10797///
10798/// Instantiate a resource method builder
10799///
10800/// ```test_harness,no_run
10801/// # extern crate hyper;
10802/// # extern crate hyper_rustls;
10803/// # extern crate google_datamigration1 as datamigration1;
10804/// # async fn dox() {
10805/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10806///
10807/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10809/// #     secret,
10810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10811/// # ).build().await.unwrap();
10812///
10813/// # let client = hyper_util::client::legacy::Client::builder(
10814/// #     hyper_util::rt::TokioExecutor::new()
10815/// # )
10816/// # .build(
10817/// #     hyper_rustls::HttpsConnectorBuilder::new()
10818/// #         .with_native_roots()
10819/// #         .unwrap()
10820/// #         .https_or_http()
10821/// #         .enable_http1()
10822/// #         .build()
10823/// # );
10824/// # let mut hub = DatabaseMigrationService::new(client, auth);
10825/// // You can configure optional parameters by calling the respective setters at will, and
10826/// // execute the final call using `doit()`.
10827/// // Values shown here are possibly random and not representative !
10828/// let result = hub.projects().locations_conversion_workspaces_describe_conversion_workspace_revisions("conversionWorkspace")
10829///              .commit_id("Lorem")
10830///              .doit().await;
10831/// # }
10832/// ```
10833pub struct ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
10834where
10835    C: 'a,
10836{
10837    hub: &'a DatabaseMigrationService<C>,
10838    _conversion_workspace: String,
10839    _commit_id: Option<String>,
10840    _delegate: Option<&'a mut dyn common::Delegate>,
10841    _additional_params: HashMap<String, String>,
10842    _scopes: BTreeSet<String>,
10843}
10844
10845impl<'a, C> common::CallBuilder
10846    for ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
10847{
10848}
10849
10850impl<'a, C> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
10851where
10852    C: common::Connector,
10853{
10854    /// Perform the operation you have build so far.
10855    pub async fn doit(
10856        mut self,
10857    ) -> common::Result<(
10858        common::Response,
10859        DescribeConversionWorkspaceRevisionsResponse,
10860    )> {
10861        use std::borrow::Cow;
10862        use std::io::{Read, Seek};
10863
10864        use common::{url::Params, ToParts};
10865        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10866
10867        let mut dd = common::DefaultDelegate;
10868        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10869        dlg.begin(common::MethodInfo { id: "datamigration.projects.locations.conversionWorkspaces.describeConversionWorkspaceRevisions",
10870                               http_method: hyper::Method::GET });
10871
10872        for &field in ["alt", "conversionWorkspace", "commitId"].iter() {
10873            if self._additional_params.contains_key(field) {
10874                dlg.finished(false);
10875                return Err(common::Error::FieldClash(field));
10876            }
10877        }
10878
10879        let mut params = Params::with_capacity(4 + self._additional_params.len());
10880        params.push("conversionWorkspace", self._conversion_workspace);
10881        if let Some(value) = self._commit_id.as_ref() {
10882            params.push("commitId", value);
10883        }
10884
10885        params.extend(self._additional_params.iter());
10886
10887        params.push("alt", "json");
10888        let mut url = self.hub._base_url.clone()
10889            + "v1/{+conversionWorkspace}:describeConversionWorkspaceRevisions";
10890        if self._scopes.is_empty() {
10891            self._scopes
10892                .insert(Scope::CloudPlatform.as_ref().to_string());
10893        }
10894
10895        #[allow(clippy::single_element_loop)]
10896        for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
10897            url = params.uri_replacement(url, param_name, find_this, true);
10898        }
10899        {
10900            let to_remove = ["conversionWorkspace"];
10901            params.remove_params(&to_remove);
10902        }
10903
10904        let url = params.parse_with_url(&url);
10905
10906        loop {
10907            let token = match self
10908                .hub
10909                .auth
10910                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10911                .await
10912            {
10913                Ok(token) => token,
10914                Err(e) => match dlg.token(e) {
10915                    Ok(token) => token,
10916                    Err(e) => {
10917                        dlg.finished(false);
10918                        return Err(common::Error::MissingToken(e));
10919                    }
10920                },
10921            };
10922            let mut req_result = {
10923                let client = &self.hub.client;
10924                dlg.pre_request();
10925                let mut req_builder = hyper::Request::builder()
10926                    .method(hyper::Method::GET)
10927                    .uri(url.as_str())
10928                    .header(USER_AGENT, self.hub._user_agent.clone());
10929
10930                if let Some(token) = token.as_ref() {
10931                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10932                }
10933
10934                let request = req_builder
10935                    .header(CONTENT_LENGTH, 0_u64)
10936                    .body(common::to_body::<String>(None));
10937
10938                client.request(request.unwrap()).await
10939            };
10940
10941            match req_result {
10942                Err(err) => {
10943                    if let common::Retry::After(d) = dlg.http_error(&err) {
10944                        sleep(d).await;
10945                        continue;
10946                    }
10947                    dlg.finished(false);
10948                    return Err(common::Error::HttpError(err));
10949                }
10950                Ok(res) => {
10951                    let (mut parts, body) = res.into_parts();
10952                    let mut body = common::Body::new(body);
10953                    if !parts.status.is_success() {
10954                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10955                        let error = serde_json::from_str(&common::to_string(&bytes));
10956                        let response = common::to_response(parts, bytes.into());
10957
10958                        if let common::Retry::After(d) =
10959                            dlg.http_failure(&response, error.as_ref().ok())
10960                        {
10961                            sleep(d).await;
10962                            continue;
10963                        }
10964
10965                        dlg.finished(false);
10966
10967                        return Err(match error {
10968                            Ok(value) => common::Error::BadRequest(value),
10969                            _ => common::Error::Failure(response),
10970                        });
10971                    }
10972                    let response = {
10973                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10974                        let encoded = common::to_string(&bytes);
10975                        match serde_json::from_str(&encoded) {
10976                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10977                            Err(error) => {
10978                                dlg.response_json_decode_error(&encoded, &error);
10979                                return Err(common::Error::JsonDecodeError(
10980                                    encoded.to_string(),
10981                                    error,
10982                                ));
10983                            }
10984                        }
10985                    };
10986
10987                    dlg.finished(true);
10988                    return Ok(response);
10989                }
10990            }
10991        }
10992    }
10993
10994    /// Required. Name of the conversion workspace resource whose revisions are listed. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
10995    ///
10996    /// Sets the *conversion workspace* path property to the given value.
10997    ///
10998    /// Even though the property as already been set when instantiating this call,
10999    /// we provide this method for API completeness.
11000    pub fn conversion_workspace(
11001        mut self,
11002        new_value: &str,
11003    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11004        self._conversion_workspace = new_value.to_string();
11005        self
11006    }
11007    /// Optional. Optional filter to request a specific commit ID.
11008    ///
11009    /// Sets the *commit id* query property to the given value.
11010    pub fn commit_id(
11011        mut self,
11012        new_value: &str,
11013    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11014        self._commit_id = Some(new_value.to_string());
11015        self
11016    }
11017    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11018    /// while executing the actual API request.
11019    ///
11020    /// ````text
11021    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11022    /// ````
11023    ///
11024    /// Sets the *delegate* property to the given value.
11025    pub fn delegate(
11026        mut self,
11027        new_value: &'a mut dyn common::Delegate,
11028    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11029        self._delegate = Some(new_value);
11030        self
11031    }
11032
11033    /// Set any additional parameter of the query string used in the request.
11034    /// It should be used to set parameters which are not yet available through their own
11035    /// setters.
11036    ///
11037    /// Please note that this method must not be used to set any of the known parameters
11038    /// which have their own setter method. If done anyway, the request will fail.
11039    ///
11040    /// # Additional Parameters
11041    ///
11042    /// * *$.xgafv* (query-string) - V1 error format.
11043    /// * *access_token* (query-string) - OAuth access token.
11044    /// * *alt* (query-string) - Data format for response.
11045    /// * *callback* (query-string) - JSONP
11046    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11047    /// * *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.
11048    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11049    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11050    /// * *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.
11051    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11052    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11053    pub fn param<T>(
11054        mut self,
11055        name: T,
11056        value: T,
11057    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11058    where
11059        T: AsRef<str>,
11060    {
11061        self._additional_params
11062            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11063        self
11064    }
11065
11066    /// Identifies the authorization scope for the method you are building.
11067    ///
11068    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11069    /// [`Scope::CloudPlatform`].
11070    ///
11071    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11072    /// tokens for more than one scope.
11073    ///
11074    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11075    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11076    /// sufficient, a read-write scope will do as well.
11077    pub fn add_scope<St>(
11078        mut self,
11079        scope: St,
11080    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11081    where
11082        St: AsRef<str>,
11083    {
11084        self._scopes.insert(String::from(scope.as_ref()));
11085        self
11086    }
11087    /// Identifies the authorization scope(s) for the method you are building.
11088    ///
11089    /// See [`Self::add_scope()`] for details.
11090    pub fn add_scopes<I, St>(
11091        mut self,
11092        scopes: I,
11093    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11094    where
11095        I: IntoIterator<Item = St>,
11096        St: AsRef<str>,
11097    {
11098        self._scopes
11099            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11100        self
11101    }
11102
11103    /// Removes all scopes, and no default scope will be used either.
11104    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11105    /// for details).
11106    pub fn clear_scopes(
11107        mut self,
11108    ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11109        self._scopes.clear();
11110        self
11111    }
11112}
11113
11114/// Describes the database entities tree for a specific conversion workspace and a specific tree type. Database entities are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are simple data objects describing the structure of the client database.
11115///
11116/// A builder for the *locations.conversionWorkspaces.describeDatabaseEntities* method supported by a *project* resource.
11117/// It is not used directly, but through a [`ProjectMethods`] instance.
11118///
11119/// # Example
11120///
11121/// Instantiate a resource method builder
11122///
11123/// ```test_harness,no_run
11124/// # extern crate hyper;
11125/// # extern crate hyper_rustls;
11126/// # extern crate google_datamigration1 as datamigration1;
11127/// # async fn dox() {
11128/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11129///
11130/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11131/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11132/// #     secret,
11133/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11134/// # ).build().await.unwrap();
11135///
11136/// # let client = hyper_util::client::legacy::Client::builder(
11137/// #     hyper_util::rt::TokioExecutor::new()
11138/// # )
11139/// # .build(
11140/// #     hyper_rustls::HttpsConnectorBuilder::new()
11141/// #         .with_native_roots()
11142/// #         .unwrap()
11143/// #         .https_or_http()
11144/// #         .enable_http1()
11145/// #         .build()
11146/// # );
11147/// # let mut hub = DatabaseMigrationService::new(client, auth);
11148/// // You can configure optional parameters by calling the respective setters at will, and
11149/// // execute the final call using `doit()`.
11150/// // Values shown here are possibly random and not representative !
11151/// let result = hub.projects().locations_conversion_workspaces_describe_database_entities("conversionWorkspace")
11152///              .view("no")
11153///              .uncommitted(false)
11154///              .tree("accusam")
11155///              .page_token("takimata")
11156///              .page_size(-46)
11157///              .filter("voluptua.")
11158///              .commit_id("et")
11159///              .doit().await;
11160/// # }
11161/// ```
11162pub struct ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11163where
11164    C: 'a,
11165{
11166    hub: &'a DatabaseMigrationService<C>,
11167    _conversion_workspace: String,
11168    _view: Option<String>,
11169    _uncommitted: Option<bool>,
11170    _tree: Option<String>,
11171    _page_token: Option<String>,
11172    _page_size: Option<i32>,
11173    _filter: Option<String>,
11174    _commit_id: Option<String>,
11175    _delegate: Option<&'a mut dyn common::Delegate>,
11176    _additional_params: HashMap<String, String>,
11177    _scopes: BTreeSet<String>,
11178}
11179
11180impl<'a, C> common::CallBuilder
11181    for ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11182{
11183}
11184
11185impl<'a, C> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11186where
11187    C: common::Connector,
11188{
11189    /// Perform the operation you have build so far.
11190    pub async fn doit(
11191        mut self,
11192    ) -> common::Result<(common::Response, DescribeDatabaseEntitiesResponse)> {
11193        use std::borrow::Cow;
11194        use std::io::{Read, Seek};
11195
11196        use common::{url::Params, ToParts};
11197        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11198
11199        let mut dd = common::DefaultDelegate;
11200        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11201        dlg.begin(common::MethodInfo {
11202            id: "datamigration.projects.locations.conversionWorkspaces.describeDatabaseEntities",
11203            http_method: hyper::Method::GET,
11204        });
11205
11206        for &field in [
11207            "alt",
11208            "conversionWorkspace",
11209            "view",
11210            "uncommitted",
11211            "tree",
11212            "pageToken",
11213            "pageSize",
11214            "filter",
11215            "commitId",
11216        ]
11217        .iter()
11218        {
11219            if self._additional_params.contains_key(field) {
11220                dlg.finished(false);
11221                return Err(common::Error::FieldClash(field));
11222            }
11223        }
11224
11225        let mut params = Params::with_capacity(10 + self._additional_params.len());
11226        params.push("conversionWorkspace", self._conversion_workspace);
11227        if let Some(value) = self._view.as_ref() {
11228            params.push("view", value);
11229        }
11230        if let Some(value) = self._uncommitted.as_ref() {
11231            params.push("uncommitted", value.to_string());
11232        }
11233        if let Some(value) = self._tree.as_ref() {
11234            params.push("tree", value);
11235        }
11236        if let Some(value) = self._page_token.as_ref() {
11237            params.push("pageToken", value);
11238        }
11239        if let Some(value) = self._page_size.as_ref() {
11240            params.push("pageSize", value.to_string());
11241        }
11242        if let Some(value) = self._filter.as_ref() {
11243            params.push("filter", value);
11244        }
11245        if let Some(value) = self._commit_id.as_ref() {
11246            params.push("commitId", value);
11247        }
11248
11249        params.extend(self._additional_params.iter());
11250
11251        params.push("alt", "json");
11252        let mut url =
11253            self.hub._base_url.clone() + "v1/{+conversionWorkspace}:describeDatabaseEntities";
11254        if self._scopes.is_empty() {
11255            self._scopes
11256                .insert(Scope::CloudPlatform.as_ref().to_string());
11257        }
11258
11259        #[allow(clippy::single_element_loop)]
11260        for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
11261            url = params.uri_replacement(url, param_name, find_this, true);
11262        }
11263        {
11264            let to_remove = ["conversionWorkspace"];
11265            params.remove_params(&to_remove);
11266        }
11267
11268        let url = params.parse_with_url(&url);
11269
11270        loop {
11271            let token = match self
11272                .hub
11273                .auth
11274                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11275                .await
11276            {
11277                Ok(token) => token,
11278                Err(e) => match dlg.token(e) {
11279                    Ok(token) => token,
11280                    Err(e) => {
11281                        dlg.finished(false);
11282                        return Err(common::Error::MissingToken(e));
11283                    }
11284                },
11285            };
11286            let mut req_result = {
11287                let client = &self.hub.client;
11288                dlg.pre_request();
11289                let mut req_builder = hyper::Request::builder()
11290                    .method(hyper::Method::GET)
11291                    .uri(url.as_str())
11292                    .header(USER_AGENT, self.hub._user_agent.clone());
11293
11294                if let Some(token) = token.as_ref() {
11295                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11296                }
11297
11298                let request = req_builder
11299                    .header(CONTENT_LENGTH, 0_u64)
11300                    .body(common::to_body::<String>(None));
11301
11302                client.request(request.unwrap()).await
11303            };
11304
11305            match req_result {
11306                Err(err) => {
11307                    if let common::Retry::After(d) = dlg.http_error(&err) {
11308                        sleep(d).await;
11309                        continue;
11310                    }
11311                    dlg.finished(false);
11312                    return Err(common::Error::HttpError(err));
11313                }
11314                Ok(res) => {
11315                    let (mut parts, body) = res.into_parts();
11316                    let mut body = common::Body::new(body);
11317                    if !parts.status.is_success() {
11318                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11319                        let error = serde_json::from_str(&common::to_string(&bytes));
11320                        let response = common::to_response(parts, bytes.into());
11321
11322                        if let common::Retry::After(d) =
11323                            dlg.http_failure(&response, error.as_ref().ok())
11324                        {
11325                            sleep(d).await;
11326                            continue;
11327                        }
11328
11329                        dlg.finished(false);
11330
11331                        return Err(match error {
11332                            Ok(value) => common::Error::BadRequest(value),
11333                            _ => common::Error::Failure(response),
11334                        });
11335                    }
11336                    let response = {
11337                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11338                        let encoded = common::to_string(&bytes);
11339                        match serde_json::from_str(&encoded) {
11340                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11341                            Err(error) => {
11342                                dlg.response_json_decode_error(&encoded, &error);
11343                                return Err(common::Error::JsonDecodeError(
11344                                    encoded.to_string(),
11345                                    error,
11346                                ));
11347                            }
11348                        }
11349                    };
11350
11351                    dlg.finished(true);
11352                    return Ok(response);
11353                }
11354            }
11355        }
11356    }
11357
11358    /// Required. Name of the conversion workspace resource whose database entities are described. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
11359    ///
11360    /// Sets the *conversion workspace* path property to the given value.
11361    ///
11362    /// Even though the property as already been set when instantiating this call,
11363    /// we provide this method for API completeness.
11364    pub fn conversion_workspace(
11365        mut self,
11366        new_value: &str,
11367    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11368        self._conversion_workspace = new_value.to_string();
11369        self
11370    }
11371    /// Optional. Results view based on AIP-157
11372    ///
11373    /// Sets the *view* query property to the given value.
11374    pub fn view(
11375        mut self,
11376        new_value: &str,
11377    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11378        self._view = Some(new_value.to_string());
11379        self
11380    }
11381    /// Optional. Whether to retrieve the latest committed version of the entities or the latest version. This field is ignored if a specific commit_id is specified.
11382    ///
11383    /// Sets the *uncommitted* query property to the given value.
11384    pub fn uncommitted(
11385        mut self,
11386        new_value: bool,
11387    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11388        self._uncommitted = Some(new_value);
11389        self
11390    }
11391    /// Required. The tree to fetch.
11392    ///
11393    /// Sets the *tree* query property to the given value.
11394    pub fn tree(
11395        mut self,
11396        new_value: &str,
11397    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11398        self._tree = Some(new_value.to_string());
11399        self
11400    }
11401    /// Optional. The nextPageToken value received in the previous call to conversionWorkspace.describeDatabaseEntities, used in the subsequent request to retrieve the next page of results. On first call this should be left blank. When paginating, all other parameters provided to conversionWorkspace.describeDatabaseEntities must match the call that provided the page token.
11402    ///
11403    /// Sets the *page token* query property to the given value.
11404    pub fn page_token(
11405        mut self,
11406        new_value: &str,
11407    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11408        self._page_token = Some(new_value.to_string());
11409        self
11410    }
11411    /// Optional. The maximum number of entities to return. The service may return fewer entities than the value specifies.
11412    ///
11413    /// Sets the *page size* query property to the given value.
11414    pub fn page_size(
11415        mut self,
11416        new_value: i32,
11417    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11418        self._page_size = Some(new_value);
11419        self
11420    }
11421    /// Optional. Filter the returned entities based on AIP-160 standard.
11422    ///
11423    /// Sets the *filter* query property to the given value.
11424    pub fn filter(
11425        mut self,
11426        new_value: &str,
11427    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11428        self._filter = Some(new_value.to_string());
11429        self
11430    }
11431    /// Optional. Request a specific commit ID. If not specified, the entities from the latest commit are returned.
11432    ///
11433    /// Sets the *commit id* query property to the given value.
11434    pub fn commit_id(
11435        mut self,
11436        new_value: &str,
11437    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11438        self._commit_id = Some(new_value.to_string());
11439        self
11440    }
11441    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11442    /// while executing the actual API request.
11443    ///
11444    /// ````text
11445    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11446    /// ````
11447    ///
11448    /// Sets the *delegate* property to the given value.
11449    pub fn delegate(
11450        mut self,
11451        new_value: &'a mut dyn common::Delegate,
11452    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11453        self._delegate = Some(new_value);
11454        self
11455    }
11456
11457    /// Set any additional parameter of the query string used in the request.
11458    /// It should be used to set parameters which are not yet available through their own
11459    /// setters.
11460    ///
11461    /// Please note that this method must not be used to set any of the known parameters
11462    /// which have their own setter method. If done anyway, the request will fail.
11463    ///
11464    /// # Additional Parameters
11465    ///
11466    /// * *$.xgafv* (query-string) - V1 error format.
11467    /// * *access_token* (query-string) - OAuth access token.
11468    /// * *alt* (query-string) - Data format for response.
11469    /// * *callback* (query-string) - JSONP
11470    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11471    /// * *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.
11472    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11473    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11474    /// * *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.
11475    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11476    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11477    pub fn param<T>(
11478        mut self,
11479        name: T,
11480        value: T,
11481    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11482    where
11483        T: AsRef<str>,
11484    {
11485        self._additional_params
11486            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11487        self
11488    }
11489
11490    /// Identifies the authorization scope for the method you are building.
11491    ///
11492    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11493    /// [`Scope::CloudPlatform`].
11494    ///
11495    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11496    /// tokens for more than one scope.
11497    ///
11498    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11499    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11500    /// sufficient, a read-write scope will do as well.
11501    pub fn add_scope<St>(
11502        mut self,
11503        scope: St,
11504    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11505    where
11506        St: AsRef<str>,
11507    {
11508        self._scopes.insert(String::from(scope.as_ref()));
11509        self
11510    }
11511    /// Identifies the authorization scope(s) for the method you are building.
11512    ///
11513    /// See [`Self::add_scope()`] for details.
11514    pub fn add_scopes<I, St>(
11515        mut self,
11516        scopes: I,
11517    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
11518    where
11519        I: IntoIterator<Item = St>,
11520        St: AsRef<str>,
11521    {
11522        self._scopes
11523            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11524        self
11525    }
11526
11527    /// Removes all scopes, and no default scope will be used either.
11528    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11529    /// for details).
11530    pub fn clear_scopes(
11531        mut self,
11532    ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
11533        self._scopes.clear();
11534        self
11535    }
11536}
11537
11538/// Gets details of a single conversion workspace.
11539///
11540/// A builder for the *locations.conversionWorkspaces.get* method supported by a *project* resource.
11541/// It is not used directly, but through a [`ProjectMethods`] instance.
11542///
11543/// # Example
11544///
11545/// Instantiate a resource method builder
11546///
11547/// ```test_harness,no_run
11548/// # extern crate hyper;
11549/// # extern crate hyper_rustls;
11550/// # extern crate google_datamigration1 as datamigration1;
11551/// # async fn dox() {
11552/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11553///
11554/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11556/// #     secret,
11557/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11558/// # ).build().await.unwrap();
11559///
11560/// # let client = hyper_util::client::legacy::Client::builder(
11561/// #     hyper_util::rt::TokioExecutor::new()
11562/// # )
11563/// # .build(
11564/// #     hyper_rustls::HttpsConnectorBuilder::new()
11565/// #         .with_native_roots()
11566/// #         .unwrap()
11567/// #         .https_or_http()
11568/// #         .enable_http1()
11569/// #         .build()
11570/// # );
11571/// # let mut hub = DatabaseMigrationService::new(client, auth);
11572/// // You can configure optional parameters by calling the respective setters at will, and
11573/// // execute the final call using `doit()`.
11574/// // Values shown here are possibly random and not representative !
11575/// let result = hub.projects().locations_conversion_workspaces_get("name")
11576///              .doit().await;
11577/// # }
11578/// ```
11579pub struct ProjectLocationConversionWorkspaceGetCall<'a, C>
11580where
11581    C: 'a,
11582{
11583    hub: &'a DatabaseMigrationService<C>,
11584    _name: String,
11585    _delegate: Option<&'a mut dyn common::Delegate>,
11586    _additional_params: HashMap<String, String>,
11587    _scopes: BTreeSet<String>,
11588}
11589
11590impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceGetCall<'a, C> {}
11591
11592impl<'a, C> ProjectLocationConversionWorkspaceGetCall<'a, C>
11593where
11594    C: common::Connector,
11595{
11596    /// Perform the operation you have build so far.
11597    pub async fn doit(mut self) -> common::Result<(common::Response, ConversionWorkspace)> {
11598        use std::borrow::Cow;
11599        use std::io::{Read, Seek};
11600
11601        use common::{url::Params, ToParts};
11602        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11603
11604        let mut dd = common::DefaultDelegate;
11605        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11606        dlg.begin(common::MethodInfo {
11607            id: "datamigration.projects.locations.conversionWorkspaces.get",
11608            http_method: hyper::Method::GET,
11609        });
11610
11611        for &field in ["alt", "name"].iter() {
11612            if self._additional_params.contains_key(field) {
11613                dlg.finished(false);
11614                return Err(common::Error::FieldClash(field));
11615            }
11616        }
11617
11618        let mut params = Params::with_capacity(3 + self._additional_params.len());
11619        params.push("name", self._name);
11620
11621        params.extend(self._additional_params.iter());
11622
11623        params.push("alt", "json");
11624        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11625        if self._scopes.is_empty() {
11626            self._scopes
11627                .insert(Scope::CloudPlatform.as_ref().to_string());
11628        }
11629
11630        #[allow(clippy::single_element_loop)]
11631        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11632            url = params.uri_replacement(url, param_name, find_this, true);
11633        }
11634        {
11635            let to_remove = ["name"];
11636            params.remove_params(&to_remove);
11637        }
11638
11639        let url = params.parse_with_url(&url);
11640
11641        loop {
11642            let token = match self
11643                .hub
11644                .auth
11645                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11646                .await
11647            {
11648                Ok(token) => token,
11649                Err(e) => match dlg.token(e) {
11650                    Ok(token) => token,
11651                    Err(e) => {
11652                        dlg.finished(false);
11653                        return Err(common::Error::MissingToken(e));
11654                    }
11655                },
11656            };
11657            let mut req_result = {
11658                let client = &self.hub.client;
11659                dlg.pre_request();
11660                let mut req_builder = hyper::Request::builder()
11661                    .method(hyper::Method::GET)
11662                    .uri(url.as_str())
11663                    .header(USER_AGENT, self.hub._user_agent.clone());
11664
11665                if let Some(token) = token.as_ref() {
11666                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11667                }
11668
11669                let request = req_builder
11670                    .header(CONTENT_LENGTH, 0_u64)
11671                    .body(common::to_body::<String>(None));
11672
11673                client.request(request.unwrap()).await
11674            };
11675
11676            match req_result {
11677                Err(err) => {
11678                    if let common::Retry::After(d) = dlg.http_error(&err) {
11679                        sleep(d).await;
11680                        continue;
11681                    }
11682                    dlg.finished(false);
11683                    return Err(common::Error::HttpError(err));
11684                }
11685                Ok(res) => {
11686                    let (mut parts, body) = res.into_parts();
11687                    let mut body = common::Body::new(body);
11688                    if !parts.status.is_success() {
11689                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11690                        let error = serde_json::from_str(&common::to_string(&bytes));
11691                        let response = common::to_response(parts, bytes.into());
11692
11693                        if let common::Retry::After(d) =
11694                            dlg.http_failure(&response, error.as_ref().ok())
11695                        {
11696                            sleep(d).await;
11697                            continue;
11698                        }
11699
11700                        dlg.finished(false);
11701
11702                        return Err(match error {
11703                            Ok(value) => common::Error::BadRequest(value),
11704                            _ => common::Error::Failure(response),
11705                        });
11706                    }
11707                    let response = {
11708                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11709                        let encoded = common::to_string(&bytes);
11710                        match serde_json::from_str(&encoded) {
11711                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11712                            Err(error) => {
11713                                dlg.response_json_decode_error(&encoded, &error);
11714                                return Err(common::Error::JsonDecodeError(
11715                                    encoded.to_string(),
11716                                    error,
11717                                ));
11718                            }
11719                        }
11720                    };
11721
11722                    dlg.finished(true);
11723                    return Ok(response);
11724                }
11725            }
11726        }
11727    }
11728
11729    /// Required. Name of the conversion workspace resource to get.
11730    ///
11731    /// Sets the *name* path property to the given value.
11732    ///
11733    /// Even though the property as already been set when instantiating this call,
11734    /// we provide this method for API completeness.
11735    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
11736        self._name = new_value.to_string();
11737        self
11738    }
11739    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11740    /// while executing the actual API request.
11741    ///
11742    /// ````text
11743    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11744    /// ````
11745    ///
11746    /// Sets the *delegate* property to the given value.
11747    pub fn delegate(
11748        mut self,
11749        new_value: &'a mut dyn common::Delegate,
11750    ) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
11751        self._delegate = Some(new_value);
11752        self
11753    }
11754
11755    /// Set any additional parameter of the query string used in the request.
11756    /// It should be used to set parameters which are not yet available through their own
11757    /// setters.
11758    ///
11759    /// Please note that this method must not be used to set any of the known parameters
11760    /// which have their own setter method. If done anyway, the request will fail.
11761    ///
11762    /// # Additional Parameters
11763    ///
11764    /// * *$.xgafv* (query-string) - V1 error format.
11765    /// * *access_token* (query-string) - OAuth access token.
11766    /// * *alt* (query-string) - Data format for response.
11767    /// * *callback* (query-string) - JSONP
11768    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11769    /// * *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.
11770    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11771    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11772    /// * *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.
11773    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11774    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11775    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
11776    where
11777        T: AsRef<str>,
11778    {
11779        self._additional_params
11780            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11781        self
11782    }
11783
11784    /// Identifies the authorization scope for the method you are building.
11785    ///
11786    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11787    /// [`Scope::CloudPlatform`].
11788    ///
11789    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11790    /// tokens for more than one scope.
11791    ///
11792    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11793    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11794    /// sufficient, a read-write scope will do as well.
11795    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
11796    where
11797        St: AsRef<str>,
11798    {
11799        self._scopes.insert(String::from(scope.as_ref()));
11800        self
11801    }
11802    /// Identifies the authorization scope(s) for the method you are building.
11803    ///
11804    /// See [`Self::add_scope()`] for details.
11805    pub fn add_scopes<I, St>(
11806        mut self,
11807        scopes: I,
11808    ) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
11809    where
11810        I: IntoIterator<Item = St>,
11811        St: AsRef<str>,
11812    {
11813        self._scopes
11814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11815        self
11816    }
11817
11818    /// Removes all scopes, and no default scope will be used either.
11819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11820    /// for details).
11821    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
11822        self._scopes.clear();
11823        self
11824    }
11825}
11826
11827/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
11828///
11829/// A builder for the *locations.conversionWorkspaces.getIamPolicy* method supported by a *project* resource.
11830/// It is not used directly, but through a [`ProjectMethods`] instance.
11831///
11832/// # Example
11833///
11834/// Instantiate a resource method builder
11835///
11836/// ```test_harness,no_run
11837/// # extern crate hyper;
11838/// # extern crate hyper_rustls;
11839/// # extern crate google_datamigration1 as datamigration1;
11840/// # async fn dox() {
11841/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11842///
11843/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11845/// #     secret,
11846/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11847/// # ).build().await.unwrap();
11848///
11849/// # let client = hyper_util::client::legacy::Client::builder(
11850/// #     hyper_util::rt::TokioExecutor::new()
11851/// # )
11852/// # .build(
11853/// #     hyper_rustls::HttpsConnectorBuilder::new()
11854/// #         .with_native_roots()
11855/// #         .unwrap()
11856/// #         .https_or_http()
11857/// #         .enable_http1()
11858/// #         .build()
11859/// # );
11860/// # let mut hub = DatabaseMigrationService::new(client, auth);
11861/// // You can configure optional parameters by calling the respective setters at will, and
11862/// // execute the final call using `doit()`.
11863/// // Values shown here are possibly random and not representative !
11864/// let result = hub.projects().locations_conversion_workspaces_get_iam_policy("resource")
11865///              .options_requested_policy_version(-2)
11866///              .doit().await;
11867/// # }
11868/// ```
11869pub struct ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
11870where
11871    C: 'a,
11872{
11873    hub: &'a DatabaseMigrationService<C>,
11874    _resource: String,
11875    _options_requested_policy_version: Option<i32>,
11876    _delegate: Option<&'a mut dyn common::Delegate>,
11877    _additional_params: HashMap<String, String>,
11878    _scopes: BTreeSet<String>,
11879}
11880
11881impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {}
11882
11883impl<'a, C> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
11884where
11885    C: common::Connector,
11886{
11887    /// Perform the operation you have build so far.
11888    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11889        use std::borrow::Cow;
11890        use std::io::{Read, Seek};
11891
11892        use common::{url::Params, ToParts};
11893        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11894
11895        let mut dd = common::DefaultDelegate;
11896        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11897        dlg.begin(common::MethodInfo {
11898            id: "datamigration.projects.locations.conversionWorkspaces.getIamPolicy",
11899            http_method: hyper::Method::GET,
11900        });
11901
11902        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
11903            if self._additional_params.contains_key(field) {
11904                dlg.finished(false);
11905                return Err(common::Error::FieldClash(field));
11906            }
11907        }
11908
11909        let mut params = Params::with_capacity(4 + self._additional_params.len());
11910        params.push("resource", self._resource);
11911        if let Some(value) = self._options_requested_policy_version.as_ref() {
11912            params.push("options.requestedPolicyVersion", value.to_string());
11913        }
11914
11915        params.extend(self._additional_params.iter());
11916
11917        params.push("alt", "json");
11918        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
11919        if self._scopes.is_empty() {
11920            self._scopes
11921                .insert(Scope::CloudPlatform.as_ref().to_string());
11922        }
11923
11924        #[allow(clippy::single_element_loop)]
11925        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11926            url = params.uri_replacement(url, param_name, find_this, true);
11927        }
11928        {
11929            let to_remove = ["resource"];
11930            params.remove_params(&to_remove);
11931        }
11932
11933        let url = params.parse_with_url(&url);
11934
11935        loop {
11936            let token = match self
11937                .hub
11938                .auth
11939                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11940                .await
11941            {
11942                Ok(token) => token,
11943                Err(e) => match dlg.token(e) {
11944                    Ok(token) => token,
11945                    Err(e) => {
11946                        dlg.finished(false);
11947                        return Err(common::Error::MissingToken(e));
11948                    }
11949                },
11950            };
11951            let mut req_result = {
11952                let client = &self.hub.client;
11953                dlg.pre_request();
11954                let mut req_builder = hyper::Request::builder()
11955                    .method(hyper::Method::GET)
11956                    .uri(url.as_str())
11957                    .header(USER_AGENT, self.hub._user_agent.clone());
11958
11959                if let Some(token) = token.as_ref() {
11960                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11961                }
11962
11963                let request = req_builder
11964                    .header(CONTENT_LENGTH, 0_u64)
11965                    .body(common::to_body::<String>(None));
11966
11967                client.request(request.unwrap()).await
11968            };
11969
11970            match req_result {
11971                Err(err) => {
11972                    if let common::Retry::After(d) = dlg.http_error(&err) {
11973                        sleep(d).await;
11974                        continue;
11975                    }
11976                    dlg.finished(false);
11977                    return Err(common::Error::HttpError(err));
11978                }
11979                Ok(res) => {
11980                    let (mut parts, body) = res.into_parts();
11981                    let mut body = common::Body::new(body);
11982                    if !parts.status.is_success() {
11983                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11984                        let error = serde_json::from_str(&common::to_string(&bytes));
11985                        let response = common::to_response(parts, bytes.into());
11986
11987                        if let common::Retry::After(d) =
11988                            dlg.http_failure(&response, error.as_ref().ok())
11989                        {
11990                            sleep(d).await;
11991                            continue;
11992                        }
11993
11994                        dlg.finished(false);
11995
11996                        return Err(match error {
11997                            Ok(value) => common::Error::BadRequest(value),
11998                            _ => common::Error::Failure(response),
11999                        });
12000                    }
12001                    let response = {
12002                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12003                        let encoded = common::to_string(&bytes);
12004                        match serde_json::from_str(&encoded) {
12005                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12006                            Err(error) => {
12007                                dlg.response_json_decode_error(&encoded, &error);
12008                                return Err(common::Error::JsonDecodeError(
12009                                    encoded.to_string(),
12010                                    error,
12011                                ));
12012                            }
12013                        }
12014                    };
12015
12016                    dlg.finished(true);
12017                    return Ok(response);
12018                }
12019            }
12020        }
12021    }
12022
12023    /// 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.
12024    ///
12025    /// Sets the *resource* path property to the given value.
12026    ///
12027    /// Even though the property as already been set when instantiating this call,
12028    /// we provide this method for API completeness.
12029    pub fn resource(
12030        mut self,
12031        new_value: &str,
12032    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
12033        self._resource = new_value.to_string();
12034        self
12035    }
12036    /// 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).
12037    ///
12038    /// Sets the *options.requested policy version* query property to the given value.
12039    pub fn options_requested_policy_version(
12040        mut self,
12041        new_value: i32,
12042    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
12043        self._options_requested_policy_version = Some(new_value);
12044        self
12045    }
12046    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12047    /// while executing the actual API request.
12048    ///
12049    /// ````text
12050    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12051    /// ````
12052    ///
12053    /// Sets the *delegate* property to the given value.
12054    pub fn delegate(
12055        mut self,
12056        new_value: &'a mut dyn common::Delegate,
12057    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
12058        self._delegate = Some(new_value);
12059        self
12060    }
12061
12062    /// Set any additional parameter of the query string used in the request.
12063    /// It should be used to set parameters which are not yet available through their own
12064    /// setters.
12065    ///
12066    /// Please note that this method must not be used to set any of the known parameters
12067    /// which have their own setter method. If done anyway, the request will fail.
12068    ///
12069    /// # Additional Parameters
12070    ///
12071    /// * *$.xgafv* (query-string) - V1 error format.
12072    /// * *access_token* (query-string) - OAuth access token.
12073    /// * *alt* (query-string) - Data format for response.
12074    /// * *callback* (query-string) - JSONP
12075    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12076    /// * *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.
12077    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12078    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12079    /// * *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.
12080    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12081    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12082    pub fn param<T>(
12083        mut self,
12084        name: T,
12085        value: T,
12086    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
12087    where
12088        T: AsRef<str>,
12089    {
12090        self._additional_params
12091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12092        self
12093    }
12094
12095    /// Identifies the authorization scope for the method you are building.
12096    ///
12097    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12098    /// [`Scope::CloudPlatform`].
12099    ///
12100    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12101    /// tokens for more than one scope.
12102    ///
12103    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12104    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12105    /// sufficient, a read-write scope will do as well.
12106    pub fn add_scope<St>(
12107        mut self,
12108        scope: St,
12109    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
12110    where
12111        St: AsRef<str>,
12112    {
12113        self._scopes.insert(String::from(scope.as_ref()));
12114        self
12115    }
12116    /// Identifies the authorization scope(s) for the method you are building.
12117    ///
12118    /// See [`Self::add_scope()`] for details.
12119    pub fn add_scopes<I, St>(
12120        mut self,
12121        scopes: I,
12122    ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
12123    where
12124        I: IntoIterator<Item = St>,
12125        St: AsRef<str>,
12126    {
12127        self._scopes
12128            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12129        self
12130    }
12131
12132    /// Removes all scopes, and no default scope will be used either.
12133    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12134    /// for details).
12135    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
12136        self._scopes.clear();
12137        self
12138    }
12139}
12140
12141/// Lists conversion workspaces in a given project and location.
12142///
12143/// A builder for the *locations.conversionWorkspaces.list* method supported by a *project* resource.
12144/// It is not used directly, but through a [`ProjectMethods`] instance.
12145///
12146/// # Example
12147///
12148/// Instantiate a resource method builder
12149///
12150/// ```test_harness,no_run
12151/// # extern crate hyper;
12152/// # extern crate hyper_rustls;
12153/// # extern crate google_datamigration1 as datamigration1;
12154/// # async fn dox() {
12155/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12156///
12157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12158/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12159/// #     secret,
12160/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12161/// # ).build().await.unwrap();
12162///
12163/// # let client = hyper_util::client::legacy::Client::builder(
12164/// #     hyper_util::rt::TokioExecutor::new()
12165/// # )
12166/// # .build(
12167/// #     hyper_rustls::HttpsConnectorBuilder::new()
12168/// #         .with_native_roots()
12169/// #         .unwrap()
12170/// #         .https_or_http()
12171/// #         .enable_http1()
12172/// #         .build()
12173/// # );
12174/// # let mut hub = DatabaseMigrationService::new(client, auth);
12175/// // You can configure optional parameters by calling the respective setters at will, and
12176/// // execute the final call using `doit()`.
12177/// // Values shown here are possibly random and not representative !
12178/// let result = hub.projects().locations_conversion_workspaces_list("parent")
12179///              .page_token("takimata")
12180///              .page_size(-19)
12181///              .filter("gubergren")
12182///              .doit().await;
12183/// # }
12184/// ```
12185pub struct ProjectLocationConversionWorkspaceListCall<'a, C>
12186where
12187    C: 'a,
12188{
12189    hub: &'a DatabaseMigrationService<C>,
12190    _parent: String,
12191    _page_token: Option<String>,
12192    _page_size: Option<i32>,
12193    _filter: Option<String>,
12194    _delegate: Option<&'a mut dyn common::Delegate>,
12195    _additional_params: HashMap<String, String>,
12196    _scopes: BTreeSet<String>,
12197}
12198
12199impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceListCall<'a, C> {}
12200
12201impl<'a, C> ProjectLocationConversionWorkspaceListCall<'a, C>
12202where
12203    C: common::Connector,
12204{
12205    /// Perform the operation you have build so far.
12206    pub async fn doit(
12207        mut self,
12208    ) -> common::Result<(common::Response, ListConversionWorkspacesResponse)> {
12209        use std::borrow::Cow;
12210        use std::io::{Read, Seek};
12211
12212        use common::{url::Params, ToParts};
12213        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12214
12215        let mut dd = common::DefaultDelegate;
12216        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12217        dlg.begin(common::MethodInfo {
12218            id: "datamigration.projects.locations.conversionWorkspaces.list",
12219            http_method: hyper::Method::GET,
12220        });
12221
12222        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
12223            if self._additional_params.contains_key(field) {
12224                dlg.finished(false);
12225                return Err(common::Error::FieldClash(field));
12226            }
12227        }
12228
12229        let mut params = Params::with_capacity(6 + self._additional_params.len());
12230        params.push("parent", self._parent);
12231        if let Some(value) = self._page_token.as_ref() {
12232            params.push("pageToken", value);
12233        }
12234        if let Some(value) = self._page_size.as_ref() {
12235            params.push("pageSize", value.to_string());
12236        }
12237        if let Some(value) = self._filter.as_ref() {
12238            params.push("filter", value);
12239        }
12240
12241        params.extend(self._additional_params.iter());
12242
12243        params.push("alt", "json");
12244        let mut url = self.hub._base_url.clone() + "v1/{+parent}/conversionWorkspaces";
12245        if self._scopes.is_empty() {
12246            self._scopes
12247                .insert(Scope::CloudPlatform.as_ref().to_string());
12248        }
12249
12250        #[allow(clippy::single_element_loop)]
12251        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12252            url = params.uri_replacement(url, param_name, find_this, true);
12253        }
12254        {
12255            let to_remove = ["parent"];
12256            params.remove_params(&to_remove);
12257        }
12258
12259        let url = params.parse_with_url(&url);
12260
12261        loop {
12262            let token = match self
12263                .hub
12264                .auth
12265                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12266                .await
12267            {
12268                Ok(token) => token,
12269                Err(e) => match dlg.token(e) {
12270                    Ok(token) => token,
12271                    Err(e) => {
12272                        dlg.finished(false);
12273                        return Err(common::Error::MissingToken(e));
12274                    }
12275                },
12276            };
12277            let mut req_result = {
12278                let client = &self.hub.client;
12279                dlg.pre_request();
12280                let mut req_builder = hyper::Request::builder()
12281                    .method(hyper::Method::GET)
12282                    .uri(url.as_str())
12283                    .header(USER_AGENT, self.hub._user_agent.clone());
12284
12285                if let Some(token) = token.as_ref() {
12286                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12287                }
12288
12289                let request = req_builder
12290                    .header(CONTENT_LENGTH, 0_u64)
12291                    .body(common::to_body::<String>(None));
12292
12293                client.request(request.unwrap()).await
12294            };
12295
12296            match req_result {
12297                Err(err) => {
12298                    if let common::Retry::After(d) = dlg.http_error(&err) {
12299                        sleep(d).await;
12300                        continue;
12301                    }
12302                    dlg.finished(false);
12303                    return Err(common::Error::HttpError(err));
12304                }
12305                Ok(res) => {
12306                    let (mut parts, body) = res.into_parts();
12307                    let mut body = common::Body::new(body);
12308                    if !parts.status.is_success() {
12309                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12310                        let error = serde_json::from_str(&common::to_string(&bytes));
12311                        let response = common::to_response(parts, bytes.into());
12312
12313                        if let common::Retry::After(d) =
12314                            dlg.http_failure(&response, error.as_ref().ok())
12315                        {
12316                            sleep(d).await;
12317                            continue;
12318                        }
12319
12320                        dlg.finished(false);
12321
12322                        return Err(match error {
12323                            Ok(value) => common::Error::BadRequest(value),
12324                            _ => common::Error::Failure(response),
12325                        });
12326                    }
12327                    let response = {
12328                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12329                        let encoded = common::to_string(&bytes);
12330                        match serde_json::from_str(&encoded) {
12331                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12332                            Err(error) => {
12333                                dlg.response_json_decode_error(&encoded, &error);
12334                                return Err(common::Error::JsonDecodeError(
12335                                    encoded.to_string(),
12336                                    error,
12337                                ));
12338                            }
12339                        }
12340                    };
12341
12342                    dlg.finished(true);
12343                    return Ok(response);
12344                }
12345            }
12346        }
12347    }
12348
12349    /// Required. The parent which owns this collection of conversion workspaces.
12350    ///
12351    /// Sets the *parent* path property to the given value.
12352    ///
12353    /// Even though the property as already been set when instantiating this call,
12354    /// we provide this method for API completeness.
12355    pub fn parent(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12356        self._parent = new_value.to_string();
12357        self
12358    }
12359    /// The nextPageToken value received in the previous call to conversionWorkspaces.list, used in the subsequent request to retrieve the next page of results. On first call this should be left blank. When paginating, all other parameters provided to conversionWorkspaces.list must match the call that provided the page token.
12360    ///
12361    /// Sets the *page token* query property to the given value.
12362    pub fn page_token(
12363        mut self,
12364        new_value: &str,
12365    ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12366        self._page_token = Some(new_value.to_string());
12367        self
12368    }
12369    /// The maximum number of conversion workspaces to return. The service may return fewer than this value. If unspecified, at most 50 sets are returned.
12370    ///
12371    /// Sets the *page size* query property to the given value.
12372    pub fn page_size(
12373        mut self,
12374        new_value: i32,
12375    ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12376        self._page_size = Some(new_value);
12377        self
12378    }
12379    /// A filter expression that filters conversion workspaces listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list conversion workspaces created this year by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z.** You can also filter nested fields. For example, you could specify **source.version = "12.c.1"** to select all conversion workspaces with source database version equal to 12.c.1.
12380    ///
12381    /// Sets the *filter* query property to the given value.
12382    pub fn filter(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12383        self._filter = Some(new_value.to_string());
12384        self
12385    }
12386    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12387    /// while executing the actual API request.
12388    ///
12389    /// ````text
12390    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12391    /// ````
12392    ///
12393    /// Sets the *delegate* property to the given value.
12394    pub fn delegate(
12395        mut self,
12396        new_value: &'a mut dyn common::Delegate,
12397    ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12398        self._delegate = Some(new_value);
12399        self
12400    }
12401
12402    /// Set any additional parameter of the query string used in the request.
12403    /// It should be used to set parameters which are not yet available through their own
12404    /// setters.
12405    ///
12406    /// Please note that this method must not be used to set any of the known parameters
12407    /// which have their own setter method. If done anyway, the request will fail.
12408    ///
12409    /// # Additional Parameters
12410    ///
12411    /// * *$.xgafv* (query-string) - V1 error format.
12412    /// * *access_token* (query-string) - OAuth access token.
12413    /// * *alt* (query-string) - Data format for response.
12414    /// * *callback* (query-string) - JSONP
12415    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12416    /// * *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.
12417    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12418    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12419    /// * *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.
12420    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12421    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12422    pub fn param<T>(
12423        mut self,
12424        name: T,
12425        value: T,
12426    ) -> ProjectLocationConversionWorkspaceListCall<'a, C>
12427    where
12428        T: AsRef<str>,
12429    {
12430        self._additional_params
12431            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12432        self
12433    }
12434
12435    /// Identifies the authorization scope for the method you are building.
12436    ///
12437    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12438    /// [`Scope::CloudPlatform`].
12439    ///
12440    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12441    /// tokens for more than one scope.
12442    ///
12443    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12444    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12445    /// sufficient, a read-write scope will do as well.
12446    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceListCall<'a, C>
12447    where
12448        St: AsRef<str>,
12449    {
12450        self._scopes.insert(String::from(scope.as_ref()));
12451        self
12452    }
12453    /// Identifies the authorization scope(s) for the method you are building.
12454    ///
12455    /// See [`Self::add_scope()`] for details.
12456    pub fn add_scopes<I, St>(
12457        mut self,
12458        scopes: I,
12459    ) -> ProjectLocationConversionWorkspaceListCall<'a, C>
12460    where
12461        I: IntoIterator<Item = St>,
12462        St: AsRef<str>,
12463    {
12464        self._scopes
12465            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12466        self
12467    }
12468
12469    /// Removes all scopes, and no default scope will be used either.
12470    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12471    /// for details).
12472    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
12473        self._scopes.clear();
12474        self
12475    }
12476}
12477
12478/// Updates the parameters of a single conversion workspace.
12479///
12480/// A builder for the *locations.conversionWorkspaces.patch* method supported by a *project* resource.
12481/// It is not used directly, but through a [`ProjectMethods`] instance.
12482///
12483/// # Example
12484///
12485/// Instantiate a resource method builder
12486///
12487/// ```test_harness,no_run
12488/// # extern crate hyper;
12489/// # extern crate hyper_rustls;
12490/// # extern crate google_datamigration1 as datamigration1;
12491/// use datamigration1::api::ConversionWorkspace;
12492/// # async fn dox() {
12493/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12494///
12495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12496/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12497/// #     secret,
12498/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12499/// # ).build().await.unwrap();
12500///
12501/// # let client = hyper_util::client::legacy::Client::builder(
12502/// #     hyper_util::rt::TokioExecutor::new()
12503/// # )
12504/// # .build(
12505/// #     hyper_rustls::HttpsConnectorBuilder::new()
12506/// #         .with_native_roots()
12507/// #         .unwrap()
12508/// #         .https_or_http()
12509/// #         .enable_http1()
12510/// #         .build()
12511/// # );
12512/// # let mut hub = DatabaseMigrationService::new(client, auth);
12513/// // As the method needs a request, you would usually fill it with the desired information
12514/// // into the respective structure. Some of the parts shown here might not be applicable !
12515/// // Values shown here are possibly random and not representative !
12516/// let mut req = ConversionWorkspace::default();
12517///
12518/// // You can configure optional parameters by calling the respective setters at will, and
12519/// // execute the final call using `doit()`.
12520/// // Values shown here are possibly random and not representative !
12521/// let result = hub.projects().locations_conversion_workspaces_patch(req, "name")
12522///              .update_mask(FieldMask::new::<&str>(&[]))
12523///              .request_id("accusam")
12524///              .doit().await;
12525/// # }
12526/// ```
12527pub struct ProjectLocationConversionWorkspacePatchCall<'a, C>
12528where
12529    C: 'a,
12530{
12531    hub: &'a DatabaseMigrationService<C>,
12532    _request: ConversionWorkspace,
12533    _name: String,
12534    _update_mask: Option<common::FieldMask>,
12535    _request_id: Option<String>,
12536    _delegate: Option<&'a mut dyn common::Delegate>,
12537    _additional_params: HashMap<String, String>,
12538    _scopes: BTreeSet<String>,
12539}
12540
12541impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspacePatchCall<'a, C> {}
12542
12543impl<'a, C> ProjectLocationConversionWorkspacePatchCall<'a, C>
12544where
12545    C: common::Connector,
12546{
12547    /// Perform the operation you have build so far.
12548    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12549        use std::borrow::Cow;
12550        use std::io::{Read, Seek};
12551
12552        use common::{url::Params, ToParts};
12553        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12554
12555        let mut dd = common::DefaultDelegate;
12556        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12557        dlg.begin(common::MethodInfo {
12558            id: "datamigration.projects.locations.conversionWorkspaces.patch",
12559            http_method: hyper::Method::PATCH,
12560        });
12561
12562        for &field in ["alt", "name", "updateMask", "requestId"].iter() {
12563            if self._additional_params.contains_key(field) {
12564                dlg.finished(false);
12565                return Err(common::Error::FieldClash(field));
12566            }
12567        }
12568
12569        let mut params = Params::with_capacity(6 + self._additional_params.len());
12570        params.push("name", self._name);
12571        if let Some(value) = self._update_mask.as_ref() {
12572            params.push("updateMask", value.to_string());
12573        }
12574        if let Some(value) = self._request_id.as_ref() {
12575            params.push("requestId", value);
12576        }
12577
12578        params.extend(self._additional_params.iter());
12579
12580        params.push("alt", "json");
12581        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12582        if self._scopes.is_empty() {
12583            self._scopes
12584                .insert(Scope::CloudPlatform.as_ref().to_string());
12585        }
12586
12587        #[allow(clippy::single_element_loop)]
12588        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12589            url = params.uri_replacement(url, param_name, find_this, true);
12590        }
12591        {
12592            let to_remove = ["name"];
12593            params.remove_params(&to_remove);
12594        }
12595
12596        let url = params.parse_with_url(&url);
12597
12598        let mut json_mime_type = mime::APPLICATION_JSON;
12599        let mut request_value_reader = {
12600            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12601            common::remove_json_null_values(&mut value);
12602            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12603            serde_json::to_writer(&mut dst, &value).unwrap();
12604            dst
12605        };
12606        let request_size = request_value_reader
12607            .seek(std::io::SeekFrom::End(0))
12608            .unwrap();
12609        request_value_reader
12610            .seek(std::io::SeekFrom::Start(0))
12611            .unwrap();
12612
12613        loop {
12614            let token = match self
12615                .hub
12616                .auth
12617                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12618                .await
12619            {
12620                Ok(token) => token,
12621                Err(e) => match dlg.token(e) {
12622                    Ok(token) => token,
12623                    Err(e) => {
12624                        dlg.finished(false);
12625                        return Err(common::Error::MissingToken(e));
12626                    }
12627                },
12628            };
12629            request_value_reader
12630                .seek(std::io::SeekFrom::Start(0))
12631                .unwrap();
12632            let mut req_result = {
12633                let client = &self.hub.client;
12634                dlg.pre_request();
12635                let mut req_builder = hyper::Request::builder()
12636                    .method(hyper::Method::PATCH)
12637                    .uri(url.as_str())
12638                    .header(USER_AGENT, self.hub._user_agent.clone());
12639
12640                if let Some(token) = token.as_ref() {
12641                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12642                }
12643
12644                let request = req_builder
12645                    .header(CONTENT_TYPE, json_mime_type.to_string())
12646                    .header(CONTENT_LENGTH, request_size as u64)
12647                    .body(common::to_body(
12648                        request_value_reader.get_ref().clone().into(),
12649                    ));
12650
12651                client.request(request.unwrap()).await
12652            };
12653
12654            match req_result {
12655                Err(err) => {
12656                    if let common::Retry::After(d) = dlg.http_error(&err) {
12657                        sleep(d).await;
12658                        continue;
12659                    }
12660                    dlg.finished(false);
12661                    return Err(common::Error::HttpError(err));
12662                }
12663                Ok(res) => {
12664                    let (mut parts, body) = res.into_parts();
12665                    let mut body = common::Body::new(body);
12666                    if !parts.status.is_success() {
12667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12668                        let error = serde_json::from_str(&common::to_string(&bytes));
12669                        let response = common::to_response(parts, bytes.into());
12670
12671                        if let common::Retry::After(d) =
12672                            dlg.http_failure(&response, error.as_ref().ok())
12673                        {
12674                            sleep(d).await;
12675                            continue;
12676                        }
12677
12678                        dlg.finished(false);
12679
12680                        return Err(match error {
12681                            Ok(value) => common::Error::BadRequest(value),
12682                            _ => common::Error::Failure(response),
12683                        });
12684                    }
12685                    let response = {
12686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12687                        let encoded = common::to_string(&bytes);
12688                        match serde_json::from_str(&encoded) {
12689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12690                            Err(error) => {
12691                                dlg.response_json_decode_error(&encoded, &error);
12692                                return Err(common::Error::JsonDecodeError(
12693                                    encoded.to_string(),
12694                                    error,
12695                                ));
12696                            }
12697                        }
12698                    };
12699
12700                    dlg.finished(true);
12701                    return Ok(response);
12702                }
12703            }
12704        }
12705    }
12706
12707    ///
12708    /// Sets the *request* property to the given value.
12709    ///
12710    /// Even though the property as already been set when instantiating this call,
12711    /// we provide this method for API completeness.
12712    pub fn request(
12713        mut self,
12714        new_value: ConversionWorkspace,
12715    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12716        self._request = new_value;
12717        self
12718    }
12719    /// Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
12720    ///
12721    /// Sets the *name* path property to the given value.
12722    ///
12723    /// Even though the property as already been set when instantiating this call,
12724    /// we provide this method for API completeness.
12725    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12726        self._name = new_value.to_string();
12727        self
12728    }
12729    /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
12730    ///
12731    /// Sets the *update mask* query property to the given value.
12732    pub fn update_mask(
12733        mut self,
12734        new_value: common::FieldMask,
12735    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12736        self._update_mask = Some(new_value);
12737        self
12738    }
12739    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
12740    ///
12741    /// Sets the *request id* query property to the given value.
12742    pub fn request_id(
12743        mut self,
12744        new_value: &str,
12745    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12746        self._request_id = Some(new_value.to_string());
12747        self
12748    }
12749    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12750    /// while executing the actual API request.
12751    ///
12752    /// ````text
12753    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12754    /// ````
12755    ///
12756    /// Sets the *delegate* property to the given value.
12757    pub fn delegate(
12758        mut self,
12759        new_value: &'a mut dyn common::Delegate,
12760    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12761        self._delegate = Some(new_value);
12762        self
12763    }
12764
12765    /// Set any additional parameter of the query string used in the request.
12766    /// It should be used to set parameters which are not yet available through their own
12767    /// setters.
12768    ///
12769    /// Please note that this method must not be used to set any of the known parameters
12770    /// which have their own setter method. If done anyway, the request will fail.
12771    ///
12772    /// # Additional Parameters
12773    ///
12774    /// * *$.xgafv* (query-string) - V1 error format.
12775    /// * *access_token* (query-string) - OAuth access token.
12776    /// * *alt* (query-string) - Data format for response.
12777    /// * *callback* (query-string) - JSONP
12778    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12779    /// * *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.
12780    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12781    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12782    /// * *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.
12783    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12784    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12785    pub fn param<T>(
12786        mut self,
12787        name: T,
12788        value: T,
12789    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
12790    where
12791        T: AsRef<str>,
12792    {
12793        self._additional_params
12794            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12795        self
12796    }
12797
12798    /// Identifies the authorization scope for the method you are building.
12799    ///
12800    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12801    /// [`Scope::CloudPlatform`].
12802    ///
12803    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12804    /// tokens for more than one scope.
12805    ///
12806    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12807    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12808    /// sufficient, a read-write scope will do as well.
12809    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
12810    where
12811        St: AsRef<str>,
12812    {
12813        self._scopes.insert(String::from(scope.as_ref()));
12814        self
12815    }
12816    /// Identifies the authorization scope(s) for the method you are building.
12817    ///
12818    /// See [`Self::add_scope()`] for details.
12819    pub fn add_scopes<I, St>(
12820        mut self,
12821        scopes: I,
12822    ) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
12823    where
12824        I: IntoIterator<Item = St>,
12825        St: AsRef<str>,
12826    {
12827        self._scopes
12828            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12829        self
12830    }
12831
12832    /// Removes all scopes, and no default scope will be used either.
12833    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12834    /// for details).
12835    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
12836        self._scopes.clear();
12837        self
12838    }
12839}
12840
12841/// Rolls back a conversion workspace to the last committed snapshot.
12842///
12843/// A builder for the *locations.conversionWorkspaces.rollback* method supported by a *project* resource.
12844/// It is not used directly, but through a [`ProjectMethods`] instance.
12845///
12846/// # Example
12847///
12848/// Instantiate a resource method builder
12849///
12850/// ```test_harness,no_run
12851/// # extern crate hyper;
12852/// # extern crate hyper_rustls;
12853/// # extern crate google_datamigration1 as datamigration1;
12854/// use datamigration1::api::RollbackConversionWorkspaceRequest;
12855/// # async fn dox() {
12856/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12857///
12858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12860/// #     secret,
12861/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12862/// # ).build().await.unwrap();
12863///
12864/// # let client = hyper_util::client::legacy::Client::builder(
12865/// #     hyper_util::rt::TokioExecutor::new()
12866/// # )
12867/// # .build(
12868/// #     hyper_rustls::HttpsConnectorBuilder::new()
12869/// #         .with_native_roots()
12870/// #         .unwrap()
12871/// #         .https_or_http()
12872/// #         .enable_http1()
12873/// #         .build()
12874/// # );
12875/// # let mut hub = DatabaseMigrationService::new(client, auth);
12876/// // As the method needs a request, you would usually fill it with the desired information
12877/// // into the respective structure. Some of the parts shown here might not be applicable !
12878/// // Values shown here are possibly random and not representative !
12879/// let mut req = RollbackConversionWorkspaceRequest::default();
12880///
12881/// // You can configure optional parameters by calling the respective setters at will, and
12882/// // execute the final call using `doit()`.
12883/// // Values shown here are possibly random and not representative !
12884/// let result = hub.projects().locations_conversion_workspaces_rollback(req, "name")
12885///              .doit().await;
12886/// # }
12887/// ```
12888pub struct ProjectLocationConversionWorkspaceRollbackCall<'a, C>
12889where
12890    C: 'a,
12891{
12892    hub: &'a DatabaseMigrationService<C>,
12893    _request: RollbackConversionWorkspaceRequest,
12894    _name: String,
12895    _delegate: Option<&'a mut dyn common::Delegate>,
12896    _additional_params: HashMap<String, String>,
12897    _scopes: BTreeSet<String>,
12898}
12899
12900impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceRollbackCall<'a, C> {}
12901
12902impl<'a, C> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
12903where
12904    C: common::Connector,
12905{
12906    /// Perform the operation you have build so far.
12907    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12908        use std::borrow::Cow;
12909        use std::io::{Read, Seek};
12910
12911        use common::{url::Params, ToParts};
12912        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12913
12914        let mut dd = common::DefaultDelegate;
12915        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12916        dlg.begin(common::MethodInfo {
12917            id: "datamigration.projects.locations.conversionWorkspaces.rollback",
12918            http_method: hyper::Method::POST,
12919        });
12920
12921        for &field in ["alt", "name"].iter() {
12922            if self._additional_params.contains_key(field) {
12923                dlg.finished(false);
12924                return Err(common::Error::FieldClash(field));
12925            }
12926        }
12927
12928        let mut params = Params::with_capacity(4 + self._additional_params.len());
12929        params.push("name", self._name);
12930
12931        params.extend(self._additional_params.iter());
12932
12933        params.push("alt", "json");
12934        let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
12935        if self._scopes.is_empty() {
12936            self._scopes
12937                .insert(Scope::CloudPlatform.as_ref().to_string());
12938        }
12939
12940        #[allow(clippy::single_element_loop)]
12941        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12942            url = params.uri_replacement(url, param_name, find_this, true);
12943        }
12944        {
12945            let to_remove = ["name"];
12946            params.remove_params(&to_remove);
12947        }
12948
12949        let url = params.parse_with_url(&url);
12950
12951        let mut json_mime_type = mime::APPLICATION_JSON;
12952        let mut request_value_reader = {
12953            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12954            common::remove_json_null_values(&mut value);
12955            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12956            serde_json::to_writer(&mut dst, &value).unwrap();
12957            dst
12958        };
12959        let request_size = request_value_reader
12960            .seek(std::io::SeekFrom::End(0))
12961            .unwrap();
12962        request_value_reader
12963            .seek(std::io::SeekFrom::Start(0))
12964            .unwrap();
12965
12966        loop {
12967            let token = match self
12968                .hub
12969                .auth
12970                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12971                .await
12972            {
12973                Ok(token) => token,
12974                Err(e) => match dlg.token(e) {
12975                    Ok(token) => token,
12976                    Err(e) => {
12977                        dlg.finished(false);
12978                        return Err(common::Error::MissingToken(e));
12979                    }
12980                },
12981            };
12982            request_value_reader
12983                .seek(std::io::SeekFrom::Start(0))
12984                .unwrap();
12985            let mut req_result = {
12986                let client = &self.hub.client;
12987                dlg.pre_request();
12988                let mut req_builder = hyper::Request::builder()
12989                    .method(hyper::Method::POST)
12990                    .uri(url.as_str())
12991                    .header(USER_AGENT, self.hub._user_agent.clone());
12992
12993                if let Some(token) = token.as_ref() {
12994                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12995                }
12996
12997                let request = req_builder
12998                    .header(CONTENT_TYPE, json_mime_type.to_string())
12999                    .header(CONTENT_LENGTH, request_size as u64)
13000                    .body(common::to_body(
13001                        request_value_reader.get_ref().clone().into(),
13002                    ));
13003
13004                client.request(request.unwrap()).await
13005            };
13006
13007            match req_result {
13008                Err(err) => {
13009                    if let common::Retry::After(d) = dlg.http_error(&err) {
13010                        sleep(d).await;
13011                        continue;
13012                    }
13013                    dlg.finished(false);
13014                    return Err(common::Error::HttpError(err));
13015                }
13016                Ok(res) => {
13017                    let (mut parts, body) = res.into_parts();
13018                    let mut body = common::Body::new(body);
13019                    if !parts.status.is_success() {
13020                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13021                        let error = serde_json::from_str(&common::to_string(&bytes));
13022                        let response = common::to_response(parts, bytes.into());
13023
13024                        if let common::Retry::After(d) =
13025                            dlg.http_failure(&response, error.as_ref().ok())
13026                        {
13027                            sleep(d).await;
13028                            continue;
13029                        }
13030
13031                        dlg.finished(false);
13032
13033                        return Err(match error {
13034                            Ok(value) => common::Error::BadRequest(value),
13035                            _ => common::Error::Failure(response),
13036                        });
13037                    }
13038                    let response = {
13039                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13040                        let encoded = common::to_string(&bytes);
13041                        match serde_json::from_str(&encoded) {
13042                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13043                            Err(error) => {
13044                                dlg.response_json_decode_error(&encoded, &error);
13045                                return Err(common::Error::JsonDecodeError(
13046                                    encoded.to_string(),
13047                                    error,
13048                                ));
13049                            }
13050                        }
13051                    };
13052
13053                    dlg.finished(true);
13054                    return Ok(response);
13055                }
13056            }
13057        }
13058    }
13059
13060    ///
13061    /// Sets the *request* property to the given value.
13062    ///
13063    /// Even though the property as already been set when instantiating this call,
13064    /// we provide this method for API completeness.
13065    pub fn request(
13066        mut self,
13067        new_value: RollbackConversionWorkspaceRequest,
13068    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
13069        self._request = new_value;
13070        self
13071    }
13072    /// Required. Name of the conversion workspace resource to roll back to.
13073    ///
13074    /// Sets the *name* path property to the given value.
13075    ///
13076    /// Even though the property as already been set when instantiating this call,
13077    /// we provide this method for API completeness.
13078    pub fn name(
13079        mut self,
13080        new_value: &str,
13081    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
13082        self._name = new_value.to_string();
13083        self
13084    }
13085    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13086    /// while executing the actual API request.
13087    ///
13088    /// ````text
13089    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13090    /// ````
13091    ///
13092    /// Sets the *delegate* property to the given value.
13093    pub fn delegate(
13094        mut self,
13095        new_value: &'a mut dyn common::Delegate,
13096    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
13097        self._delegate = Some(new_value);
13098        self
13099    }
13100
13101    /// Set any additional parameter of the query string used in the request.
13102    /// It should be used to set parameters which are not yet available through their own
13103    /// setters.
13104    ///
13105    /// Please note that this method must not be used to set any of the known parameters
13106    /// which have their own setter method. If done anyway, the request will fail.
13107    ///
13108    /// # Additional Parameters
13109    ///
13110    /// * *$.xgafv* (query-string) - V1 error format.
13111    /// * *access_token* (query-string) - OAuth access token.
13112    /// * *alt* (query-string) - Data format for response.
13113    /// * *callback* (query-string) - JSONP
13114    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13115    /// * *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.
13116    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13117    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13118    /// * *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.
13119    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13120    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13121    pub fn param<T>(
13122        mut self,
13123        name: T,
13124        value: T,
13125    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
13126    where
13127        T: AsRef<str>,
13128    {
13129        self._additional_params
13130            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13131        self
13132    }
13133
13134    /// Identifies the authorization scope for the method you are building.
13135    ///
13136    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13137    /// [`Scope::CloudPlatform`].
13138    ///
13139    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13140    /// tokens for more than one scope.
13141    ///
13142    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13143    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13144    /// sufficient, a read-write scope will do as well.
13145    pub fn add_scope<St>(
13146        mut self,
13147        scope: St,
13148    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
13149    where
13150        St: AsRef<str>,
13151    {
13152        self._scopes.insert(String::from(scope.as_ref()));
13153        self
13154    }
13155    /// Identifies the authorization scope(s) for the method you are building.
13156    ///
13157    /// See [`Self::add_scope()`] for details.
13158    pub fn add_scopes<I, St>(
13159        mut self,
13160        scopes: I,
13161    ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
13162    where
13163        I: IntoIterator<Item = St>,
13164        St: AsRef<str>,
13165    {
13166        self._scopes
13167            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13168        self
13169    }
13170
13171    /// Removes all scopes, and no default scope will be used either.
13172    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13173    /// for details).
13174    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
13175        self._scopes.clear();
13176        self
13177    }
13178}
13179
13180/// Searches/lists the background jobs for a specific conversion workspace. The background jobs are not resources like conversion workspaces or mapping rules, and they can't be created, updated or deleted. Instead, they are a way to expose the data plane jobs log.
13181///
13182/// A builder for the *locations.conversionWorkspaces.searchBackgroundJobs* method supported by a *project* resource.
13183/// It is not used directly, but through a [`ProjectMethods`] instance.
13184///
13185/// # Example
13186///
13187/// Instantiate a resource method builder
13188///
13189/// ```test_harness,no_run
13190/// # extern crate hyper;
13191/// # extern crate hyper_rustls;
13192/// # extern crate google_datamigration1 as datamigration1;
13193/// # async fn dox() {
13194/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13195///
13196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13197/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13198/// #     secret,
13199/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13200/// # ).build().await.unwrap();
13201///
13202/// # let client = hyper_util::client::legacy::Client::builder(
13203/// #     hyper_util::rt::TokioExecutor::new()
13204/// # )
13205/// # .build(
13206/// #     hyper_rustls::HttpsConnectorBuilder::new()
13207/// #         .with_native_roots()
13208/// #         .unwrap()
13209/// #         .https_or_http()
13210/// #         .enable_http1()
13211/// #         .build()
13212/// # );
13213/// # let mut hub = DatabaseMigrationService::new(client, auth);
13214/// // You can configure optional parameters by calling the respective setters at will, and
13215/// // execute the final call using `doit()`.
13216/// // Values shown here are possibly random and not representative !
13217/// let result = hub.projects().locations_conversion_workspaces_search_background_jobs("conversionWorkspace")
13218///              .return_most_recent_per_job_type(false)
13219///              .max_size(-2)
13220///              .completed_until_time(chrono::Utc::now())
13221///              .doit().await;
13222/// # }
13223/// ```
13224pub struct ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13225where
13226    C: 'a,
13227{
13228    hub: &'a DatabaseMigrationService<C>,
13229    _conversion_workspace: String,
13230    _return_most_recent_per_job_type: Option<bool>,
13231    _max_size: Option<i32>,
13232    _completed_until_time: Option<chrono::DateTime<chrono::offset::Utc>>,
13233    _delegate: Option<&'a mut dyn common::Delegate>,
13234    _additional_params: HashMap<String, String>,
13235    _scopes: BTreeSet<String>,
13236}
13237
13238impl<'a, C> common::CallBuilder
13239    for ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13240{
13241}
13242
13243impl<'a, C> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13244where
13245    C: common::Connector,
13246{
13247    /// Perform the operation you have build so far.
13248    pub async fn doit(
13249        mut self,
13250    ) -> common::Result<(common::Response, SearchBackgroundJobsResponse)> {
13251        use std::borrow::Cow;
13252        use std::io::{Read, Seek};
13253
13254        use common::{url::Params, ToParts};
13255        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13256
13257        let mut dd = common::DefaultDelegate;
13258        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13259        dlg.begin(common::MethodInfo {
13260            id: "datamigration.projects.locations.conversionWorkspaces.searchBackgroundJobs",
13261            http_method: hyper::Method::GET,
13262        });
13263
13264        for &field in [
13265            "alt",
13266            "conversionWorkspace",
13267            "returnMostRecentPerJobType",
13268            "maxSize",
13269            "completedUntilTime",
13270        ]
13271        .iter()
13272        {
13273            if self._additional_params.contains_key(field) {
13274                dlg.finished(false);
13275                return Err(common::Error::FieldClash(field));
13276            }
13277        }
13278
13279        let mut params = Params::with_capacity(6 + self._additional_params.len());
13280        params.push("conversionWorkspace", self._conversion_workspace);
13281        if let Some(value) = self._return_most_recent_per_job_type.as_ref() {
13282            params.push("returnMostRecentPerJobType", value.to_string());
13283        }
13284        if let Some(value) = self._max_size.as_ref() {
13285            params.push("maxSize", value.to_string());
13286        }
13287        if let Some(value) = self._completed_until_time.as_ref() {
13288            params.push(
13289                "completedUntilTime",
13290                common::serde::datetime_to_string(&value),
13291            );
13292        }
13293
13294        params.extend(self._additional_params.iter());
13295
13296        params.push("alt", "json");
13297        let mut url = self.hub._base_url.clone() + "v1/{+conversionWorkspace}:searchBackgroundJobs";
13298        if self._scopes.is_empty() {
13299            self._scopes
13300                .insert(Scope::CloudPlatform.as_ref().to_string());
13301        }
13302
13303        #[allow(clippy::single_element_loop)]
13304        for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
13305            url = params.uri_replacement(url, param_name, find_this, true);
13306        }
13307        {
13308            let to_remove = ["conversionWorkspace"];
13309            params.remove_params(&to_remove);
13310        }
13311
13312        let url = params.parse_with_url(&url);
13313
13314        loop {
13315            let token = match self
13316                .hub
13317                .auth
13318                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13319                .await
13320            {
13321                Ok(token) => token,
13322                Err(e) => match dlg.token(e) {
13323                    Ok(token) => token,
13324                    Err(e) => {
13325                        dlg.finished(false);
13326                        return Err(common::Error::MissingToken(e));
13327                    }
13328                },
13329            };
13330            let mut req_result = {
13331                let client = &self.hub.client;
13332                dlg.pre_request();
13333                let mut req_builder = hyper::Request::builder()
13334                    .method(hyper::Method::GET)
13335                    .uri(url.as_str())
13336                    .header(USER_AGENT, self.hub._user_agent.clone());
13337
13338                if let Some(token) = token.as_ref() {
13339                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13340                }
13341
13342                let request = req_builder
13343                    .header(CONTENT_LENGTH, 0_u64)
13344                    .body(common::to_body::<String>(None));
13345
13346                client.request(request.unwrap()).await
13347            };
13348
13349            match req_result {
13350                Err(err) => {
13351                    if let common::Retry::After(d) = dlg.http_error(&err) {
13352                        sleep(d).await;
13353                        continue;
13354                    }
13355                    dlg.finished(false);
13356                    return Err(common::Error::HttpError(err));
13357                }
13358                Ok(res) => {
13359                    let (mut parts, body) = res.into_parts();
13360                    let mut body = common::Body::new(body);
13361                    if !parts.status.is_success() {
13362                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13363                        let error = serde_json::from_str(&common::to_string(&bytes));
13364                        let response = common::to_response(parts, bytes.into());
13365
13366                        if let common::Retry::After(d) =
13367                            dlg.http_failure(&response, error.as_ref().ok())
13368                        {
13369                            sleep(d).await;
13370                            continue;
13371                        }
13372
13373                        dlg.finished(false);
13374
13375                        return Err(match error {
13376                            Ok(value) => common::Error::BadRequest(value),
13377                            _ => common::Error::Failure(response),
13378                        });
13379                    }
13380                    let response = {
13381                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13382                        let encoded = common::to_string(&bytes);
13383                        match serde_json::from_str(&encoded) {
13384                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13385                            Err(error) => {
13386                                dlg.response_json_decode_error(&encoded, &error);
13387                                return Err(common::Error::JsonDecodeError(
13388                                    encoded.to_string(),
13389                                    error,
13390                                ));
13391                            }
13392                        }
13393                    };
13394
13395                    dlg.finished(true);
13396                    return Ok(response);
13397                }
13398            }
13399        }
13400    }
13401
13402    /// Required. Name of the conversion workspace resource whose jobs are listed, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
13403    ///
13404    /// Sets the *conversion workspace* path property to the given value.
13405    ///
13406    /// Even though the property as already been set when instantiating this call,
13407    /// we provide this method for API completeness.
13408    pub fn conversion_workspace(
13409        mut self,
13410        new_value: &str,
13411    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13412        self._conversion_workspace = new_value.to_string();
13413        self
13414    }
13415    /// Optional. Whether or not to return just the most recent job per job type,
13416    ///
13417    /// Sets the *return most recent per job type* query property to the given value.
13418    pub fn return_most_recent_per_job_type(
13419        mut self,
13420        new_value: bool,
13421    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13422        self._return_most_recent_per_job_type = Some(new_value);
13423        self
13424    }
13425    /// Optional. The maximum number of jobs to return. The service may return fewer than this value. If unspecified, at most 100 jobs are returned. The maximum value is 100; values above 100 are coerced to 100.
13426    ///
13427    /// Sets the *max size* query property to the given value.
13428    pub fn max_size(
13429        mut self,
13430        new_value: i32,
13431    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13432        self._max_size = Some(new_value);
13433        self
13434    }
13435    /// Optional. If provided, only returns jobs that completed until (not including) the given timestamp.
13436    ///
13437    /// Sets the *completed until time* query property to the given value.
13438    pub fn completed_until_time(
13439        mut self,
13440        new_value: chrono::DateTime<chrono::offset::Utc>,
13441    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13442        self._completed_until_time = Some(new_value);
13443        self
13444    }
13445    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13446    /// while executing the actual API request.
13447    ///
13448    /// ````text
13449    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13450    /// ````
13451    ///
13452    /// Sets the *delegate* property to the given value.
13453    pub fn delegate(
13454        mut self,
13455        new_value: &'a mut dyn common::Delegate,
13456    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13457        self._delegate = Some(new_value);
13458        self
13459    }
13460
13461    /// Set any additional parameter of the query string used in the request.
13462    /// It should be used to set parameters which are not yet available through their own
13463    /// setters.
13464    ///
13465    /// Please note that this method must not be used to set any of the known parameters
13466    /// which have their own setter method. If done anyway, the request will fail.
13467    ///
13468    /// # Additional Parameters
13469    ///
13470    /// * *$.xgafv* (query-string) - V1 error format.
13471    /// * *access_token* (query-string) - OAuth access token.
13472    /// * *alt* (query-string) - Data format for response.
13473    /// * *callback* (query-string) - JSONP
13474    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13475    /// * *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.
13476    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13477    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13478    /// * *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.
13479    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13480    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13481    pub fn param<T>(
13482        mut self,
13483        name: T,
13484        value: T,
13485    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13486    where
13487        T: AsRef<str>,
13488    {
13489        self._additional_params
13490            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13491        self
13492    }
13493
13494    /// Identifies the authorization scope for the method you are building.
13495    ///
13496    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13497    /// [`Scope::CloudPlatform`].
13498    ///
13499    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13500    /// tokens for more than one scope.
13501    ///
13502    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13503    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13504    /// sufficient, a read-write scope will do as well.
13505    pub fn add_scope<St>(
13506        mut self,
13507        scope: St,
13508    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13509    where
13510        St: AsRef<str>,
13511    {
13512        self._scopes.insert(String::from(scope.as_ref()));
13513        self
13514    }
13515    /// Identifies the authorization scope(s) for the method you are building.
13516    ///
13517    /// See [`Self::add_scope()`] for details.
13518    pub fn add_scopes<I, St>(
13519        mut self,
13520        scopes: I,
13521    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
13522    where
13523        I: IntoIterator<Item = St>,
13524        St: AsRef<str>,
13525    {
13526        self._scopes
13527            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13528        self
13529    }
13530
13531    /// Removes all scopes, and no default scope will be used either.
13532    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13533    /// for details).
13534    pub fn clear_scopes(
13535        mut self,
13536    ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
13537        self._scopes.clear();
13538        self
13539    }
13540}
13541
13542/// Imports a snapshot of the source database into the conversion workspace.
13543///
13544/// A builder for the *locations.conversionWorkspaces.seed* method supported by a *project* resource.
13545/// It is not used directly, but through a [`ProjectMethods`] instance.
13546///
13547/// # Example
13548///
13549/// Instantiate a resource method builder
13550///
13551/// ```test_harness,no_run
13552/// # extern crate hyper;
13553/// # extern crate hyper_rustls;
13554/// # extern crate google_datamigration1 as datamigration1;
13555/// use datamigration1::api::SeedConversionWorkspaceRequest;
13556/// # async fn dox() {
13557/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13558///
13559/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13560/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13561/// #     secret,
13562/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13563/// # ).build().await.unwrap();
13564///
13565/// # let client = hyper_util::client::legacy::Client::builder(
13566/// #     hyper_util::rt::TokioExecutor::new()
13567/// # )
13568/// # .build(
13569/// #     hyper_rustls::HttpsConnectorBuilder::new()
13570/// #         .with_native_roots()
13571/// #         .unwrap()
13572/// #         .https_or_http()
13573/// #         .enable_http1()
13574/// #         .build()
13575/// # );
13576/// # let mut hub = DatabaseMigrationService::new(client, auth);
13577/// // As the method needs a request, you would usually fill it with the desired information
13578/// // into the respective structure. Some of the parts shown here might not be applicable !
13579/// // Values shown here are possibly random and not representative !
13580/// let mut req = SeedConversionWorkspaceRequest::default();
13581///
13582/// // You can configure optional parameters by calling the respective setters at will, and
13583/// // execute the final call using `doit()`.
13584/// // Values shown here are possibly random and not representative !
13585/// let result = hub.projects().locations_conversion_workspaces_seed(req, "name")
13586///              .doit().await;
13587/// # }
13588/// ```
13589pub struct ProjectLocationConversionWorkspaceSeedCall<'a, C>
13590where
13591    C: 'a,
13592{
13593    hub: &'a DatabaseMigrationService<C>,
13594    _request: SeedConversionWorkspaceRequest,
13595    _name: String,
13596    _delegate: Option<&'a mut dyn common::Delegate>,
13597    _additional_params: HashMap<String, String>,
13598    _scopes: BTreeSet<String>,
13599}
13600
13601impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceSeedCall<'a, C> {}
13602
13603impl<'a, C> ProjectLocationConversionWorkspaceSeedCall<'a, C>
13604where
13605    C: common::Connector,
13606{
13607    /// Perform the operation you have build so far.
13608    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13609        use std::borrow::Cow;
13610        use std::io::{Read, Seek};
13611
13612        use common::{url::Params, ToParts};
13613        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13614
13615        let mut dd = common::DefaultDelegate;
13616        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13617        dlg.begin(common::MethodInfo {
13618            id: "datamigration.projects.locations.conversionWorkspaces.seed",
13619            http_method: hyper::Method::POST,
13620        });
13621
13622        for &field in ["alt", "name"].iter() {
13623            if self._additional_params.contains_key(field) {
13624                dlg.finished(false);
13625                return Err(common::Error::FieldClash(field));
13626            }
13627        }
13628
13629        let mut params = Params::with_capacity(4 + self._additional_params.len());
13630        params.push("name", self._name);
13631
13632        params.extend(self._additional_params.iter());
13633
13634        params.push("alt", "json");
13635        let mut url = self.hub._base_url.clone() + "v1/{+name}:seed";
13636        if self._scopes.is_empty() {
13637            self._scopes
13638                .insert(Scope::CloudPlatform.as_ref().to_string());
13639        }
13640
13641        #[allow(clippy::single_element_loop)]
13642        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13643            url = params.uri_replacement(url, param_name, find_this, true);
13644        }
13645        {
13646            let to_remove = ["name"];
13647            params.remove_params(&to_remove);
13648        }
13649
13650        let url = params.parse_with_url(&url);
13651
13652        let mut json_mime_type = mime::APPLICATION_JSON;
13653        let mut request_value_reader = {
13654            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13655            common::remove_json_null_values(&mut value);
13656            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13657            serde_json::to_writer(&mut dst, &value).unwrap();
13658            dst
13659        };
13660        let request_size = request_value_reader
13661            .seek(std::io::SeekFrom::End(0))
13662            .unwrap();
13663        request_value_reader
13664            .seek(std::io::SeekFrom::Start(0))
13665            .unwrap();
13666
13667        loop {
13668            let token = match self
13669                .hub
13670                .auth
13671                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13672                .await
13673            {
13674                Ok(token) => token,
13675                Err(e) => match dlg.token(e) {
13676                    Ok(token) => token,
13677                    Err(e) => {
13678                        dlg.finished(false);
13679                        return Err(common::Error::MissingToken(e));
13680                    }
13681                },
13682            };
13683            request_value_reader
13684                .seek(std::io::SeekFrom::Start(0))
13685                .unwrap();
13686            let mut req_result = {
13687                let client = &self.hub.client;
13688                dlg.pre_request();
13689                let mut req_builder = hyper::Request::builder()
13690                    .method(hyper::Method::POST)
13691                    .uri(url.as_str())
13692                    .header(USER_AGENT, self.hub._user_agent.clone());
13693
13694                if let Some(token) = token.as_ref() {
13695                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13696                }
13697
13698                let request = req_builder
13699                    .header(CONTENT_TYPE, json_mime_type.to_string())
13700                    .header(CONTENT_LENGTH, request_size as u64)
13701                    .body(common::to_body(
13702                        request_value_reader.get_ref().clone().into(),
13703                    ));
13704
13705                client.request(request.unwrap()).await
13706            };
13707
13708            match req_result {
13709                Err(err) => {
13710                    if let common::Retry::After(d) = dlg.http_error(&err) {
13711                        sleep(d).await;
13712                        continue;
13713                    }
13714                    dlg.finished(false);
13715                    return Err(common::Error::HttpError(err));
13716                }
13717                Ok(res) => {
13718                    let (mut parts, body) = res.into_parts();
13719                    let mut body = common::Body::new(body);
13720                    if !parts.status.is_success() {
13721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13722                        let error = serde_json::from_str(&common::to_string(&bytes));
13723                        let response = common::to_response(parts, bytes.into());
13724
13725                        if let common::Retry::After(d) =
13726                            dlg.http_failure(&response, error.as_ref().ok())
13727                        {
13728                            sleep(d).await;
13729                            continue;
13730                        }
13731
13732                        dlg.finished(false);
13733
13734                        return Err(match error {
13735                            Ok(value) => common::Error::BadRequest(value),
13736                            _ => common::Error::Failure(response),
13737                        });
13738                    }
13739                    let response = {
13740                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13741                        let encoded = common::to_string(&bytes);
13742                        match serde_json::from_str(&encoded) {
13743                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13744                            Err(error) => {
13745                                dlg.response_json_decode_error(&encoded, &error);
13746                                return Err(common::Error::JsonDecodeError(
13747                                    encoded.to_string(),
13748                                    error,
13749                                ));
13750                            }
13751                        }
13752                    };
13753
13754                    dlg.finished(true);
13755                    return Ok(response);
13756                }
13757            }
13758        }
13759    }
13760
13761    ///
13762    /// Sets the *request* property to the given value.
13763    ///
13764    /// Even though the property as already been set when instantiating this call,
13765    /// we provide this method for API completeness.
13766    pub fn request(
13767        mut self,
13768        new_value: SeedConversionWorkspaceRequest,
13769    ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
13770        self._request = new_value;
13771        self
13772    }
13773    /// Name of the conversion workspace resource to seed with new database structure, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
13774    ///
13775    /// Sets the *name* path property to the given value.
13776    ///
13777    /// Even though the property as already been set when instantiating this call,
13778    /// we provide this method for API completeness.
13779    pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
13780        self._name = new_value.to_string();
13781        self
13782    }
13783    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13784    /// while executing the actual API request.
13785    ///
13786    /// ````text
13787    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13788    /// ````
13789    ///
13790    /// Sets the *delegate* property to the given value.
13791    pub fn delegate(
13792        mut self,
13793        new_value: &'a mut dyn common::Delegate,
13794    ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
13795        self._delegate = Some(new_value);
13796        self
13797    }
13798
13799    /// Set any additional parameter of the query string used in the request.
13800    /// It should be used to set parameters which are not yet available through their own
13801    /// setters.
13802    ///
13803    /// Please note that this method must not be used to set any of the known parameters
13804    /// which have their own setter method. If done anyway, the request will fail.
13805    ///
13806    /// # Additional Parameters
13807    ///
13808    /// * *$.xgafv* (query-string) - V1 error format.
13809    /// * *access_token* (query-string) - OAuth access token.
13810    /// * *alt* (query-string) - Data format for response.
13811    /// * *callback* (query-string) - JSONP
13812    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13813    /// * *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.
13814    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13815    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13816    /// * *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.
13817    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13818    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13819    pub fn param<T>(
13820        mut self,
13821        name: T,
13822        value: T,
13823    ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
13824    where
13825        T: AsRef<str>,
13826    {
13827        self._additional_params
13828            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13829        self
13830    }
13831
13832    /// Identifies the authorization scope for the method you are building.
13833    ///
13834    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13835    /// [`Scope::CloudPlatform`].
13836    ///
13837    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13838    /// tokens for more than one scope.
13839    ///
13840    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13841    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13842    /// sufficient, a read-write scope will do as well.
13843    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
13844    where
13845        St: AsRef<str>,
13846    {
13847        self._scopes.insert(String::from(scope.as_ref()));
13848        self
13849    }
13850    /// Identifies the authorization scope(s) for the method you are building.
13851    ///
13852    /// See [`Self::add_scope()`] for details.
13853    pub fn add_scopes<I, St>(
13854        mut self,
13855        scopes: I,
13856    ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
13857    where
13858        I: IntoIterator<Item = St>,
13859        St: AsRef<str>,
13860    {
13861        self._scopes
13862            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13863        self
13864    }
13865
13866    /// Removes all scopes, and no default scope will be used either.
13867    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13868    /// for details).
13869    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
13870        self._scopes.clear();
13871        self
13872    }
13873}
13874
13875/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
13876///
13877/// A builder for the *locations.conversionWorkspaces.setIamPolicy* method supported by a *project* resource.
13878/// It is not used directly, but through a [`ProjectMethods`] instance.
13879///
13880/// # Example
13881///
13882/// Instantiate a resource method builder
13883///
13884/// ```test_harness,no_run
13885/// # extern crate hyper;
13886/// # extern crate hyper_rustls;
13887/// # extern crate google_datamigration1 as datamigration1;
13888/// use datamigration1::api::SetIamPolicyRequest;
13889/// # async fn dox() {
13890/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13891///
13892/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13893/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13894/// #     secret,
13895/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13896/// # ).build().await.unwrap();
13897///
13898/// # let client = hyper_util::client::legacy::Client::builder(
13899/// #     hyper_util::rt::TokioExecutor::new()
13900/// # )
13901/// # .build(
13902/// #     hyper_rustls::HttpsConnectorBuilder::new()
13903/// #         .with_native_roots()
13904/// #         .unwrap()
13905/// #         .https_or_http()
13906/// #         .enable_http1()
13907/// #         .build()
13908/// # );
13909/// # let mut hub = DatabaseMigrationService::new(client, auth);
13910/// // As the method needs a request, you would usually fill it with the desired information
13911/// // into the respective structure. Some of the parts shown here might not be applicable !
13912/// // Values shown here are possibly random and not representative !
13913/// let mut req = SetIamPolicyRequest::default();
13914///
13915/// // You can configure optional parameters by calling the respective setters at will, and
13916/// // execute the final call using `doit()`.
13917/// // Values shown here are possibly random and not representative !
13918/// let result = hub.projects().locations_conversion_workspaces_set_iam_policy(req, "resource")
13919///              .doit().await;
13920/// # }
13921/// ```
13922pub struct ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
13923where
13924    C: 'a,
13925{
13926    hub: &'a DatabaseMigrationService<C>,
13927    _request: SetIamPolicyRequest,
13928    _resource: String,
13929    _delegate: Option<&'a mut dyn common::Delegate>,
13930    _additional_params: HashMap<String, String>,
13931    _scopes: BTreeSet<String>,
13932}
13933
13934impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {}
13935
13936impl<'a, C> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
13937where
13938    C: common::Connector,
13939{
13940    /// Perform the operation you have build so far.
13941    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
13942        use std::borrow::Cow;
13943        use std::io::{Read, Seek};
13944
13945        use common::{url::Params, ToParts};
13946        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13947
13948        let mut dd = common::DefaultDelegate;
13949        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13950        dlg.begin(common::MethodInfo {
13951            id: "datamigration.projects.locations.conversionWorkspaces.setIamPolicy",
13952            http_method: hyper::Method::POST,
13953        });
13954
13955        for &field in ["alt", "resource"].iter() {
13956            if self._additional_params.contains_key(field) {
13957                dlg.finished(false);
13958                return Err(common::Error::FieldClash(field));
13959            }
13960        }
13961
13962        let mut params = Params::with_capacity(4 + self._additional_params.len());
13963        params.push("resource", self._resource);
13964
13965        params.extend(self._additional_params.iter());
13966
13967        params.push("alt", "json");
13968        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
13969        if self._scopes.is_empty() {
13970            self._scopes
13971                .insert(Scope::CloudPlatform.as_ref().to_string());
13972        }
13973
13974        #[allow(clippy::single_element_loop)]
13975        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13976            url = params.uri_replacement(url, param_name, find_this, true);
13977        }
13978        {
13979            let to_remove = ["resource"];
13980            params.remove_params(&to_remove);
13981        }
13982
13983        let url = params.parse_with_url(&url);
13984
13985        let mut json_mime_type = mime::APPLICATION_JSON;
13986        let mut request_value_reader = {
13987            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13988            common::remove_json_null_values(&mut value);
13989            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13990            serde_json::to_writer(&mut dst, &value).unwrap();
13991            dst
13992        };
13993        let request_size = request_value_reader
13994            .seek(std::io::SeekFrom::End(0))
13995            .unwrap();
13996        request_value_reader
13997            .seek(std::io::SeekFrom::Start(0))
13998            .unwrap();
13999
14000        loop {
14001            let token = match self
14002                .hub
14003                .auth
14004                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14005                .await
14006            {
14007                Ok(token) => token,
14008                Err(e) => match dlg.token(e) {
14009                    Ok(token) => token,
14010                    Err(e) => {
14011                        dlg.finished(false);
14012                        return Err(common::Error::MissingToken(e));
14013                    }
14014                },
14015            };
14016            request_value_reader
14017                .seek(std::io::SeekFrom::Start(0))
14018                .unwrap();
14019            let mut req_result = {
14020                let client = &self.hub.client;
14021                dlg.pre_request();
14022                let mut req_builder = hyper::Request::builder()
14023                    .method(hyper::Method::POST)
14024                    .uri(url.as_str())
14025                    .header(USER_AGENT, self.hub._user_agent.clone());
14026
14027                if let Some(token) = token.as_ref() {
14028                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14029                }
14030
14031                let request = req_builder
14032                    .header(CONTENT_TYPE, json_mime_type.to_string())
14033                    .header(CONTENT_LENGTH, request_size as u64)
14034                    .body(common::to_body(
14035                        request_value_reader.get_ref().clone().into(),
14036                    ));
14037
14038                client.request(request.unwrap()).await
14039            };
14040
14041            match req_result {
14042                Err(err) => {
14043                    if let common::Retry::After(d) = dlg.http_error(&err) {
14044                        sleep(d).await;
14045                        continue;
14046                    }
14047                    dlg.finished(false);
14048                    return Err(common::Error::HttpError(err));
14049                }
14050                Ok(res) => {
14051                    let (mut parts, body) = res.into_parts();
14052                    let mut body = common::Body::new(body);
14053                    if !parts.status.is_success() {
14054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14055                        let error = serde_json::from_str(&common::to_string(&bytes));
14056                        let response = common::to_response(parts, bytes.into());
14057
14058                        if let common::Retry::After(d) =
14059                            dlg.http_failure(&response, error.as_ref().ok())
14060                        {
14061                            sleep(d).await;
14062                            continue;
14063                        }
14064
14065                        dlg.finished(false);
14066
14067                        return Err(match error {
14068                            Ok(value) => common::Error::BadRequest(value),
14069                            _ => common::Error::Failure(response),
14070                        });
14071                    }
14072                    let response = {
14073                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14074                        let encoded = common::to_string(&bytes);
14075                        match serde_json::from_str(&encoded) {
14076                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14077                            Err(error) => {
14078                                dlg.response_json_decode_error(&encoded, &error);
14079                                return Err(common::Error::JsonDecodeError(
14080                                    encoded.to_string(),
14081                                    error,
14082                                ));
14083                            }
14084                        }
14085                    };
14086
14087                    dlg.finished(true);
14088                    return Ok(response);
14089                }
14090            }
14091        }
14092    }
14093
14094    ///
14095    /// Sets the *request* property to the given value.
14096    ///
14097    /// Even though the property as already been set when instantiating this call,
14098    /// we provide this method for API completeness.
14099    pub fn request(
14100        mut self,
14101        new_value: SetIamPolicyRequest,
14102    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
14103        self._request = new_value;
14104        self
14105    }
14106    /// 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.
14107    ///
14108    /// Sets the *resource* path property to the given value.
14109    ///
14110    /// Even though the property as already been set when instantiating this call,
14111    /// we provide this method for API completeness.
14112    pub fn resource(
14113        mut self,
14114        new_value: &str,
14115    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
14116        self._resource = new_value.to_string();
14117        self
14118    }
14119    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14120    /// while executing the actual API request.
14121    ///
14122    /// ````text
14123    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14124    /// ````
14125    ///
14126    /// Sets the *delegate* property to the given value.
14127    pub fn delegate(
14128        mut self,
14129        new_value: &'a mut dyn common::Delegate,
14130    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
14131        self._delegate = Some(new_value);
14132        self
14133    }
14134
14135    /// Set any additional parameter of the query string used in the request.
14136    /// It should be used to set parameters which are not yet available through their own
14137    /// setters.
14138    ///
14139    /// Please note that this method must not be used to set any of the known parameters
14140    /// which have their own setter method. If done anyway, the request will fail.
14141    ///
14142    /// # Additional Parameters
14143    ///
14144    /// * *$.xgafv* (query-string) - V1 error format.
14145    /// * *access_token* (query-string) - OAuth access token.
14146    /// * *alt* (query-string) - Data format for response.
14147    /// * *callback* (query-string) - JSONP
14148    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14149    /// * *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.
14150    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14151    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14152    /// * *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.
14153    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14154    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14155    pub fn param<T>(
14156        mut self,
14157        name: T,
14158        value: T,
14159    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
14160    where
14161        T: AsRef<str>,
14162    {
14163        self._additional_params
14164            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14165        self
14166    }
14167
14168    /// Identifies the authorization scope for the method you are building.
14169    ///
14170    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14171    /// [`Scope::CloudPlatform`].
14172    ///
14173    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14174    /// tokens for more than one scope.
14175    ///
14176    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14177    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14178    /// sufficient, a read-write scope will do as well.
14179    pub fn add_scope<St>(
14180        mut self,
14181        scope: St,
14182    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
14183    where
14184        St: AsRef<str>,
14185    {
14186        self._scopes.insert(String::from(scope.as_ref()));
14187        self
14188    }
14189    /// Identifies the authorization scope(s) for the method you are building.
14190    ///
14191    /// See [`Self::add_scope()`] for details.
14192    pub fn add_scopes<I, St>(
14193        mut self,
14194        scopes: I,
14195    ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
14196    where
14197        I: IntoIterator<Item = St>,
14198        St: AsRef<str>,
14199    {
14200        self._scopes
14201            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14202        self
14203    }
14204
14205    /// Removes all scopes, and no default scope will be used either.
14206    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14207    /// for details).
14208    pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
14209        self._scopes.clear();
14210        self
14211    }
14212}
14213
14214/// 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.
14215///
14216/// A builder for the *locations.conversionWorkspaces.testIamPermissions* method supported by a *project* resource.
14217/// It is not used directly, but through a [`ProjectMethods`] instance.
14218///
14219/// # Example
14220///
14221/// Instantiate a resource method builder
14222///
14223/// ```test_harness,no_run
14224/// # extern crate hyper;
14225/// # extern crate hyper_rustls;
14226/// # extern crate google_datamigration1 as datamigration1;
14227/// use datamigration1::api::TestIamPermissionsRequest;
14228/// # async fn dox() {
14229/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14230///
14231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14232/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14233/// #     secret,
14234/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14235/// # ).build().await.unwrap();
14236///
14237/// # let client = hyper_util::client::legacy::Client::builder(
14238/// #     hyper_util::rt::TokioExecutor::new()
14239/// # )
14240/// # .build(
14241/// #     hyper_rustls::HttpsConnectorBuilder::new()
14242/// #         .with_native_roots()
14243/// #         .unwrap()
14244/// #         .https_or_http()
14245/// #         .enable_http1()
14246/// #         .build()
14247/// # );
14248/// # let mut hub = DatabaseMigrationService::new(client, auth);
14249/// // As the method needs a request, you would usually fill it with the desired information
14250/// // into the respective structure. Some of the parts shown here might not be applicable !
14251/// // Values shown here are possibly random and not representative !
14252/// let mut req = TestIamPermissionsRequest::default();
14253///
14254/// // You can configure optional parameters by calling the respective setters at will, and
14255/// // execute the final call using `doit()`.
14256/// // Values shown here are possibly random and not representative !
14257/// let result = hub.projects().locations_conversion_workspaces_test_iam_permissions(req, "resource")
14258///              .doit().await;
14259/// # }
14260/// ```
14261pub struct ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
14262where
14263    C: 'a,
14264{
14265    hub: &'a DatabaseMigrationService<C>,
14266    _request: TestIamPermissionsRequest,
14267    _resource: String,
14268    _delegate: Option<&'a mut dyn common::Delegate>,
14269    _additional_params: HashMap<String, String>,
14270    _scopes: BTreeSet<String>,
14271}
14272
14273impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {}
14274
14275impl<'a, C> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
14276where
14277    C: common::Connector,
14278{
14279    /// Perform the operation you have build so far.
14280    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
14281        use std::borrow::Cow;
14282        use std::io::{Read, Seek};
14283
14284        use common::{url::Params, ToParts};
14285        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14286
14287        let mut dd = common::DefaultDelegate;
14288        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14289        dlg.begin(common::MethodInfo {
14290            id: "datamigration.projects.locations.conversionWorkspaces.testIamPermissions",
14291            http_method: hyper::Method::POST,
14292        });
14293
14294        for &field in ["alt", "resource"].iter() {
14295            if self._additional_params.contains_key(field) {
14296                dlg.finished(false);
14297                return Err(common::Error::FieldClash(field));
14298            }
14299        }
14300
14301        let mut params = Params::with_capacity(4 + self._additional_params.len());
14302        params.push("resource", self._resource);
14303
14304        params.extend(self._additional_params.iter());
14305
14306        params.push("alt", "json");
14307        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
14308        if self._scopes.is_empty() {
14309            self._scopes
14310                .insert(Scope::CloudPlatform.as_ref().to_string());
14311        }
14312
14313        #[allow(clippy::single_element_loop)]
14314        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14315            url = params.uri_replacement(url, param_name, find_this, true);
14316        }
14317        {
14318            let to_remove = ["resource"];
14319            params.remove_params(&to_remove);
14320        }
14321
14322        let url = params.parse_with_url(&url);
14323
14324        let mut json_mime_type = mime::APPLICATION_JSON;
14325        let mut request_value_reader = {
14326            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14327            common::remove_json_null_values(&mut value);
14328            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14329            serde_json::to_writer(&mut dst, &value).unwrap();
14330            dst
14331        };
14332        let request_size = request_value_reader
14333            .seek(std::io::SeekFrom::End(0))
14334            .unwrap();
14335        request_value_reader
14336            .seek(std::io::SeekFrom::Start(0))
14337            .unwrap();
14338
14339        loop {
14340            let token = match self
14341                .hub
14342                .auth
14343                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14344                .await
14345            {
14346                Ok(token) => token,
14347                Err(e) => match dlg.token(e) {
14348                    Ok(token) => token,
14349                    Err(e) => {
14350                        dlg.finished(false);
14351                        return Err(common::Error::MissingToken(e));
14352                    }
14353                },
14354            };
14355            request_value_reader
14356                .seek(std::io::SeekFrom::Start(0))
14357                .unwrap();
14358            let mut req_result = {
14359                let client = &self.hub.client;
14360                dlg.pre_request();
14361                let mut req_builder = hyper::Request::builder()
14362                    .method(hyper::Method::POST)
14363                    .uri(url.as_str())
14364                    .header(USER_AGENT, self.hub._user_agent.clone());
14365
14366                if let Some(token) = token.as_ref() {
14367                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14368                }
14369
14370                let request = req_builder
14371                    .header(CONTENT_TYPE, json_mime_type.to_string())
14372                    .header(CONTENT_LENGTH, request_size as u64)
14373                    .body(common::to_body(
14374                        request_value_reader.get_ref().clone().into(),
14375                    ));
14376
14377                client.request(request.unwrap()).await
14378            };
14379
14380            match req_result {
14381                Err(err) => {
14382                    if let common::Retry::After(d) = dlg.http_error(&err) {
14383                        sleep(d).await;
14384                        continue;
14385                    }
14386                    dlg.finished(false);
14387                    return Err(common::Error::HttpError(err));
14388                }
14389                Ok(res) => {
14390                    let (mut parts, body) = res.into_parts();
14391                    let mut body = common::Body::new(body);
14392                    if !parts.status.is_success() {
14393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14394                        let error = serde_json::from_str(&common::to_string(&bytes));
14395                        let response = common::to_response(parts, bytes.into());
14396
14397                        if let common::Retry::After(d) =
14398                            dlg.http_failure(&response, error.as_ref().ok())
14399                        {
14400                            sleep(d).await;
14401                            continue;
14402                        }
14403
14404                        dlg.finished(false);
14405
14406                        return Err(match error {
14407                            Ok(value) => common::Error::BadRequest(value),
14408                            _ => common::Error::Failure(response),
14409                        });
14410                    }
14411                    let response = {
14412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14413                        let encoded = common::to_string(&bytes);
14414                        match serde_json::from_str(&encoded) {
14415                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14416                            Err(error) => {
14417                                dlg.response_json_decode_error(&encoded, &error);
14418                                return Err(common::Error::JsonDecodeError(
14419                                    encoded.to_string(),
14420                                    error,
14421                                ));
14422                            }
14423                        }
14424                    };
14425
14426                    dlg.finished(true);
14427                    return Ok(response);
14428                }
14429            }
14430        }
14431    }
14432
14433    ///
14434    /// Sets the *request* property to the given value.
14435    ///
14436    /// Even though the property as already been set when instantiating this call,
14437    /// we provide this method for API completeness.
14438    pub fn request(
14439        mut self,
14440        new_value: TestIamPermissionsRequest,
14441    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
14442        self._request = new_value;
14443        self
14444    }
14445    /// 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.
14446    ///
14447    /// Sets the *resource* path property to the given value.
14448    ///
14449    /// Even though the property as already been set when instantiating this call,
14450    /// we provide this method for API completeness.
14451    pub fn resource(
14452        mut self,
14453        new_value: &str,
14454    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
14455        self._resource = new_value.to_string();
14456        self
14457    }
14458    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14459    /// while executing the actual API request.
14460    ///
14461    /// ````text
14462    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14463    /// ````
14464    ///
14465    /// Sets the *delegate* property to the given value.
14466    pub fn delegate(
14467        mut self,
14468        new_value: &'a mut dyn common::Delegate,
14469    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
14470        self._delegate = Some(new_value);
14471        self
14472    }
14473
14474    /// Set any additional parameter of the query string used in the request.
14475    /// It should be used to set parameters which are not yet available through their own
14476    /// setters.
14477    ///
14478    /// Please note that this method must not be used to set any of the known parameters
14479    /// which have their own setter method. If done anyway, the request will fail.
14480    ///
14481    /// # Additional Parameters
14482    ///
14483    /// * *$.xgafv* (query-string) - V1 error format.
14484    /// * *access_token* (query-string) - OAuth access token.
14485    /// * *alt* (query-string) - Data format for response.
14486    /// * *callback* (query-string) - JSONP
14487    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14488    /// * *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.
14489    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14490    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14491    /// * *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.
14492    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14493    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14494    pub fn param<T>(
14495        mut self,
14496        name: T,
14497        value: T,
14498    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
14499    where
14500        T: AsRef<str>,
14501    {
14502        self._additional_params
14503            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14504        self
14505    }
14506
14507    /// Identifies the authorization scope for the method you are building.
14508    ///
14509    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14510    /// [`Scope::CloudPlatform`].
14511    ///
14512    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14513    /// tokens for more than one scope.
14514    ///
14515    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14516    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14517    /// sufficient, a read-write scope will do as well.
14518    pub fn add_scope<St>(
14519        mut self,
14520        scope: St,
14521    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
14522    where
14523        St: AsRef<str>,
14524    {
14525        self._scopes.insert(String::from(scope.as_ref()));
14526        self
14527    }
14528    /// Identifies the authorization scope(s) for the method you are building.
14529    ///
14530    /// See [`Self::add_scope()`] for details.
14531    pub fn add_scopes<I, St>(
14532        mut self,
14533        scopes: I,
14534    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
14535    where
14536        I: IntoIterator<Item = St>,
14537        St: AsRef<str>,
14538    {
14539        self._scopes
14540            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14541        self
14542    }
14543
14544    /// Removes all scopes, and no default scope will be used either.
14545    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14546    /// for details).
14547    pub fn clear_scopes(
14548        mut self,
14549    ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
14550        self._scopes.clear();
14551        self
14552    }
14553}
14554
14555/// Creates a new migration job in a given project and location.
14556///
14557/// A builder for the *locations.migrationJobs.create* method supported by a *project* resource.
14558/// It is not used directly, but through a [`ProjectMethods`] instance.
14559///
14560/// # Example
14561///
14562/// Instantiate a resource method builder
14563///
14564/// ```test_harness,no_run
14565/// # extern crate hyper;
14566/// # extern crate hyper_rustls;
14567/// # extern crate google_datamigration1 as datamigration1;
14568/// use datamigration1::api::MigrationJob;
14569/// # async fn dox() {
14570/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14571///
14572/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14573/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14574/// #     secret,
14575/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14576/// # ).build().await.unwrap();
14577///
14578/// # let client = hyper_util::client::legacy::Client::builder(
14579/// #     hyper_util::rt::TokioExecutor::new()
14580/// # )
14581/// # .build(
14582/// #     hyper_rustls::HttpsConnectorBuilder::new()
14583/// #         .with_native_roots()
14584/// #         .unwrap()
14585/// #         .https_or_http()
14586/// #         .enable_http1()
14587/// #         .build()
14588/// # );
14589/// # let mut hub = DatabaseMigrationService::new(client, auth);
14590/// // As the method needs a request, you would usually fill it with the desired information
14591/// // into the respective structure. Some of the parts shown here might not be applicable !
14592/// // Values shown here are possibly random and not representative !
14593/// let mut req = MigrationJob::default();
14594///
14595/// // You can configure optional parameters by calling the respective setters at will, and
14596/// // execute the final call using `doit()`.
14597/// // Values shown here are possibly random and not representative !
14598/// let result = hub.projects().locations_migration_jobs_create(req, "parent")
14599///              .request_id("no")
14600///              .migration_job_id("est")
14601///              .doit().await;
14602/// # }
14603/// ```
14604pub struct ProjectLocationMigrationJobCreateCall<'a, C>
14605where
14606    C: 'a,
14607{
14608    hub: &'a DatabaseMigrationService<C>,
14609    _request: MigrationJob,
14610    _parent: String,
14611    _request_id: Option<String>,
14612    _migration_job_id: Option<String>,
14613    _delegate: Option<&'a mut dyn common::Delegate>,
14614    _additional_params: HashMap<String, String>,
14615    _scopes: BTreeSet<String>,
14616}
14617
14618impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobCreateCall<'a, C> {}
14619
14620impl<'a, C> ProjectLocationMigrationJobCreateCall<'a, C>
14621where
14622    C: common::Connector,
14623{
14624    /// Perform the operation you have build so far.
14625    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14626        use std::borrow::Cow;
14627        use std::io::{Read, Seek};
14628
14629        use common::{url::Params, ToParts};
14630        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14631
14632        let mut dd = common::DefaultDelegate;
14633        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14634        dlg.begin(common::MethodInfo {
14635            id: "datamigration.projects.locations.migrationJobs.create",
14636            http_method: hyper::Method::POST,
14637        });
14638
14639        for &field in ["alt", "parent", "requestId", "migrationJobId"].iter() {
14640            if self._additional_params.contains_key(field) {
14641                dlg.finished(false);
14642                return Err(common::Error::FieldClash(field));
14643            }
14644        }
14645
14646        let mut params = Params::with_capacity(6 + self._additional_params.len());
14647        params.push("parent", self._parent);
14648        if let Some(value) = self._request_id.as_ref() {
14649            params.push("requestId", value);
14650        }
14651        if let Some(value) = self._migration_job_id.as_ref() {
14652            params.push("migrationJobId", value);
14653        }
14654
14655        params.extend(self._additional_params.iter());
14656
14657        params.push("alt", "json");
14658        let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationJobs";
14659        if self._scopes.is_empty() {
14660            self._scopes
14661                .insert(Scope::CloudPlatform.as_ref().to_string());
14662        }
14663
14664        #[allow(clippy::single_element_loop)]
14665        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14666            url = params.uri_replacement(url, param_name, find_this, true);
14667        }
14668        {
14669            let to_remove = ["parent"];
14670            params.remove_params(&to_remove);
14671        }
14672
14673        let url = params.parse_with_url(&url);
14674
14675        let mut json_mime_type = mime::APPLICATION_JSON;
14676        let mut request_value_reader = {
14677            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14678            common::remove_json_null_values(&mut value);
14679            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14680            serde_json::to_writer(&mut dst, &value).unwrap();
14681            dst
14682        };
14683        let request_size = request_value_reader
14684            .seek(std::io::SeekFrom::End(0))
14685            .unwrap();
14686        request_value_reader
14687            .seek(std::io::SeekFrom::Start(0))
14688            .unwrap();
14689
14690        loop {
14691            let token = match self
14692                .hub
14693                .auth
14694                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14695                .await
14696            {
14697                Ok(token) => token,
14698                Err(e) => match dlg.token(e) {
14699                    Ok(token) => token,
14700                    Err(e) => {
14701                        dlg.finished(false);
14702                        return Err(common::Error::MissingToken(e));
14703                    }
14704                },
14705            };
14706            request_value_reader
14707                .seek(std::io::SeekFrom::Start(0))
14708                .unwrap();
14709            let mut req_result = {
14710                let client = &self.hub.client;
14711                dlg.pre_request();
14712                let mut req_builder = hyper::Request::builder()
14713                    .method(hyper::Method::POST)
14714                    .uri(url.as_str())
14715                    .header(USER_AGENT, self.hub._user_agent.clone());
14716
14717                if let Some(token) = token.as_ref() {
14718                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14719                }
14720
14721                let request = req_builder
14722                    .header(CONTENT_TYPE, json_mime_type.to_string())
14723                    .header(CONTENT_LENGTH, request_size as u64)
14724                    .body(common::to_body(
14725                        request_value_reader.get_ref().clone().into(),
14726                    ));
14727
14728                client.request(request.unwrap()).await
14729            };
14730
14731            match req_result {
14732                Err(err) => {
14733                    if let common::Retry::After(d) = dlg.http_error(&err) {
14734                        sleep(d).await;
14735                        continue;
14736                    }
14737                    dlg.finished(false);
14738                    return Err(common::Error::HttpError(err));
14739                }
14740                Ok(res) => {
14741                    let (mut parts, body) = res.into_parts();
14742                    let mut body = common::Body::new(body);
14743                    if !parts.status.is_success() {
14744                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14745                        let error = serde_json::from_str(&common::to_string(&bytes));
14746                        let response = common::to_response(parts, bytes.into());
14747
14748                        if let common::Retry::After(d) =
14749                            dlg.http_failure(&response, error.as_ref().ok())
14750                        {
14751                            sleep(d).await;
14752                            continue;
14753                        }
14754
14755                        dlg.finished(false);
14756
14757                        return Err(match error {
14758                            Ok(value) => common::Error::BadRequest(value),
14759                            _ => common::Error::Failure(response),
14760                        });
14761                    }
14762                    let response = {
14763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14764                        let encoded = common::to_string(&bytes);
14765                        match serde_json::from_str(&encoded) {
14766                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14767                            Err(error) => {
14768                                dlg.response_json_decode_error(&encoded, &error);
14769                                return Err(common::Error::JsonDecodeError(
14770                                    encoded.to_string(),
14771                                    error,
14772                                ));
14773                            }
14774                        }
14775                    };
14776
14777                    dlg.finished(true);
14778                    return Ok(response);
14779                }
14780            }
14781        }
14782    }
14783
14784    ///
14785    /// Sets the *request* property to the given value.
14786    ///
14787    /// Even though the property as already been set when instantiating this call,
14788    /// we provide this method for API completeness.
14789    pub fn request(
14790        mut self,
14791        new_value: MigrationJob,
14792    ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14793        self._request = new_value;
14794        self
14795    }
14796    /// Required. The parent which owns this collection of migration jobs.
14797    ///
14798    /// Sets the *parent* path property to the given value.
14799    ///
14800    /// Even though the property as already been set when instantiating this call,
14801    /// we provide this method for API completeness.
14802    pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14803        self._parent = new_value.to_string();
14804        self
14805    }
14806    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
14807    ///
14808    /// Sets the *request id* query property to the given value.
14809    pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14810        self._request_id = Some(new_value.to_string());
14811        self
14812    }
14813    /// Required. The ID of the instance to create.
14814    ///
14815    /// Sets the *migration job id* query property to the given value.
14816    pub fn migration_job_id(
14817        mut self,
14818        new_value: &str,
14819    ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14820        self._migration_job_id = Some(new_value.to_string());
14821        self
14822    }
14823    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14824    /// while executing the actual API request.
14825    ///
14826    /// ````text
14827    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14828    /// ````
14829    ///
14830    /// Sets the *delegate* property to the given value.
14831    pub fn delegate(
14832        mut self,
14833        new_value: &'a mut dyn common::Delegate,
14834    ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14835        self._delegate = Some(new_value);
14836        self
14837    }
14838
14839    /// Set any additional parameter of the query string used in the request.
14840    /// It should be used to set parameters which are not yet available through their own
14841    /// setters.
14842    ///
14843    /// Please note that this method must not be used to set any of the known parameters
14844    /// which have their own setter method. If done anyway, the request will fail.
14845    ///
14846    /// # Additional Parameters
14847    ///
14848    /// * *$.xgafv* (query-string) - V1 error format.
14849    /// * *access_token* (query-string) - OAuth access token.
14850    /// * *alt* (query-string) - Data format for response.
14851    /// * *callback* (query-string) - JSONP
14852    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14853    /// * *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.
14854    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14855    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14856    /// * *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.
14857    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14858    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14859    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobCreateCall<'a, C>
14860    where
14861        T: AsRef<str>,
14862    {
14863        self._additional_params
14864            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14865        self
14866    }
14867
14868    /// Identifies the authorization scope for the method you are building.
14869    ///
14870    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14871    /// [`Scope::CloudPlatform`].
14872    ///
14873    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14874    /// tokens for more than one scope.
14875    ///
14876    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14877    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14878    /// sufficient, a read-write scope will do as well.
14879    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobCreateCall<'a, C>
14880    where
14881        St: AsRef<str>,
14882    {
14883        self._scopes.insert(String::from(scope.as_ref()));
14884        self
14885    }
14886    /// Identifies the authorization scope(s) for the method you are building.
14887    ///
14888    /// See [`Self::add_scope()`] for details.
14889    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobCreateCall<'a, C>
14890    where
14891        I: IntoIterator<Item = St>,
14892        St: AsRef<str>,
14893    {
14894        self._scopes
14895            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14896        self
14897    }
14898
14899    /// Removes all scopes, and no default scope will be used either.
14900    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14901    /// for details).
14902    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobCreateCall<'a, C> {
14903        self._scopes.clear();
14904        self
14905    }
14906}
14907
14908/// Deletes a single migration job.
14909///
14910/// A builder for the *locations.migrationJobs.delete* method supported by a *project* resource.
14911/// It is not used directly, but through a [`ProjectMethods`] instance.
14912///
14913/// # Example
14914///
14915/// Instantiate a resource method builder
14916///
14917/// ```test_harness,no_run
14918/// # extern crate hyper;
14919/// # extern crate hyper_rustls;
14920/// # extern crate google_datamigration1 as datamigration1;
14921/// # async fn dox() {
14922/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14923///
14924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14926/// #     secret,
14927/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14928/// # ).build().await.unwrap();
14929///
14930/// # let client = hyper_util::client::legacy::Client::builder(
14931/// #     hyper_util::rt::TokioExecutor::new()
14932/// # )
14933/// # .build(
14934/// #     hyper_rustls::HttpsConnectorBuilder::new()
14935/// #         .with_native_roots()
14936/// #         .unwrap()
14937/// #         .https_or_http()
14938/// #         .enable_http1()
14939/// #         .build()
14940/// # );
14941/// # let mut hub = DatabaseMigrationService::new(client, auth);
14942/// // You can configure optional parameters by calling the respective setters at will, and
14943/// // execute the final call using `doit()`.
14944/// // Values shown here are possibly random and not representative !
14945/// let result = hub.projects().locations_migration_jobs_delete("name")
14946///              .request_id("sed")
14947///              .force(false)
14948///              .doit().await;
14949/// # }
14950/// ```
14951pub struct ProjectLocationMigrationJobDeleteCall<'a, C>
14952where
14953    C: 'a,
14954{
14955    hub: &'a DatabaseMigrationService<C>,
14956    _name: String,
14957    _request_id: Option<String>,
14958    _force: Option<bool>,
14959    _delegate: Option<&'a mut dyn common::Delegate>,
14960    _additional_params: HashMap<String, String>,
14961    _scopes: BTreeSet<String>,
14962}
14963
14964impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobDeleteCall<'a, C> {}
14965
14966impl<'a, C> ProjectLocationMigrationJobDeleteCall<'a, C>
14967where
14968    C: common::Connector,
14969{
14970    /// Perform the operation you have build so far.
14971    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14972        use std::borrow::Cow;
14973        use std::io::{Read, Seek};
14974
14975        use common::{url::Params, ToParts};
14976        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14977
14978        let mut dd = common::DefaultDelegate;
14979        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14980        dlg.begin(common::MethodInfo {
14981            id: "datamigration.projects.locations.migrationJobs.delete",
14982            http_method: hyper::Method::DELETE,
14983        });
14984
14985        for &field in ["alt", "name", "requestId", "force"].iter() {
14986            if self._additional_params.contains_key(field) {
14987                dlg.finished(false);
14988                return Err(common::Error::FieldClash(field));
14989            }
14990        }
14991
14992        let mut params = Params::with_capacity(5 + self._additional_params.len());
14993        params.push("name", self._name);
14994        if let Some(value) = self._request_id.as_ref() {
14995            params.push("requestId", value);
14996        }
14997        if let Some(value) = self._force.as_ref() {
14998            params.push("force", value.to_string());
14999        }
15000
15001        params.extend(self._additional_params.iter());
15002
15003        params.push("alt", "json");
15004        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15005        if self._scopes.is_empty() {
15006            self._scopes
15007                .insert(Scope::CloudPlatform.as_ref().to_string());
15008        }
15009
15010        #[allow(clippy::single_element_loop)]
15011        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15012            url = params.uri_replacement(url, param_name, find_this, true);
15013        }
15014        {
15015            let to_remove = ["name"];
15016            params.remove_params(&to_remove);
15017        }
15018
15019        let url = params.parse_with_url(&url);
15020
15021        loop {
15022            let token = match self
15023                .hub
15024                .auth
15025                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15026                .await
15027            {
15028                Ok(token) => token,
15029                Err(e) => match dlg.token(e) {
15030                    Ok(token) => token,
15031                    Err(e) => {
15032                        dlg.finished(false);
15033                        return Err(common::Error::MissingToken(e));
15034                    }
15035                },
15036            };
15037            let mut req_result = {
15038                let client = &self.hub.client;
15039                dlg.pre_request();
15040                let mut req_builder = hyper::Request::builder()
15041                    .method(hyper::Method::DELETE)
15042                    .uri(url.as_str())
15043                    .header(USER_AGENT, self.hub._user_agent.clone());
15044
15045                if let Some(token) = token.as_ref() {
15046                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15047                }
15048
15049                let request = req_builder
15050                    .header(CONTENT_LENGTH, 0_u64)
15051                    .body(common::to_body::<String>(None));
15052
15053                client.request(request.unwrap()).await
15054            };
15055
15056            match req_result {
15057                Err(err) => {
15058                    if let common::Retry::After(d) = dlg.http_error(&err) {
15059                        sleep(d).await;
15060                        continue;
15061                    }
15062                    dlg.finished(false);
15063                    return Err(common::Error::HttpError(err));
15064                }
15065                Ok(res) => {
15066                    let (mut parts, body) = res.into_parts();
15067                    let mut body = common::Body::new(body);
15068                    if !parts.status.is_success() {
15069                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15070                        let error = serde_json::from_str(&common::to_string(&bytes));
15071                        let response = common::to_response(parts, bytes.into());
15072
15073                        if let common::Retry::After(d) =
15074                            dlg.http_failure(&response, error.as_ref().ok())
15075                        {
15076                            sleep(d).await;
15077                            continue;
15078                        }
15079
15080                        dlg.finished(false);
15081
15082                        return Err(match error {
15083                            Ok(value) => common::Error::BadRequest(value),
15084                            _ => common::Error::Failure(response),
15085                        });
15086                    }
15087                    let response = {
15088                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15089                        let encoded = common::to_string(&bytes);
15090                        match serde_json::from_str(&encoded) {
15091                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15092                            Err(error) => {
15093                                dlg.response_json_decode_error(&encoded, &error);
15094                                return Err(common::Error::JsonDecodeError(
15095                                    encoded.to_string(),
15096                                    error,
15097                                ));
15098                            }
15099                        }
15100                    };
15101
15102                    dlg.finished(true);
15103                    return Ok(response);
15104                }
15105            }
15106        }
15107    }
15108
15109    /// Required. Name of the migration job resource to delete.
15110    ///
15111    /// Sets the *name* path property to the given value.
15112    ///
15113    /// Even though the property as already been set when instantiating this call,
15114    /// we provide this method for API completeness.
15115    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
15116        self._name = new_value.to_string();
15117        self
15118    }
15119    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
15120    ///
15121    /// Sets the *request id* query property to the given value.
15122    pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
15123        self._request_id = Some(new_value.to_string());
15124        self
15125    }
15126    /// The destination CloudSQL connection profile is always deleted with the migration job. In case of force delete, the destination CloudSQL replica database is also deleted.
15127    ///
15128    /// Sets the *force* query property to the given value.
15129    pub fn force(mut self, new_value: bool) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
15130        self._force = Some(new_value);
15131        self
15132    }
15133    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15134    /// while executing the actual API request.
15135    ///
15136    /// ````text
15137    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15138    /// ````
15139    ///
15140    /// Sets the *delegate* property to the given value.
15141    pub fn delegate(
15142        mut self,
15143        new_value: &'a mut dyn common::Delegate,
15144    ) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
15145        self._delegate = Some(new_value);
15146        self
15147    }
15148
15149    /// Set any additional parameter of the query string used in the request.
15150    /// It should be used to set parameters which are not yet available through their own
15151    /// setters.
15152    ///
15153    /// Please note that this method must not be used to set any of the known parameters
15154    /// which have their own setter method. If done anyway, the request will fail.
15155    ///
15156    /// # Additional Parameters
15157    ///
15158    /// * *$.xgafv* (query-string) - V1 error format.
15159    /// * *access_token* (query-string) - OAuth access token.
15160    /// * *alt* (query-string) - Data format for response.
15161    /// * *callback* (query-string) - JSONP
15162    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15163    /// * *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.
15164    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15165    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15166    /// * *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.
15167    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15168    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15169    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobDeleteCall<'a, C>
15170    where
15171        T: AsRef<str>,
15172    {
15173        self._additional_params
15174            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15175        self
15176    }
15177
15178    /// Identifies the authorization scope for the method you are building.
15179    ///
15180    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15181    /// [`Scope::CloudPlatform`].
15182    ///
15183    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15184    /// tokens for more than one scope.
15185    ///
15186    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15187    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15188    /// sufficient, a read-write scope will do as well.
15189    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobDeleteCall<'a, C>
15190    where
15191        St: AsRef<str>,
15192    {
15193        self._scopes.insert(String::from(scope.as_ref()));
15194        self
15195    }
15196    /// Identifies the authorization scope(s) for the method you are building.
15197    ///
15198    /// See [`Self::add_scope()`] for details.
15199    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobDeleteCall<'a, C>
15200    where
15201        I: IntoIterator<Item = St>,
15202        St: AsRef<str>,
15203    {
15204        self._scopes
15205            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15206        self
15207    }
15208
15209    /// Removes all scopes, and no default scope will be used either.
15210    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15211    /// for details).
15212    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
15213        self._scopes.clear();
15214        self
15215    }
15216}
15217
15218/// Demotes the destination database to become a read replica of the source. This is applicable for the following migrations: 1. MySQL to Cloud SQL for MySQL 2. PostgreSQL to Cloud SQL for PostgreSQL 3. PostgreSQL to AlloyDB for PostgreSQL.
15219///
15220/// A builder for the *locations.migrationJobs.demoteDestination* method supported by a *project* resource.
15221/// It is not used directly, but through a [`ProjectMethods`] instance.
15222///
15223/// # Example
15224///
15225/// Instantiate a resource method builder
15226///
15227/// ```test_harness,no_run
15228/// # extern crate hyper;
15229/// # extern crate hyper_rustls;
15230/// # extern crate google_datamigration1 as datamigration1;
15231/// use datamigration1::api::DemoteDestinationRequest;
15232/// # async fn dox() {
15233/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15234///
15235/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15236/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15237/// #     secret,
15238/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15239/// # ).build().await.unwrap();
15240///
15241/// # let client = hyper_util::client::legacy::Client::builder(
15242/// #     hyper_util::rt::TokioExecutor::new()
15243/// # )
15244/// # .build(
15245/// #     hyper_rustls::HttpsConnectorBuilder::new()
15246/// #         .with_native_roots()
15247/// #         .unwrap()
15248/// #         .https_or_http()
15249/// #         .enable_http1()
15250/// #         .build()
15251/// # );
15252/// # let mut hub = DatabaseMigrationService::new(client, auth);
15253/// // As the method needs a request, you would usually fill it with the desired information
15254/// // into the respective structure. Some of the parts shown here might not be applicable !
15255/// // Values shown here are possibly random and not representative !
15256/// let mut req = DemoteDestinationRequest::default();
15257///
15258/// // You can configure optional parameters by calling the respective setters at will, and
15259/// // execute the final call using `doit()`.
15260/// // Values shown here are possibly random and not representative !
15261/// let result = hub.projects().locations_migration_jobs_demote_destination(req, "name")
15262///              .doit().await;
15263/// # }
15264/// ```
15265pub struct ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
15266where
15267    C: 'a,
15268{
15269    hub: &'a DatabaseMigrationService<C>,
15270    _request: DemoteDestinationRequest,
15271    _name: String,
15272    _delegate: Option<&'a mut dyn common::Delegate>,
15273    _additional_params: HashMap<String, String>,
15274    _scopes: BTreeSet<String>,
15275}
15276
15277impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {}
15278
15279impl<'a, C> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
15280where
15281    C: common::Connector,
15282{
15283    /// Perform the operation you have build so far.
15284    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15285        use std::borrow::Cow;
15286        use std::io::{Read, Seek};
15287
15288        use common::{url::Params, ToParts};
15289        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15290
15291        let mut dd = common::DefaultDelegate;
15292        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15293        dlg.begin(common::MethodInfo {
15294            id: "datamigration.projects.locations.migrationJobs.demoteDestination",
15295            http_method: hyper::Method::POST,
15296        });
15297
15298        for &field in ["alt", "name"].iter() {
15299            if self._additional_params.contains_key(field) {
15300                dlg.finished(false);
15301                return Err(common::Error::FieldClash(field));
15302            }
15303        }
15304
15305        let mut params = Params::with_capacity(4 + self._additional_params.len());
15306        params.push("name", self._name);
15307
15308        params.extend(self._additional_params.iter());
15309
15310        params.push("alt", "json");
15311        let mut url = self.hub._base_url.clone() + "v1/{+name}:demoteDestination";
15312        if self._scopes.is_empty() {
15313            self._scopes
15314                .insert(Scope::CloudPlatform.as_ref().to_string());
15315        }
15316
15317        #[allow(clippy::single_element_loop)]
15318        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15319            url = params.uri_replacement(url, param_name, find_this, true);
15320        }
15321        {
15322            let to_remove = ["name"];
15323            params.remove_params(&to_remove);
15324        }
15325
15326        let url = params.parse_with_url(&url);
15327
15328        let mut json_mime_type = mime::APPLICATION_JSON;
15329        let mut request_value_reader = {
15330            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15331            common::remove_json_null_values(&mut value);
15332            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15333            serde_json::to_writer(&mut dst, &value).unwrap();
15334            dst
15335        };
15336        let request_size = request_value_reader
15337            .seek(std::io::SeekFrom::End(0))
15338            .unwrap();
15339        request_value_reader
15340            .seek(std::io::SeekFrom::Start(0))
15341            .unwrap();
15342
15343        loop {
15344            let token = match self
15345                .hub
15346                .auth
15347                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15348                .await
15349            {
15350                Ok(token) => token,
15351                Err(e) => match dlg.token(e) {
15352                    Ok(token) => token,
15353                    Err(e) => {
15354                        dlg.finished(false);
15355                        return Err(common::Error::MissingToken(e));
15356                    }
15357                },
15358            };
15359            request_value_reader
15360                .seek(std::io::SeekFrom::Start(0))
15361                .unwrap();
15362            let mut req_result = {
15363                let client = &self.hub.client;
15364                dlg.pre_request();
15365                let mut req_builder = hyper::Request::builder()
15366                    .method(hyper::Method::POST)
15367                    .uri(url.as_str())
15368                    .header(USER_AGENT, self.hub._user_agent.clone());
15369
15370                if let Some(token) = token.as_ref() {
15371                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15372                }
15373
15374                let request = req_builder
15375                    .header(CONTENT_TYPE, json_mime_type.to_string())
15376                    .header(CONTENT_LENGTH, request_size as u64)
15377                    .body(common::to_body(
15378                        request_value_reader.get_ref().clone().into(),
15379                    ));
15380
15381                client.request(request.unwrap()).await
15382            };
15383
15384            match req_result {
15385                Err(err) => {
15386                    if let common::Retry::After(d) = dlg.http_error(&err) {
15387                        sleep(d).await;
15388                        continue;
15389                    }
15390                    dlg.finished(false);
15391                    return Err(common::Error::HttpError(err));
15392                }
15393                Ok(res) => {
15394                    let (mut parts, body) = res.into_parts();
15395                    let mut body = common::Body::new(body);
15396                    if !parts.status.is_success() {
15397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15398                        let error = serde_json::from_str(&common::to_string(&bytes));
15399                        let response = common::to_response(parts, bytes.into());
15400
15401                        if let common::Retry::After(d) =
15402                            dlg.http_failure(&response, error.as_ref().ok())
15403                        {
15404                            sleep(d).await;
15405                            continue;
15406                        }
15407
15408                        dlg.finished(false);
15409
15410                        return Err(match error {
15411                            Ok(value) => common::Error::BadRequest(value),
15412                            _ => common::Error::Failure(response),
15413                        });
15414                    }
15415                    let response = {
15416                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15417                        let encoded = common::to_string(&bytes);
15418                        match serde_json::from_str(&encoded) {
15419                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15420                            Err(error) => {
15421                                dlg.response_json_decode_error(&encoded, &error);
15422                                return Err(common::Error::JsonDecodeError(
15423                                    encoded.to_string(),
15424                                    error,
15425                                ));
15426                            }
15427                        }
15428                    };
15429
15430                    dlg.finished(true);
15431                    return Ok(response);
15432                }
15433            }
15434        }
15435    }
15436
15437    ///
15438    /// Sets the *request* property to the given value.
15439    ///
15440    /// Even though the property as already been set when instantiating this call,
15441    /// we provide this method for API completeness.
15442    pub fn request(
15443        mut self,
15444        new_value: DemoteDestinationRequest,
15445    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
15446        self._request = new_value;
15447        self
15448    }
15449    /// Name of the migration job resource to demote its destination.
15450    ///
15451    /// Sets the *name* path property to the given value.
15452    ///
15453    /// Even though the property as already been set when instantiating this call,
15454    /// we provide this method for API completeness.
15455    pub fn name(
15456        mut self,
15457        new_value: &str,
15458    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
15459        self._name = new_value.to_string();
15460        self
15461    }
15462    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15463    /// while executing the actual API request.
15464    ///
15465    /// ````text
15466    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15467    /// ````
15468    ///
15469    /// Sets the *delegate* property to the given value.
15470    pub fn delegate(
15471        mut self,
15472        new_value: &'a mut dyn common::Delegate,
15473    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
15474        self._delegate = Some(new_value);
15475        self
15476    }
15477
15478    /// Set any additional parameter of the query string used in the request.
15479    /// It should be used to set parameters which are not yet available through their own
15480    /// setters.
15481    ///
15482    /// Please note that this method must not be used to set any of the known parameters
15483    /// which have their own setter method. If done anyway, the request will fail.
15484    ///
15485    /// # Additional Parameters
15486    ///
15487    /// * *$.xgafv* (query-string) - V1 error format.
15488    /// * *access_token* (query-string) - OAuth access token.
15489    /// * *alt* (query-string) - Data format for response.
15490    /// * *callback* (query-string) - JSONP
15491    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15492    /// * *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.
15493    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15494    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15495    /// * *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.
15496    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15497    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15498    pub fn param<T>(
15499        mut self,
15500        name: T,
15501        value: T,
15502    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
15503    where
15504        T: AsRef<str>,
15505    {
15506        self._additional_params
15507            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15508        self
15509    }
15510
15511    /// Identifies the authorization scope for the method you are building.
15512    ///
15513    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15514    /// [`Scope::CloudPlatform`].
15515    ///
15516    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15517    /// tokens for more than one scope.
15518    ///
15519    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15520    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15521    /// sufficient, a read-write scope will do as well.
15522    pub fn add_scope<St>(
15523        mut self,
15524        scope: St,
15525    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
15526    where
15527        St: AsRef<str>,
15528    {
15529        self._scopes.insert(String::from(scope.as_ref()));
15530        self
15531    }
15532    /// Identifies the authorization scope(s) for the method you are building.
15533    ///
15534    /// See [`Self::add_scope()`] for details.
15535    pub fn add_scopes<I, St>(
15536        mut self,
15537        scopes: I,
15538    ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
15539    where
15540        I: IntoIterator<Item = St>,
15541        St: AsRef<str>,
15542    {
15543        self._scopes
15544            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15545        self
15546    }
15547
15548    /// Removes all scopes, and no default scope will be used either.
15549    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15550    /// for details).
15551    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
15552        self._scopes.clear();
15553        self
15554    }
15555}
15556
15557/// Generate a SSH configuration script to configure the reverse SSH connectivity.
15558///
15559/// A builder for the *locations.migrationJobs.generateSshScript* method supported by a *project* resource.
15560/// It is not used directly, but through a [`ProjectMethods`] instance.
15561///
15562/// # Example
15563///
15564/// Instantiate a resource method builder
15565///
15566/// ```test_harness,no_run
15567/// # extern crate hyper;
15568/// # extern crate hyper_rustls;
15569/// # extern crate google_datamigration1 as datamigration1;
15570/// use datamigration1::api::GenerateSshScriptRequest;
15571/// # async fn dox() {
15572/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15573///
15574/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15575/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15576/// #     secret,
15577/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15578/// # ).build().await.unwrap();
15579///
15580/// # let client = hyper_util::client::legacy::Client::builder(
15581/// #     hyper_util::rt::TokioExecutor::new()
15582/// # )
15583/// # .build(
15584/// #     hyper_rustls::HttpsConnectorBuilder::new()
15585/// #         .with_native_roots()
15586/// #         .unwrap()
15587/// #         .https_or_http()
15588/// #         .enable_http1()
15589/// #         .build()
15590/// # );
15591/// # let mut hub = DatabaseMigrationService::new(client, auth);
15592/// // As the method needs a request, you would usually fill it with the desired information
15593/// // into the respective structure. Some of the parts shown here might not be applicable !
15594/// // Values shown here are possibly random and not representative !
15595/// let mut req = GenerateSshScriptRequest::default();
15596///
15597/// // You can configure optional parameters by calling the respective setters at will, and
15598/// // execute the final call using `doit()`.
15599/// // Values shown here are possibly random and not representative !
15600/// let result = hub.projects().locations_migration_jobs_generate_ssh_script(req, "migrationJob")
15601///              .doit().await;
15602/// # }
15603/// ```
15604pub struct ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
15605where
15606    C: 'a,
15607{
15608    hub: &'a DatabaseMigrationService<C>,
15609    _request: GenerateSshScriptRequest,
15610    _migration_job: String,
15611    _delegate: Option<&'a mut dyn common::Delegate>,
15612    _additional_params: HashMap<String, String>,
15613    _scopes: BTreeSet<String>,
15614}
15615
15616impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {}
15617
15618impl<'a, C> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
15619where
15620    C: common::Connector,
15621{
15622    /// Perform the operation you have build so far.
15623    pub async fn doit(mut self) -> common::Result<(common::Response, SshScript)> {
15624        use std::borrow::Cow;
15625        use std::io::{Read, Seek};
15626
15627        use common::{url::Params, ToParts};
15628        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15629
15630        let mut dd = common::DefaultDelegate;
15631        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15632        dlg.begin(common::MethodInfo {
15633            id: "datamigration.projects.locations.migrationJobs.generateSshScript",
15634            http_method: hyper::Method::POST,
15635        });
15636
15637        for &field in ["alt", "migrationJob"].iter() {
15638            if self._additional_params.contains_key(field) {
15639                dlg.finished(false);
15640                return Err(common::Error::FieldClash(field));
15641            }
15642        }
15643
15644        let mut params = Params::with_capacity(4 + self._additional_params.len());
15645        params.push("migrationJob", self._migration_job);
15646
15647        params.extend(self._additional_params.iter());
15648
15649        params.push("alt", "json");
15650        let mut url = self.hub._base_url.clone() + "v1/{+migrationJob}:generateSshScript";
15651        if self._scopes.is_empty() {
15652            self._scopes
15653                .insert(Scope::CloudPlatform.as_ref().to_string());
15654        }
15655
15656        #[allow(clippy::single_element_loop)]
15657        for &(find_this, param_name) in [("{+migrationJob}", "migrationJob")].iter() {
15658            url = params.uri_replacement(url, param_name, find_this, true);
15659        }
15660        {
15661            let to_remove = ["migrationJob"];
15662            params.remove_params(&to_remove);
15663        }
15664
15665        let url = params.parse_with_url(&url);
15666
15667        let mut json_mime_type = mime::APPLICATION_JSON;
15668        let mut request_value_reader = {
15669            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15670            common::remove_json_null_values(&mut value);
15671            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15672            serde_json::to_writer(&mut dst, &value).unwrap();
15673            dst
15674        };
15675        let request_size = request_value_reader
15676            .seek(std::io::SeekFrom::End(0))
15677            .unwrap();
15678        request_value_reader
15679            .seek(std::io::SeekFrom::Start(0))
15680            .unwrap();
15681
15682        loop {
15683            let token = match self
15684                .hub
15685                .auth
15686                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15687                .await
15688            {
15689                Ok(token) => token,
15690                Err(e) => match dlg.token(e) {
15691                    Ok(token) => token,
15692                    Err(e) => {
15693                        dlg.finished(false);
15694                        return Err(common::Error::MissingToken(e));
15695                    }
15696                },
15697            };
15698            request_value_reader
15699                .seek(std::io::SeekFrom::Start(0))
15700                .unwrap();
15701            let mut req_result = {
15702                let client = &self.hub.client;
15703                dlg.pre_request();
15704                let mut req_builder = hyper::Request::builder()
15705                    .method(hyper::Method::POST)
15706                    .uri(url.as_str())
15707                    .header(USER_AGENT, self.hub._user_agent.clone());
15708
15709                if let Some(token) = token.as_ref() {
15710                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15711                }
15712
15713                let request = req_builder
15714                    .header(CONTENT_TYPE, json_mime_type.to_string())
15715                    .header(CONTENT_LENGTH, request_size as u64)
15716                    .body(common::to_body(
15717                        request_value_reader.get_ref().clone().into(),
15718                    ));
15719
15720                client.request(request.unwrap()).await
15721            };
15722
15723            match req_result {
15724                Err(err) => {
15725                    if let common::Retry::After(d) = dlg.http_error(&err) {
15726                        sleep(d).await;
15727                        continue;
15728                    }
15729                    dlg.finished(false);
15730                    return Err(common::Error::HttpError(err));
15731                }
15732                Ok(res) => {
15733                    let (mut parts, body) = res.into_parts();
15734                    let mut body = common::Body::new(body);
15735                    if !parts.status.is_success() {
15736                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15737                        let error = serde_json::from_str(&common::to_string(&bytes));
15738                        let response = common::to_response(parts, bytes.into());
15739
15740                        if let common::Retry::After(d) =
15741                            dlg.http_failure(&response, error.as_ref().ok())
15742                        {
15743                            sleep(d).await;
15744                            continue;
15745                        }
15746
15747                        dlg.finished(false);
15748
15749                        return Err(match error {
15750                            Ok(value) => common::Error::BadRequest(value),
15751                            _ => common::Error::Failure(response),
15752                        });
15753                    }
15754                    let response = {
15755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15756                        let encoded = common::to_string(&bytes);
15757                        match serde_json::from_str(&encoded) {
15758                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15759                            Err(error) => {
15760                                dlg.response_json_decode_error(&encoded, &error);
15761                                return Err(common::Error::JsonDecodeError(
15762                                    encoded.to_string(),
15763                                    error,
15764                                ));
15765                            }
15766                        }
15767                    };
15768
15769                    dlg.finished(true);
15770                    return Ok(response);
15771                }
15772            }
15773        }
15774    }
15775
15776    ///
15777    /// Sets the *request* property to the given value.
15778    ///
15779    /// Even though the property as already been set when instantiating this call,
15780    /// we provide this method for API completeness.
15781    pub fn request(
15782        mut self,
15783        new_value: GenerateSshScriptRequest,
15784    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
15785        self._request = new_value;
15786        self
15787    }
15788    /// Name of the migration job resource to generate the SSH script.
15789    ///
15790    /// Sets the *migration job* path property to the given value.
15791    ///
15792    /// Even though the property as already been set when instantiating this call,
15793    /// we provide this method for API completeness.
15794    pub fn migration_job(
15795        mut self,
15796        new_value: &str,
15797    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
15798        self._migration_job = new_value.to_string();
15799        self
15800    }
15801    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15802    /// while executing the actual API request.
15803    ///
15804    /// ````text
15805    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15806    /// ````
15807    ///
15808    /// Sets the *delegate* property to the given value.
15809    pub fn delegate(
15810        mut self,
15811        new_value: &'a mut dyn common::Delegate,
15812    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
15813        self._delegate = Some(new_value);
15814        self
15815    }
15816
15817    /// Set any additional parameter of the query string used in the request.
15818    /// It should be used to set parameters which are not yet available through their own
15819    /// setters.
15820    ///
15821    /// Please note that this method must not be used to set any of the known parameters
15822    /// which have their own setter method. If done anyway, the request will fail.
15823    ///
15824    /// # Additional Parameters
15825    ///
15826    /// * *$.xgafv* (query-string) - V1 error format.
15827    /// * *access_token* (query-string) - OAuth access token.
15828    /// * *alt* (query-string) - Data format for response.
15829    /// * *callback* (query-string) - JSONP
15830    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15831    /// * *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.
15832    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15833    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15834    /// * *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.
15835    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15836    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15837    pub fn param<T>(
15838        mut self,
15839        name: T,
15840        value: T,
15841    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
15842    where
15843        T: AsRef<str>,
15844    {
15845        self._additional_params
15846            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15847        self
15848    }
15849
15850    /// Identifies the authorization scope for the method you are building.
15851    ///
15852    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15853    /// [`Scope::CloudPlatform`].
15854    ///
15855    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15856    /// tokens for more than one scope.
15857    ///
15858    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15859    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15860    /// sufficient, a read-write scope will do as well.
15861    pub fn add_scope<St>(
15862        mut self,
15863        scope: St,
15864    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
15865    where
15866        St: AsRef<str>,
15867    {
15868        self._scopes.insert(String::from(scope.as_ref()));
15869        self
15870    }
15871    /// Identifies the authorization scope(s) for the method you are building.
15872    ///
15873    /// See [`Self::add_scope()`] for details.
15874    pub fn add_scopes<I, St>(
15875        mut self,
15876        scopes: I,
15877    ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
15878    where
15879        I: IntoIterator<Item = St>,
15880        St: AsRef<str>,
15881    {
15882        self._scopes
15883            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15884        self
15885    }
15886
15887    /// Removes all scopes, and no default scope will be used either.
15888    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15889    /// for details).
15890    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
15891        self._scopes.clear();
15892        self
15893    }
15894}
15895
15896/// Generate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
15897///
15898/// A builder for the *locations.migrationJobs.generateTcpProxyScript* method supported by a *project* resource.
15899/// It is not used directly, but through a [`ProjectMethods`] instance.
15900///
15901/// # Example
15902///
15903/// Instantiate a resource method builder
15904///
15905/// ```test_harness,no_run
15906/// # extern crate hyper;
15907/// # extern crate hyper_rustls;
15908/// # extern crate google_datamigration1 as datamigration1;
15909/// use datamigration1::api::GenerateTcpProxyScriptRequest;
15910/// # async fn dox() {
15911/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15912///
15913/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15914/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15915/// #     secret,
15916/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15917/// # ).build().await.unwrap();
15918///
15919/// # let client = hyper_util::client::legacy::Client::builder(
15920/// #     hyper_util::rt::TokioExecutor::new()
15921/// # )
15922/// # .build(
15923/// #     hyper_rustls::HttpsConnectorBuilder::new()
15924/// #         .with_native_roots()
15925/// #         .unwrap()
15926/// #         .https_or_http()
15927/// #         .enable_http1()
15928/// #         .build()
15929/// # );
15930/// # let mut hub = DatabaseMigrationService::new(client, auth);
15931/// // As the method needs a request, you would usually fill it with the desired information
15932/// // into the respective structure. Some of the parts shown here might not be applicable !
15933/// // Values shown here are possibly random and not representative !
15934/// let mut req = GenerateTcpProxyScriptRequest::default();
15935///
15936/// // You can configure optional parameters by calling the respective setters at will, and
15937/// // execute the final call using `doit()`.
15938/// // Values shown here are possibly random and not representative !
15939/// let result = hub.projects().locations_migration_jobs_generate_tcp_proxy_script(req, "migrationJob")
15940///              .doit().await;
15941/// # }
15942/// ```
15943pub struct ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
15944where
15945    C: 'a,
15946{
15947    hub: &'a DatabaseMigrationService<C>,
15948    _request: GenerateTcpProxyScriptRequest,
15949    _migration_job: String,
15950    _delegate: Option<&'a mut dyn common::Delegate>,
15951    _additional_params: HashMap<String, String>,
15952    _scopes: BTreeSet<String>,
15953}
15954
15955impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {}
15956
15957impl<'a, C> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
15958where
15959    C: common::Connector,
15960{
15961    /// Perform the operation you have build so far.
15962    pub async fn doit(mut self) -> common::Result<(common::Response, TcpProxyScript)> {
15963        use std::borrow::Cow;
15964        use std::io::{Read, Seek};
15965
15966        use common::{url::Params, ToParts};
15967        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15968
15969        let mut dd = common::DefaultDelegate;
15970        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15971        dlg.begin(common::MethodInfo {
15972            id: "datamigration.projects.locations.migrationJobs.generateTcpProxyScript",
15973            http_method: hyper::Method::POST,
15974        });
15975
15976        for &field in ["alt", "migrationJob"].iter() {
15977            if self._additional_params.contains_key(field) {
15978                dlg.finished(false);
15979                return Err(common::Error::FieldClash(field));
15980            }
15981        }
15982
15983        let mut params = Params::with_capacity(4 + self._additional_params.len());
15984        params.push("migrationJob", self._migration_job);
15985
15986        params.extend(self._additional_params.iter());
15987
15988        params.push("alt", "json");
15989        let mut url = self.hub._base_url.clone() + "v1/{+migrationJob}:generateTcpProxyScript";
15990        if self._scopes.is_empty() {
15991            self._scopes
15992                .insert(Scope::CloudPlatform.as_ref().to_string());
15993        }
15994
15995        #[allow(clippy::single_element_loop)]
15996        for &(find_this, param_name) in [("{+migrationJob}", "migrationJob")].iter() {
15997            url = params.uri_replacement(url, param_name, find_this, true);
15998        }
15999        {
16000            let to_remove = ["migrationJob"];
16001            params.remove_params(&to_remove);
16002        }
16003
16004        let url = params.parse_with_url(&url);
16005
16006        let mut json_mime_type = mime::APPLICATION_JSON;
16007        let mut request_value_reader = {
16008            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16009            common::remove_json_null_values(&mut value);
16010            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16011            serde_json::to_writer(&mut dst, &value).unwrap();
16012            dst
16013        };
16014        let request_size = request_value_reader
16015            .seek(std::io::SeekFrom::End(0))
16016            .unwrap();
16017        request_value_reader
16018            .seek(std::io::SeekFrom::Start(0))
16019            .unwrap();
16020
16021        loop {
16022            let token = match self
16023                .hub
16024                .auth
16025                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16026                .await
16027            {
16028                Ok(token) => token,
16029                Err(e) => match dlg.token(e) {
16030                    Ok(token) => token,
16031                    Err(e) => {
16032                        dlg.finished(false);
16033                        return Err(common::Error::MissingToken(e));
16034                    }
16035                },
16036            };
16037            request_value_reader
16038                .seek(std::io::SeekFrom::Start(0))
16039                .unwrap();
16040            let mut req_result = {
16041                let client = &self.hub.client;
16042                dlg.pre_request();
16043                let mut req_builder = hyper::Request::builder()
16044                    .method(hyper::Method::POST)
16045                    .uri(url.as_str())
16046                    .header(USER_AGENT, self.hub._user_agent.clone());
16047
16048                if let Some(token) = token.as_ref() {
16049                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16050                }
16051
16052                let request = req_builder
16053                    .header(CONTENT_TYPE, json_mime_type.to_string())
16054                    .header(CONTENT_LENGTH, request_size as u64)
16055                    .body(common::to_body(
16056                        request_value_reader.get_ref().clone().into(),
16057                    ));
16058
16059                client.request(request.unwrap()).await
16060            };
16061
16062            match req_result {
16063                Err(err) => {
16064                    if let common::Retry::After(d) = dlg.http_error(&err) {
16065                        sleep(d).await;
16066                        continue;
16067                    }
16068                    dlg.finished(false);
16069                    return Err(common::Error::HttpError(err));
16070                }
16071                Ok(res) => {
16072                    let (mut parts, body) = res.into_parts();
16073                    let mut body = common::Body::new(body);
16074                    if !parts.status.is_success() {
16075                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16076                        let error = serde_json::from_str(&common::to_string(&bytes));
16077                        let response = common::to_response(parts, bytes.into());
16078
16079                        if let common::Retry::After(d) =
16080                            dlg.http_failure(&response, error.as_ref().ok())
16081                        {
16082                            sleep(d).await;
16083                            continue;
16084                        }
16085
16086                        dlg.finished(false);
16087
16088                        return Err(match error {
16089                            Ok(value) => common::Error::BadRequest(value),
16090                            _ => common::Error::Failure(response),
16091                        });
16092                    }
16093                    let response = {
16094                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16095                        let encoded = common::to_string(&bytes);
16096                        match serde_json::from_str(&encoded) {
16097                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16098                            Err(error) => {
16099                                dlg.response_json_decode_error(&encoded, &error);
16100                                return Err(common::Error::JsonDecodeError(
16101                                    encoded.to_string(),
16102                                    error,
16103                                ));
16104                            }
16105                        }
16106                    };
16107
16108                    dlg.finished(true);
16109                    return Ok(response);
16110                }
16111            }
16112        }
16113    }
16114
16115    ///
16116    /// Sets the *request* property to the given value.
16117    ///
16118    /// Even though the property as already been set when instantiating this call,
16119    /// we provide this method for API completeness.
16120    pub fn request(
16121        mut self,
16122        new_value: GenerateTcpProxyScriptRequest,
16123    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
16124        self._request = new_value;
16125        self
16126    }
16127    /// Name of the migration job resource to generate the TCP Proxy script.
16128    ///
16129    /// Sets the *migration job* path property to the given value.
16130    ///
16131    /// Even though the property as already been set when instantiating this call,
16132    /// we provide this method for API completeness.
16133    pub fn migration_job(
16134        mut self,
16135        new_value: &str,
16136    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
16137        self._migration_job = new_value.to_string();
16138        self
16139    }
16140    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16141    /// while executing the actual API request.
16142    ///
16143    /// ````text
16144    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16145    /// ````
16146    ///
16147    /// Sets the *delegate* property to the given value.
16148    pub fn delegate(
16149        mut self,
16150        new_value: &'a mut dyn common::Delegate,
16151    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
16152        self._delegate = Some(new_value);
16153        self
16154    }
16155
16156    /// Set any additional parameter of the query string used in the request.
16157    /// It should be used to set parameters which are not yet available through their own
16158    /// setters.
16159    ///
16160    /// Please note that this method must not be used to set any of the known parameters
16161    /// which have their own setter method. If done anyway, the request will fail.
16162    ///
16163    /// # Additional Parameters
16164    ///
16165    /// * *$.xgafv* (query-string) - V1 error format.
16166    /// * *access_token* (query-string) - OAuth access token.
16167    /// * *alt* (query-string) - Data format for response.
16168    /// * *callback* (query-string) - JSONP
16169    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16170    /// * *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.
16171    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16172    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16173    /// * *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.
16174    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16175    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16176    pub fn param<T>(
16177        mut self,
16178        name: T,
16179        value: T,
16180    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
16181    where
16182        T: AsRef<str>,
16183    {
16184        self._additional_params
16185            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16186        self
16187    }
16188
16189    /// Identifies the authorization scope for the method you are building.
16190    ///
16191    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16192    /// [`Scope::CloudPlatform`].
16193    ///
16194    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16195    /// tokens for more than one scope.
16196    ///
16197    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16198    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16199    /// sufficient, a read-write scope will do as well.
16200    pub fn add_scope<St>(
16201        mut self,
16202        scope: St,
16203    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
16204    where
16205        St: AsRef<str>,
16206    {
16207        self._scopes.insert(String::from(scope.as_ref()));
16208        self
16209    }
16210    /// Identifies the authorization scope(s) for the method you are building.
16211    ///
16212    /// See [`Self::add_scope()`] for details.
16213    pub fn add_scopes<I, St>(
16214        mut self,
16215        scopes: I,
16216    ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
16217    where
16218        I: IntoIterator<Item = St>,
16219        St: AsRef<str>,
16220    {
16221        self._scopes
16222            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16223        self
16224    }
16225
16226    /// Removes all scopes, and no default scope will be used either.
16227    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16228    /// for details).
16229    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
16230        self._scopes.clear();
16231        self
16232    }
16233}
16234
16235/// Gets details of a single migration job.
16236///
16237/// A builder for the *locations.migrationJobs.get* method supported by a *project* resource.
16238/// It is not used directly, but through a [`ProjectMethods`] instance.
16239///
16240/// # Example
16241///
16242/// Instantiate a resource method builder
16243///
16244/// ```test_harness,no_run
16245/// # extern crate hyper;
16246/// # extern crate hyper_rustls;
16247/// # extern crate google_datamigration1 as datamigration1;
16248/// # async fn dox() {
16249/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16250///
16251/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16253/// #     secret,
16254/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16255/// # ).build().await.unwrap();
16256///
16257/// # let client = hyper_util::client::legacy::Client::builder(
16258/// #     hyper_util::rt::TokioExecutor::new()
16259/// # )
16260/// # .build(
16261/// #     hyper_rustls::HttpsConnectorBuilder::new()
16262/// #         .with_native_roots()
16263/// #         .unwrap()
16264/// #         .https_or_http()
16265/// #         .enable_http1()
16266/// #         .build()
16267/// # );
16268/// # let mut hub = DatabaseMigrationService::new(client, auth);
16269/// // You can configure optional parameters by calling the respective setters at will, and
16270/// // execute the final call using `doit()`.
16271/// // Values shown here are possibly random and not representative !
16272/// let result = hub.projects().locations_migration_jobs_get("name")
16273///              .doit().await;
16274/// # }
16275/// ```
16276pub struct ProjectLocationMigrationJobGetCall<'a, C>
16277where
16278    C: 'a,
16279{
16280    hub: &'a DatabaseMigrationService<C>,
16281    _name: String,
16282    _delegate: Option<&'a mut dyn common::Delegate>,
16283    _additional_params: HashMap<String, String>,
16284    _scopes: BTreeSet<String>,
16285}
16286
16287impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGetCall<'a, C> {}
16288
16289impl<'a, C> ProjectLocationMigrationJobGetCall<'a, C>
16290where
16291    C: common::Connector,
16292{
16293    /// Perform the operation you have build so far.
16294    pub async fn doit(mut self) -> common::Result<(common::Response, MigrationJob)> {
16295        use std::borrow::Cow;
16296        use std::io::{Read, Seek};
16297
16298        use common::{url::Params, ToParts};
16299        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16300
16301        let mut dd = common::DefaultDelegate;
16302        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16303        dlg.begin(common::MethodInfo {
16304            id: "datamigration.projects.locations.migrationJobs.get",
16305            http_method: hyper::Method::GET,
16306        });
16307
16308        for &field in ["alt", "name"].iter() {
16309            if self._additional_params.contains_key(field) {
16310                dlg.finished(false);
16311                return Err(common::Error::FieldClash(field));
16312            }
16313        }
16314
16315        let mut params = Params::with_capacity(3 + self._additional_params.len());
16316        params.push("name", self._name);
16317
16318        params.extend(self._additional_params.iter());
16319
16320        params.push("alt", "json");
16321        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16322        if self._scopes.is_empty() {
16323            self._scopes
16324                .insert(Scope::CloudPlatform.as_ref().to_string());
16325        }
16326
16327        #[allow(clippy::single_element_loop)]
16328        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16329            url = params.uri_replacement(url, param_name, find_this, true);
16330        }
16331        {
16332            let to_remove = ["name"];
16333            params.remove_params(&to_remove);
16334        }
16335
16336        let url = params.parse_with_url(&url);
16337
16338        loop {
16339            let token = match self
16340                .hub
16341                .auth
16342                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16343                .await
16344            {
16345                Ok(token) => token,
16346                Err(e) => match dlg.token(e) {
16347                    Ok(token) => token,
16348                    Err(e) => {
16349                        dlg.finished(false);
16350                        return Err(common::Error::MissingToken(e));
16351                    }
16352                },
16353            };
16354            let mut req_result = {
16355                let client = &self.hub.client;
16356                dlg.pre_request();
16357                let mut req_builder = hyper::Request::builder()
16358                    .method(hyper::Method::GET)
16359                    .uri(url.as_str())
16360                    .header(USER_AGENT, self.hub._user_agent.clone());
16361
16362                if let Some(token) = token.as_ref() {
16363                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16364                }
16365
16366                let request = req_builder
16367                    .header(CONTENT_LENGTH, 0_u64)
16368                    .body(common::to_body::<String>(None));
16369
16370                client.request(request.unwrap()).await
16371            };
16372
16373            match req_result {
16374                Err(err) => {
16375                    if let common::Retry::After(d) = dlg.http_error(&err) {
16376                        sleep(d).await;
16377                        continue;
16378                    }
16379                    dlg.finished(false);
16380                    return Err(common::Error::HttpError(err));
16381                }
16382                Ok(res) => {
16383                    let (mut parts, body) = res.into_parts();
16384                    let mut body = common::Body::new(body);
16385                    if !parts.status.is_success() {
16386                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16387                        let error = serde_json::from_str(&common::to_string(&bytes));
16388                        let response = common::to_response(parts, bytes.into());
16389
16390                        if let common::Retry::After(d) =
16391                            dlg.http_failure(&response, error.as_ref().ok())
16392                        {
16393                            sleep(d).await;
16394                            continue;
16395                        }
16396
16397                        dlg.finished(false);
16398
16399                        return Err(match error {
16400                            Ok(value) => common::Error::BadRequest(value),
16401                            _ => common::Error::Failure(response),
16402                        });
16403                    }
16404                    let response = {
16405                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16406                        let encoded = common::to_string(&bytes);
16407                        match serde_json::from_str(&encoded) {
16408                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16409                            Err(error) => {
16410                                dlg.response_json_decode_error(&encoded, &error);
16411                                return Err(common::Error::JsonDecodeError(
16412                                    encoded.to_string(),
16413                                    error,
16414                                ));
16415                            }
16416                        }
16417                    };
16418
16419                    dlg.finished(true);
16420                    return Ok(response);
16421                }
16422            }
16423        }
16424    }
16425
16426    /// Required. Name of the migration job resource to get.
16427    ///
16428    /// Sets the *name* path property to the given value.
16429    ///
16430    /// Even though the property as already been set when instantiating this call,
16431    /// we provide this method for API completeness.
16432    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobGetCall<'a, C> {
16433        self._name = new_value.to_string();
16434        self
16435    }
16436    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16437    /// while executing the actual API request.
16438    ///
16439    /// ````text
16440    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16441    /// ````
16442    ///
16443    /// Sets the *delegate* property to the given value.
16444    pub fn delegate(
16445        mut self,
16446        new_value: &'a mut dyn common::Delegate,
16447    ) -> ProjectLocationMigrationJobGetCall<'a, C> {
16448        self._delegate = Some(new_value);
16449        self
16450    }
16451
16452    /// Set any additional parameter of the query string used in the request.
16453    /// It should be used to set parameters which are not yet available through their own
16454    /// setters.
16455    ///
16456    /// Please note that this method must not be used to set any of the known parameters
16457    /// which have their own setter method. If done anyway, the request will fail.
16458    ///
16459    /// # Additional Parameters
16460    ///
16461    /// * *$.xgafv* (query-string) - V1 error format.
16462    /// * *access_token* (query-string) - OAuth access token.
16463    /// * *alt* (query-string) - Data format for response.
16464    /// * *callback* (query-string) - JSONP
16465    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16466    /// * *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.
16467    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16468    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16469    /// * *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.
16470    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16471    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16472    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobGetCall<'a, C>
16473    where
16474        T: AsRef<str>,
16475    {
16476        self._additional_params
16477            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16478        self
16479    }
16480
16481    /// Identifies the authorization scope for the method you are building.
16482    ///
16483    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16484    /// [`Scope::CloudPlatform`].
16485    ///
16486    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16487    /// tokens for more than one scope.
16488    ///
16489    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16490    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16491    /// sufficient, a read-write scope will do as well.
16492    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobGetCall<'a, C>
16493    where
16494        St: AsRef<str>,
16495    {
16496        self._scopes.insert(String::from(scope.as_ref()));
16497        self
16498    }
16499    /// Identifies the authorization scope(s) for the method you are building.
16500    ///
16501    /// See [`Self::add_scope()`] for details.
16502    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobGetCall<'a, C>
16503    where
16504        I: IntoIterator<Item = St>,
16505        St: AsRef<str>,
16506    {
16507        self._scopes
16508            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16509        self
16510    }
16511
16512    /// Removes all scopes, and no default scope will be used either.
16513    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16514    /// for details).
16515    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGetCall<'a, C> {
16516        self._scopes.clear();
16517        self
16518    }
16519}
16520
16521/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
16522///
16523/// A builder for the *locations.migrationJobs.getIamPolicy* method supported by a *project* resource.
16524/// It is not used directly, but through a [`ProjectMethods`] instance.
16525///
16526/// # Example
16527///
16528/// Instantiate a resource method builder
16529///
16530/// ```test_harness,no_run
16531/// # extern crate hyper;
16532/// # extern crate hyper_rustls;
16533/// # extern crate google_datamigration1 as datamigration1;
16534/// # async fn dox() {
16535/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16536///
16537/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16538/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16539/// #     secret,
16540/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16541/// # ).build().await.unwrap();
16542///
16543/// # let client = hyper_util::client::legacy::Client::builder(
16544/// #     hyper_util::rt::TokioExecutor::new()
16545/// # )
16546/// # .build(
16547/// #     hyper_rustls::HttpsConnectorBuilder::new()
16548/// #         .with_native_roots()
16549/// #         .unwrap()
16550/// #         .https_or_http()
16551/// #         .enable_http1()
16552/// #         .build()
16553/// # );
16554/// # let mut hub = DatabaseMigrationService::new(client, auth);
16555/// // You can configure optional parameters by calling the respective setters at will, and
16556/// // execute the final call using `doit()`.
16557/// // Values shown here are possibly random and not representative !
16558/// let result = hub.projects().locations_migration_jobs_get_iam_policy("resource")
16559///              .options_requested_policy_version(-8)
16560///              .doit().await;
16561/// # }
16562/// ```
16563pub struct ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
16564where
16565    C: 'a,
16566{
16567    hub: &'a DatabaseMigrationService<C>,
16568    _resource: String,
16569    _options_requested_policy_version: Option<i32>,
16570    _delegate: Option<&'a mut dyn common::Delegate>,
16571    _additional_params: HashMap<String, String>,
16572    _scopes: BTreeSet<String>,
16573}
16574
16575impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {}
16576
16577impl<'a, C> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
16578where
16579    C: common::Connector,
16580{
16581    /// Perform the operation you have build so far.
16582    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16583        use std::borrow::Cow;
16584        use std::io::{Read, Seek};
16585
16586        use common::{url::Params, ToParts};
16587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16588
16589        let mut dd = common::DefaultDelegate;
16590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16591        dlg.begin(common::MethodInfo {
16592            id: "datamigration.projects.locations.migrationJobs.getIamPolicy",
16593            http_method: hyper::Method::GET,
16594        });
16595
16596        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
16597            if self._additional_params.contains_key(field) {
16598                dlg.finished(false);
16599                return Err(common::Error::FieldClash(field));
16600            }
16601        }
16602
16603        let mut params = Params::with_capacity(4 + self._additional_params.len());
16604        params.push("resource", self._resource);
16605        if let Some(value) = self._options_requested_policy_version.as_ref() {
16606            params.push("options.requestedPolicyVersion", value.to_string());
16607        }
16608
16609        params.extend(self._additional_params.iter());
16610
16611        params.push("alt", "json");
16612        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
16613        if self._scopes.is_empty() {
16614            self._scopes
16615                .insert(Scope::CloudPlatform.as_ref().to_string());
16616        }
16617
16618        #[allow(clippy::single_element_loop)]
16619        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16620            url = params.uri_replacement(url, param_name, find_this, true);
16621        }
16622        {
16623            let to_remove = ["resource"];
16624            params.remove_params(&to_remove);
16625        }
16626
16627        let url = params.parse_with_url(&url);
16628
16629        loop {
16630            let token = match self
16631                .hub
16632                .auth
16633                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16634                .await
16635            {
16636                Ok(token) => token,
16637                Err(e) => match dlg.token(e) {
16638                    Ok(token) => token,
16639                    Err(e) => {
16640                        dlg.finished(false);
16641                        return Err(common::Error::MissingToken(e));
16642                    }
16643                },
16644            };
16645            let mut req_result = {
16646                let client = &self.hub.client;
16647                dlg.pre_request();
16648                let mut req_builder = hyper::Request::builder()
16649                    .method(hyper::Method::GET)
16650                    .uri(url.as_str())
16651                    .header(USER_AGENT, self.hub._user_agent.clone());
16652
16653                if let Some(token) = token.as_ref() {
16654                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16655                }
16656
16657                let request = req_builder
16658                    .header(CONTENT_LENGTH, 0_u64)
16659                    .body(common::to_body::<String>(None));
16660
16661                client.request(request.unwrap()).await
16662            };
16663
16664            match req_result {
16665                Err(err) => {
16666                    if let common::Retry::After(d) = dlg.http_error(&err) {
16667                        sleep(d).await;
16668                        continue;
16669                    }
16670                    dlg.finished(false);
16671                    return Err(common::Error::HttpError(err));
16672                }
16673                Ok(res) => {
16674                    let (mut parts, body) = res.into_parts();
16675                    let mut body = common::Body::new(body);
16676                    if !parts.status.is_success() {
16677                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16678                        let error = serde_json::from_str(&common::to_string(&bytes));
16679                        let response = common::to_response(parts, bytes.into());
16680
16681                        if let common::Retry::After(d) =
16682                            dlg.http_failure(&response, error.as_ref().ok())
16683                        {
16684                            sleep(d).await;
16685                            continue;
16686                        }
16687
16688                        dlg.finished(false);
16689
16690                        return Err(match error {
16691                            Ok(value) => common::Error::BadRequest(value),
16692                            _ => common::Error::Failure(response),
16693                        });
16694                    }
16695                    let response = {
16696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16697                        let encoded = common::to_string(&bytes);
16698                        match serde_json::from_str(&encoded) {
16699                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16700                            Err(error) => {
16701                                dlg.response_json_decode_error(&encoded, &error);
16702                                return Err(common::Error::JsonDecodeError(
16703                                    encoded.to_string(),
16704                                    error,
16705                                ));
16706                            }
16707                        }
16708                    };
16709
16710                    dlg.finished(true);
16711                    return Ok(response);
16712                }
16713            }
16714        }
16715    }
16716
16717    /// 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.
16718    ///
16719    /// Sets the *resource* path property to the given value.
16720    ///
16721    /// Even though the property as already been set when instantiating this call,
16722    /// we provide this method for API completeness.
16723    pub fn resource(
16724        mut self,
16725        new_value: &str,
16726    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
16727        self._resource = new_value.to_string();
16728        self
16729    }
16730    /// 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).
16731    ///
16732    /// Sets the *options.requested policy version* query property to the given value.
16733    pub fn options_requested_policy_version(
16734        mut self,
16735        new_value: i32,
16736    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
16737        self._options_requested_policy_version = Some(new_value);
16738        self
16739    }
16740    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16741    /// while executing the actual API request.
16742    ///
16743    /// ````text
16744    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16745    /// ````
16746    ///
16747    /// Sets the *delegate* property to the given value.
16748    pub fn delegate(
16749        mut self,
16750        new_value: &'a mut dyn common::Delegate,
16751    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
16752        self._delegate = Some(new_value);
16753        self
16754    }
16755
16756    /// Set any additional parameter of the query string used in the request.
16757    /// It should be used to set parameters which are not yet available through their own
16758    /// setters.
16759    ///
16760    /// Please note that this method must not be used to set any of the known parameters
16761    /// which have their own setter method. If done anyway, the request will fail.
16762    ///
16763    /// # Additional Parameters
16764    ///
16765    /// * *$.xgafv* (query-string) - V1 error format.
16766    /// * *access_token* (query-string) - OAuth access token.
16767    /// * *alt* (query-string) - Data format for response.
16768    /// * *callback* (query-string) - JSONP
16769    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16770    /// * *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.
16771    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16772    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16773    /// * *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.
16774    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16775    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16776    pub fn param<T>(
16777        mut self,
16778        name: T,
16779        value: T,
16780    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
16781    where
16782        T: AsRef<str>,
16783    {
16784        self._additional_params
16785            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16786        self
16787    }
16788
16789    /// Identifies the authorization scope for the method you are building.
16790    ///
16791    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16792    /// [`Scope::CloudPlatform`].
16793    ///
16794    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16795    /// tokens for more than one scope.
16796    ///
16797    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16798    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16799    /// sufficient, a read-write scope will do as well.
16800    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
16801    where
16802        St: AsRef<str>,
16803    {
16804        self._scopes.insert(String::from(scope.as_ref()));
16805        self
16806    }
16807    /// Identifies the authorization scope(s) for the method you are building.
16808    ///
16809    /// See [`Self::add_scope()`] for details.
16810    pub fn add_scopes<I, St>(
16811        mut self,
16812        scopes: I,
16813    ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
16814    where
16815        I: IntoIterator<Item = St>,
16816        St: AsRef<str>,
16817    {
16818        self._scopes
16819            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16820        self
16821    }
16822
16823    /// Removes all scopes, and no default scope will be used either.
16824    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16825    /// for details).
16826    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
16827        self._scopes.clear();
16828        self
16829    }
16830}
16831
16832/// Lists migration jobs in a given project and location.
16833///
16834/// A builder for the *locations.migrationJobs.list* method supported by a *project* resource.
16835/// It is not used directly, but through a [`ProjectMethods`] instance.
16836///
16837/// # Example
16838///
16839/// Instantiate a resource method builder
16840///
16841/// ```test_harness,no_run
16842/// # extern crate hyper;
16843/// # extern crate hyper_rustls;
16844/// # extern crate google_datamigration1 as datamigration1;
16845/// # async fn dox() {
16846/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16847///
16848/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16849/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16850/// #     secret,
16851/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16852/// # ).build().await.unwrap();
16853///
16854/// # let client = hyper_util::client::legacy::Client::builder(
16855/// #     hyper_util::rt::TokioExecutor::new()
16856/// # )
16857/// # .build(
16858/// #     hyper_rustls::HttpsConnectorBuilder::new()
16859/// #         .with_native_roots()
16860/// #         .unwrap()
16861/// #         .https_or_http()
16862/// #         .enable_http1()
16863/// #         .build()
16864/// # );
16865/// # let mut hub = DatabaseMigrationService::new(client, auth);
16866/// // You can configure optional parameters by calling the respective setters at will, and
16867/// // execute the final call using `doit()`.
16868/// // Values shown here are possibly random and not representative !
16869/// let result = hub.projects().locations_migration_jobs_list("parent")
16870///              .page_token("est")
16871///              .page_size(-30)
16872///              .order_by("diam")
16873///              .filter("dolores")
16874///              .doit().await;
16875/// # }
16876/// ```
16877pub struct ProjectLocationMigrationJobListCall<'a, C>
16878where
16879    C: 'a,
16880{
16881    hub: &'a DatabaseMigrationService<C>,
16882    _parent: String,
16883    _page_token: Option<String>,
16884    _page_size: Option<i32>,
16885    _order_by: Option<String>,
16886    _filter: Option<String>,
16887    _delegate: Option<&'a mut dyn common::Delegate>,
16888    _additional_params: HashMap<String, String>,
16889    _scopes: BTreeSet<String>,
16890}
16891
16892impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobListCall<'a, C> {}
16893
16894impl<'a, C> ProjectLocationMigrationJobListCall<'a, C>
16895where
16896    C: common::Connector,
16897{
16898    /// Perform the operation you have build so far.
16899    pub async fn doit(mut self) -> common::Result<(common::Response, ListMigrationJobsResponse)> {
16900        use std::borrow::Cow;
16901        use std::io::{Read, Seek};
16902
16903        use common::{url::Params, ToParts};
16904        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16905
16906        let mut dd = common::DefaultDelegate;
16907        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16908        dlg.begin(common::MethodInfo {
16909            id: "datamigration.projects.locations.migrationJobs.list",
16910            http_method: hyper::Method::GET,
16911        });
16912
16913        for &field in [
16914            "alt",
16915            "parent",
16916            "pageToken",
16917            "pageSize",
16918            "orderBy",
16919            "filter",
16920        ]
16921        .iter()
16922        {
16923            if self._additional_params.contains_key(field) {
16924                dlg.finished(false);
16925                return Err(common::Error::FieldClash(field));
16926            }
16927        }
16928
16929        let mut params = Params::with_capacity(7 + self._additional_params.len());
16930        params.push("parent", self._parent);
16931        if let Some(value) = self._page_token.as_ref() {
16932            params.push("pageToken", value);
16933        }
16934        if let Some(value) = self._page_size.as_ref() {
16935            params.push("pageSize", value.to_string());
16936        }
16937        if let Some(value) = self._order_by.as_ref() {
16938            params.push("orderBy", value);
16939        }
16940        if let Some(value) = self._filter.as_ref() {
16941            params.push("filter", value);
16942        }
16943
16944        params.extend(self._additional_params.iter());
16945
16946        params.push("alt", "json");
16947        let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationJobs";
16948        if self._scopes.is_empty() {
16949            self._scopes
16950                .insert(Scope::CloudPlatform.as_ref().to_string());
16951        }
16952
16953        #[allow(clippy::single_element_loop)]
16954        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16955            url = params.uri_replacement(url, param_name, find_this, true);
16956        }
16957        {
16958            let to_remove = ["parent"];
16959            params.remove_params(&to_remove);
16960        }
16961
16962        let url = params.parse_with_url(&url);
16963
16964        loop {
16965            let token = match self
16966                .hub
16967                .auth
16968                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16969                .await
16970            {
16971                Ok(token) => token,
16972                Err(e) => match dlg.token(e) {
16973                    Ok(token) => token,
16974                    Err(e) => {
16975                        dlg.finished(false);
16976                        return Err(common::Error::MissingToken(e));
16977                    }
16978                },
16979            };
16980            let mut req_result = {
16981                let client = &self.hub.client;
16982                dlg.pre_request();
16983                let mut req_builder = hyper::Request::builder()
16984                    .method(hyper::Method::GET)
16985                    .uri(url.as_str())
16986                    .header(USER_AGENT, self.hub._user_agent.clone());
16987
16988                if let Some(token) = token.as_ref() {
16989                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16990                }
16991
16992                let request = req_builder
16993                    .header(CONTENT_LENGTH, 0_u64)
16994                    .body(common::to_body::<String>(None));
16995
16996                client.request(request.unwrap()).await
16997            };
16998
16999            match req_result {
17000                Err(err) => {
17001                    if let common::Retry::After(d) = dlg.http_error(&err) {
17002                        sleep(d).await;
17003                        continue;
17004                    }
17005                    dlg.finished(false);
17006                    return Err(common::Error::HttpError(err));
17007                }
17008                Ok(res) => {
17009                    let (mut parts, body) = res.into_parts();
17010                    let mut body = common::Body::new(body);
17011                    if !parts.status.is_success() {
17012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17013                        let error = serde_json::from_str(&common::to_string(&bytes));
17014                        let response = common::to_response(parts, bytes.into());
17015
17016                        if let common::Retry::After(d) =
17017                            dlg.http_failure(&response, error.as_ref().ok())
17018                        {
17019                            sleep(d).await;
17020                            continue;
17021                        }
17022
17023                        dlg.finished(false);
17024
17025                        return Err(match error {
17026                            Ok(value) => common::Error::BadRequest(value),
17027                            _ => common::Error::Failure(response),
17028                        });
17029                    }
17030                    let response = {
17031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17032                        let encoded = common::to_string(&bytes);
17033                        match serde_json::from_str(&encoded) {
17034                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17035                            Err(error) => {
17036                                dlg.response_json_decode_error(&encoded, &error);
17037                                return Err(common::Error::JsonDecodeError(
17038                                    encoded.to_string(),
17039                                    error,
17040                                ));
17041                            }
17042                        }
17043                    };
17044
17045                    dlg.finished(true);
17046                    return Ok(response);
17047                }
17048            }
17049        }
17050    }
17051
17052    /// Required. The parent which owns this collection of migrationJobs.
17053    ///
17054    /// Sets the *parent* path property to the given value.
17055    ///
17056    /// Even though the property as already been set when instantiating this call,
17057    /// we provide this method for API completeness.
17058    pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
17059        self._parent = new_value.to_string();
17060        self
17061    }
17062    /// The nextPageToken value received in the previous call to migrationJobs.list, used in the subsequent request to retrieve the next page of results. On first call this should be left blank. When paginating, all other parameters provided to migrationJobs.list must match the call that provided the page token.
17063    ///
17064    /// Sets the *page token* query property to the given value.
17065    pub fn page_token(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
17066        self._page_token = Some(new_value.to_string());
17067        self
17068    }
17069    /// The maximum number of migration jobs to return. The service may return fewer than this value. If unspecified, at most 50 migration jobs will be returned. The maximum value is 1000; values above 1000 are coerced to 1000.
17070    ///
17071    /// Sets the *page size* query property to the given value.
17072    pub fn page_size(mut self, new_value: i32) -> ProjectLocationMigrationJobListCall<'a, C> {
17073        self._page_size = Some(new_value);
17074        self
17075    }
17076    /// Sort the results based on the migration job name. Valid values are: "name", "name asc", and "name desc".
17077    ///
17078    /// Sets the *order by* query property to the given value.
17079    pub fn order_by(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
17080        self._order_by = Some(new_value.to_string());
17081        self
17082    }
17083    /// A filter expression that filters migration jobs listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list migration jobs created this year by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z.** You can also filter nested fields. For example, you could specify **reverseSshConnectivity.vmIp = "1.2.3.4"** to select all migration jobs connecting through the specific SSH tunnel bastion.
17084    ///
17085    /// Sets the *filter* query property to the given value.
17086    pub fn filter(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
17087        self._filter = Some(new_value.to_string());
17088        self
17089    }
17090    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17091    /// while executing the actual API request.
17092    ///
17093    /// ````text
17094    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17095    /// ````
17096    ///
17097    /// Sets the *delegate* property to the given value.
17098    pub fn delegate(
17099        mut self,
17100        new_value: &'a mut dyn common::Delegate,
17101    ) -> ProjectLocationMigrationJobListCall<'a, C> {
17102        self._delegate = Some(new_value);
17103        self
17104    }
17105
17106    /// Set any additional parameter of the query string used in the request.
17107    /// It should be used to set parameters which are not yet available through their own
17108    /// setters.
17109    ///
17110    /// Please note that this method must not be used to set any of the known parameters
17111    /// which have their own setter method. If done anyway, the request will fail.
17112    ///
17113    /// # Additional Parameters
17114    ///
17115    /// * *$.xgafv* (query-string) - V1 error format.
17116    /// * *access_token* (query-string) - OAuth access token.
17117    /// * *alt* (query-string) - Data format for response.
17118    /// * *callback* (query-string) - JSONP
17119    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17120    /// * *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.
17121    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17122    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17123    /// * *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.
17124    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17125    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17126    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobListCall<'a, C>
17127    where
17128        T: AsRef<str>,
17129    {
17130        self._additional_params
17131            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17132        self
17133    }
17134
17135    /// Identifies the authorization scope for the method you are building.
17136    ///
17137    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17138    /// [`Scope::CloudPlatform`].
17139    ///
17140    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17141    /// tokens for more than one scope.
17142    ///
17143    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17144    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17145    /// sufficient, a read-write scope will do as well.
17146    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobListCall<'a, C>
17147    where
17148        St: AsRef<str>,
17149    {
17150        self._scopes.insert(String::from(scope.as_ref()));
17151        self
17152    }
17153    /// Identifies the authorization scope(s) for the method you are building.
17154    ///
17155    /// See [`Self::add_scope()`] for details.
17156    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobListCall<'a, C>
17157    where
17158        I: IntoIterator<Item = St>,
17159        St: AsRef<str>,
17160    {
17161        self._scopes
17162            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17163        self
17164    }
17165
17166    /// Removes all scopes, and no default scope will be used either.
17167    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17168    /// for details).
17169    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobListCall<'a, C> {
17170        self._scopes.clear();
17171        self
17172    }
17173}
17174
17175/// Updates the parameters of a single migration job.
17176///
17177/// A builder for the *locations.migrationJobs.patch* method supported by a *project* resource.
17178/// It is not used directly, but through a [`ProjectMethods`] instance.
17179///
17180/// # Example
17181///
17182/// Instantiate a resource method builder
17183///
17184/// ```test_harness,no_run
17185/// # extern crate hyper;
17186/// # extern crate hyper_rustls;
17187/// # extern crate google_datamigration1 as datamigration1;
17188/// use datamigration1::api::MigrationJob;
17189/// # async fn dox() {
17190/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17191///
17192/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17193/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17194/// #     secret,
17195/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17196/// # ).build().await.unwrap();
17197///
17198/// # let client = hyper_util::client::legacy::Client::builder(
17199/// #     hyper_util::rt::TokioExecutor::new()
17200/// # )
17201/// # .build(
17202/// #     hyper_rustls::HttpsConnectorBuilder::new()
17203/// #         .with_native_roots()
17204/// #         .unwrap()
17205/// #         .https_or_http()
17206/// #         .enable_http1()
17207/// #         .build()
17208/// # );
17209/// # let mut hub = DatabaseMigrationService::new(client, auth);
17210/// // As the method needs a request, you would usually fill it with the desired information
17211/// // into the respective structure. Some of the parts shown here might not be applicable !
17212/// // Values shown here are possibly random and not representative !
17213/// let mut req = MigrationJob::default();
17214///
17215/// // You can configure optional parameters by calling the respective setters at will, and
17216/// // execute the final call using `doit()`.
17217/// // Values shown here are possibly random and not representative !
17218/// let result = hub.projects().locations_migration_jobs_patch(req, "name")
17219///              .update_mask(FieldMask::new::<&str>(&[]))
17220///              .request_id("et")
17221///              .doit().await;
17222/// # }
17223/// ```
17224pub struct ProjectLocationMigrationJobPatchCall<'a, C>
17225where
17226    C: 'a,
17227{
17228    hub: &'a DatabaseMigrationService<C>,
17229    _request: MigrationJob,
17230    _name: String,
17231    _update_mask: Option<common::FieldMask>,
17232    _request_id: Option<String>,
17233    _delegate: Option<&'a mut dyn common::Delegate>,
17234    _additional_params: HashMap<String, String>,
17235    _scopes: BTreeSet<String>,
17236}
17237
17238impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobPatchCall<'a, C> {}
17239
17240impl<'a, C> ProjectLocationMigrationJobPatchCall<'a, C>
17241where
17242    C: common::Connector,
17243{
17244    /// Perform the operation you have build so far.
17245    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17246        use std::borrow::Cow;
17247        use std::io::{Read, Seek};
17248
17249        use common::{url::Params, ToParts};
17250        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17251
17252        let mut dd = common::DefaultDelegate;
17253        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17254        dlg.begin(common::MethodInfo {
17255            id: "datamigration.projects.locations.migrationJobs.patch",
17256            http_method: hyper::Method::PATCH,
17257        });
17258
17259        for &field in ["alt", "name", "updateMask", "requestId"].iter() {
17260            if self._additional_params.contains_key(field) {
17261                dlg.finished(false);
17262                return Err(common::Error::FieldClash(field));
17263            }
17264        }
17265
17266        let mut params = Params::with_capacity(6 + self._additional_params.len());
17267        params.push("name", self._name);
17268        if let Some(value) = self._update_mask.as_ref() {
17269            params.push("updateMask", value.to_string());
17270        }
17271        if let Some(value) = self._request_id.as_ref() {
17272            params.push("requestId", value);
17273        }
17274
17275        params.extend(self._additional_params.iter());
17276
17277        params.push("alt", "json");
17278        let mut url = self.hub._base_url.clone() + "v1/{+name}";
17279        if self._scopes.is_empty() {
17280            self._scopes
17281                .insert(Scope::CloudPlatform.as_ref().to_string());
17282        }
17283
17284        #[allow(clippy::single_element_loop)]
17285        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17286            url = params.uri_replacement(url, param_name, find_this, true);
17287        }
17288        {
17289            let to_remove = ["name"];
17290            params.remove_params(&to_remove);
17291        }
17292
17293        let url = params.parse_with_url(&url);
17294
17295        let mut json_mime_type = mime::APPLICATION_JSON;
17296        let mut request_value_reader = {
17297            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17298            common::remove_json_null_values(&mut value);
17299            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17300            serde_json::to_writer(&mut dst, &value).unwrap();
17301            dst
17302        };
17303        let request_size = request_value_reader
17304            .seek(std::io::SeekFrom::End(0))
17305            .unwrap();
17306        request_value_reader
17307            .seek(std::io::SeekFrom::Start(0))
17308            .unwrap();
17309
17310        loop {
17311            let token = match self
17312                .hub
17313                .auth
17314                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17315                .await
17316            {
17317                Ok(token) => token,
17318                Err(e) => match dlg.token(e) {
17319                    Ok(token) => token,
17320                    Err(e) => {
17321                        dlg.finished(false);
17322                        return Err(common::Error::MissingToken(e));
17323                    }
17324                },
17325            };
17326            request_value_reader
17327                .seek(std::io::SeekFrom::Start(0))
17328                .unwrap();
17329            let mut req_result = {
17330                let client = &self.hub.client;
17331                dlg.pre_request();
17332                let mut req_builder = hyper::Request::builder()
17333                    .method(hyper::Method::PATCH)
17334                    .uri(url.as_str())
17335                    .header(USER_AGENT, self.hub._user_agent.clone());
17336
17337                if let Some(token) = token.as_ref() {
17338                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17339                }
17340
17341                let request = req_builder
17342                    .header(CONTENT_TYPE, json_mime_type.to_string())
17343                    .header(CONTENT_LENGTH, request_size as u64)
17344                    .body(common::to_body(
17345                        request_value_reader.get_ref().clone().into(),
17346                    ));
17347
17348                client.request(request.unwrap()).await
17349            };
17350
17351            match req_result {
17352                Err(err) => {
17353                    if let common::Retry::After(d) = dlg.http_error(&err) {
17354                        sleep(d).await;
17355                        continue;
17356                    }
17357                    dlg.finished(false);
17358                    return Err(common::Error::HttpError(err));
17359                }
17360                Ok(res) => {
17361                    let (mut parts, body) = res.into_parts();
17362                    let mut body = common::Body::new(body);
17363                    if !parts.status.is_success() {
17364                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17365                        let error = serde_json::from_str(&common::to_string(&bytes));
17366                        let response = common::to_response(parts, bytes.into());
17367
17368                        if let common::Retry::After(d) =
17369                            dlg.http_failure(&response, error.as_ref().ok())
17370                        {
17371                            sleep(d).await;
17372                            continue;
17373                        }
17374
17375                        dlg.finished(false);
17376
17377                        return Err(match error {
17378                            Ok(value) => common::Error::BadRequest(value),
17379                            _ => common::Error::Failure(response),
17380                        });
17381                    }
17382                    let response = {
17383                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17384                        let encoded = common::to_string(&bytes);
17385                        match serde_json::from_str(&encoded) {
17386                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17387                            Err(error) => {
17388                                dlg.response_json_decode_error(&encoded, &error);
17389                                return Err(common::Error::JsonDecodeError(
17390                                    encoded.to_string(),
17391                                    error,
17392                                ));
17393                            }
17394                        }
17395                    };
17396
17397                    dlg.finished(true);
17398                    return Ok(response);
17399                }
17400            }
17401        }
17402    }
17403
17404    ///
17405    /// Sets the *request* property to the given value.
17406    ///
17407    /// Even though the property as already been set when instantiating this call,
17408    /// we provide this method for API completeness.
17409    pub fn request(
17410        mut self,
17411        new_value: MigrationJob,
17412    ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17413        self._request = new_value;
17414        self
17415    }
17416    /// The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
17417    ///
17418    /// Sets the *name* path property to the given value.
17419    ///
17420    /// Even though the property as already been set when instantiating this call,
17421    /// we provide this method for API completeness.
17422    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17423        self._name = new_value.to_string();
17424        self
17425    }
17426    /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
17427    ///
17428    /// Sets the *update mask* query property to the given value.
17429    pub fn update_mask(
17430        mut self,
17431        new_value: common::FieldMask,
17432    ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17433        self._update_mask = Some(new_value);
17434        self
17435    }
17436    /// A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
17437    ///
17438    /// Sets the *request id* query property to the given value.
17439    pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17440        self._request_id = Some(new_value.to_string());
17441        self
17442    }
17443    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17444    /// while executing the actual API request.
17445    ///
17446    /// ````text
17447    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17448    /// ````
17449    ///
17450    /// Sets the *delegate* property to the given value.
17451    pub fn delegate(
17452        mut self,
17453        new_value: &'a mut dyn common::Delegate,
17454    ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17455        self._delegate = Some(new_value);
17456        self
17457    }
17458
17459    /// Set any additional parameter of the query string used in the request.
17460    /// It should be used to set parameters which are not yet available through their own
17461    /// setters.
17462    ///
17463    /// Please note that this method must not be used to set any of the known parameters
17464    /// which have their own setter method. If done anyway, the request will fail.
17465    ///
17466    /// # Additional Parameters
17467    ///
17468    /// * *$.xgafv* (query-string) - V1 error format.
17469    /// * *access_token* (query-string) - OAuth access token.
17470    /// * *alt* (query-string) - Data format for response.
17471    /// * *callback* (query-string) - JSONP
17472    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17473    /// * *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.
17474    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17475    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17476    /// * *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.
17477    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17478    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17479    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobPatchCall<'a, C>
17480    where
17481        T: AsRef<str>,
17482    {
17483        self._additional_params
17484            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17485        self
17486    }
17487
17488    /// Identifies the authorization scope for the method you are building.
17489    ///
17490    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17491    /// [`Scope::CloudPlatform`].
17492    ///
17493    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17494    /// tokens for more than one scope.
17495    ///
17496    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17497    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17498    /// sufficient, a read-write scope will do as well.
17499    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobPatchCall<'a, C>
17500    where
17501        St: AsRef<str>,
17502    {
17503        self._scopes.insert(String::from(scope.as_ref()));
17504        self
17505    }
17506    /// Identifies the authorization scope(s) for the method you are building.
17507    ///
17508    /// See [`Self::add_scope()`] for details.
17509    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobPatchCall<'a, C>
17510    where
17511        I: IntoIterator<Item = St>,
17512        St: AsRef<str>,
17513    {
17514        self._scopes
17515            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17516        self
17517    }
17518
17519    /// Removes all scopes, and no default scope will be used either.
17520    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17521    /// for details).
17522    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobPatchCall<'a, C> {
17523        self._scopes.clear();
17524        self
17525    }
17526}
17527
17528/// Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
17529///
17530/// A builder for the *locations.migrationJobs.promote* method supported by a *project* resource.
17531/// It is not used directly, but through a [`ProjectMethods`] instance.
17532///
17533/// # Example
17534///
17535/// Instantiate a resource method builder
17536///
17537/// ```test_harness,no_run
17538/// # extern crate hyper;
17539/// # extern crate hyper_rustls;
17540/// # extern crate google_datamigration1 as datamigration1;
17541/// use datamigration1::api::PromoteMigrationJobRequest;
17542/// # async fn dox() {
17543/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17544///
17545/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17546/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17547/// #     secret,
17548/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17549/// # ).build().await.unwrap();
17550///
17551/// # let client = hyper_util::client::legacy::Client::builder(
17552/// #     hyper_util::rt::TokioExecutor::new()
17553/// # )
17554/// # .build(
17555/// #     hyper_rustls::HttpsConnectorBuilder::new()
17556/// #         .with_native_roots()
17557/// #         .unwrap()
17558/// #         .https_or_http()
17559/// #         .enable_http1()
17560/// #         .build()
17561/// # );
17562/// # let mut hub = DatabaseMigrationService::new(client, auth);
17563/// // As the method needs a request, you would usually fill it with the desired information
17564/// // into the respective structure. Some of the parts shown here might not be applicable !
17565/// // Values shown here are possibly random and not representative !
17566/// let mut req = PromoteMigrationJobRequest::default();
17567///
17568/// // You can configure optional parameters by calling the respective setters at will, and
17569/// // execute the final call using `doit()`.
17570/// // Values shown here are possibly random and not representative !
17571/// let result = hub.projects().locations_migration_jobs_promote(req, "name")
17572///              .doit().await;
17573/// # }
17574/// ```
17575pub struct ProjectLocationMigrationJobPromoteCall<'a, C>
17576where
17577    C: 'a,
17578{
17579    hub: &'a DatabaseMigrationService<C>,
17580    _request: PromoteMigrationJobRequest,
17581    _name: String,
17582    _delegate: Option<&'a mut dyn common::Delegate>,
17583    _additional_params: HashMap<String, String>,
17584    _scopes: BTreeSet<String>,
17585}
17586
17587impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobPromoteCall<'a, C> {}
17588
17589impl<'a, C> ProjectLocationMigrationJobPromoteCall<'a, C>
17590where
17591    C: common::Connector,
17592{
17593    /// Perform the operation you have build so far.
17594    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17595        use std::borrow::Cow;
17596        use std::io::{Read, Seek};
17597
17598        use common::{url::Params, ToParts};
17599        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17600
17601        let mut dd = common::DefaultDelegate;
17602        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17603        dlg.begin(common::MethodInfo {
17604            id: "datamigration.projects.locations.migrationJobs.promote",
17605            http_method: hyper::Method::POST,
17606        });
17607
17608        for &field in ["alt", "name"].iter() {
17609            if self._additional_params.contains_key(field) {
17610                dlg.finished(false);
17611                return Err(common::Error::FieldClash(field));
17612            }
17613        }
17614
17615        let mut params = Params::with_capacity(4 + self._additional_params.len());
17616        params.push("name", self._name);
17617
17618        params.extend(self._additional_params.iter());
17619
17620        params.push("alt", "json");
17621        let mut url = self.hub._base_url.clone() + "v1/{+name}:promote";
17622        if self._scopes.is_empty() {
17623            self._scopes
17624                .insert(Scope::CloudPlatform.as_ref().to_string());
17625        }
17626
17627        #[allow(clippy::single_element_loop)]
17628        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17629            url = params.uri_replacement(url, param_name, find_this, true);
17630        }
17631        {
17632            let to_remove = ["name"];
17633            params.remove_params(&to_remove);
17634        }
17635
17636        let url = params.parse_with_url(&url);
17637
17638        let mut json_mime_type = mime::APPLICATION_JSON;
17639        let mut request_value_reader = {
17640            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17641            common::remove_json_null_values(&mut value);
17642            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17643            serde_json::to_writer(&mut dst, &value).unwrap();
17644            dst
17645        };
17646        let request_size = request_value_reader
17647            .seek(std::io::SeekFrom::End(0))
17648            .unwrap();
17649        request_value_reader
17650            .seek(std::io::SeekFrom::Start(0))
17651            .unwrap();
17652
17653        loop {
17654            let token = match self
17655                .hub
17656                .auth
17657                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17658                .await
17659            {
17660                Ok(token) => token,
17661                Err(e) => match dlg.token(e) {
17662                    Ok(token) => token,
17663                    Err(e) => {
17664                        dlg.finished(false);
17665                        return Err(common::Error::MissingToken(e));
17666                    }
17667                },
17668            };
17669            request_value_reader
17670                .seek(std::io::SeekFrom::Start(0))
17671                .unwrap();
17672            let mut req_result = {
17673                let client = &self.hub.client;
17674                dlg.pre_request();
17675                let mut req_builder = hyper::Request::builder()
17676                    .method(hyper::Method::POST)
17677                    .uri(url.as_str())
17678                    .header(USER_AGENT, self.hub._user_agent.clone());
17679
17680                if let Some(token) = token.as_ref() {
17681                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17682                }
17683
17684                let request = req_builder
17685                    .header(CONTENT_TYPE, json_mime_type.to_string())
17686                    .header(CONTENT_LENGTH, request_size as u64)
17687                    .body(common::to_body(
17688                        request_value_reader.get_ref().clone().into(),
17689                    ));
17690
17691                client.request(request.unwrap()).await
17692            };
17693
17694            match req_result {
17695                Err(err) => {
17696                    if let common::Retry::After(d) = dlg.http_error(&err) {
17697                        sleep(d).await;
17698                        continue;
17699                    }
17700                    dlg.finished(false);
17701                    return Err(common::Error::HttpError(err));
17702                }
17703                Ok(res) => {
17704                    let (mut parts, body) = res.into_parts();
17705                    let mut body = common::Body::new(body);
17706                    if !parts.status.is_success() {
17707                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17708                        let error = serde_json::from_str(&common::to_string(&bytes));
17709                        let response = common::to_response(parts, bytes.into());
17710
17711                        if let common::Retry::After(d) =
17712                            dlg.http_failure(&response, error.as_ref().ok())
17713                        {
17714                            sleep(d).await;
17715                            continue;
17716                        }
17717
17718                        dlg.finished(false);
17719
17720                        return Err(match error {
17721                            Ok(value) => common::Error::BadRequest(value),
17722                            _ => common::Error::Failure(response),
17723                        });
17724                    }
17725                    let response = {
17726                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17727                        let encoded = common::to_string(&bytes);
17728                        match serde_json::from_str(&encoded) {
17729                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17730                            Err(error) => {
17731                                dlg.response_json_decode_error(&encoded, &error);
17732                                return Err(common::Error::JsonDecodeError(
17733                                    encoded.to_string(),
17734                                    error,
17735                                ));
17736                            }
17737                        }
17738                    };
17739
17740                    dlg.finished(true);
17741                    return Ok(response);
17742                }
17743            }
17744        }
17745    }
17746
17747    ///
17748    /// Sets the *request* property to the given value.
17749    ///
17750    /// Even though the property as already been set when instantiating this call,
17751    /// we provide this method for API completeness.
17752    pub fn request(
17753        mut self,
17754        new_value: PromoteMigrationJobRequest,
17755    ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
17756        self._request = new_value;
17757        self
17758    }
17759    /// Name of the migration job resource to promote.
17760    ///
17761    /// Sets the *name* path property to the given value.
17762    ///
17763    /// Even though the property as already been set when instantiating this call,
17764    /// we provide this method for API completeness.
17765    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
17766        self._name = new_value.to_string();
17767        self
17768    }
17769    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17770    /// while executing the actual API request.
17771    ///
17772    /// ````text
17773    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17774    /// ````
17775    ///
17776    /// Sets the *delegate* property to the given value.
17777    pub fn delegate(
17778        mut self,
17779        new_value: &'a mut dyn common::Delegate,
17780    ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
17781        self._delegate = Some(new_value);
17782        self
17783    }
17784
17785    /// Set any additional parameter of the query string used in the request.
17786    /// It should be used to set parameters which are not yet available through their own
17787    /// setters.
17788    ///
17789    /// Please note that this method must not be used to set any of the known parameters
17790    /// which have their own setter method. If done anyway, the request will fail.
17791    ///
17792    /// # Additional Parameters
17793    ///
17794    /// * *$.xgafv* (query-string) - V1 error format.
17795    /// * *access_token* (query-string) - OAuth access token.
17796    /// * *alt* (query-string) - Data format for response.
17797    /// * *callback* (query-string) - JSONP
17798    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17799    /// * *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.
17800    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17801    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17802    /// * *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.
17803    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17804    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17805    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobPromoteCall<'a, C>
17806    where
17807        T: AsRef<str>,
17808    {
17809        self._additional_params
17810            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17811        self
17812    }
17813
17814    /// Identifies the authorization scope for the method you are building.
17815    ///
17816    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17817    /// [`Scope::CloudPlatform`].
17818    ///
17819    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17820    /// tokens for more than one scope.
17821    ///
17822    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17823    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17824    /// sufficient, a read-write scope will do as well.
17825    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobPromoteCall<'a, C>
17826    where
17827        St: AsRef<str>,
17828    {
17829        self._scopes.insert(String::from(scope.as_ref()));
17830        self
17831    }
17832    /// Identifies the authorization scope(s) for the method you are building.
17833    ///
17834    /// See [`Self::add_scope()`] for details.
17835    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobPromoteCall<'a, C>
17836    where
17837        I: IntoIterator<Item = St>,
17838        St: AsRef<str>,
17839    {
17840        self._scopes
17841            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17842        self
17843    }
17844
17845    /// Removes all scopes, and no default scope will be used either.
17846    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17847    /// for details).
17848    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
17849        self._scopes.clear();
17850        self
17851    }
17852}
17853
17854/// Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
17855///
17856/// A builder for the *locations.migrationJobs.restart* method supported by a *project* resource.
17857/// It is not used directly, but through a [`ProjectMethods`] instance.
17858///
17859/// # Example
17860///
17861/// Instantiate a resource method builder
17862///
17863/// ```test_harness,no_run
17864/// # extern crate hyper;
17865/// # extern crate hyper_rustls;
17866/// # extern crate google_datamigration1 as datamigration1;
17867/// use datamigration1::api::RestartMigrationJobRequest;
17868/// # async fn dox() {
17869/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17870///
17871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17872/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17873/// #     secret,
17874/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17875/// # ).build().await.unwrap();
17876///
17877/// # let client = hyper_util::client::legacy::Client::builder(
17878/// #     hyper_util::rt::TokioExecutor::new()
17879/// # )
17880/// # .build(
17881/// #     hyper_rustls::HttpsConnectorBuilder::new()
17882/// #         .with_native_roots()
17883/// #         .unwrap()
17884/// #         .https_or_http()
17885/// #         .enable_http1()
17886/// #         .build()
17887/// # );
17888/// # let mut hub = DatabaseMigrationService::new(client, auth);
17889/// // As the method needs a request, you would usually fill it with the desired information
17890/// // into the respective structure. Some of the parts shown here might not be applicable !
17891/// // Values shown here are possibly random and not representative !
17892/// let mut req = RestartMigrationJobRequest::default();
17893///
17894/// // You can configure optional parameters by calling the respective setters at will, and
17895/// // execute the final call using `doit()`.
17896/// // Values shown here are possibly random and not representative !
17897/// let result = hub.projects().locations_migration_jobs_restart(req, "name")
17898///              .doit().await;
17899/// # }
17900/// ```
17901pub struct ProjectLocationMigrationJobRestartCall<'a, C>
17902where
17903    C: 'a,
17904{
17905    hub: &'a DatabaseMigrationService<C>,
17906    _request: RestartMigrationJobRequest,
17907    _name: String,
17908    _delegate: Option<&'a mut dyn common::Delegate>,
17909    _additional_params: HashMap<String, String>,
17910    _scopes: BTreeSet<String>,
17911}
17912
17913impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobRestartCall<'a, C> {}
17914
17915impl<'a, C> ProjectLocationMigrationJobRestartCall<'a, C>
17916where
17917    C: common::Connector,
17918{
17919    /// Perform the operation you have build so far.
17920    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17921        use std::borrow::Cow;
17922        use std::io::{Read, Seek};
17923
17924        use common::{url::Params, ToParts};
17925        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17926
17927        let mut dd = common::DefaultDelegate;
17928        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17929        dlg.begin(common::MethodInfo {
17930            id: "datamigration.projects.locations.migrationJobs.restart",
17931            http_method: hyper::Method::POST,
17932        });
17933
17934        for &field in ["alt", "name"].iter() {
17935            if self._additional_params.contains_key(field) {
17936                dlg.finished(false);
17937                return Err(common::Error::FieldClash(field));
17938            }
17939        }
17940
17941        let mut params = Params::with_capacity(4 + self._additional_params.len());
17942        params.push("name", self._name);
17943
17944        params.extend(self._additional_params.iter());
17945
17946        params.push("alt", "json");
17947        let mut url = self.hub._base_url.clone() + "v1/{+name}:restart";
17948        if self._scopes.is_empty() {
17949            self._scopes
17950                .insert(Scope::CloudPlatform.as_ref().to_string());
17951        }
17952
17953        #[allow(clippy::single_element_loop)]
17954        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17955            url = params.uri_replacement(url, param_name, find_this, true);
17956        }
17957        {
17958            let to_remove = ["name"];
17959            params.remove_params(&to_remove);
17960        }
17961
17962        let url = params.parse_with_url(&url);
17963
17964        let mut json_mime_type = mime::APPLICATION_JSON;
17965        let mut request_value_reader = {
17966            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17967            common::remove_json_null_values(&mut value);
17968            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17969            serde_json::to_writer(&mut dst, &value).unwrap();
17970            dst
17971        };
17972        let request_size = request_value_reader
17973            .seek(std::io::SeekFrom::End(0))
17974            .unwrap();
17975        request_value_reader
17976            .seek(std::io::SeekFrom::Start(0))
17977            .unwrap();
17978
17979        loop {
17980            let token = match self
17981                .hub
17982                .auth
17983                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17984                .await
17985            {
17986                Ok(token) => token,
17987                Err(e) => match dlg.token(e) {
17988                    Ok(token) => token,
17989                    Err(e) => {
17990                        dlg.finished(false);
17991                        return Err(common::Error::MissingToken(e));
17992                    }
17993                },
17994            };
17995            request_value_reader
17996                .seek(std::io::SeekFrom::Start(0))
17997                .unwrap();
17998            let mut req_result = {
17999                let client = &self.hub.client;
18000                dlg.pre_request();
18001                let mut req_builder = hyper::Request::builder()
18002                    .method(hyper::Method::POST)
18003                    .uri(url.as_str())
18004                    .header(USER_AGENT, self.hub._user_agent.clone());
18005
18006                if let Some(token) = token.as_ref() {
18007                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18008                }
18009
18010                let request = req_builder
18011                    .header(CONTENT_TYPE, json_mime_type.to_string())
18012                    .header(CONTENT_LENGTH, request_size as u64)
18013                    .body(common::to_body(
18014                        request_value_reader.get_ref().clone().into(),
18015                    ));
18016
18017                client.request(request.unwrap()).await
18018            };
18019
18020            match req_result {
18021                Err(err) => {
18022                    if let common::Retry::After(d) = dlg.http_error(&err) {
18023                        sleep(d).await;
18024                        continue;
18025                    }
18026                    dlg.finished(false);
18027                    return Err(common::Error::HttpError(err));
18028                }
18029                Ok(res) => {
18030                    let (mut parts, body) = res.into_parts();
18031                    let mut body = common::Body::new(body);
18032                    if !parts.status.is_success() {
18033                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18034                        let error = serde_json::from_str(&common::to_string(&bytes));
18035                        let response = common::to_response(parts, bytes.into());
18036
18037                        if let common::Retry::After(d) =
18038                            dlg.http_failure(&response, error.as_ref().ok())
18039                        {
18040                            sleep(d).await;
18041                            continue;
18042                        }
18043
18044                        dlg.finished(false);
18045
18046                        return Err(match error {
18047                            Ok(value) => common::Error::BadRequest(value),
18048                            _ => common::Error::Failure(response),
18049                        });
18050                    }
18051                    let response = {
18052                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18053                        let encoded = common::to_string(&bytes);
18054                        match serde_json::from_str(&encoded) {
18055                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18056                            Err(error) => {
18057                                dlg.response_json_decode_error(&encoded, &error);
18058                                return Err(common::Error::JsonDecodeError(
18059                                    encoded.to_string(),
18060                                    error,
18061                                ));
18062                            }
18063                        }
18064                    };
18065
18066                    dlg.finished(true);
18067                    return Ok(response);
18068                }
18069            }
18070        }
18071    }
18072
18073    ///
18074    /// Sets the *request* property to the given value.
18075    ///
18076    /// Even though the property as already been set when instantiating this call,
18077    /// we provide this method for API completeness.
18078    pub fn request(
18079        mut self,
18080        new_value: RestartMigrationJobRequest,
18081    ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
18082        self._request = new_value;
18083        self
18084    }
18085    /// Name of the migration job resource to restart.
18086    ///
18087    /// Sets the *name* path property to the given value.
18088    ///
18089    /// Even though the property as already been set when instantiating this call,
18090    /// we provide this method for API completeness.
18091    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobRestartCall<'a, C> {
18092        self._name = new_value.to_string();
18093        self
18094    }
18095    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18096    /// while executing the actual API request.
18097    ///
18098    /// ````text
18099    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18100    /// ````
18101    ///
18102    /// Sets the *delegate* property to the given value.
18103    pub fn delegate(
18104        mut self,
18105        new_value: &'a mut dyn common::Delegate,
18106    ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
18107        self._delegate = Some(new_value);
18108        self
18109    }
18110
18111    /// Set any additional parameter of the query string used in the request.
18112    /// It should be used to set parameters which are not yet available through their own
18113    /// setters.
18114    ///
18115    /// Please note that this method must not be used to set any of the known parameters
18116    /// which have their own setter method. If done anyway, the request will fail.
18117    ///
18118    /// # Additional Parameters
18119    ///
18120    /// * *$.xgafv* (query-string) - V1 error format.
18121    /// * *access_token* (query-string) - OAuth access token.
18122    /// * *alt* (query-string) - Data format for response.
18123    /// * *callback* (query-string) - JSONP
18124    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18125    /// * *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.
18126    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18127    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18128    /// * *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.
18129    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18130    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18131    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobRestartCall<'a, C>
18132    where
18133        T: AsRef<str>,
18134    {
18135        self._additional_params
18136            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18137        self
18138    }
18139
18140    /// Identifies the authorization scope for the method you are building.
18141    ///
18142    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18143    /// [`Scope::CloudPlatform`].
18144    ///
18145    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18146    /// tokens for more than one scope.
18147    ///
18148    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18149    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18150    /// sufficient, a read-write scope will do as well.
18151    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobRestartCall<'a, C>
18152    where
18153        St: AsRef<str>,
18154    {
18155        self._scopes.insert(String::from(scope.as_ref()));
18156        self
18157    }
18158    /// Identifies the authorization scope(s) for the method you are building.
18159    ///
18160    /// See [`Self::add_scope()`] for details.
18161    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobRestartCall<'a, C>
18162    where
18163        I: IntoIterator<Item = St>,
18164        St: AsRef<str>,
18165    {
18166        self._scopes
18167            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18168        self
18169    }
18170
18171    /// Removes all scopes, and no default scope will be used either.
18172    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18173    /// for details).
18174    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobRestartCall<'a, C> {
18175        self._scopes.clear();
18176        self
18177    }
18178}
18179
18180/// Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
18181///
18182/// A builder for the *locations.migrationJobs.resume* method supported by a *project* resource.
18183/// It is not used directly, but through a [`ProjectMethods`] instance.
18184///
18185/// # Example
18186///
18187/// Instantiate a resource method builder
18188///
18189/// ```test_harness,no_run
18190/// # extern crate hyper;
18191/// # extern crate hyper_rustls;
18192/// # extern crate google_datamigration1 as datamigration1;
18193/// use datamigration1::api::ResumeMigrationJobRequest;
18194/// # async fn dox() {
18195/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18196///
18197/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18198/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18199/// #     secret,
18200/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18201/// # ).build().await.unwrap();
18202///
18203/// # let client = hyper_util::client::legacy::Client::builder(
18204/// #     hyper_util::rt::TokioExecutor::new()
18205/// # )
18206/// # .build(
18207/// #     hyper_rustls::HttpsConnectorBuilder::new()
18208/// #         .with_native_roots()
18209/// #         .unwrap()
18210/// #         .https_or_http()
18211/// #         .enable_http1()
18212/// #         .build()
18213/// # );
18214/// # let mut hub = DatabaseMigrationService::new(client, auth);
18215/// // As the method needs a request, you would usually fill it with the desired information
18216/// // into the respective structure. Some of the parts shown here might not be applicable !
18217/// // Values shown here are possibly random and not representative !
18218/// let mut req = ResumeMigrationJobRequest::default();
18219///
18220/// // You can configure optional parameters by calling the respective setters at will, and
18221/// // execute the final call using `doit()`.
18222/// // Values shown here are possibly random and not representative !
18223/// let result = hub.projects().locations_migration_jobs_resume(req, "name")
18224///              .doit().await;
18225/// # }
18226/// ```
18227pub struct ProjectLocationMigrationJobResumeCall<'a, C>
18228where
18229    C: 'a,
18230{
18231    hub: &'a DatabaseMigrationService<C>,
18232    _request: ResumeMigrationJobRequest,
18233    _name: String,
18234    _delegate: Option<&'a mut dyn common::Delegate>,
18235    _additional_params: HashMap<String, String>,
18236    _scopes: BTreeSet<String>,
18237}
18238
18239impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobResumeCall<'a, C> {}
18240
18241impl<'a, C> ProjectLocationMigrationJobResumeCall<'a, C>
18242where
18243    C: common::Connector,
18244{
18245    /// Perform the operation you have build so far.
18246    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18247        use std::borrow::Cow;
18248        use std::io::{Read, Seek};
18249
18250        use common::{url::Params, ToParts};
18251        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18252
18253        let mut dd = common::DefaultDelegate;
18254        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18255        dlg.begin(common::MethodInfo {
18256            id: "datamigration.projects.locations.migrationJobs.resume",
18257            http_method: hyper::Method::POST,
18258        });
18259
18260        for &field in ["alt", "name"].iter() {
18261            if self._additional_params.contains_key(field) {
18262                dlg.finished(false);
18263                return Err(common::Error::FieldClash(field));
18264            }
18265        }
18266
18267        let mut params = Params::with_capacity(4 + self._additional_params.len());
18268        params.push("name", self._name);
18269
18270        params.extend(self._additional_params.iter());
18271
18272        params.push("alt", "json");
18273        let mut url = self.hub._base_url.clone() + "v1/{+name}:resume";
18274        if self._scopes.is_empty() {
18275            self._scopes
18276                .insert(Scope::CloudPlatform.as_ref().to_string());
18277        }
18278
18279        #[allow(clippy::single_element_loop)]
18280        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18281            url = params.uri_replacement(url, param_name, find_this, true);
18282        }
18283        {
18284            let to_remove = ["name"];
18285            params.remove_params(&to_remove);
18286        }
18287
18288        let url = params.parse_with_url(&url);
18289
18290        let mut json_mime_type = mime::APPLICATION_JSON;
18291        let mut request_value_reader = {
18292            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18293            common::remove_json_null_values(&mut value);
18294            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18295            serde_json::to_writer(&mut dst, &value).unwrap();
18296            dst
18297        };
18298        let request_size = request_value_reader
18299            .seek(std::io::SeekFrom::End(0))
18300            .unwrap();
18301        request_value_reader
18302            .seek(std::io::SeekFrom::Start(0))
18303            .unwrap();
18304
18305        loop {
18306            let token = match self
18307                .hub
18308                .auth
18309                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18310                .await
18311            {
18312                Ok(token) => token,
18313                Err(e) => match dlg.token(e) {
18314                    Ok(token) => token,
18315                    Err(e) => {
18316                        dlg.finished(false);
18317                        return Err(common::Error::MissingToken(e));
18318                    }
18319                },
18320            };
18321            request_value_reader
18322                .seek(std::io::SeekFrom::Start(0))
18323                .unwrap();
18324            let mut req_result = {
18325                let client = &self.hub.client;
18326                dlg.pre_request();
18327                let mut req_builder = hyper::Request::builder()
18328                    .method(hyper::Method::POST)
18329                    .uri(url.as_str())
18330                    .header(USER_AGENT, self.hub._user_agent.clone());
18331
18332                if let Some(token) = token.as_ref() {
18333                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18334                }
18335
18336                let request = req_builder
18337                    .header(CONTENT_TYPE, json_mime_type.to_string())
18338                    .header(CONTENT_LENGTH, request_size as u64)
18339                    .body(common::to_body(
18340                        request_value_reader.get_ref().clone().into(),
18341                    ));
18342
18343                client.request(request.unwrap()).await
18344            };
18345
18346            match req_result {
18347                Err(err) => {
18348                    if let common::Retry::After(d) = dlg.http_error(&err) {
18349                        sleep(d).await;
18350                        continue;
18351                    }
18352                    dlg.finished(false);
18353                    return Err(common::Error::HttpError(err));
18354                }
18355                Ok(res) => {
18356                    let (mut parts, body) = res.into_parts();
18357                    let mut body = common::Body::new(body);
18358                    if !parts.status.is_success() {
18359                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18360                        let error = serde_json::from_str(&common::to_string(&bytes));
18361                        let response = common::to_response(parts, bytes.into());
18362
18363                        if let common::Retry::After(d) =
18364                            dlg.http_failure(&response, error.as_ref().ok())
18365                        {
18366                            sleep(d).await;
18367                            continue;
18368                        }
18369
18370                        dlg.finished(false);
18371
18372                        return Err(match error {
18373                            Ok(value) => common::Error::BadRequest(value),
18374                            _ => common::Error::Failure(response),
18375                        });
18376                    }
18377                    let response = {
18378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18379                        let encoded = common::to_string(&bytes);
18380                        match serde_json::from_str(&encoded) {
18381                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18382                            Err(error) => {
18383                                dlg.response_json_decode_error(&encoded, &error);
18384                                return Err(common::Error::JsonDecodeError(
18385                                    encoded.to_string(),
18386                                    error,
18387                                ));
18388                            }
18389                        }
18390                    };
18391
18392                    dlg.finished(true);
18393                    return Ok(response);
18394                }
18395            }
18396        }
18397    }
18398
18399    ///
18400    /// Sets the *request* property to the given value.
18401    ///
18402    /// Even though the property as already been set when instantiating this call,
18403    /// we provide this method for API completeness.
18404    pub fn request(
18405        mut self,
18406        new_value: ResumeMigrationJobRequest,
18407    ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
18408        self._request = new_value;
18409        self
18410    }
18411    /// Name of the migration job resource to resume.
18412    ///
18413    /// Sets the *name* path property to the given value.
18414    ///
18415    /// Even though the property as already been set when instantiating this call,
18416    /// we provide this method for API completeness.
18417    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobResumeCall<'a, C> {
18418        self._name = new_value.to_string();
18419        self
18420    }
18421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18422    /// while executing the actual API request.
18423    ///
18424    /// ````text
18425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18426    /// ````
18427    ///
18428    /// Sets the *delegate* property to the given value.
18429    pub fn delegate(
18430        mut self,
18431        new_value: &'a mut dyn common::Delegate,
18432    ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
18433        self._delegate = Some(new_value);
18434        self
18435    }
18436
18437    /// Set any additional parameter of the query string used in the request.
18438    /// It should be used to set parameters which are not yet available through their own
18439    /// setters.
18440    ///
18441    /// Please note that this method must not be used to set any of the known parameters
18442    /// which have their own setter method. If done anyway, the request will fail.
18443    ///
18444    /// # Additional Parameters
18445    ///
18446    /// * *$.xgafv* (query-string) - V1 error format.
18447    /// * *access_token* (query-string) - OAuth access token.
18448    /// * *alt* (query-string) - Data format for response.
18449    /// * *callback* (query-string) - JSONP
18450    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18451    /// * *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.
18452    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18453    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18454    /// * *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.
18455    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18456    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18457    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobResumeCall<'a, C>
18458    where
18459        T: AsRef<str>,
18460    {
18461        self._additional_params
18462            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18463        self
18464    }
18465
18466    /// Identifies the authorization scope for the method you are building.
18467    ///
18468    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18469    /// [`Scope::CloudPlatform`].
18470    ///
18471    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18472    /// tokens for more than one scope.
18473    ///
18474    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18475    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18476    /// sufficient, a read-write scope will do as well.
18477    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobResumeCall<'a, C>
18478    where
18479        St: AsRef<str>,
18480    {
18481        self._scopes.insert(String::from(scope.as_ref()));
18482        self
18483    }
18484    /// Identifies the authorization scope(s) for the method you are building.
18485    ///
18486    /// See [`Self::add_scope()`] for details.
18487    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobResumeCall<'a, C>
18488    where
18489        I: IntoIterator<Item = St>,
18490        St: AsRef<str>,
18491    {
18492        self._scopes
18493            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18494        self
18495    }
18496
18497    /// Removes all scopes, and no default scope will be used either.
18498    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18499    /// for details).
18500    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobResumeCall<'a, C> {
18501        self._scopes.clear();
18502        self
18503    }
18504}
18505
18506/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
18507///
18508/// A builder for the *locations.migrationJobs.setIamPolicy* method supported by a *project* resource.
18509/// It is not used directly, but through a [`ProjectMethods`] instance.
18510///
18511/// # Example
18512///
18513/// Instantiate a resource method builder
18514///
18515/// ```test_harness,no_run
18516/// # extern crate hyper;
18517/// # extern crate hyper_rustls;
18518/// # extern crate google_datamigration1 as datamigration1;
18519/// use datamigration1::api::SetIamPolicyRequest;
18520/// # async fn dox() {
18521/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18522///
18523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18524/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18525/// #     secret,
18526/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18527/// # ).build().await.unwrap();
18528///
18529/// # let client = hyper_util::client::legacy::Client::builder(
18530/// #     hyper_util::rt::TokioExecutor::new()
18531/// # )
18532/// # .build(
18533/// #     hyper_rustls::HttpsConnectorBuilder::new()
18534/// #         .with_native_roots()
18535/// #         .unwrap()
18536/// #         .https_or_http()
18537/// #         .enable_http1()
18538/// #         .build()
18539/// # );
18540/// # let mut hub = DatabaseMigrationService::new(client, auth);
18541/// // As the method needs a request, you would usually fill it with the desired information
18542/// // into the respective structure. Some of the parts shown here might not be applicable !
18543/// // Values shown here are possibly random and not representative !
18544/// let mut req = SetIamPolicyRequest::default();
18545///
18546/// // You can configure optional parameters by calling the respective setters at will, and
18547/// // execute the final call using `doit()`.
18548/// // Values shown here are possibly random and not representative !
18549/// let result = hub.projects().locations_migration_jobs_set_iam_policy(req, "resource")
18550///              .doit().await;
18551/// # }
18552/// ```
18553pub struct ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
18554where
18555    C: 'a,
18556{
18557    hub: &'a DatabaseMigrationService<C>,
18558    _request: SetIamPolicyRequest,
18559    _resource: String,
18560    _delegate: Option<&'a mut dyn common::Delegate>,
18561    _additional_params: HashMap<String, String>,
18562    _scopes: BTreeSet<String>,
18563}
18564
18565impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {}
18566
18567impl<'a, C> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
18568where
18569    C: common::Connector,
18570{
18571    /// Perform the operation you have build so far.
18572    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18573        use std::borrow::Cow;
18574        use std::io::{Read, Seek};
18575
18576        use common::{url::Params, ToParts};
18577        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18578
18579        let mut dd = common::DefaultDelegate;
18580        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18581        dlg.begin(common::MethodInfo {
18582            id: "datamigration.projects.locations.migrationJobs.setIamPolicy",
18583            http_method: hyper::Method::POST,
18584        });
18585
18586        for &field in ["alt", "resource"].iter() {
18587            if self._additional_params.contains_key(field) {
18588                dlg.finished(false);
18589                return Err(common::Error::FieldClash(field));
18590            }
18591        }
18592
18593        let mut params = Params::with_capacity(4 + self._additional_params.len());
18594        params.push("resource", self._resource);
18595
18596        params.extend(self._additional_params.iter());
18597
18598        params.push("alt", "json");
18599        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
18600        if self._scopes.is_empty() {
18601            self._scopes
18602                .insert(Scope::CloudPlatform.as_ref().to_string());
18603        }
18604
18605        #[allow(clippy::single_element_loop)]
18606        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18607            url = params.uri_replacement(url, param_name, find_this, true);
18608        }
18609        {
18610            let to_remove = ["resource"];
18611            params.remove_params(&to_remove);
18612        }
18613
18614        let url = params.parse_with_url(&url);
18615
18616        let mut json_mime_type = mime::APPLICATION_JSON;
18617        let mut request_value_reader = {
18618            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18619            common::remove_json_null_values(&mut value);
18620            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18621            serde_json::to_writer(&mut dst, &value).unwrap();
18622            dst
18623        };
18624        let request_size = request_value_reader
18625            .seek(std::io::SeekFrom::End(0))
18626            .unwrap();
18627        request_value_reader
18628            .seek(std::io::SeekFrom::Start(0))
18629            .unwrap();
18630
18631        loop {
18632            let token = match self
18633                .hub
18634                .auth
18635                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18636                .await
18637            {
18638                Ok(token) => token,
18639                Err(e) => match dlg.token(e) {
18640                    Ok(token) => token,
18641                    Err(e) => {
18642                        dlg.finished(false);
18643                        return Err(common::Error::MissingToken(e));
18644                    }
18645                },
18646            };
18647            request_value_reader
18648                .seek(std::io::SeekFrom::Start(0))
18649                .unwrap();
18650            let mut req_result = {
18651                let client = &self.hub.client;
18652                dlg.pre_request();
18653                let mut req_builder = hyper::Request::builder()
18654                    .method(hyper::Method::POST)
18655                    .uri(url.as_str())
18656                    .header(USER_AGENT, self.hub._user_agent.clone());
18657
18658                if let Some(token) = token.as_ref() {
18659                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18660                }
18661
18662                let request = req_builder
18663                    .header(CONTENT_TYPE, json_mime_type.to_string())
18664                    .header(CONTENT_LENGTH, request_size as u64)
18665                    .body(common::to_body(
18666                        request_value_reader.get_ref().clone().into(),
18667                    ));
18668
18669                client.request(request.unwrap()).await
18670            };
18671
18672            match req_result {
18673                Err(err) => {
18674                    if let common::Retry::After(d) = dlg.http_error(&err) {
18675                        sleep(d).await;
18676                        continue;
18677                    }
18678                    dlg.finished(false);
18679                    return Err(common::Error::HttpError(err));
18680                }
18681                Ok(res) => {
18682                    let (mut parts, body) = res.into_parts();
18683                    let mut body = common::Body::new(body);
18684                    if !parts.status.is_success() {
18685                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18686                        let error = serde_json::from_str(&common::to_string(&bytes));
18687                        let response = common::to_response(parts, bytes.into());
18688
18689                        if let common::Retry::After(d) =
18690                            dlg.http_failure(&response, error.as_ref().ok())
18691                        {
18692                            sleep(d).await;
18693                            continue;
18694                        }
18695
18696                        dlg.finished(false);
18697
18698                        return Err(match error {
18699                            Ok(value) => common::Error::BadRequest(value),
18700                            _ => common::Error::Failure(response),
18701                        });
18702                    }
18703                    let response = {
18704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18705                        let encoded = common::to_string(&bytes);
18706                        match serde_json::from_str(&encoded) {
18707                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18708                            Err(error) => {
18709                                dlg.response_json_decode_error(&encoded, &error);
18710                                return Err(common::Error::JsonDecodeError(
18711                                    encoded.to_string(),
18712                                    error,
18713                                ));
18714                            }
18715                        }
18716                    };
18717
18718                    dlg.finished(true);
18719                    return Ok(response);
18720                }
18721            }
18722        }
18723    }
18724
18725    ///
18726    /// Sets the *request* property to the given value.
18727    ///
18728    /// Even though the property as already been set when instantiating this call,
18729    /// we provide this method for API completeness.
18730    pub fn request(
18731        mut self,
18732        new_value: SetIamPolicyRequest,
18733    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
18734        self._request = new_value;
18735        self
18736    }
18737    /// 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.
18738    ///
18739    /// Sets the *resource* path property to the given value.
18740    ///
18741    /// Even though the property as already been set when instantiating this call,
18742    /// we provide this method for API completeness.
18743    pub fn resource(
18744        mut self,
18745        new_value: &str,
18746    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
18747        self._resource = new_value.to_string();
18748        self
18749    }
18750    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18751    /// while executing the actual API request.
18752    ///
18753    /// ````text
18754    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18755    /// ````
18756    ///
18757    /// Sets the *delegate* property to the given value.
18758    pub fn delegate(
18759        mut self,
18760        new_value: &'a mut dyn common::Delegate,
18761    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
18762        self._delegate = Some(new_value);
18763        self
18764    }
18765
18766    /// Set any additional parameter of the query string used in the request.
18767    /// It should be used to set parameters which are not yet available through their own
18768    /// setters.
18769    ///
18770    /// Please note that this method must not be used to set any of the known parameters
18771    /// which have their own setter method. If done anyway, the request will fail.
18772    ///
18773    /// # Additional Parameters
18774    ///
18775    /// * *$.xgafv* (query-string) - V1 error format.
18776    /// * *access_token* (query-string) - OAuth access token.
18777    /// * *alt* (query-string) - Data format for response.
18778    /// * *callback* (query-string) - JSONP
18779    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18780    /// * *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.
18781    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18782    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18783    /// * *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.
18784    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18785    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18786    pub fn param<T>(
18787        mut self,
18788        name: T,
18789        value: T,
18790    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
18791    where
18792        T: AsRef<str>,
18793    {
18794        self._additional_params
18795            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18796        self
18797    }
18798
18799    /// Identifies the authorization scope for the method you are building.
18800    ///
18801    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18802    /// [`Scope::CloudPlatform`].
18803    ///
18804    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18805    /// tokens for more than one scope.
18806    ///
18807    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18808    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18809    /// sufficient, a read-write scope will do as well.
18810    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
18811    where
18812        St: AsRef<str>,
18813    {
18814        self._scopes.insert(String::from(scope.as_ref()));
18815        self
18816    }
18817    /// Identifies the authorization scope(s) for the method you are building.
18818    ///
18819    /// See [`Self::add_scope()`] for details.
18820    pub fn add_scopes<I, St>(
18821        mut self,
18822        scopes: I,
18823    ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
18824    where
18825        I: IntoIterator<Item = St>,
18826        St: AsRef<str>,
18827    {
18828        self._scopes
18829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18830        self
18831    }
18832
18833    /// Removes all scopes, and no default scope will be used either.
18834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18835    /// for details).
18836    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
18837        self._scopes.clear();
18838        self
18839    }
18840}
18841
18842/// Start an already created migration job.
18843///
18844/// A builder for the *locations.migrationJobs.start* method supported by a *project* resource.
18845/// It is not used directly, but through a [`ProjectMethods`] instance.
18846///
18847/// # Example
18848///
18849/// Instantiate a resource method builder
18850///
18851/// ```test_harness,no_run
18852/// # extern crate hyper;
18853/// # extern crate hyper_rustls;
18854/// # extern crate google_datamigration1 as datamigration1;
18855/// use datamigration1::api::StartMigrationJobRequest;
18856/// # async fn dox() {
18857/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18858///
18859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18860/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18861/// #     secret,
18862/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18863/// # ).build().await.unwrap();
18864///
18865/// # let client = hyper_util::client::legacy::Client::builder(
18866/// #     hyper_util::rt::TokioExecutor::new()
18867/// # )
18868/// # .build(
18869/// #     hyper_rustls::HttpsConnectorBuilder::new()
18870/// #         .with_native_roots()
18871/// #         .unwrap()
18872/// #         .https_or_http()
18873/// #         .enable_http1()
18874/// #         .build()
18875/// # );
18876/// # let mut hub = DatabaseMigrationService::new(client, auth);
18877/// // As the method needs a request, you would usually fill it with the desired information
18878/// // into the respective structure. Some of the parts shown here might not be applicable !
18879/// // Values shown here are possibly random and not representative !
18880/// let mut req = StartMigrationJobRequest::default();
18881///
18882/// // You can configure optional parameters by calling the respective setters at will, and
18883/// // execute the final call using `doit()`.
18884/// // Values shown here are possibly random and not representative !
18885/// let result = hub.projects().locations_migration_jobs_start(req, "name")
18886///              .doit().await;
18887/// # }
18888/// ```
18889pub struct ProjectLocationMigrationJobStartCall<'a, C>
18890where
18891    C: 'a,
18892{
18893    hub: &'a DatabaseMigrationService<C>,
18894    _request: StartMigrationJobRequest,
18895    _name: String,
18896    _delegate: Option<&'a mut dyn common::Delegate>,
18897    _additional_params: HashMap<String, String>,
18898    _scopes: BTreeSet<String>,
18899}
18900
18901impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobStartCall<'a, C> {}
18902
18903impl<'a, C> ProjectLocationMigrationJobStartCall<'a, C>
18904where
18905    C: common::Connector,
18906{
18907    /// Perform the operation you have build so far.
18908    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18909        use std::borrow::Cow;
18910        use std::io::{Read, Seek};
18911
18912        use common::{url::Params, ToParts};
18913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18914
18915        let mut dd = common::DefaultDelegate;
18916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18917        dlg.begin(common::MethodInfo {
18918            id: "datamigration.projects.locations.migrationJobs.start",
18919            http_method: hyper::Method::POST,
18920        });
18921
18922        for &field in ["alt", "name"].iter() {
18923            if self._additional_params.contains_key(field) {
18924                dlg.finished(false);
18925                return Err(common::Error::FieldClash(field));
18926            }
18927        }
18928
18929        let mut params = Params::with_capacity(4 + self._additional_params.len());
18930        params.push("name", self._name);
18931
18932        params.extend(self._additional_params.iter());
18933
18934        params.push("alt", "json");
18935        let mut url = self.hub._base_url.clone() + "v1/{+name}:start";
18936        if self._scopes.is_empty() {
18937            self._scopes
18938                .insert(Scope::CloudPlatform.as_ref().to_string());
18939        }
18940
18941        #[allow(clippy::single_element_loop)]
18942        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18943            url = params.uri_replacement(url, param_name, find_this, true);
18944        }
18945        {
18946            let to_remove = ["name"];
18947            params.remove_params(&to_remove);
18948        }
18949
18950        let url = params.parse_with_url(&url);
18951
18952        let mut json_mime_type = mime::APPLICATION_JSON;
18953        let mut request_value_reader = {
18954            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18955            common::remove_json_null_values(&mut value);
18956            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18957            serde_json::to_writer(&mut dst, &value).unwrap();
18958            dst
18959        };
18960        let request_size = request_value_reader
18961            .seek(std::io::SeekFrom::End(0))
18962            .unwrap();
18963        request_value_reader
18964            .seek(std::io::SeekFrom::Start(0))
18965            .unwrap();
18966
18967        loop {
18968            let token = match self
18969                .hub
18970                .auth
18971                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18972                .await
18973            {
18974                Ok(token) => token,
18975                Err(e) => match dlg.token(e) {
18976                    Ok(token) => token,
18977                    Err(e) => {
18978                        dlg.finished(false);
18979                        return Err(common::Error::MissingToken(e));
18980                    }
18981                },
18982            };
18983            request_value_reader
18984                .seek(std::io::SeekFrom::Start(0))
18985                .unwrap();
18986            let mut req_result = {
18987                let client = &self.hub.client;
18988                dlg.pre_request();
18989                let mut req_builder = hyper::Request::builder()
18990                    .method(hyper::Method::POST)
18991                    .uri(url.as_str())
18992                    .header(USER_AGENT, self.hub._user_agent.clone());
18993
18994                if let Some(token) = token.as_ref() {
18995                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18996                }
18997
18998                let request = req_builder
18999                    .header(CONTENT_TYPE, json_mime_type.to_string())
19000                    .header(CONTENT_LENGTH, request_size as u64)
19001                    .body(common::to_body(
19002                        request_value_reader.get_ref().clone().into(),
19003                    ));
19004
19005                client.request(request.unwrap()).await
19006            };
19007
19008            match req_result {
19009                Err(err) => {
19010                    if let common::Retry::After(d) = dlg.http_error(&err) {
19011                        sleep(d).await;
19012                        continue;
19013                    }
19014                    dlg.finished(false);
19015                    return Err(common::Error::HttpError(err));
19016                }
19017                Ok(res) => {
19018                    let (mut parts, body) = res.into_parts();
19019                    let mut body = common::Body::new(body);
19020                    if !parts.status.is_success() {
19021                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19022                        let error = serde_json::from_str(&common::to_string(&bytes));
19023                        let response = common::to_response(parts, bytes.into());
19024
19025                        if let common::Retry::After(d) =
19026                            dlg.http_failure(&response, error.as_ref().ok())
19027                        {
19028                            sleep(d).await;
19029                            continue;
19030                        }
19031
19032                        dlg.finished(false);
19033
19034                        return Err(match error {
19035                            Ok(value) => common::Error::BadRequest(value),
19036                            _ => common::Error::Failure(response),
19037                        });
19038                    }
19039                    let response = {
19040                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19041                        let encoded = common::to_string(&bytes);
19042                        match serde_json::from_str(&encoded) {
19043                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19044                            Err(error) => {
19045                                dlg.response_json_decode_error(&encoded, &error);
19046                                return Err(common::Error::JsonDecodeError(
19047                                    encoded.to_string(),
19048                                    error,
19049                                ));
19050                            }
19051                        }
19052                    };
19053
19054                    dlg.finished(true);
19055                    return Ok(response);
19056                }
19057            }
19058        }
19059    }
19060
19061    ///
19062    /// Sets the *request* property to the given value.
19063    ///
19064    /// Even though the property as already been set when instantiating this call,
19065    /// we provide this method for API completeness.
19066    pub fn request(
19067        mut self,
19068        new_value: StartMigrationJobRequest,
19069    ) -> ProjectLocationMigrationJobStartCall<'a, C> {
19070        self._request = new_value;
19071        self
19072    }
19073    /// Name of the migration job resource to start.
19074    ///
19075    /// Sets the *name* path property to the given value.
19076    ///
19077    /// Even though the property as already been set when instantiating this call,
19078    /// we provide this method for API completeness.
19079    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobStartCall<'a, C> {
19080        self._name = new_value.to_string();
19081        self
19082    }
19083    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19084    /// while executing the actual API request.
19085    ///
19086    /// ````text
19087    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19088    /// ````
19089    ///
19090    /// Sets the *delegate* property to the given value.
19091    pub fn delegate(
19092        mut self,
19093        new_value: &'a mut dyn common::Delegate,
19094    ) -> ProjectLocationMigrationJobStartCall<'a, C> {
19095        self._delegate = Some(new_value);
19096        self
19097    }
19098
19099    /// Set any additional parameter of the query string used in the request.
19100    /// It should be used to set parameters which are not yet available through their own
19101    /// setters.
19102    ///
19103    /// Please note that this method must not be used to set any of the known parameters
19104    /// which have their own setter method. If done anyway, the request will fail.
19105    ///
19106    /// # Additional Parameters
19107    ///
19108    /// * *$.xgafv* (query-string) - V1 error format.
19109    /// * *access_token* (query-string) - OAuth access token.
19110    /// * *alt* (query-string) - Data format for response.
19111    /// * *callback* (query-string) - JSONP
19112    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19113    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19114    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19115    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19116    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19117    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19118    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19119    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobStartCall<'a, C>
19120    where
19121        T: AsRef<str>,
19122    {
19123        self._additional_params
19124            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19125        self
19126    }
19127
19128    /// Identifies the authorization scope for the method you are building.
19129    ///
19130    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19131    /// [`Scope::CloudPlatform`].
19132    ///
19133    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19134    /// tokens for more than one scope.
19135    ///
19136    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19137    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19138    /// sufficient, a read-write scope will do as well.
19139    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobStartCall<'a, C>
19140    where
19141        St: AsRef<str>,
19142    {
19143        self._scopes.insert(String::from(scope.as_ref()));
19144        self
19145    }
19146    /// Identifies the authorization scope(s) for the method you are building.
19147    ///
19148    /// See [`Self::add_scope()`] for details.
19149    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobStartCall<'a, C>
19150    where
19151        I: IntoIterator<Item = St>,
19152        St: AsRef<str>,
19153    {
19154        self._scopes
19155            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19156        self
19157    }
19158
19159    /// Removes all scopes, and no default scope will be used either.
19160    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19161    /// for details).
19162    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobStartCall<'a, C> {
19163        self._scopes.clear();
19164        self
19165    }
19166}
19167
19168/// Stops a running migration job.
19169///
19170/// A builder for the *locations.migrationJobs.stop* method supported by a *project* resource.
19171/// It is not used directly, but through a [`ProjectMethods`] instance.
19172///
19173/// # Example
19174///
19175/// Instantiate a resource method builder
19176///
19177/// ```test_harness,no_run
19178/// # extern crate hyper;
19179/// # extern crate hyper_rustls;
19180/// # extern crate google_datamigration1 as datamigration1;
19181/// use datamigration1::api::StopMigrationJobRequest;
19182/// # async fn dox() {
19183/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19184///
19185/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19186/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19187/// #     secret,
19188/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19189/// # ).build().await.unwrap();
19190///
19191/// # let client = hyper_util::client::legacy::Client::builder(
19192/// #     hyper_util::rt::TokioExecutor::new()
19193/// # )
19194/// # .build(
19195/// #     hyper_rustls::HttpsConnectorBuilder::new()
19196/// #         .with_native_roots()
19197/// #         .unwrap()
19198/// #         .https_or_http()
19199/// #         .enable_http1()
19200/// #         .build()
19201/// # );
19202/// # let mut hub = DatabaseMigrationService::new(client, auth);
19203/// // As the method needs a request, you would usually fill it with the desired information
19204/// // into the respective structure. Some of the parts shown here might not be applicable !
19205/// // Values shown here are possibly random and not representative !
19206/// let mut req = StopMigrationJobRequest::default();
19207///
19208/// // You can configure optional parameters by calling the respective setters at will, and
19209/// // execute the final call using `doit()`.
19210/// // Values shown here are possibly random and not representative !
19211/// let result = hub.projects().locations_migration_jobs_stop(req, "name")
19212///              .doit().await;
19213/// # }
19214/// ```
19215pub struct ProjectLocationMigrationJobStopCall<'a, C>
19216where
19217    C: 'a,
19218{
19219    hub: &'a DatabaseMigrationService<C>,
19220    _request: StopMigrationJobRequest,
19221    _name: String,
19222    _delegate: Option<&'a mut dyn common::Delegate>,
19223    _additional_params: HashMap<String, String>,
19224    _scopes: BTreeSet<String>,
19225}
19226
19227impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobStopCall<'a, C> {}
19228
19229impl<'a, C> ProjectLocationMigrationJobStopCall<'a, C>
19230where
19231    C: common::Connector,
19232{
19233    /// Perform the operation you have build so far.
19234    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19235        use std::borrow::Cow;
19236        use std::io::{Read, Seek};
19237
19238        use common::{url::Params, ToParts};
19239        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19240
19241        let mut dd = common::DefaultDelegate;
19242        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19243        dlg.begin(common::MethodInfo {
19244            id: "datamigration.projects.locations.migrationJobs.stop",
19245            http_method: hyper::Method::POST,
19246        });
19247
19248        for &field in ["alt", "name"].iter() {
19249            if self._additional_params.contains_key(field) {
19250                dlg.finished(false);
19251                return Err(common::Error::FieldClash(field));
19252            }
19253        }
19254
19255        let mut params = Params::with_capacity(4 + self._additional_params.len());
19256        params.push("name", self._name);
19257
19258        params.extend(self._additional_params.iter());
19259
19260        params.push("alt", "json");
19261        let mut url = self.hub._base_url.clone() + "v1/{+name}:stop";
19262        if self._scopes.is_empty() {
19263            self._scopes
19264                .insert(Scope::CloudPlatform.as_ref().to_string());
19265        }
19266
19267        #[allow(clippy::single_element_loop)]
19268        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19269            url = params.uri_replacement(url, param_name, find_this, true);
19270        }
19271        {
19272            let to_remove = ["name"];
19273            params.remove_params(&to_remove);
19274        }
19275
19276        let url = params.parse_with_url(&url);
19277
19278        let mut json_mime_type = mime::APPLICATION_JSON;
19279        let mut request_value_reader = {
19280            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19281            common::remove_json_null_values(&mut value);
19282            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19283            serde_json::to_writer(&mut dst, &value).unwrap();
19284            dst
19285        };
19286        let request_size = request_value_reader
19287            .seek(std::io::SeekFrom::End(0))
19288            .unwrap();
19289        request_value_reader
19290            .seek(std::io::SeekFrom::Start(0))
19291            .unwrap();
19292
19293        loop {
19294            let token = match self
19295                .hub
19296                .auth
19297                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19298                .await
19299            {
19300                Ok(token) => token,
19301                Err(e) => match dlg.token(e) {
19302                    Ok(token) => token,
19303                    Err(e) => {
19304                        dlg.finished(false);
19305                        return Err(common::Error::MissingToken(e));
19306                    }
19307                },
19308            };
19309            request_value_reader
19310                .seek(std::io::SeekFrom::Start(0))
19311                .unwrap();
19312            let mut req_result = {
19313                let client = &self.hub.client;
19314                dlg.pre_request();
19315                let mut req_builder = hyper::Request::builder()
19316                    .method(hyper::Method::POST)
19317                    .uri(url.as_str())
19318                    .header(USER_AGENT, self.hub._user_agent.clone());
19319
19320                if let Some(token) = token.as_ref() {
19321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19322                }
19323
19324                let request = req_builder
19325                    .header(CONTENT_TYPE, json_mime_type.to_string())
19326                    .header(CONTENT_LENGTH, request_size as u64)
19327                    .body(common::to_body(
19328                        request_value_reader.get_ref().clone().into(),
19329                    ));
19330
19331                client.request(request.unwrap()).await
19332            };
19333
19334            match req_result {
19335                Err(err) => {
19336                    if let common::Retry::After(d) = dlg.http_error(&err) {
19337                        sleep(d).await;
19338                        continue;
19339                    }
19340                    dlg.finished(false);
19341                    return Err(common::Error::HttpError(err));
19342                }
19343                Ok(res) => {
19344                    let (mut parts, body) = res.into_parts();
19345                    let mut body = common::Body::new(body);
19346                    if !parts.status.is_success() {
19347                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19348                        let error = serde_json::from_str(&common::to_string(&bytes));
19349                        let response = common::to_response(parts, bytes.into());
19350
19351                        if let common::Retry::After(d) =
19352                            dlg.http_failure(&response, error.as_ref().ok())
19353                        {
19354                            sleep(d).await;
19355                            continue;
19356                        }
19357
19358                        dlg.finished(false);
19359
19360                        return Err(match error {
19361                            Ok(value) => common::Error::BadRequest(value),
19362                            _ => common::Error::Failure(response),
19363                        });
19364                    }
19365                    let response = {
19366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19367                        let encoded = common::to_string(&bytes);
19368                        match serde_json::from_str(&encoded) {
19369                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19370                            Err(error) => {
19371                                dlg.response_json_decode_error(&encoded, &error);
19372                                return Err(common::Error::JsonDecodeError(
19373                                    encoded.to_string(),
19374                                    error,
19375                                ));
19376                            }
19377                        }
19378                    };
19379
19380                    dlg.finished(true);
19381                    return Ok(response);
19382                }
19383            }
19384        }
19385    }
19386
19387    ///
19388    /// Sets the *request* 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 request(
19393        mut self,
19394        new_value: StopMigrationJobRequest,
19395    ) -> ProjectLocationMigrationJobStopCall<'a, C> {
19396        self._request = new_value;
19397        self
19398    }
19399    /// Name of the migration job resource to stop.
19400    ///
19401    /// Sets the *name* path property to the given value.
19402    ///
19403    /// Even though the property as already been set when instantiating this call,
19404    /// we provide this method for API completeness.
19405    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobStopCall<'a, C> {
19406        self._name = new_value.to_string();
19407        self
19408    }
19409    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19410    /// while executing the actual API request.
19411    ///
19412    /// ````text
19413    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19414    /// ````
19415    ///
19416    /// Sets the *delegate* property to the given value.
19417    pub fn delegate(
19418        mut self,
19419        new_value: &'a mut dyn common::Delegate,
19420    ) -> ProjectLocationMigrationJobStopCall<'a, C> {
19421        self._delegate = Some(new_value);
19422        self
19423    }
19424
19425    /// Set any additional parameter of the query string used in the request.
19426    /// It should be used to set parameters which are not yet available through their own
19427    /// setters.
19428    ///
19429    /// Please note that this method must not be used to set any of the known parameters
19430    /// which have their own setter method. If done anyway, the request will fail.
19431    ///
19432    /// # Additional Parameters
19433    ///
19434    /// * *$.xgafv* (query-string) - V1 error format.
19435    /// * *access_token* (query-string) - OAuth access token.
19436    /// * *alt* (query-string) - Data format for response.
19437    /// * *callback* (query-string) - JSONP
19438    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19439    /// * *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.
19440    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19441    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19442    /// * *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.
19443    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19444    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19445    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobStopCall<'a, C>
19446    where
19447        T: AsRef<str>,
19448    {
19449        self._additional_params
19450            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19451        self
19452    }
19453
19454    /// Identifies the authorization scope for the method you are building.
19455    ///
19456    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19457    /// [`Scope::CloudPlatform`].
19458    ///
19459    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19460    /// tokens for more than one scope.
19461    ///
19462    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19463    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19464    /// sufficient, a read-write scope will do as well.
19465    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobStopCall<'a, C>
19466    where
19467        St: AsRef<str>,
19468    {
19469        self._scopes.insert(String::from(scope.as_ref()));
19470        self
19471    }
19472    /// Identifies the authorization scope(s) for the method you are building.
19473    ///
19474    /// See [`Self::add_scope()`] for details.
19475    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobStopCall<'a, C>
19476    where
19477        I: IntoIterator<Item = St>,
19478        St: AsRef<str>,
19479    {
19480        self._scopes
19481            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19482        self
19483    }
19484
19485    /// Removes all scopes, and no default scope will be used either.
19486    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19487    /// for details).
19488    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobStopCall<'a, C> {
19489        self._scopes.clear();
19490        self
19491    }
19492}
19493
19494/// 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.
19495///
19496/// A builder for the *locations.migrationJobs.testIamPermissions* method supported by a *project* resource.
19497/// It is not used directly, but through a [`ProjectMethods`] instance.
19498///
19499/// # Example
19500///
19501/// Instantiate a resource method builder
19502///
19503/// ```test_harness,no_run
19504/// # extern crate hyper;
19505/// # extern crate hyper_rustls;
19506/// # extern crate google_datamigration1 as datamigration1;
19507/// use datamigration1::api::TestIamPermissionsRequest;
19508/// # async fn dox() {
19509/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19510///
19511/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19512/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19513/// #     secret,
19514/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19515/// # ).build().await.unwrap();
19516///
19517/// # let client = hyper_util::client::legacy::Client::builder(
19518/// #     hyper_util::rt::TokioExecutor::new()
19519/// # )
19520/// # .build(
19521/// #     hyper_rustls::HttpsConnectorBuilder::new()
19522/// #         .with_native_roots()
19523/// #         .unwrap()
19524/// #         .https_or_http()
19525/// #         .enable_http1()
19526/// #         .build()
19527/// # );
19528/// # let mut hub = DatabaseMigrationService::new(client, auth);
19529/// // As the method needs a request, you would usually fill it with the desired information
19530/// // into the respective structure. Some of the parts shown here might not be applicable !
19531/// // Values shown here are possibly random and not representative !
19532/// let mut req = TestIamPermissionsRequest::default();
19533///
19534/// // You can configure optional parameters by calling the respective setters at will, and
19535/// // execute the final call using `doit()`.
19536/// // Values shown here are possibly random and not representative !
19537/// let result = hub.projects().locations_migration_jobs_test_iam_permissions(req, "resource")
19538///              .doit().await;
19539/// # }
19540/// ```
19541pub struct ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
19542where
19543    C: 'a,
19544{
19545    hub: &'a DatabaseMigrationService<C>,
19546    _request: TestIamPermissionsRequest,
19547    _resource: String,
19548    _delegate: Option<&'a mut dyn common::Delegate>,
19549    _additional_params: HashMap<String, String>,
19550    _scopes: BTreeSet<String>,
19551}
19552
19553impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {}
19554
19555impl<'a, C> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
19556where
19557    C: common::Connector,
19558{
19559    /// Perform the operation you have build so far.
19560    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
19561        use std::borrow::Cow;
19562        use std::io::{Read, Seek};
19563
19564        use common::{url::Params, ToParts};
19565        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19566
19567        let mut dd = common::DefaultDelegate;
19568        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19569        dlg.begin(common::MethodInfo {
19570            id: "datamigration.projects.locations.migrationJobs.testIamPermissions",
19571            http_method: hyper::Method::POST,
19572        });
19573
19574        for &field in ["alt", "resource"].iter() {
19575            if self._additional_params.contains_key(field) {
19576                dlg.finished(false);
19577                return Err(common::Error::FieldClash(field));
19578            }
19579        }
19580
19581        let mut params = Params::with_capacity(4 + self._additional_params.len());
19582        params.push("resource", self._resource);
19583
19584        params.extend(self._additional_params.iter());
19585
19586        params.push("alt", "json");
19587        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
19588        if self._scopes.is_empty() {
19589            self._scopes
19590                .insert(Scope::CloudPlatform.as_ref().to_string());
19591        }
19592
19593        #[allow(clippy::single_element_loop)]
19594        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
19595            url = params.uri_replacement(url, param_name, find_this, true);
19596        }
19597        {
19598            let to_remove = ["resource"];
19599            params.remove_params(&to_remove);
19600        }
19601
19602        let url = params.parse_with_url(&url);
19603
19604        let mut json_mime_type = mime::APPLICATION_JSON;
19605        let mut request_value_reader = {
19606            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19607            common::remove_json_null_values(&mut value);
19608            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19609            serde_json::to_writer(&mut dst, &value).unwrap();
19610            dst
19611        };
19612        let request_size = request_value_reader
19613            .seek(std::io::SeekFrom::End(0))
19614            .unwrap();
19615        request_value_reader
19616            .seek(std::io::SeekFrom::Start(0))
19617            .unwrap();
19618
19619        loop {
19620            let token = match self
19621                .hub
19622                .auth
19623                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19624                .await
19625            {
19626                Ok(token) => token,
19627                Err(e) => match dlg.token(e) {
19628                    Ok(token) => token,
19629                    Err(e) => {
19630                        dlg.finished(false);
19631                        return Err(common::Error::MissingToken(e));
19632                    }
19633                },
19634            };
19635            request_value_reader
19636                .seek(std::io::SeekFrom::Start(0))
19637                .unwrap();
19638            let mut req_result = {
19639                let client = &self.hub.client;
19640                dlg.pre_request();
19641                let mut req_builder = hyper::Request::builder()
19642                    .method(hyper::Method::POST)
19643                    .uri(url.as_str())
19644                    .header(USER_AGENT, self.hub._user_agent.clone());
19645
19646                if let Some(token) = token.as_ref() {
19647                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19648                }
19649
19650                let request = req_builder
19651                    .header(CONTENT_TYPE, json_mime_type.to_string())
19652                    .header(CONTENT_LENGTH, request_size as u64)
19653                    .body(common::to_body(
19654                        request_value_reader.get_ref().clone().into(),
19655                    ));
19656
19657                client.request(request.unwrap()).await
19658            };
19659
19660            match req_result {
19661                Err(err) => {
19662                    if let common::Retry::After(d) = dlg.http_error(&err) {
19663                        sleep(d).await;
19664                        continue;
19665                    }
19666                    dlg.finished(false);
19667                    return Err(common::Error::HttpError(err));
19668                }
19669                Ok(res) => {
19670                    let (mut parts, body) = res.into_parts();
19671                    let mut body = common::Body::new(body);
19672                    if !parts.status.is_success() {
19673                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19674                        let error = serde_json::from_str(&common::to_string(&bytes));
19675                        let response = common::to_response(parts, bytes.into());
19676
19677                        if let common::Retry::After(d) =
19678                            dlg.http_failure(&response, error.as_ref().ok())
19679                        {
19680                            sleep(d).await;
19681                            continue;
19682                        }
19683
19684                        dlg.finished(false);
19685
19686                        return Err(match error {
19687                            Ok(value) => common::Error::BadRequest(value),
19688                            _ => common::Error::Failure(response),
19689                        });
19690                    }
19691                    let response = {
19692                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19693                        let encoded = common::to_string(&bytes);
19694                        match serde_json::from_str(&encoded) {
19695                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19696                            Err(error) => {
19697                                dlg.response_json_decode_error(&encoded, &error);
19698                                return Err(common::Error::JsonDecodeError(
19699                                    encoded.to_string(),
19700                                    error,
19701                                ));
19702                            }
19703                        }
19704                    };
19705
19706                    dlg.finished(true);
19707                    return Ok(response);
19708                }
19709            }
19710        }
19711    }
19712
19713    ///
19714    /// Sets the *request* property to the given value.
19715    ///
19716    /// Even though the property as already been set when instantiating this call,
19717    /// we provide this method for API completeness.
19718    pub fn request(
19719        mut self,
19720        new_value: TestIamPermissionsRequest,
19721    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
19722        self._request = new_value;
19723        self
19724    }
19725    /// 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.
19726    ///
19727    /// Sets the *resource* path property to the given value.
19728    ///
19729    /// Even though the property as already been set when instantiating this call,
19730    /// we provide this method for API completeness.
19731    pub fn resource(
19732        mut self,
19733        new_value: &str,
19734    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
19735        self._resource = new_value.to_string();
19736        self
19737    }
19738    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19739    /// while executing the actual API request.
19740    ///
19741    /// ````text
19742    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19743    /// ````
19744    ///
19745    /// Sets the *delegate* property to the given value.
19746    pub fn delegate(
19747        mut self,
19748        new_value: &'a mut dyn common::Delegate,
19749    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
19750        self._delegate = Some(new_value);
19751        self
19752    }
19753
19754    /// Set any additional parameter of the query string used in the request.
19755    /// It should be used to set parameters which are not yet available through their own
19756    /// setters.
19757    ///
19758    /// Please note that this method must not be used to set any of the known parameters
19759    /// which have their own setter method. If done anyway, the request will fail.
19760    ///
19761    /// # Additional Parameters
19762    ///
19763    /// * *$.xgafv* (query-string) - V1 error format.
19764    /// * *access_token* (query-string) - OAuth access token.
19765    /// * *alt* (query-string) - Data format for response.
19766    /// * *callback* (query-string) - JSONP
19767    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19768    /// * *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.
19769    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19770    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19771    /// * *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.
19772    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19773    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19774    pub fn param<T>(
19775        mut self,
19776        name: T,
19777        value: T,
19778    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
19779    where
19780        T: AsRef<str>,
19781    {
19782        self._additional_params
19783            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19784        self
19785    }
19786
19787    /// Identifies the authorization scope for the method you are building.
19788    ///
19789    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19790    /// [`Scope::CloudPlatform`].
19791    ///
19792    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19793    /// tokens for more than one scope.
19794    ///
19795    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19796    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19797    /// sufficient, a read-write scope will do as well.
19798    pub fn add_scope<St>(
19799        mut self,
19800        scope: St,
19801    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
19802    where
19803        St: AsRef<str>,
19804    {
19805        self._scopes.insert(String::from(scope.as_ref()));
19806        self
19807    }
19808    /// Identifies the authorization scope(s) for the method you are building.
19809    ///
19810    /// See [`Self::add_scope()`] for details.
19811    pub fn add_scopes<I, St>(
19812        mut self,
19813        scopes: I,
19814    ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
19815    where
19816        I: IntoIterator<Item = St>,
19817        St: AsRef<str>,
19818    {
19819        self._scopes
19820            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19821        self
19822    }
19823
19824    /// Removes all scopes, and no default scope will be used either.
19825    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19826    /// for details).
19827    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
19828        self._scopes.clear();
19829        self
19830    }
19831}
19832
19833/// Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.
19834///
19835/// A builder for the *locations.migrationJobs.verify* method supported by a *project* resource.
19836/// It is not used directly, but through a [`ProjectMethods`] instance.
19837///
19838/// # Example
19839///
19840/// Instantiate a resource method builder
19841///
19842/// ```test_harness,no_run
19843/// # extern crate hyper;
19844/// # extern crate hyper_rustls;
19845/// # extern crate google_datamigration1 as datamigration1;
19846/// use datamigration1::api::VerifyMigrationJobRequest;
19847/// # async fn dox() {
19848/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19849///
19850/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19851/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19852/// #     secret,
19853/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19854/// # ).build().await.unwrap();
19855///
19856/// # let client = hyper_util::client::legacy::Client::builder(
19857/// #     hyper_util::rt::TokioExecutor::new()
19858/// # )
19859/// # .build(
19860/// #     hyper_rustls::HttpsConnectorBuilder::new()
19861/// #         .with_native_roots()
19862/// #         .unwrap()
19863/// #         .https_or_http()
19864/// #         .enable_http1()
19865/// #         .build()
19866/// # );
19867/// # let mut hub = DatabaseMigrationService::new(client, auth);
19868/// // As the method needs a request, you would usually fill it with the desired information
19869/// // into the respective structure. Some of the parts shown here might not be applicable !
19870/// // Values shown here are possibly random and not representative !
19871/// let mut req = VerifyMigrationJobRequest::default();
19872///
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_migration_jobs_verify(req, "name")
19877///              .doit().await;
19878/// # }
19879/// ```
19880pub struct ProjectLocationMigrationJobVerifyCall<'a, C>
19881where
19882    C: 'a,
19883{
19884    hub: &'a DatabaseMigrationService<C>,
19885    _request: VerifyMigrationJobRequest,
19886    _name: String,
19887    _delegate: Option<&'a mut dyn common::Delegate>,
19888    _additional_params: HashMap<String, String>,
19889    _scopes: BTreeSet<String>,
19890}
19891
19892impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobVerifyCall<'a, C> {}
19893
19894impl<'a, C> ProjectLocationMigrationJobVerifyCall<'a, C>
19895where
19896    C: common::Connector,
19897{
19898    /// Perform the operation you have build so far.
19899    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19900        use std::borrow::Cow;
19901        use std::io::{Read, Seek};
19902
19903        use common::{url::Params, ToParts};
19904        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19905
19906        let mut dd = common::DefaultDelegate;
19907        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19908        dlg.begin(common::MethodInfo {
19909            id: "datamigration.projects.locations.migrationJobs.verify",
19910            http_method: hyper::Method::POST,
19911        });
19912
19913        for &field in ["alt", "name"].iter() {
19914            if self._additional_params.contains_key(field) {
19915                dlg.finished(false);
19916                return Err(common::Error::FieldClash(field));
19917            }
19918        }
19919
19920        let mut params = Params::with_capacity(4 + self._additional_params.len());
19921        params.push("name", self._name);
19922
19923        params.extend(self._additional_params.iter());
19924
19925        params.push("alt", "json");
19926        let mut url = self.hub._base_url.clone() + "v1/{+name}:verify";
19927        if self._scopes.is_empty() {
19928            self._scopes
19929                .insert(Scope::CloudPlatform.as_ref().to_string());
19930        }
19931
19932        #[allow(clippy::single_element_loop)]
19933        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19934            url = params.uri_replacement(url, param_name, find_this, true);
19935        }
19936        {
19937            let to_remove = ["name"];
19938            params.remove_params(&to_remove);
19939        }
19940
19941        let url = params.parse_with_url(&url);
19942
19943        let mut json_mime_type = mime::APPLICATION_JSON;
19944        let mut request_value_reader = {
19945            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19946            common::remove_json_null_values(&mut value);
19947            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19948            serde_json::to_writer(&mut dst, &value).unwrap();
19949            dst
19950        };
19951        let request_size = request_value_reader
19952            .seek(std::io::SeekFrom::End(0))
19953            .unwrap();
19954        request_value_reader
19955            .seek(std::io::SeekFrom::Start(0))
19956            .unwrap();
19957
19958        loop {
19959            let token = match self
19960                .hub
19961                .auth
19962                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19963                .await
19964            {
19965                Ok(token) => token,
19966                Err(e) => match dlg.token(e) {
19967                    Ok(token) => token,
19968                    Err(e) => {
19969                        dlg.finished(false);
19970                        return Err(common::Error::MissingToken(e));
19971                    }
19972                },
19973            };
19974            request_value_reader
19975                .seek(std::io::SeekFrom::Start(0))
19976                .unwrap();
19977            let mut req_result = {
19978                let client = &self.hub.client;
19979                dlg.pre_request();
19980                let mut req_builder = hyper::Request::builder()
19981                    .method(hyper::Method::POST)
19982                    .uri(url.as_str())
19983                    .header(USER_AGENT, self.hub._user_agent.clone());
19984
19985                if let Some(token) = token.as_ref() {
19986                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19987                }
19988
19989                let request = req_builder
19990                    .header(CONTENT_TYPE, json_mime_type.to_string())
19991                    .header(CONTENT_LENGTH, request_size as u64)
19992                    .body(common::to_body(
19993                        request_value_reader.get_ref().clone().into(),
19994                    ));
19995
19996                client.request(request.unwrap()).await
19997            };
19998
19999            match req_result {
20000                Err(err) => {
20001                    if let common::Retry::After(d) = dlg.http_error(&err) {
20002                        sleep(d).await;
20003                        continue;
20004                    }
20005                    dlg.finished(false);
20006                    return Err(common::Error::HttpError(err));
20007                }
20008                Ok(res) => {
20009                    let (mut parts, body) = res.into_parts();
20010                    let mut body = common::Body::new(body);
20011                    if !parts.status.is_success() {
20012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20013                        let error = serde_json::from_str(&common::to_string(&bytes));
20014                        let response = common::to_response(parts, bytes.into());
20015
20016                        if let common::Retry::After(d) =
20017                            dlg.http_failure(&response, error.as_ref().ok())
20018                        {
20019                            sleep(d).await;
20020                            continue;
20021                        }
20022
20023                        dlg.finished(false);
20024
20025                        return Err(match error {
20026                            Ok(value) => common::Error::BadRequest(value),
20027                            _ => common::Error::Failure(response),
20028                        });
20029                    }
20030                    let response = {
20031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20032                        let encoded = common::to_string(&bytes);
20033                        match serde_json::from_str(&encoded) {
20034                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20035                            Err(error) => {
20036                                dlg.response_json_decode_error(&encoded, &error);
20037                                return Err(common::Error::JsonDecodeError(
20038                                    encoded.to_string(),
20039                                    error,
20040                                ));
20041                            }
20042                        }
20043                    };
20044
20045                    dlg.finished(true);
20046                    return Ok(response);
20047                }
20048            }
20049        }
20050    }
20051
20052    ///
20053    /// Sets the *request* property to the given value.
20054    ///
20055    /// Even though the property as already been set when instantiating this call,
20056    /// we provide this method for API completeness.
20057    pub fn request(
20058        mut self,
20059        new_value: VerifyMigrationJobRequest,
20060    ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
20061        self._request = new_value;
20062        self
20063    }
20064    /// Name of the migration job resource to verify.
20065    ///
20066    /// Sets the *name* path property to the given value.
20067    ///
20068    /// Even though the property as already been set when instantiating this call,
20069    /// we provide this method for API completeness.
20070    pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
20071        self._name = new_value.to_string();
20072        self
20073    }
20074    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20075    /// while executing the actual API request.
20076    ///
20077    /// ````text
20078    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20079    /// ````
20080    ///
20081    /// Sets the *delegate* property to the given value.
20082    pub fn delegate(
20083        mut self,
20084        new_value: &'a mut dyn common::Delegate,
20085    ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
20086        self._delegate = Some(new_value);
20087        self
20088    }
20089
20090    /// Set any additional parameter of the query string used in the request.
20091    /// It should be used to set parameters which are not yet available through their own
20092    /// setters.
20093    ///
20094    /// Please note that this method must not be used to set any of the known parameters
20095    /// which have their own setter method. If done anyway, the request will fail.
20096    ///
20097    /// # Additional Parameters
20098    ///
20099    /// * *$.xgafv* (query-string) - V1 error format.
20100    /// * *access_token* (query-string) - OAuth access token.
20101    /// * *alt* (query-string) - Data format for response.
20102    /// * *callback* (query-string) - JSONP
20103    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20104    /// * *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.
20105    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20106    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20107    /// * *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.
20108    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20109    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20110    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobVerifyCall<'a, C>
20111    where
20112        T: AsRef<str>,
20113    {
20114        self._additional_params
20115            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20116        self
20117    }
20118
20119    /// Identifies the authorization scope for the method you are building.
20120    ///
20121    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20122    /// [`Scope::CloudPlatform`].
20123    ///
20124    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20125    /// tokens for more than one scope.
20126    ///
20127    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20128    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20129    /// sufficient, a read-write scope will do as well.
20130    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobVerifyCall<'a, C>
20131    where
20132        St: AsRef<str>,
20133    {
20134        self._scopes.insert(String::from(scope.as_ref()));
20135        self
20136    }
20137    /// Identifies the authorization scope(s) for the method you are building.
20138    ///
20139    /// See [`Self::add_scope()`] for details.
20140    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobVerifyCall<'a, C>
20141    where
20142        I: IntoIterator<Item = St>,
20143        St: AsRef<str>,
20144    {
20145        self._scopes
20146            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20147        self
20148    }
20149
20150    /// Removes all scopes, and no default scope will be used either.
20151    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20152    /// for details).
20153    pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
20154        self._scopes.clear();
20155        self
20156    }
20157}
20158
20159/// 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`.
20160///
20161/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
20162/// It is not used directly, but through a [`ProjectMethods`] instance.
20163///
20164/// # Example
20165///
20166/// Instantiate a resource method builder
20167///
20168/// ```test_harness,no_run
20169/// # extern crate hyper;
20170/// # extern crate hyper_rustls;
20171/// # extern crate google_datamigration1 as datamigration1;
20172/// use datamigration1::api::CancelOperationRequest;
20173/// # async fn dox() {
20174/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20175///
20176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20178/// #     secret,
20179/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20180/// # ).build().await.unwrap();
20181///
20182/// # let client = hyper_util::client::legacy::Client::builder(
20183/// #     hyper_util::rt::TokioExecutor::new()
20184/// # )
20185/// # .build(
20186/// #     hyper_rustls::HttpsConnectorBuilder::new()
20187/// #         .with_native_roots()
20188/// #         .unwrap()
20189/// #         .https_or_http()
20190/// #         .enable_http1()
20191/// #         .build()
20192/// # );
20193/// # let mut hub = DatabaseMigrationService::new(client, auth);
20194/// // As the method needs a request, you would usually fill it with the desired information
20195/// // into the respective structure. Some of the parts shown here might not be applicable !
20196/// // Values shown here are possibly random and not representative !
20197/// let mut req = CancelOperationRequest::default();
20198///
20199/// // You can configure optional parameters by calling the respective setters at will, and
20200/// // execute the final call using `doit()`.
20201/// // Values shown here are possibly random and not representative !
20202/// let result = hub.projects().locations_operations_cancel(req, "name")
20203///              .doit().await;
20204/// # }
20205/// ```
20206pub struct ProjectLocationOperationCancelCall<'a, C>
20207where
20208    C: 'a,
20209{
20210    hub: &'a DatabaseMigrationService<C>,
20211    _request: CancelOperationRequest,
20212    _name: String,
20213    _delegate: Option<&'a mut dyn common::Delegate>,
20214    _additional_params: HashMap<String, String>,
20215    _scopes: BTreeSet<String>,
20216}
20217
20218impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
20219
20220impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
20221where
20222    C: common::Connector,
20223{
20224    /// Perform the operation you have build so far.
20225    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20226        use std::borrow::Cow;
20227        use std::io::{Read, Seek};
20228
20229        use common::{url::Params, ToParts};
20230        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20231
20232        let mut dd = common::DefaultDelegate;
20233        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20234        dlg.begin(common::MethodInfo {
20235            id: "datamigration.projects.locations.operations.cancel",
20236            http_method: hyper::Method::POST,
20237        });
20238
20239        for &field in ["alt", "name"].iter() {
20240            if self._additional_params.contains_key(field) {
20241                dlg.finished(false);
20242                return Err(common::Error::FieldClash(field));
20243            }
20244        }
20245
20246        let mut params = Params::with_capacity(4 + self._additional_params.len());
20247        params.push("name", self._name);
20248
20249        params.extend(self._additional_params.iter());
20250
20251        params.push("alt", "json");
20252        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
20253        if self._scopes.is_empty() {
20254            self._scopes
20255                .insert(Scope::CloudPlatform.as_ref().to_string());
20256        }
20257
20258        #[allow(clippy::single_element_loop)]
20259        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20260            url = params.uri_replacement(url, param_name, find_this, true);
20261        }
20262        {
20263            let to_remove = ["name"];
20264            params.remove_params(&to_remove);
20265        }
20266
20267        let url = params.parse_with_url(&url);
20268
20269        let mut json_mime_type = mime::APPLICATION_JSON;
20270        let mut request_value_reader = {
20271            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20272            common::remove_json_null_values(&mut value);
20273            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20274            serde_json::to_writer(&mut dst, &value).unwrap();
20275            dst
20276        };
20277        let request_size = request_value_reader
20278            .seek(std::io::SeekFrom::End(0))
20279            .unwrap();
20280        request_value_reader
20281            .seek(std::io::SeekFrom::Start(0))
20282            .unwrap();
20283
20284        loop {
20285            let token = match self
20286                .hub
20287                .auth
20288                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20289                .await
20290            {
20291                Ok(token) => token,
20292                Err(e) => match dlg.token(e) {
20293                    Ok(token) => token,
20294                    Err(e) => {
20295                        dlg.finished(false);
20296                        return Err(common::Error::MissingToken(e));
20297                    }
20298                },
20299            };
20300            request_value_reader
20301                .seek(std::io::SeekFrom::Start(0))
20302                .unwrap();
20303            let mut req_result = {
20304                let client = &self.hub.client;
20305                dlg.pre_request();
20306                let mut req_builder = hyper::Request::builder()
20307                    .method(hyper::Method::POST)
20308                    .uri(url.as_str())
20309                    .header(USER_AGENT, self.hub._user_agent.clone());
20310
20311                if let Some(token) = token.as_ref() {
20312                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20313                }
20314
20315                let request = req_builder
20316                    .header(CONTENT_TYPE, json_mime_type.to_string())
20317                    .header(CONTENT_LENGTH, request_size as u64)
20318                    .body(common::to_body(
20319                        request_value_reader.get_ref().clone().into(),
20320                    ));
20321
20322                client.request(request.unwrap()).await
20323            };
20324
20325            match req_result {
20326                Err(err) => {
20327                    if let common::Retry::After(d) = dlg.http_error(&err) {
20328                        sleep(d).await;
20329                        continue;
20330                    }
20331                    dlg.finished(false);
20332                    return Err(common::Error::HttpError(err));
20333                }
20334                Ok(res) => {
20335                    let (mut parts, body) = res.into_parts();
20336                    let mut body = common::Body::new(body);
20337                    if !parts.status.is_success() {
20338                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20339                        let error = serde_json::from_str(&common::to_string(&bytes));
20340                        let response = common::to_response(parts, bytes.into());
20341
20342                        if let common::Retry::After(d) =
20343                            dlg.http_failure(&response, error.as_ref().ok())
20344                        {
20345                            sleep(d).await;
20346                            continue;
20347                        }
20348
20349                        dlg.finished(false);
20350
20351                        return Err(match error {
20352                            Ok(value) => common::Error::BadRequest(value),
20353                            _ => common::Error::Failure(response),
20354                        });
20355                    }
20356                    let response = {
20357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20358                        let encoded = common::to_string(&bytes);
20359                        match serde_json::from_str(&encoded) {
20360                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20361                            Err(error) => {
20362                                dlg.response_json_decode_error(&encoded, &error);
20363                                return Err(common::Error::JsonDecodeError(
20364                                    encoded.to_string(),
20365                                    error,
20366                                ));
20367                            }
20368                        }
20369                    };
20370
20371                    dlg.finished(true);
20372                    return Ok(response);
20373                }
20374            }
20375        }
20376    }
20377
20378    ///
20379    /// Sets the *request* property to the given value.
20380    ///
20381    /// Even though the property as already been set when instantiating this call,
20382    /// we provide this method for API completeness.
20383    pub fn request(
20384        mut self,
20385        new_value: CancelOperationRequest,
20386    ) -> ProjectLocationOperationCancelCall<'a, C> {
20387        self._request = new_value;
20388        self
20389    }
20390    /// The name of the operation resource to be cancelled.
20391    ///
20392    /// Sets the *name* path property to the given value.
20393    ///
20394    /// Even though the property as already been set when instantiating this call,
20395    /// we provide this method for API completeness.
20396    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
20397        self._name = new_value.to_string();
20398        self
20399    }
20400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20401    /// while executing the actual API request.
20402    ///
20403    /// ````text
20404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20405    /// ````
20406    ///
20407    /// Sets the *delegate* property to the given value.
20408    pub fn delegate(
20409        mut self,
20410        new_value: &'a mut dyn common::Delegate,
20411    ) -> ProjectLocationOperationCancelCall<'a, C> {
20412        self._delegate = Some(new_value);
20413        self
20414    }
20415
20416    /// Set any additional parameter of the query string used in the request.
20417    /// It should be used to set parameters which are not yet available through their own
20418    /// setters.
20419    ///
20420    /// Please note that this method must not be used to set any of the known parameters
20421    /// which have their own setter method. If done anyway, the request will fail.
20422    ///
20423    /// # Additional Parameters
20424    ///
20425    /// * *$.xgafv* (query-string) - V1 error format.
20426    /// * *access_token* (query-string) - OAuth access token.
20427    /// * *alt* (query-string) - Data format for response.
20428    /// * *callback* (query-string) - JSONP
20429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20430    /// * *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.
20431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20433    /// * *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.
20434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20436    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
20437    where
20438        T: AsRef<str>,
20439    {
20440        self._additional_params
20441            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20442        self
20443    }
20444
20445    /// Identifies the authorization scope for the method you are building.
20446    ///
20447    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20448    /// [`Scope::CloudPlatform`].
20449    ///
20450    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20451    /// tokens for more than one scope.
20452    ///
20453    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20454    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20455    /// sufficient, a read-write scope will do as well.
20456    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
20457    where
20458        St: AsRef<str>,
20459    {
20460        self._scopes.insert(String::from(scope.as_ref()));
20461        self
20462    }
20463    /// Identifies the authorization scope(s) for the method you are building.
20464    ///
20465    /// See [`Self::add_scope()`] for details.
20466    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
20467    where
20468        I: IntoIterator<Item = St>,
20469        St: AsRef<str>,
20470    {
20471        self._scopes
20472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20473        self
20474    }
20475
20476    /// Removes all scopes, and no default scope will be used either.
20477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20478    /// for details).
20479    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
20480        self._scopes.clear();
20481        self
20482    }
20483}
20484
20485/// 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`.
20486///
20487/// A builder for the *locations.operations.delete* method supported by a *project* resource.
20488/// It is not used directly, but through a [`ProjectMethods`] instance.
20489///
20490/// # Example
20491///
20492/// Instantiate a resource method builder
20493///
20494/// ```test_harness,no_run
20495/// # extern crate hyper;
20496/// # extern crate hyper_rustls;
20497/// # extern crate google_datamigration1 as datamigration1;
20498/// # async fn dox() {
20499/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20500///
20501/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20502/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20503/// #     secret,
20504/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20505/// # ).build().await.unwrap();
20506///
20507/// # let client = hyper_util::client::legacy::Client::builder(
20508/// #     hyper_util::rt::TokioExecutor::new()
20509/// # )
20510/// # .build(
20511/// #     hyper_rustls::HttpsConnectorBuilder::new()
20512/// #         .with_native_roots()
20513/// #         .unwrap()
20514/// #         .https_or_http()
20515/// #         .enable_http1()
20516/// #         .build()
20517/// # );
20518/// # let mut hub = DatabaseMigrationService::new(client, auth);
20519/// // You can configure optional parameters by calling the respective setters at will, and
20520/// // execute the final call using `doit()`.
20521/// // Values shown here are possibly random and not representative !
20522/// let result = hub.projects().locations_operations_delete("name")
20523///              .doit().await;
20524/// # }
20525/// ```
20526pub struct ProjectLocationOperationDeleteCall<'a, C>
20527where
20528    C: 'a,
20529{
20530    hub: &'a DatabaseMigrationService<C>,
20531    _name: String,
20532    _delegate: Option<&'a mut dyn common::Delegate>,
20533    _additional_params: HashMap<String, String>,
20534    _scopes: BTreeSet<String>,
20535}
20536
20537impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
20538
20539impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
20540where
20541    C: common::Connector,
20542{
20543    /// Perform the operation you have build so far.
20544    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20545        use std::borrow::Cow;
20546        use std::io::{Read, Seek};
20547
20548        use common::{url::Params, ToParts};
20549        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20550
20551        let mut dd = common::DefaultDelegate;
20552        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20553        dlg.begin(common::MethodInfo {
20554            id: "datamigration.projects.locations.operations.delete",
20555            http_method: hyper::Method::DELETE,
20556        });
20557
20558        for &field in ["alt", "name"].iter() {
20559            if self._additional_params.contains_key(field) {
20560                dlg.finished(false);
20561                return Err(common::Error::FieldClash(field));
20562            }
20563        }
20564
20565        let mut params = Params::with_capacity(3 + self._additional_params.len());
20566        params.push("name", self._name);
20567
20568        params.extend(self._additional_params.iter());
20569
20570        params.push("alt", "json");
20571        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20572        if self._scopes.is_empty() {
20573            self._scopes
20574                .insert(Scope::CloudPlatform.as_ref().to_string());
20575        }
20576
20577        #[allow(clippy::single_element_loop)]
20578        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20579            url = params.uri_replacement(url, param_name, find_this, true);
20580        }
20581        {
20582            let to_remove = ["name"];
20583            params.remove_params(&to_remove);
20584        }
20585
20586        let url = params.parse_with_url(&url);
20587
20588        loop {
20589            let token = match self
20590                .hub
20591                .auth
20592                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20593                .await
20594            {
20595                Ok(token) => token,
20596                Err(e) => match dlg.token(e) {
20597                    Ok(token) => token,
20598                    Err(e) => {
20599                        dlg.finished(false);
20600                        return Err(common::Error::MissingToken(e));
20601                    }
20602                },
20603            };
20604            let mut req_result = {
20605                let client = &self.hub.client;
20606                dlg.pre_request();
20607                let mut req_builder = hyper::Request::builder()
20608                    .method(hyper::Method::DELETE)
20609                    .uri(url.as_str())
20610                    .header(USER_AGENT, self.hub._user_agent.clone());
20611
20612                if let Some(token) = token.as_ref() {
20613                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20614                }
20615
20616                let request = req_builder
20617                    .header(CONTENT_LENGTH, 0_u64)
20618                    .body(common::to_body::<String>(None));
20619
20620                client.request(request.unwrap()).await
20621            };
20622
20623            match req_result {
20624                Err(err) => {
20625                    if let common::Retry::After(d) = dlg.http_error(&err) {
20626                        sleep(d).await;
20627                        continue;
20628                    }
20629                    dlg.finished(false);
20630                    return Err(common::Error::HttpError(err));
20631                }
20632                Ok(res) => {
20633                    let (mut parts, body) = res.into_parts();
20634                    let mut body = common::Body::new(body);
20635                    if !parts.status.is_success() {
20636                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20637                        let error = serde_json::from_str(&common::to_string(&bytes));
20638                        let response = common::to_response(parts, bytes.into());
20639
20640                        if let common::Retry::After(d) =
20641                            dlg.http_failure(&response, error.as_ref().ok())
20642                        {
20643                            sleep(d).await;
20644                            continue;
20645                        }
20646
20647                        dlg.finished(false);
20648
20649                        return Err(match error {
20650                            Ok(value) => common::Error::BadRequest(value),
20651                            _ => common::Error::Failure(response),
20652                        });
20653                    }
20654                    let response = {
20655                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20656                        let encoded = common::to_string(&bytes);
20657                        match serde_json::from_str(&encoded) {
20658                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20659                            Err(error) => {
20660                                dlg.response_json_decode_error(&encoded, &error);
20661                                return Err(common::Error::JsonDecodeError(
20662                                    encoded.to_string(),
20663                                    error,
20664                                ));
20665                            }
20666                        }
20667                    };
20668
20669                    dlg.finished(true);
20670                    return Ok(response);
20671                }
20672            }
20673        }
20674    }
20675
20676    /// The name of the operation resource to be deleted.
20677    ///
20678    /// Sets the *name* path property to the given value.
20679    ///
20680    /// Even though the property as already been set when instantiating this call,
20681    /// we provide this method for API completeness.
20682    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
20683        self._name = new_value.to_string();
20684        self
20685    }
20686    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20687    /// while executing the actual API request.
20688    ///
20689    /// ````text
20690    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20691    /// ````
20692    ///
20693    /// Sets the *delegate* property to the given value.
20694    pub fn delegate(
20695        mut self,
20696        new_value: &'a mut dyn common::Delegate,
20697    ) -> ProjectLocationOperationDeleteCall<'a, C> {
20698        self._delegate = Some(new_value);
20699        self
20700    }
20701
20702    /// Set any additional parameter of the query string used in the request.
20703    /// It should be used to set parameters which are not yet available through their own
20704    /// setters.
20705    ///
20706    /// Please note that this method must not be used to set any of the known parameters
20707    /// which have their own setter method. If done anyway, the request will fail.
20708    ///
20709    /// # Additional Parameters
20710    ///
20711    /// * *$.xgafv* (query-string) - V1 error format.
20712    /// * *access_token* (query-string) - OAuth access token.
20713    /// * *alt* (query-string) - Data format for response.
20714    /// * *callback* (query-string) - JSONP
20715    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20716    /// * *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.
20717    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20718    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20719    /// * *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.
20720    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20721    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20722    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
20723    where
20724        T: AsRef<str>,
20725    {
20726        self._additional_params
20727            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20728        self
20729    }
20730
20731    /// Identifies the authorization scope for the method you are building.
20732    ///
20733    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20734    /// [`Scope::CloudPlatform`].
20735    ///
20736    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20737    /// tokens for more than one scope.
20738    ///
20739    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20740    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20741    /// sufficient, a read-write scope will do as well.
20742    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
20743    where
20744        St: AsRef<str>,
20745    {
20746        self._scopes.insert(String::from(scope.as_ref()));
20747        self
20748    }
20749    /// Identifies the authorization scope(s) for the method you are building.
20750    ///
20751    /// See [`Self::add_scope()`] for details.
20752    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
20753    where
20754        I: IntoIterator<Item = St>,
20755        St: AsRef<str>,
20756    {
20757        self._scopes
20758            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20759        self
20760    }
20761
20762    /// Removes all scopes, and no default scope will be used either.
20763    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20764    /// for details).
20765    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
20766        self._scopes.clear();
20767        self
20768    }
20769}
20770
20771/// 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.
20772///
20773/// A builder for the *locations.operations.get* method supported by a *project* resource.
20774/// It is not used directly, but through a [`ProjectMethods`] instance.
20775///
20776/// # Example
20777///
20778/// Instantiate a resource method builder
20779///
20780/// ```test_harness,no_run
20781/// # extern crate hyper;
20782/// # extern crate hyper_rustls;
20783/// # extern crate google_datamigration1 as datamigration1;
20784/// # async fn dox() {
20785/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20786///
20787/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20788/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20789/// #     secret,
20790/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20791/// # ).build().await.unwrap();
20792///
20793/// # let client = hyper_util::client::legacy::Client::builder(
20794/// #     hyper_util::rt::TokioExecutor::new()
20795/// # )
20796/// # .build(
20797/// #     hyper_rustls::HttpsConnectorBuilder::new()
20798/// #         .with_native_roots()
20799/// #         .unwrap()
20800/// #         .https_or_http()
20801/// #         .enable_http1()
20802/// #         .build()
20803/// # );
20804/// # let mut hub = DatabaseMigrationService::new(client, auth);
20805/// // You can configure optional parameters by calling the respective setters at will, and
20806/// // execute the final call using `doit()`.
20807/// // Values shown here are possibly random and not representative !
20808/// let result = hub.projects().locations_operations_get("name")
20809///              .doit().await;
20810/// # }
20811/// ```
20812pub struct ProjectLocationOperationGetCall<'a, C>
20813where
20814    C: 'a,
20815{
20816    hub: &'a DatabaseMigrationService<C>,
20817    _name: String,
20818    _delegate: Option<&'a mut dyn common::Delegate>,
20819    _additional_params: HashMap<String, String>,
20820    _scopes: BTreeSet<String>,
20821}
20822
20823impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
20824
20825impl<'a, C> ProjectLocationOperationGetCall<'a, C>
20826where
20827    C: common::Connector,
20828{
20829    /// Perform the operation you have build so far.
20830    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20831        use std::borrow::Cow;
20832        use std::io::{Read, Seek};
20833
20834        use common::{url::Params, ToParts};
20835        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20836
20837        let mut dd = common::DefaultDelegate;
20838        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20839        dlg.begin(common::MethodInfo {
20840            id: "datamigration.projects.locations.operations.get",
20841            http_method: hyper::Method::GET,
20842        });
20843
20844        for &field in ["alt", "name"].iter() {
20845            if self._additional_params.contains_key(field) {
20846                dlg.finished(false);
20847                return Err(common::Error::FieldClash(field));
20848            }
20849        }
20850
20851        let mut params = Params::with_capacity(3 + self._additional_params.len());
20852        params.push("name", self._name);
20853
20854        params.extend(self._additional_params.iter());
20855
20856        params.push("alt", "json");
20857        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20858        if self._scopes.is_empty() {
20859            self._scopes
20860                .insert(Scope::CloudPlatform.as_ref().to_string());
20861        }
20862
20863        #[allow(clippy::single_element_loop)]
20864        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20865            url = params.uri_replacement(url, param_name, find_this, true);
20866        }
20867        {
20868            let to_remove = ["name"];
20869            params.remove_params(&to_remove);
20870        }
20871
20872        let url = params.parse_with_url(&url);
20873
20874        loop {
20875            let token = match self
20876                .hub
20877                .auth
20878                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20879                .await
20880            {
20881                Ok(token) => token,
20882                Err(e) => match dlg.token(e) {
20883                    Ok(token) => token,
20884                    Err(e) => {
20885                        dlg.finished(false);
20886                        return Err(common::Error::MissingToken(e));
20887                    }
20888                },
20889            };
20890            let mut req_result = {
20891                let client = &self.hub.client;
20892                dlg.pre_request();
20893                let mut req_builder = hyper::Request::builder()
20894                    .method(hyper::Method::GET)
20895                    .uri(url.as_str())
20896                    .header(USER_AGENT, self.hub._user_agent.clone());
20897
20898                if let Some(token) = token.as_ref() {
20899                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20900                }
20901
20902                let request = req_builder
20903                    .header(CONTENT_LENGTH, 0_u64)
20904                    .body(common::to_body::<String>(None));
20905
20906                client.request(request.unwrap()).await
20907            };
20908
20909            match req_result {
20910                Err(err) => {
20911                    if let common::Retry::After(d) = dlg.http_error(&err) {
20912                        sleep(d).await;
20913                        continue;
20914                    }
20915                    dlg.finished(false);
20916                    return Err(common::Error::HttpError(err));
20917                }
20918                Ok(res) => {
20919                    let (mut parts, body) = res.into_parts();
20920                    let mut body = common::Body::new(body);
20921                    if !parts.status.is_success() {
20922                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20923                        let error = serde_json::from_str(&common::to_string(&bytes));
20924                        let response = common::to_response(parts, bytes.into());
20925
20926                        if let common::Retry::After(d) =
20927                            dlg.http_failure(&response, error.as_ref().ok())
20928                        {
20929                            sleep(d).await;
20930                            continue;
20931                        }
20932
20933                        dlg.finished(false);
20934
20935                        return Err(match error {
20936                            Ok(value) => common::Error::BadRequest(value),
20937                            _ => common::Error::Failure(response),
20938                        });
20939                    }
20940                    let response = {
20941                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20942                        let encoded = common::to_string(&bytes);
20943                        match serde_json::from_str(&encoded) {
20944                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20945                            Err(error) => {
20946                                dlg.response_json_decode_error(&encoded, &error);
20947                                return Err(common::Error::JsonDecodeError(
20948                                    encoded.to_string(),
20949                                    error,
20950                                ));
20951                            }
20952                        }
20953                    };
20954
20955                    dlg.finished(true);
20956                    return Ok(response);
20957                }
20958            }
20959        }
20960    }
20961
20962    /// The name of the operation resource.
20963    ///
20964    /// Sets the *name* path property to the given value.
20965    ///
20966    /// Even though the property as already been set when instantiating this call,
20967    /// we provide this method for API completeness.
20968    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
20969        self._name = new_value.to_string();
20970        self
20971    }
20972    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20973    /// while executing the actual API request.
20974    ///
20975    /// ````text
20976    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20977    /// ````
20978    ///
20979    /// Sets the *delegate* property to the given value.
20980    pub fn delegate(
20981        mut self,
20982        new_value: &'a mut dyn common::Delegate,
20983    ) -> ProjectLocationOperationGetCall<'a, C> {
20984        self._delegate = Some(new_value);
20985        self
20986    }
20987
20988    /// Set any additional parameter of the query string used in the request.
20989    /// It should be used to set parameters which are not yet available through their own
20990    /// setters.
20991    ///
20992    /// Please note that this method must not be used to set any of the known parameters
20993    /// which have their own setter method. If done anyway, the request will fail.
20994    ///
20995    /// # Additional Parameters
20996    ///
20997    /// * *$.xgafv* (query-string) - V1 error format.
20998    /// * *access_token* (query-string) - OAuth access token.
20999    /// * *alt* (query-string) - Data format for response.
21000    /// * *callback* (query-string) - JSONP
21001    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21002    /// * *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.
21003    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21004    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21005    /// * *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.
21006    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21007    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21008    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
21009    where
21010        T: AsRef<str>,
21011    {
21012        self._additional_params
21013            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21014        self
21015    }
21016
21017    /// Identifies the authorization scope for the method you are building.
21018    ///
21019    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21020    /// [`Scope::CloudPlatform`].
21021    ///
21022    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21023    /// tokens for more than one scope.
21024    ///
21025    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21026    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21027    /// sufficient, a read-write scope will do as well.
21028    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
21029    where
21030        St: AsRef<str>,
21031    {
21032        self._scopes.insert(String::from(scope.as_ref()));
21033        self
21034    }
21035    /// Identifies the authorization scope(s) for the method you are building.
21036    ///
21037    /// See [`Self::add_scope()`] for details.
21038    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
21039    where
21040        I: IntoIterator<Item = St>,
21041        St: AsRef<str>,
21042    {
21043        self._scopes
21044            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21045        self
21046    }
21047
21048    /// Removes all scopes, and no default scope will be used either.
21049    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21050    /// for details).
21051    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
21052        self._scopes.clear();
21053        self
21054    }
21055}
21056
21057/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
21058///
21059/// A builder for the *locations.operations.list* method supported by a *project* resource.
21060/// It is not used directly, but through a [`ProjectMethods`] instance.
21061///
21062/// # Example
21063///
21064/// Instantiate a resource method builder
21065///
21066/// ```test_harness,no_run
21067/// # extern crate hyper;
21068/// # extern crate hyper_rustls;
21069/// # extern crate google_datamigration1 as datamigration1;
21070/// # async fn dox() {
21071/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21072///
21073/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21074/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21075/// #     secret,
21076/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21077/// # ).build().await.unwrap();
21078///
21079/// # let client = hyper_util::client::legacy::Client::builder(
21080/// #     hyper_util::rt::TokioExecutor::new()
21081/// # )
21082/// # .build(
21083/// #     hyper_rustls::HttpsConnectorBuilder::new()
21084/// #         .with_native_roots()
21085/// #         .unwrap()
21086/// #         .https_or_http()
21087/// #         .enable_http1()
21088/// #         .build()
21089/// # );
21090/// # let mut hub = DatabaseMigrationService::new(client, auth);
21091/// // You can configure optional parameters by calling the respective setters at will, and
21092/// // execute the final call using `doit()`.
21093/// // Values shown here are possibly random and not representative !
21094/// let result = hub.projects().locations_operations_list("name")
21095///              .page_token("erat")
21096///              .page_size(-82)
21097///              .filter("amet")
21098///              .doit().await;
21099/// # }
21100/// ```
21101pub struct ProjectLocationOperationListCall<'a, C>
21102where
21103    C: 'a,
21104{
21105    hub: &'a DatabaseMigrationService<C>,
21106    _name: String,
21107    _page_token: Option<String>,
21108    _page_size: Option<i32>,
21109    _filter: Option<String>,
21110    _delegate: Option<&'a mut dyn common::Delegate>,
21111    _additional_params: HashMap<String, String>,
21112    _scopes: BTreeSet<String>,
21113}
21114
21115impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
21116
21117impl<'a, C> ProjectLocationOperationListCall<'a, C>
21118where
21119    C: common::Connector,
21120{
21121    /// Perform the operation you have build so far.
21122    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
21123        use std::borrow::Cow;
21124        use std::io::{Read, Seek};
21125
21126        use common::{url::Params, ToParts};
21127        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21128
21129        let mut dd = common::DefaultDelegate;
21130        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21131        dlg.begin(common::MethodInfo {
21132            id: "datamigration.projects.locations.operations.list",
21133            http_method: hyper::Method::GET,
21134        });
21135
21136        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
21137            if self._additional_params.contains_key(field) {
21138                dlg.finished(false);
21139                return Err(common::Error::FieldClash(field));
21140            }
21141        }
21142
21143        let mut params = Params::with_capacity(6 + self._additional_params.len());
21144        params.push("name", self._name);
21145        if let Some(value) = self._page_token.as_ref() {
21146            params.push("pageToken", value);
21147        }
21148        if let Some(value) = self._page_size.as_ref() {
21149            params.push("pageSize", value.to_string());
21150        }
21151        if let Some(value) = self._filter.as_ref() {
21152            params.push("filter", value);
21153        }
21154
21155        params.extend(self._additional_params.iter());
21156
21157        params.push("alt", "json");
21158        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
21159        if self._scopes.is_empty() {
21160            self._scopes
21161                .insert(Scope::CloudPlatform.as_ref().to_string());
21162        }
21163
21164        #[allow(clippy::single_element_loop)]
21165        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21166            url = params.uri_replacement(url, param_name, find_this, true);
21167        }
21168        {
21169            let to_remove = ["name"];
21170            params.remove_params(&to_remove);
21171        }
21172
21173        let url = params.parse_with_url(&url);
21174
21175        loop {
21176            let token = match self
21177                .hub
21178                .auth
21179                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21180                .await
21181            {
21182                Ok(token) => token,
21183                Err(e) => match dlg.token(e) {
21184                    Ok(token) => token,
21185                    Err(e) => {
21186                        dlg.finished(false);
21187                        return Err(common::Error::MissingToken(e));
21188                    }
21189                },
21190            };
21191            let mut req_result = {
21192                let client = &self.hub.client;
21193                dlg.pre_request();
21194                let mut req_builder = hyper::Request::builder()
21195                    .method(hyper::Method::GET)
21196                    .uri(url.as_str())
21197                    .header(USER_AGENT, self.hub._user_agent.clone());
21198
21199                if let Some(token) = token.as_ref() {
21200                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21201                }
21202
21203                let request = req_builder
21204                    .header(CONTENT_LENGTH, 0_u64)
21205                    .body(common::to_body::<String>(None));
21206
21207                client.request(request.unwrap()).await
21208            };
21209
21210            match req_result {
21211                Err(err) => {
21212                    if let common::Retry::After(d) = dlg.http_error(&err) {
21213                        sleep(d).await;
21214                        continue;
21215                    }
21216                    dlg.finished(false);
21217                    return Err(common::Error::HttpError(err));
21218                }
21219                Ok(res) => {
21220                    let (mut parts, body) = res.into_parts();
21221                    let mut body = common::Body::new(body);
21222                    if !parts.status.is_success() {
21223                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21224                        let error = serde_json::from_str(&common::to_string(&bytes));
21225                        let response = common::to_response(parts, bytes.into());
21226
21227                        if let common::Retry::After(d) =
21228                            dlg.http_failure(&response, error.as_ref().ok())
21229                        {
21230                            sleep(d).await;
21231                            continue;
21232                        }
21233
21234                        dlg.finished(false);
21235
21236                        return Err(match error {
21237                            Ok(value) => common::Error::BadRequest(value),
21238                            _ => common::Error::Failure(response),
21239                        });
21240                    }
21241                    let response = {
21242                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21243                        let encoded = common::to_string(&bytes);
21244                        match serde_json::from_str(&encoded) {
21245                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21246                            Err(error) => {
21247                                dlg.response_json_decode_error(&encoded, &error);
21248                                return Err(common::Error::JsonDecodeError(
21249                                    encoded.to_string(),
21250                                    error,
21251                                ));
21252                            }
21253                        }
21254                    };
21255
21256                    dlg.finished(true);
21257                    return Ok(response);
21258                }
21259            }
21260        }
21261    }
21262
21263    /// The name of the operation's parent resource.
21264    ///
21265    /// Sets the *name* path property to the given value.
21266    ///
21267    /// Even though the property as already been set when instantiating this call,
21268    /// we provide this method for API completeness.
21269    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21270        self._name = new_value.to_string();
21271        self
21272    }
21273    /// The standard list page token.
21274    ///
21275    /// Sets the *page token* query property to the given value.
21276    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21277        self._page_token = Some(new_value.to_string());
21278        self
21279    }
21280    /// The standard list page size.
21281    ///
21282    /// Sets the *page size* query property to the given value.
21283    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
21284        self._page_size = Some(new_value);
21285        self
21286    }
21287    /// The standard list filter.
21288    ///
21289    /// Sets the *filter* query property to the given value.
21290    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21291        self._filter = Some(new_value.to_string());
21292        self
21293    }
21294    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21295    /// while executing the actual API request.
21296    ///
21297    /// ````text
21298    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21299    /// ````
21300    ///
21301    /// Sets the *delegate* property to the given value.
21302    pub fn delegate(
21303        mut self,
21304        new_value: &'a mut dyn common::Delegate,
21305    ) -> ProjectLocationOperationListCall<'a, C> {
21306        self._delegate = Some(new_value);
21307        self
21308    }
21309
21310    /// Set any additional parameter of the query string used in the request.
21311    /// It should be used to set parameters which are not yet available through their own
21312    /// setters.
21313    ///
21314    /// Please note that this method must not be used to set any of the known parameters
21315    /// which have their own setter method. If done anyway, the request will fail.
21316    ///
21317    /// # Additional Parameters
21318    ///
21319    /// * *$.xgafv* (query-string) - V1 error format.
21320    /// * *access_token* (query-string) - OAuth access token.
21321    /// * *alt* (query-string) - Data format for response.
21322    /// * *callback* (query-string) - JSONP
21323    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21324    /// * *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.
21325    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21326    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21327    /// * *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.
21328    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21329    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21330    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
21331    where
21332        T: AsRef<str>,
21333    {
21334        self._additional_params
21335            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21336        self
21337    }
21338
21339    /// Identifies the authorization scope for the method you are building.
21340    ///
21341    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21342    /// [`Scope::CloudPlatform`].
21343    ///
21344    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21345    /// tokens for more than one scope.
21346    ///
21347    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21348    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21349    /// sufficient, a read-write scope will do as well.
21350    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
21351    where
21352        St: AsRef<str>,
21353    {
21354        self._scopes.insert(String::from(scope.as_ref()));
21355        self
21356    }
21357    /// Identifies the authorization scope(s) for the method you are building.
21358    ///
21359    /// See [`Self::add_scope()`] for details.
21360    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
21361    where
21362        I: IntoIterator<Item = St>,
21363        St: AsRef<str>,
21364    {
21365        self._scopes
21366            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21367        self
21368    }
21369
21370    /// Removes all scopes, and no default scope will be used either.
21371    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21372    /// for details).
21373    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
21374        self._scopes.clear();
21375        self
21376    }
21377}
21378
21379/// Creates a new private connection in a given project and location.
21380///
21381/// A builder for the *locations.privateConnections.create* method supported by a *project* resource.
21382/// It is not used directly, but through a [`ProjectMethods`] instance.
21383///
21384/// # Example
21385///
21386/// Instantiate a resource method builder
21387///
21388/// ```test_harness,no_run
21389/// # extern crate hyper;
21390/// # extern crate hyper_rustls;
21391/// # extern crate google_datamigration1 as datamigration1;
21392/// use datamigration1::api::PrivateConnection;
21393/// # async fn dox() {
21394/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21395///
21396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21398/// #     secret,
21399/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21400/// # ).build().await.unwrap();
21401///
21402/// # let client = hyper_util::client::legacy::Client::builder(
21403/// #     hyper_util::rt::TokioExecutor::new()
21404/// # )
21405/// # .build(
21406/// #     hyper_rustls::HttpsConnectorBuilder::new()
21407/// #         .with_native_roots()
21408/// #         .unwrap()
21409/// #         .https_or_http()
21410/// #         .enable_http1()
21411/// #         .build()
21412/// # );
21413/// # let mut hub = DatabaseMigrationService::new(client, auth);
21414/// // As the method needs a request, you would usually fill it with the desired information
21415/// // into the respective structure. Some of the parts shown here might not be applicable !
21416/// // Values shown here are possibly random and not representative !
21417/// let mut req = PrivateConnection::default();
21418///
21419/// // You can configure optional parameters by calling the respective setters at will, and
21420/// // execute the final call using `doit()`.
21421/// // Values shown here are possibly random and not representative !
21422/// let result = hub.projects().locations_private_connections_create(req, "parent")
21423///              .skip_validation(false)
21424///              .request_id("consetetur")
21425///              .private_connection_id("Stet")
21426///              .doit().await;
21427/// # }
21428/// ```
21429pub struct ProjectLocationPrivateConnectionCreateCall<'a, C>
21430where
21431    C: 'a,
21432{
21433    hub: &'a DatabaseMigrationService<C>,
21434    _request: PrivateConnection,
21435    _parent: String,
21436    _skip_validation: Option<bool>,
21437    _request_id: Option<String>,
21438    _private_connection_id: Option<String>,
21439    _delegate: Option<&'a mut dyn common::Delegate>,
21440    _additional_params: HashMap<String, String>,
21441    _scopes: BTreeSet<String>,
21442}
21443
21444impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionCreateCall<'a, C> {}
21445
21446impl<'a, C> ProjectLocationPrivateConnectionCreateCall<'a, C>
21447where
21448    C: common::Connector,
21449{
21450    /// Perform the operation you have build so far.
21451    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21452        use std::borrow::Cow;
21453        use std::io::{Read, Seek};
21454
21455        use common::{url::Params, ToParts};
21456        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21457
21458        let mut dd = common::DefaultDelegate;
21459        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21460        dlg.begin(common::MethodInfo {
21461            id: "datamigration.projects.locations.privateConnections.create",
21462            http_method: hyper::Method::POST,
21463        });
21464
21465        for &field in [
21466            "alt",
21467            "parent",
21468            "skipValidation",
21469            "requestId",
21470            "privateConnectionId",
21471        ]
21472        .iter()
21473        {
21474            if self._additional_params.contains_key(field) {
21475                dlg.finished(false);
21476                return Err(common::Error::FieldClash(field));
21477            }
21478        }
21479
21480        let mut params = Params::with_capacity(7 + self._additional_params.len());
21481        params.push("parent", self._parent);
21482        if let Some(value) = self._skip_validation.as_ref() {
21483            params.push("skipValidation", value.to_string());
21484        }
21485        if let Some(value) = self._request_id.as_ref() {
21486            params.push("requestId", value);
21487        }
21488        if let Some(value) = self._private_connection_id.as_ref() {
21489            params.push("privateConnectionId", value);
21490        }
21491
21492        params.extend(self._additional_params.iter());
21493
21494        params.push("alt", "json");
21495        let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
21496        if self._scopes.is_empty() {
21497            self._scopes
21498                .insert(Scope::CloudPlatform.as_ref().to_string());
21499        }
21500
21501        #[allow(clippy::single_element_loop)]
21502        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21503            url = params.uri_replacement(url, param_name, find_this, true);
21504        }
21505        {
21506            let to_remove = ["parent"];
21507            params.remove_params(&to_remove);
21508        }
21509
21510        let url = params.parse_with_url(&url);
21511
21512        let mut json_mime_type = mime::APPLICATION_JSON;
21513        let mut request_value_reader = {
21514            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21515            common::remove_json_null_values(&mut value);
21516            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21517            serde_json::to_writer(&mut dst, &value).unwrap();
21518            dst
21519        };
21520        let request_size = request_value_reader
21521            .seek(std::io::SeekFrom::End(0))
21522            .unwrap();
21523        request_value_reader
21524            .seek(std::io::SeekFrom::Start(0))
21525            .unwrap();
21526
21527        loop {
21528            let token = match self
21529                .hub
21530                .auth
21531                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21532                .await
21533            {
21534                Ok(token) => token,
21535                Err(e) => match dlg.token(e) {
21536                    Ok(token) => token,
21537                    Err(e) => {
21538                        dlg.finished(false);
21539                        return Err(common::Error::MissingToken(e));
21540                    }
21541                },
21542            };
21543            request_value_reader
21544                .seek(std::io::SeekFrom::Start(0))
21545                .unwrap();
21546            let mut req_result = {
21547                let client = &self.hub.client;
21548                dlg.pre_request();
21549                let mut req_builder = hyper::Request::builder()
21550                    .method(hyper::Method::POST)
21551                    .uri(url.as_str())
21552                    .header(USER_AGENT, self.hub._user_agent.clone());
21553
21554                if let Some(token) = token.as_ref() {
21555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21556                }
21557
21558                let request = req_builder
21559                    .header(CONTENT_TYPE, json_mime_type.to_string())
21560                    .header(CONTENT_LENGTH, request_size as u64)
21561                    .body(common::to_body(
21562                        request_value_reader.get_ref().clone().into(),
21563                    ));
21564
21565                client.request(request.unwrap()).await
21566            };
21567
21568            match req_result {
21569                Err(err) => {
21570                    if let common::Retry::After(d) = dlg.http_error(&err) {
21571                        sleep(d).await;
21572                        continue;
21573                    }
21574                    dlg.finished(false);
21575                    return Err(common::Error::HttpError(err));
21576                }
21577                Ok(res) => {
21578                    let (mut parts, body) = res.into_parts();
21579                    let mut body = common::Body::new(body);
21580                    if !parts.status.is_success() {
21581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21582                        let error = serde_json::from_str(&common::to_string(&bytes));
21583                        let response = common::to_response(parts, bytes.into());
21584
21585                        if let common::Retry::After(d) =
21586                            dlg.http_failure(&response, error.as_ref().ok())
21587                        {
21588                            sleep(d).await;
21589                            continue;
21590                        }
21591
21592                        dlg.finished(false);
21593
21594                        return Err(match error {
21595                            Ok(value) => common::Error::BadRequest(value),
21596                            _ => common::Error::Failure(response),
21597                        });
21598                    }
21599                    let response = {
21600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21601                        let encoded = common::to_string(&bytes);
21602                        match serde_json::from_str(&encoded) {
21603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21604                            Err(error) => {
21605                                dlg.response_json_decode_error(&encoded, &error);
21606                                return Err(common::Error::JsonDecodeError(
21607                                    encoded.to_string(),
21608                                    error,
21609                                ));
21610                            }
21611                        }
21612                    };
21613
21614                    dlg.finished(true);
21615                    return Ok(response);
21616                }
21617            }
21618        }
21619    }
21620
21621    ///
21622    /// Sets the *request* property to the given value.
21623    ///
21624    /// Even though the property as already been set when instantiating this call,
21625    /// we provide this method for API completeness.
21626    pub fn request(
21627        mut self,
21628        new_value: PrivateConnection,
21629    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21630        self._request = new_value;
21631        self
21632    }
21633    /// Required. The parent that owns the collection of PrivateConnections.
21634    ///
21635    /// Sets the *parent* path property to the given value.
21636    ///
21637    /// Even though the property as already been set when instantiating this call,
21638    /// we provide this method for API completeness.
21639    pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21640        self._parent = new_value.to_string();
21641        self
21642    }
21643    /// Optional. If set to true, will skip validations.
21644    ///
21645    /// Sets the *skip validation* query property to the given value.
21646    pub fn skip_validation(
21647        mut self,
21648        new_value: bool,
21649    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21650        self._skip_validation = Some(new_value);
21651        self
21652    }
21653    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
21654    ///
21655    /// Sets the *request id* query property to the given value.
21656    pub fn request_id(
21657        mut self,
21658        new_value: &str,
21659    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21660        self._request_id = Some(new_value.to_string());
21661        self
21662    }
21663    /// Required. The private connection identifier.
21664    ///
21665    /// Sets the *private connection id* query property to the given value.
21666    pub fn private_connection_id(
21667        mut self,
21668        new_value: &str,
21669    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21670        self._private_connection_id = Some(new_value.to_string());
21671        self
21672    }
21673    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21674    /// while executing the actual API request.
21675    ///
21676    /// ````text
21677    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21678    /// ````
21679    ///
21680    /// Sets the *delegate* property to the given value.
21681    pub fn delegate(
21682        mut self,
21683        new_value: &'a mut dyn common::Delegate,
21684    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21685        self._delegate = Some(new_value);
21686        self
21687    }
21688
21689    /// Set any additional parameter of the query string used in the request.
21690    /// It should be used to set parameters which are not yet available through their own
21691    /// setters.
21692    ///
21693    /// Please note that this method must not be used to set any of the known parameters
21694    /// which have their own setter method. If done anyway, the request will fail.
21695    ///
21696    /// # Additional Parameters
21697    ///
21698    /// * *$.xgafv* (query-string) - V1 error format.
21699    /// * *access_token* (query-string) - OAuth access token.
21700    /// * *alt* (query-string) - Data format for response.
21701    /// * *callback* (query-string) - JSONP
21702    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21703    /// * *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.
21704    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21705    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21706    /// * *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.
21707    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21708    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21709    pub fn param<T>(
21710        mut self,
21711        name: T,
21712        value: T,
21713    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
21714    where
21715        T: AsRef<str>,
21716    {
21717        self._additional_params
21718            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21719        self
21720    }
21721
21722    /// Identifies the authorization scope for the method you are building.
21723    ///
21724    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21725    /// [`Scope::CloudPlatform`].
21726    ///
21727    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21728    /// tokens for more than one scope.
21729    ///
21730    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21731    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21732    /// sufficient, a read-write scope will do as well.
21733    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
21734    where
21735        St: AsRef<str>,
21736    {
21737        self._scopes.insert(String::from(scope.as_ref()));
21738        self
21739    }
21740    /// Identifies the authorization scope(s) for the method you are building.
21741    ///
21742    /// See [`Self::add_scope()`] for details.
21743    pub fn add_scopes<I, St>(
21744        mut self,
21745        scopes: I,
21746    ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
21747    where
21748        I: IntoIterator<Item = St>,
21749        St: AsRef<str>,
21750    {
21751        self._scopes
21752            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21753        self
21754    }
21755
21756    /// Removes all scopes, and no default scope will be used either.
21757    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21758    /// for details).
21759    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
21760        self._scopes.clear();
21761        self
21762    }
21763}
21764
21765/// Deletes a single Database Migration Service private connection.
21766///
21767/// A builder for the *locations.privateConnections.delete* method supported by a *project* resource.
21768/// It is not used directly, but through a [`ProjectMethods`] instance.
21769///
21770/// # Example
21771///
21772/// Instantiate a resource method builder
21773///
21774/// ```test_harness,no_run
21775/// # extern crate hyper;
21776/// # extern crate hyper_rustls;
21777/// # extern crate google_datamigration1 as datamigration1;
21778/// # async fn dox() {
21779/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21780///
21781/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21782/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21783/// #     secret,
21784/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21785/// # ).build().await.unwrap();
21786///
21787/// # let client = hyper_util::client::legacy::Client::builder(
21788/// #     hyper_util::rt::TokioExecutor::new()
21789/// # )
21790/// # .build(
21791/// #     hyper_rustls::HttpsConnectorBuilder::new()
21792/// #         .with_native_roots()
21793/// #         .unwrap()
21794/// #         .https_or_http()
21795/// #         .enable_http1()
21796/// #         .build()
21797/// # );
21798/// # let mut hub = DatabaseMigrationService::new(client, auth);
21799/// // You can configure optional parameters by calling the respective setters at will, and
21800/// // execute the final call using `doit()`.
21801/// // Values shown here are possibly random and not representative !
21802/// let result = hub.projects().locations_private_connections_delete("name")
21803///              .request_id("aliquyam")
21804///              .doit().await;
21805/// # }
21806/// ```
21807pub struct ProjectLocationPrivateConnectionDeleteCall<'a, C>
21808where
21809    C: 'a,
21810{
21811    hub: &'a DatabaseMigrationService<C>,
21812    _name: String,
21813    _request_id: Option<String>,
21814    _delegate: Option<&'a mut dyn common::Delegate>,
21815    _additional_params: HashMap<String, String>,
21816    _scopes: BTreeSet<String>,
21817}
21818
21819impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionDeleteCall<'a, C> {}
21820
21821impl<'a, C> ProjectLocationPrivateConnectionDeleteCall<'a, C>
21822where
21823    C: common::Connector,
21824{
21825    /// Perform the operation you have build so far.
21826    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21827        use std::borrow::Cow;
21828        use std::io::{Read, Seek};
21829
21830        use common::{url::Params, ToParts};
21831        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21832
21833        let mut dd = common::DefaultDelegate;
21834        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21835        dlg.begin(common::MethodInfo {
21836            id: "datamigration.projects.locations.privateConnections.delete",
21837            http_method: hyper::Method::DELETE,
21838        });
21839
21840        for &field in ["alt", "name", "requestId"].iter() {
21841            if self._additional_params.contains_key(field) {
21842                dlg.finished(false);
21843                return Err(common::Error::FieldClash(field));
21844            }
21845        }
21846
21847        let mut params = Params::with_capacity(4 + self._additional_params.len());
21848        params.push("name", self._name);
21849        if let Some(value) = self._request_id.as_ref() {
21850            params.push("requestId", value);
21851        }
21852
21853        params.extend(self._additional_params.iter());
21854
21855        params.push("alt", "json");
21856        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21857        if self._scopes.is_empty() {
21858            self._scopes
21859                .insert(Scope::CloudPlatform.as_ref().to_string());
21860        }
21861
21862        #[allow(clippy::single_element_loop)]
21863        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21864            url = params.uri_replacement(url, param_name, find_this, true);
21865        }
21866        {
21867            let to_remove = ["name"];
21868            params.remove_params(&to_remove);
21869        }
21870
21871        let url = params.parse_with_url(&url);
21872
21873        loop {
21874            let token = match self
21875                .hub
21876                .auth
21877                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21878                .await
21879            {
21880                Ok(token) => token,
21881                Err(e) => match dlg.token(e) {
21882                    Ok(token) => token,
21883                    Err(e) => {
21884                        dlg.finished(false);
21885                        return Err(common::Error::MissingToken(e));
21886                    }
21887                },
21888            };
21889            let mut req_result = {
21890                let client = &self.hub.client;
21891                dlg.pre_request();
21892                let mut req_builder = hyper::Request::builder()
21893                    .method(hyper::Method::DELETE)
21894                    .uri(url.as_str())
21895                    .header(USER_AGENT, self.hub._user_agent.clone());
21896
21897                if let Some(token) = token.as_ref() {
21898                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21899                }
21900
21901                let request = req_builder
21902                    .header(CONTENT_LENGTH, 0_u64)
21903                    .body(common::to_body::<String>(None));
21904
21905                client.request(request.unwrap()).await
21906            };
21907
21908            match req_result {
21909                Err(err) => {
21910                    if let common::Retry::After(d) = dlg.http_error(&err) {
21911                        sleep(d).await;
21912                        continue;
21913                    }
21914                    dlg.finished(false);
21915                    return Err(common::Error::HttpError(err));
21916                }
21917                Ok(res) => {
21918                    let (mut parts, body) = res.into_parts();
21919                    let mut body = common::Body::new(body);
21920                    if !parts.status.is_success() {
21921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21922                        let error = serde_json::from_str(&common::to_string(&bytes));
21923                        let response = common::to_response(parts, bytes.into());
21924
21925                        if let common::Retry::After(d) =
21926                            dlg.http_failure(&response, error.as_ref().ok())
21927                        {
21928                            sleep(d).await;
21929                            continue;
21930                        }
21931
21932                        dlg.finished(false);
21933
21934                        return Err(match error {
21935                            Ok(value) => common::Error::BadRequest(value),
21936                            _ => common::Error::Failure(response),
21937                        });
21938                    }
21939                    let response = {
21940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21941                        let encoded = common::to_string(&bytes);
21942                        match serde_json::from_str(&encoded) {
21943                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21944                            Err(error) => {
21945                                dlg.response_json_decode_error(&encoded, &error);
21946                                return Err(common::Error::JsonDecodeError(
21947                                    encoded.to_string(),
21948                                    error,
21949                                ));
21950                            }
21951                        }
21952                    };
21953
21954                    dlg.finished(true);
21955                    return Ok(response);
21956                }
21957            }
21958        }
21959    }
21960
21961    /// Required. The name of the private connection to delete.
21962    ///
21963    /// Sets the *name* path property to the given value.
21964    ///
21965    /// Even though the property as already been set when instantiating this call,
21966    /// we provide this method for API completeness.
21967    pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
21968        self._name = new_value.to_string();
21969        self
21970    }
21971    /// Optional. A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.
21972    ///
21973    /// Sets the *request id* query property to the given value.
21974    pub fn request_id(
21975        mut self,
21976        new_value: &str,
21977    ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
21978        self._request_id = Some(new_value.to_string());
21979        self
21980    }
21981    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21982    /// while executing the actual API request.
21983    ///
21984    /// ````text
21985    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21986    /// ````
21987    ///
21988    /// Sets the *delegate* property to the given value.
21989    pub fn delegate(
21990        mut self,
21991        new_value: &'a mut dyn common::Delegate,
21992    ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
21993        self._delegate = Some(new_value);
21994        self
21995    }
21996
21997    /// Set any additional parameter of the query string used in the request.
21998    /// It should be used to set parameters which are not yet available through their own
21999    /// setters.
22000    ///
22001    /// Please note that this method must not be used to set any of the known parameters
22002    /// which have their own setter method. If done anyway, the request will fail.
22003    ///
22004    /// # Additional Parameters
22005    ///
22006    /// * *$.xgafv* (query-string) - V1 error format.
22007    /// * *access_token* (query-string) - OAuth access token.
22008    /// * *alt* (query-string) - Data format for response.
22009    /// * *callback* (query-string) - JSONP
22010    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22011    /// * *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.
22012    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22013    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22014    /// * *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.
22015    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22016    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22017    pub fn param<T>(
22018        mut self,
22019        name: T,
22020        value: T,
22021    ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
22022    where
22023        T: AsRef<str>,
22024    {
22025        self._additional_params
22026            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22027        self
22028    }
22029
22030    /// Identifies the authorization scope for the method you are building.
22031    ///
22032    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22033    /// [`Scope::CloudPlatform`].
22034    ///
22035    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22036    /// tokens for more than one scope.
22037    ///
22038    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22039    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22040    /// sufficient, a read-write scope will do as well.
22041    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
22042    where
22043        St: AsRef<str>,
22044    {
22045        self._scopes.insert(String::from(scope.as_ref()));
22046        self
22047    }
22048    /// Identifies the authorization scope(s) for the method you are building.
22049    ///
22050    /// See [`Self::add_scope()`] for details.
22051    pub fn add_scopes<I, St>(
22052        mut self,
22053        scopes: I,
22054    ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
22055    where
22056        I: IntoIterator<Item = St>,
22057        St: AsRef<str>,
22058    {
22059        self._scopes
22060            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22061        self
22062    }
22063
22064    /// Removes all scopes, and no default scope will be used either.
22065    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22066    /// for details).
22067    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
22068        self._scopes.clear();
22069        self
22070    }
22071}
22072
22073/// Gets details of a single private connection.
22074///
22075/// A builder for the *locations.privateConnections.get* method supported by a *project* resource.
22076/// It is not used directly, but through a [`ProjectMethods`] instance.
22077///
22078/// # Example
22079///
22080/// Instantiate a resource method builder
22081///
22082/// ```test_harness,no_run
22083/// # extern crate hyper;
22084/// # extern crate hyper_rustls;
22085/// # extern crate google_datamigration1 as datamigration1;
22086/// # async fn dox() {
22087/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22088///
22089/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22090/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22091/// #     secret,
22092/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22093/// # ).build().await.unwrap();
22094///
22095/// # let client = hyper_util::client::legacy::Client::builder(
22096/// #     hyper_util::rt::TokioExecutor::new()
22097/// # )
22098/// # .build(
22099/// #     hyper_rustls::HttpsConnectorBuilder::new()
22100/// #         .with_native_roots()
22101/// #         .unwrap()
22102/// #         .https_or_http()
22103/// #         .enable_http1()
22104/// #         .build()
22105/// # );
22106/// # let mut hub = DatabaseMigrationService::new(client, auth);
22107/// // You can configure optional parameters by calling the respective setters at will, and
22108/// // execute the final call using `doit()`.
22109/// // Values shown here are possibly random and not representative !
22110/// let result = hub.projects().locations_private_connections_get("name")
22111///              .doit().await;
22112/// # }
22113/// ```
22114pub struct ProjectLocationPrivateConnectionGetCall<'a, C>
22115where
22116    C: 'a,
22117{
22118    hub: &'a DatabaseMigrationService<C>,
22119    _name: String,
22120    _delegate: Option<&'a mut dyn common::Delegate>,
22121    _additional_params: HashMap<String, String>,
22122    _scopes: BTreeSet<String>,
22123}
22124
22125impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetCall<'a, C> {}
22126
22127impl<'a, C> ProjectLocationPrivateConnectionGetCall<'a, C>
22128where
22129    C: common::Connector,
22130{
22131    /// Perform the operation you have build so far.
22132    pub async fn doit(mut self) -> common::Result<(common::Response, PrivateConnection)> {
22133        use std::borrow::Cow;
22134        use std::io::{Read, Seek};
22135
22136        use common::{url::Params, ToParts};
22137        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22138
22139        let mut dd = common::DefaultDelegate;
22140        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22141        dlg.begin(common::MethodInfo {
22142            id: "datamigration.projects.locations.privateConnections.get",
22143            http_method: hyper::Method::GET,
22144        });
22145
22146        for &field in ["alt", "name"].iter() {
22147            if self._additional_params.contains_key(field) {
22148                dlg.finished(false);
22149                return Err(common::Error::FieldClash(field));
22150            }
22151        }
22152
22153        let mut params = Params::with_capacity(3 + self._additional_params.len());
22154        params.push("name", self._name);
22155
22156        params.extend(self._additional_params.iter());
22157
22158        params.push("alt", "json");
22159        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22160        if self._scopes.is_empty() {
22161            self._scopes
22162                .insert(Scope::CloudPlatform.as_ref().to_string());
22163        }
22164
22165        #[allow(clippy::single_element_loop)]
22166        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22167            url = params.uri_replacement(url, param_name, find_this, true);
22168        }
22169        {
22170            let to_remove = ["name"];
22171            params.remove_params(&to_remove);
22172        }
22173
22174        let url = params.parse_with_url(&url);
22175
22176        loop {
22177            let token = match self
22178                .hub
22179                .auth
22180                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22181                .await
22182            {
22183                Ok(token) => token,
22184                Err(e) => match dlg.token(e) {
22185                    Ok(token) => token,
22186                    Err(e) => {
22187                        dlg.finished(false);
22188                        return Err(common::Error::MissingToken(e));
22189                    }
22190                },
22191            };
22192            let mut req_result = {
22193                let client = &self.hub.client;
22194                dlg.pre_request();
22195                let mut req_builder = hyper::Request::builder()
22196                    .method(hyper::Method::GET)
22197                    .uri(url.as_str())
22198                    .header(USER_AGENT, self.hub._user_agent.clone());
22199
22200                if let Some(token) = token.as_ref() {
22201                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22202                }
22203
22204                let request = req_builder
22205                    .header(CONTENT_LENGTH, 0_u64)
22206                    .body(common::to_body::<String>(None));
22207
22208                client.request(request.unwrap()).await
22209            };
22210
22211            match req_result {
22212                Err(err) => {
22213                    if let common::Retry::After(d) = dlg.http_error(&err) {
22214                        sleep(d).await;
22215                        continue;
22216                    }
22217                    dlg.finished(false);
22218                    return Err(common::Error::HttpError(err));
22219                }
22220                Ok(res) => {
22221                    let (mut parts, body) = res.into_parts();
22222                    let mut body = common::Body::new(body);
22223                    if !parts.status.is_success() {
22224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22225                        let error = serde_json::from_str(&common::to_string(&bytes));
22226                        let response = common::to_response(parts, bytes.into());
22227
22228                        if let common::Retry::After(d) =
22229                            dlg.http_failure(&response, error.as_ref().ok())
22230                        {
22231                            sleep(d).await;
22232                            continue;
22233                        }
22234
22235                        dlg.finished(false);
22236
22237                        return Err(match error {
22238                            Ok(value) => common::Error::BadRequest(value),
22239                            _ => common::Error::Failure(response),
22240                        });
22241                    }
22242                    let response = {
22243                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22244                        let encoded = common::to_string(&bytes);
22245                        match serde_json::from_str(&encoded) {
22246                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22247                            Err(error) => {
22248                                dlg.response_json_decode_error(&encoded, &error);
22249                                return Err(common::Error::JsonDecodeError(
22250                                    encoded.to_string(),
22251                                    error,
22252                                ));
22253                            }
22254                        }
22255                    };
22256
22257                    dlg.finished(true);
22258                    return Ok(response);
22259                }
22260            }
22261        }
22262    }
22263
22264    /// Required. The name of the private connection to get.
22265    ///
22266    /// Sets the *name* path property to the given value.
22267    ///
22268    /// Even though the property as already been set when instantiating this call,
22269    /// we provide this method for API completeness.
22270    pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
22271        self._name = new_value.to_string();
22272        self
22273    }
22274    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22275    /// while executing the actual API request.
22276    ///
22277    /// ````text
22278    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22279    /// ````
22280    ///
22281    /// Sets the *delegate* property to the given value.
22282    pub fn delegate(
22283        mut self,
22284        new_value: &'a mut dyn common::Delegate,
22285    ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
22286        self._delegate = Some(new_value);
22287        self
22288    }
22289
22290    /// Set any additional parameter of the query string used in the request.
22291    /// It should be used to set parameters which are not yet available through their own
22292    /// setters.
22293    ///
22294    /// Please note that this method must not be used to set any of the known parameters
22295    /// which have their own setter method. If done anyway, the request will fail.
22296    ///
22297    /// # Additional Parameters
22298    ///
22299    /// * *$.xgafv* (query-string) - V1 error format.
22300    /// * *access_token* (query-string) - OAuth access token.
22301    /// * *alt* (query-string) - Data format for response.
22302    /// * *callback* (query-string) - JSONP
22303    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22304    /// * *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.
22305    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22306    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22307    /// * *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.
22308    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22309    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22310    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionGetCall<'a, C>
22311    where
22312        T: AsRef<str>,
22313    {
22314        self._additional_params
22315            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22316        self
22317    }
22318
22319    /// Identifies the authorization scope for the method you are building.
22320    ///
22321    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22322    /// [`Scope::CloudPlatform`].
22323    ///
22324    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22325    /// tokens for more than one scope.
22326    ///
22327    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22328    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22329    /// sufficient, a read-write scope will do as well.
22330    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionGetCall<'a, C>
22331    where
22332        St: AsRef<str>,
22333    {
22334        self._scopes.insert(String::from(scope.as_ref()));
22335        self
22336    }
22337    /// Identifies the authorization scope(s) for the method you are building.
22338    ///
22339    /// See [`Self::add_scope()`] for details.
22340    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionGetCall<'a, C>
22341    where
22342        I: IntoIterator<Item = St>,
22343        St: AsRef<str>,
22344    {
22345        self._scopes
22346            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22347        self
22348    }
22349
22350    /// Removes all scopes, and no default scope will be used either.
22351    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22352    /// for details).
22353    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
22354        self._scopes.clear();
22355        self
22356    }
22357}
22358
22359/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
22360///
22361/// A builder for the *locations.privateConnections.getIamPolicy* method supported by a *project* resource.
22362/// It is not used directly, but through a [`ProjectMethods`] instance.
22363///
22364/// # Example
22365///
22366/// Instantiate a resource method builder
22367///
22368/// ```test_harness,no_run
22369/// # extern crate hyper;
22370/// # extern crate hyper_rustls;
22371/// # extern crate google_datamigration1 as datamigration1;
22372/// # async fn dox() {
22373/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22374///
22375/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22377/// #     secret,
22378/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22379/// # ).build().await.unwrap();
22380///
22381/// # let client = hyper_util::client::legacy::Client::builder(
22382/// #     hyper_util::rt::TokioExecutor::new()
22383/// # )
22384/// # .build(
22385/// #     hyper_rustls::HttpsConnectorBuilder::new()
22386/// #         .with_native_roots()
22387/// #         .unwrap()
22388/// #         .https_or_http()
22389/// #         .enable_http1()
22390/// #         .build()
22391/// # );
22392/// # let mut hub = DatabaseMigrationService::new(client, auth);
22393/// // You can configure optional parameters by calling the respective setters at will, and
22394/// // execute the final call using `doit()`.
22395/// // Values shown here are possibly random and not representative !
22396/// let result = hub.projects().locations_private_connections_get_iam_policy("resource")
22397///              .options_requested_policy_version(-42)
22398///              .doit().await;
22399/// # }
22400/// ```
22401pub struct ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
22402where
22403    C: 'a,
22404{
22405    hub: &'a DatabaseMigrationService<C>,
22406    _resource: String,
22407    _options_requested_policy_version: Option<i32>,
22408    _delegate: Option<&'a mut dyn common::Delegate>,
22409    _additional_params: HashMap<String, String>,
22410    _scopes: BTreeSet<String>,
22411}
22412
22413impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {}
22414
22415impl<'a, C> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
22416where
22417    C: common::Connector,
22418{
22419    /// Perform the operation you have build so far.
22420    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22421        use std::borrow::Cow;
22422        use std::io::{Read, Seek};
22423
22424        use common::{url::Params, ToParts};
22425        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22426
22427        let mut dd = common::DefaultDelegate;
22428        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22429        dlg.begin(common::MethodInfo {
22430            id: "datamigration.projects.locations.privateConnections.getIamPolicy",
22431            http_method: hyper::Method::GET,
22432        });
22433
22434        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
22435            if self._additional_params.contains_key(field) {
22436                dlg.finished(false);
22437                return Err(common::Error::FieldClash(field));
22438            }
22439        }
22440
22441        let mut params = Params::with_capacity(4 + self._additional_params.len());
22442        params.push("resource", self._resource);
22443        if let Some(value) = self._options_requested_policy_version.as_ref() {
22444            params.push("options.requestedPolicyVersion", value.to_string());
22445        }
22446
22447        params.extend(self._additional_params.iter());
22448
22449        params.push("alt", "json");
22450        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
22451        if self._scopes.is_empty() {
22452            self._scopes
22453                .insert(Scope::CloudPlatform.as_ref().to_string());
22454        }
22455
22456        #[allow(clippy::single_element_loop)]
22457        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22458            url = params.uri_replacement(url, param_name, find_this, true);
22459        }
22460        {
22461            let to_remove = ["resource"];
22462            params.remove_params(&to_remove);
22463        }
22464
22465        let url = params.parse_with_url(&url);
22466
22467        loop {
22468            let token = match self
22469                .hub
22470                .auth
22471                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22472                .await
22473            {
22474                Ok(token) => token,
22475                Err(e) => match dlg.token(e) {
22476                    Ok(token) => token,
22477                    Err(e) => {
22478                        dlg.finished(false);
22479                        return Err(common::Error::MissingToken(e));
22480                    }
22481                },
22482            };
22483            let mut req_result = {
22484                let client = &self.hub.client;
22485                dlg.pre_request();
22486                let mut req_builder = hyper::Request::builder()
22487                    .method(hyper::Method::GET)
22488                    .uri(url.as_str())
22489                    .header(USER_AGENT, self.hub._user_agent.clone());
22490
22491                if let Some(token) = token.as_ref() {
22492                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22493                }
22494
22495                let request = req_builder
22496                    .header(CONTENT_LENGTH, 0_u64)
22497                    .body(common::to_body::<String>(None));
22498
22499                client.request(request.unwrap()).await
22500            };
22501
22502            match req_result {
22503                Err(err) => {
22504                    if let common::Retry::After(d) = dlg.http_error(&err) {
22505                        sleep(d).await;
22506                        continue;
22507                    }
22508                    dlg.finished(false);
22509                    return Err(common::Error::HttpError(err));
22510                }
22511                Ok(res) => {
22512                    let (mut parts, body) = res.into_parts();
22513                    let mut body = common::Body::new(body);
22514                    if !parts.status.is_success() {
22515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22516                        let error = serde_json::from_str(&common::to_string(&bytes));
22517                        let response = common::to_response(parts, bytes.into());
22518
22519                        if let common::Retry::After(d) =
22520                            dlg.http_failure(&response, error.as_ref().ok())
22521                        {
22522                            sleep(d).await;
22523                            continue;
22524                        }
22525
22526                        dlg.finished(false);
22527
22528                        return Err(match error {
22529                            Ok(value) => common::Error::BadRequest(value),
22530                            _ => common::Error::Failure(response),
22531                        });
22532                    }
22533                    let response = {
22534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22535                        let encoded = common::to_string(&bytes);
22536                        match serde_json::from_str(&encoded) {
22537                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22538                            Err(error) => {
22539                                dlg.response_json_decode_error(&encoded, &error);
22540                                return Err(common::Error::JsonDecodeError(
22541                                    encoded.to_string(),
22542                                    error,
22543                                ));
22544                            }
22545                        }
22546                    };
22547
22548                    dlg.finished(true);
22549                    return Ok(response);
22550                }
22551            }
22552        }
22553    }
22554
22555    /// 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.
22556    ///
22557    /// Sets the *resource* path property to the given value.
22558    ///
22559    /// Even though the property as already been set when instantiating this call,
22560    /// we provide this method for API completeness.
22561    pub fn resource(
22562        mut self,
22563        new_value: &str,
22564    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
22565        self._resource = new_value.to_string();
22566        self
22567    }
22568    /// 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).
22569    ///
22570    /// Sets the *options.requested policy version* query property to the given value.
22571    pub fn options_requested_policy_version(
22572        mut self,
22573        new_value: i32,
22574    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
22575        self._options_requested_policy_version = Some(new_value);
22576        self
22577    }
22578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22579    /// while executing the actual API request.
22580    ///
22581    /// ````text
22582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22583    /// ````
22584    ///
22585    /// Sets the *delegate* property to the given value.
22586    pub fn delegate(
22587        mut self,
22588        new_value: &'a mut dyn common::Delegate,
22589    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
22590        self._delegate = Some(new_value);
22591        self
22592    }
22593
22594    /// Set any additional parameter of the query string used in the request.
22595    /// It should be used to set parameters which are not yet available through their own
22596    /// setters.
22597    ///
22598    /// Please note that this method must not be used to set any of the known parameters
22599    /// which have their own setter method. If done anyway, the request will fail.
22600    ///
22601    /// # Additional Parameters
22602    ///
22603    /// * *$.xgafv* (query-string) - V1 error format.
22604    /// * *access_token* (query-string) - OAuth access token.
22605    /// * *alt* (query-string) - Data format for response.
22606    /// * *callback* (query-string) - JSONP
22607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22608    /// * *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.
22609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22611    /// * *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.
22612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22614    pub fn param<T>(
22615        mut self,
22616        name: T,
22617        value: T,
22618    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
22619    where
22620        T: AsRef<str>,
22621    {
22622        self._additional_params
22623            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22624        self
22625    }
22626
22627    /// Identifies the authorization scope for the method you are building.
22628    ///
22629    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22630    /// [`Scope::CloudPlatform`].
22631    ///
22632    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22633    /// tokens for more than one scope.
22634    ///
22635    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22636    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22637    /// sufficient, a read-write scope will do as well.
22638    pub fn add_scope<St>(
22639        mut self,
22640        scope: St,
22641    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
22642    where
22643        St: AsRef<str>,
22644    {
22645        self._scopes.insert(String::from(scope.as_ref()));
22646        self
22647    }
22648    /// Identifies the authorization scope(s) for the method you are building.
22649    ///
22650    /// See [`Self::add_scope()`] for details.
22651    pub fn add_scopes<I, St>(
22652        mut self,
22653        scopes: I,
22654    ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
22655    where
22656        I: IntoIterator<Item = St>,
22657        St: AsRef<str>,
22658    {
22659        self._scopes
22660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22661        self
22662    }
22663
22664    /// Removes all scopes, and no default scope will be used either.
22665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22666    /// for details).
22667    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
22668        self._scopes.clear();
22669        self
22670    }
22671}
22672
22673/// Retrieves a list of private connections in a given project and location.
22674///
22675/// A builder for the *locations.privateConnections.list* method supported by a *project* resource.
22676/// It is not used directly, but through a [`ProjectMethods`] instance.
22677///
22678/// # Example
22679///
22680/// Instantiate a resource method builder
22681///
22682/// ```test_harness,no_run
22683/// # extern crate hyper;
22684/// # extern crate hyper_rustls;
22685/// # extern crate google_datamigration1 as datamigration1;
22686/// # async fn dox() {
22687/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22688///
22689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22691/// #     secret,
22692/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22693/// # ).build().await.unwrap();
22694///
22695/// # let client = hyper_util::client::legacy::Client::builder(
22696/// #     hyper_util::rt::TokioExecutor::new()
22697/// # )
22698/// # .build(
22699/// #     hyper_rustls::HttpsConnectorBuilder::new()
22700/// #         .with_native_roots()
22701/// #         .unwrap()
22702/// #         .https_or_http()
22703/// #         .enable_http1()
22704/// #         .build()
22705/// # );
22706/// # let mut hub = DatabaseMigrationService::new(client, auth);
22707/// // You can configure optional parameters by calling the respective setters at will, and
22708/// // execute the final call using `doit()`.
22709/// // Values shown here are possibly random and not representative !
22710/// let result = hub.projects().locations_private_connections_list("parent")
22711///              .page_token("sit")
22712///              .page_size(-93)
22713///              .order_by("eos")
22714///              .filter("Lorem")
22715///              .doit().await;
22716/// # }
22717/// ```
22718pub struct ProjectLocationPrivateConnectionListCall<'a, C>
22719where
22720    C: 'a,
22721{
22722    hub: &'a DatabaseMigrationService<C>,
22723    _parent: String,
22724    _page_token: Option<String>,
22725    _page_size: Option<i32>,
22726    _order_by: Option<String>,
22727    _filter: Option<String>,
22728    _delegate: Option<&'a mut dyn common::Delegate>,
22729    _additional_params: HashMap<String, String>,
22730    _scopes: BTreeSet<String>,
22731}
22732
22733impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionListCall<'a, C> {}
22734
22735impl<'a, C> ProjectLocationPrivateConnectionListCall<'a, C>
22736where
22737    C: common::Connector,
22738{
22739    /// Perform the operation you have build so far.
22740    pub async fn doit(
22741        mut self,
22742    ) -> common::Result<(common::Response, ListPrivateConnectionsResponse)> {
22743        use std::borrow::Cow;
22744        use std::io::{Read, Seek};
22745
22746        use common::{url::Params, ToParts};
22747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22748
22749        let mut dd = common::DefaultDelegate;
22750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22751        dlg.begin(common::MethodInfo {
22752            id: "datamigration.projects.locations.privateConnections.list",
22753            http_method: hyper::Method::GET,
22754        });
22755
22756        for &field in [
22757            "alt",
22758            "parent",
22759            "pageToken",
22760            "pageSize",
22761            "orderBy",
22762            "filter",
22763        ]
22764        .iter()
22765        {
22766            if self._additional_params.contains_key(field) {
22767                dlg.finished(false);
22768                return Err(common::Error::FieldClash(field));
22769            }
22770        }
22771
22772        let mut params = Params::with_capacity(7 + self._additional_params.len());
22773        params.push("parent", self._parent);
22774        if let Some(value) = self._page_token.as_ref() {
22775            params.push("pageToken", value);
22776        }
22777        if let Some(value) = self._page_size.as_ref() {
22778            params.push("pageSize", value.to_string());
22779        }
22780        if let Some(value) = self._order_by.as_ref() {
22781            params.push("orderBy", value);
22782        }
22783        if let Some(value) = self._filter.as_ref() {
22784            params.push("filter", value);
22785        }
22786
22787        params.extend(self._additional_params.iter());
22788
22789        params.push("alt", "json");
22790        let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
22791        if self._scopes.is_empty() {
22792            self._scopes
22793                .insert(Scope::CloudPlatform.as_ref().to_string());
22794        }
22795
22796        #[allow(clippy::single_element_loop)]
22797        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22798            url = params.uri_replacement(url, param_name, find_this, true);
22799        }
22800        {
22801            let to_remove = ["parent"];
22802            params.remove_params(&to_remove);
22803        }
22804
22805        let url = params.parse_with_url(&url);
22806
22807        loop {
22808            let token = match self
22809                .hub
22810                .auth
22811                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22812                .await
22813            {
22814                Ok(token) => token,
22815                Err(e) => match dlg.token(e) {
22816                    Ok(token) => token,
22817                    Err(e) => {
22818                        dlg.finished(false);
22819                        return Err(common::Error::MissingToken(e));
22820                    }
22821                },
22822            };
22823            let mut req_result = {
22824                let client = &self.hub.client;
22825                dlg.pre_request();
22826                let mut req_builder = hyper::Request::builder()
22827                    .method(hyper::Method::GET)
22828                    .uri(url.as_str())
22829                    .header(USER_AGENT, self.hub._user_agent.clone());
22830
22831                if let Some(token) = token.as_ref() {
22832                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22833                }
22834
22835                let request = req_builder
22836                    .header(CONTENT_LENGTH, 0_u64)
22837                    .body(common::to_body::<String>(None));
22838
22839                client.request(request.unwrap()).await
22840            };
22841
22842            match req_result {
22843                Err(err) => {
22844                    if let common::Retry::After(d) = dlg.http_error(&err) {
22845                        sleep(d).await;
22846                        continue;
22847                    }
22848                    dlg.finished(false);
22849                    return Err(common::Error::HttpError(err));
22850                }
22851                Ok(res) => {
22852                    let (mut parts, body) = res.into_parts();
22853                    let mut body = common::Body::new(body);
22854                    if !parts.status.is_success() {
22855                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22856                        let error = serde_json::from_str(&common::to_string(&bytes));
22857                        let response = common::to_response(parts, bytes.into());
22858
22859                        if let common::Retry::After(d) =
22860                            dlg.http_failure(&response, error.as_ref().ok())
22861                        {
22862                            sleep(d).await;
22863                            continue;
22864                        }
22865
22866                        dlg.finished(false);
22867
22868                        return Err(match error {
22869                            Ok(value) => common::Error::BadRequest(value),
22870                            _ => common::Error::Failure(response),
22871                        });
22872                    }
22873                    let response = {
22874                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22875                        let encoded = common::to_string(&bytes);
22876                        match serde_json::from_str(&encoded) {
22877                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22878                            Err(error) => {
22879                                dlg.response_json_decode_error(&encoded, &error);
22880                                return Err(common::Error::JsonDecodeError(
22881                                    encoded.to_string(),
22882                                    error,
22883                                ));
22884                            }
22885                        }
22886                    };
22887
22888                    dlg.finished(true);
22889                    return Ok(response);
22890                }
22891            }
22892        }
22893    }
22894
22895    /// Required. The parent that owns the collection of private connections.
22896    ///
22897    /// Sets the *parent* path property to the given value.
22898    ///
22899    /// Even though the property as already been set when instantiating this call,
22900    /// we provide this method for API completeness.
22901    pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22902        self._parent = new_value.to_string();
22903        self
22904    }
22905    /// Page token received from a previous `ListPrivateConnections` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPrivateConnections` must match the call that provided the page token.
22906    ///
22907    /// Sets the *page token* query property to the given value.
22908    pub fn page_token(
22909        mut self,
22910        new_value: &str,
22911    ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22912        self._page_token = Some(new_value.to_string());
22913        self
22914    }
22915    /// Maximum number of private connections to return. If unspecified, at most 50 private connections that are returned. The maximum value is 1000; values above 1000 are coerced to 1000.
22916    ///
22917    /// Sets the *page size* query property to the given value.
22918    pub fn page_size(mut self, new_value: i32) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22919        self._page_size = Some(new_value);
22920        self
22921    }
22922    /// Order by fields for the result.
22923    ///
22924    /// Sets the *order by* query property to the given value.
22925    pub fn order_by(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22926        self._order_by = Some(new_value.to_string());
22927        self
22928    }
22929    /// A filter expression that filters private connections listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. For example, list private connections created this year by specifying **createTime %gt; 2021-01-01T00:00:00.000000000Z**.
22930    ///
22931    /// Sets the *filter* query property to the given value.
22932    pub fn filter(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22933        self._filter = Some(new_value.to_string());
22934        self
22935    }
22936    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22937    /// while executing the actual API request.
22938    ///
22939    /// ````text
22940    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22941    /// ````
22942    ///
22943    /// Sets the *delegate* property to the given value.
22944    pub fn delegate(
22945        mut self,
22946        new_value: &'a mut dyn common::Delegate,
22947    ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
22948        self._delegate = Some(new_value);
22949        self
22950    }
22951
22952    /// Set any additional parameter of the query string used in the request.
22953    /// It should be used to set parameters which are not yet available through their own
22954    /// setters.
22955    ///
22956    /// Please note that this method must not be used to set any of the known parameters
22957    /// which have their own setter method. If done anyway, the request will fail.
22958    ///
22959    /// # Additional Parameters
22960    ///
22961    /// * *$.xgafv* (query-string) - V1 error format.
22962    /// * *access_token* (query-string) - OAuth access token.
22963    /// * *alt* (query-string) - Data format for response.
22964    /// * *callback* (query-string) - JSONP
22965    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22966    /// * *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.
22967    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22968    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22969    /// * *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.
22970    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22971    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22972    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionListCall<'a, C>
22973    where
22974        T: AsRef<str>,
22975    {
22976        self._additional_params
22977            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22978        self
22979    }
22980
22981    /// Identifies the authorization scope for the method you are building.
22982    ///
22983    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22984    /// [`Scope::CloudPlatform`].
22985    ///
22986    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22987    /// tokens for more than one scope.
22988    ///
22989    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22990    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22991    /// sufficient, a read-write scope will do as well.
22992    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionListCall<'a, C>
22993    where
22994        St: AsRef<str>,
22995    {
22996        self._scopes.insert(String::from(scope.as_ref()));
22997        self
22998    }
22999    /// Identifies the authorization scope(s) for the method you are building.
23000    ///
23001    /// See [`Self::add_scope()`] for details.
23002    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionListCall<'a, C>
23003    where
23004        I: IntoIterator<Item = St>,
23005        St: AsRef<str>,
23006    {
23007        self._scopes
23008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23009        self
23010    }
23011
23012    /// Removes all scopes, and no default scope will be used either.
23013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23014    /// for details).
23015    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionListCall<'a, C> {
23016        self._scopes.clear();
23017        self
23018    }
23019}
23020
23021/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
23022///
23023/// A builder for the *locations.privateConnections.setIamPolicy* method supported by a *project* resource.
23024/// It is not used directly, but through a [`ProjectMethods`] instance.
23025///
23026/// # Example
23027///
23028/// Instantiate a resource method builder
23029///
23030/// ```test_harness,no_run
23031/// # extern crate hyper;
23032/// # extern crate hyper_rustls;
23033/// # extern crate google_datamigration1 as datamigration1;
23034/// use datamigration1::api::SetIamPolicyRequest;
23035/// # async fn dox() {
23036/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23037///
23038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23040/// #     secret,
23041/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23042/// # ).build().await.unwrap();
23043///
23044/// # let client = hyper_util::client::legacy::Client::builder(
23045/// #     hyper_util::rt::TokioExecutor::new()
23046/// # )
23047/// # .build(
23048/// #     hyper_rustls::HttpsConnectorBuilder::new()
23049/// #         .with_native_roots()
23050/// #         .unwrap()
23051/// #         .https_or_http()
23052/// #         .enable_http1()
23053/// #         .build()
23054/// # );
23055/// # let mut hub = DatabaseMigrationService::new(client, auth);
23056/// // As the method needs a request, you would usually fill it with the desired information
23057/// // into the respective structure. Some of the parts shown here might not be applicable !
23058/// // Values shown here are possibly random and not representative !
23059/// let mut req = SetIamPolicyRequest::default();
23060///
23061/// // You can configure optional parameters by calling the respective setters at will, and
23062/// // execute the final call using `doit()`.
23063/// // Values shown here are possibly random and not representative !
23064/// let result = hub.projects().locations_private_connections_set_iam_policy(req, "resource")
23065///              .doit().await;
23066/// # }
23067/// ```
23068pub struct ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
23069where
23070    C: 'a,
23071{
23072    hub: &'a DatabaseMigrationService<C>,
23073    _request: SetIamPolicyRequest,
23074    _resource: String,
23075    _delegate: Option<&'a mut dyn common::Delegate>,
23076    _additional_params: HashMap<String, String>,
23077    _scopes: BTreeSet<String>,
23078}
23079
23080impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {}
23081
23082impl<'a, C> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
23083where
23084    C: common::Connector,
23085{
23086    /// Perform the operation you have build so far.
23087    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23088        use std::borrow::Cow;
23089        use std::io::{Read, Seek};
23090
23091        use common::{url::Params, ToParts};
23092        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23093
23094        let mut dd = common::DefaultDelegate;
23095        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23096        dlg.begin(common::MethodInfo {
23097            id: "datamigration.projects.locations.privateConnections.setIamPolicy",
23098            http_method: hyper::Method::POST,
23099        });
23100
23101        for &field in ["alt", "resource"].iter() {
23102            if self._additional_params.contains_key(field) {
23103                dlg.finished(false);
23104                return Err(common::Error::FieldClash(field));
23105            }
23106        }
23107
23108        let mut params = Params::with_capacity(4 + self._additional_params.len());
23109        params.push("resource", self._resource);
23110
23111        params.extend(self._additional_params.iter());
23112
23113        params.push("alt", "json");
23114        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
23115        if self._scopes.is_empty() {
23116            self._scopes
23117                .insert(Scope::CloudPlatform.as_ref().to_string());
23118        }
23119
23120        #[allow(clippy::single_element_loop)]
23121        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23122            url = params.uri_replacement(url, param_name, find_this, true);
23123        }
23124        {
23125            let to_remove = ["resource"];
23126            params.remove_params(&to_remove);
23127        }
23128
23129        let url = params.parse_with_url(&url);
23130
23131        let mut json_mime_type = mime::APPLICATION_JSON;
23132        let mut request_value_reader = {
23133            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23134            common::remove_json_null_values(&mut value);
23135            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23136            serde_json::to_writer(&mut dst, &value).unwrap();
23137            dst
23138        };
23139        let request_size = request_value_reader
23140            .seek(std::io::SeekFrom::End(0))
23141            .unwrap();
23142        request_value_reader
23143            .seek(std::io::SeekFrom::Start(0))
23144            .unwrap();
23145
23146        loop {
23147            let token = match self
23148                .hub
23149                .auth
23150                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23151                .await
23152            {
23153                Ok(token) => token,
23154                Err(e) => match dlg.token(e) {
23155                    Ok(token) => token,
23156                    Err(e) => {
23157                        dlg.finished(false);
23158                        return Err(common::Error::MissingToken(e));
23159                    }
23160                },
23161            };
23162            request_value_reader
23163                .seek(std::io::SeekFrom::Start(0))
23164                .unwrap();
23165            let mut req_result = {
23166                let client = &self.hub.client;
23167                dlg.pre_request();
23168                let mut req_builder = hyper::Request::builder()
23169                    .method(hyper::Method::POST)
23170                    .uri(url.as_str())
23171                    .header(USER_AGENT, self.hub._user_agent.clone());
23172
23173                if let Some(token) = token.as_ref() {
23174                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23175                }
23176
23177                let request = req_builder
23178                    .header(CONTENT_TYPE, json_mime_type.to_string())
23179                    .header(CONTENT_LENGTH, request_size as u64)
23180                    .body(common::to_body(
23181                        request_value_reader.get_ref().clone().into(),
23182                    ));
23183
23184                client.request(request.unwrap()).await
23185            };
23186
23187            match req_result {
23188                Err(err) => {
23189                    if let common::Retry::After(d) = dlg.http_error(&err) {
23190                        sleep(d).await;
23191                        continue;
23192                    }
23193                    dlg.finished(false);
23194                    return Err(common::Error::HttpError(err));
23195                }
23196                Ok(res) => {
23197                    let (mut parts, body) = res.into_parts();
23198                    let mut body = common::Body::new(body);
23199                    if !parts.status.is_success() {
23200                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23201                        let error = serde_json::from_str(&common::to_string(&bytes));
23202                        let response = common::to_response(parts, bytes.into());
23203
23204                        if let common::Retry::After(d) =
23205                            dlg.http_failure(&response, error.as_ref().ok())
23206                        {
23207                            sleep(d).await;
23208                            continue;
23209                        }
23210
23211                        dlg.finished(false);
23212
23213                        return Err(match error {
23214                            Ok(value) => common::Error::BadRequest(value),
23215                            _ => common::Error::Failure(response),
23216                        });
23217                    }
23218                    let response = {
23219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23220                        let encoded = common::to_string(&bytes);
23221                        match serde_json::from_str(&encoded) {
23222                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23223                            Err(error) => {
23224                                dlg.response_json_decode_error(&encoded, &error);
23225                                return Err(common::Error::JsonDecodeError(
23226                                    encoded.to_string(),
23227                                    error,
23228                                ));
23229                            }
23230                        }
23231                    };
23232
23233                    dlg.finished(true);
23234                    return Ok(response);
23235                }
23236            }
23237        }
23238    }
23239
23240    ///
23241    /// Sets the *request* property to the given value.
23242    ///
23243    /// Even though the property as already been set when instantiating this call,
23244    /// we provide this method for API completeness.
23245    pub fn request(
23246        mut self,
23247        new_value: SetIamPolicyRequest,
23248    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
23249        self._request = new_value;
23250        self
23251    }
23252    /// 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.
23253    ///
23254    /// Sets the *resource* path property to the given value.
23255    ///
23256    /// Even though the property as already been set when instantiating this call,
23257    /// we provide this method for API completeness.
23258    pub fn resource(
23259        mut self,
23260        new_value: &str,
23261    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
23262        self._resource = new_value.to_string();
23263        self
23264    }
23265    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23266    /// while executing the actual API request.
23267    ///
23268    /// ````text
23269    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23270    /// ````
23271    ///
23272    /// Sets the *delegate* property to the given value.
23273    pub fn delegate(
23274        mut self,
23275        new_value: &'a mut dyn common::Delegate,
23276    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
23277        self._delegate = Some(new_value);
23278        self
23279    }
23280
23281    /// Set any additional parameter of the query string used in the request.
23282    /// It should be used to set parameters which are not yet available through their own
23283    /// setters.
23284    ///
23285    /// Please note that this method must not be used to set any of the known parameters
23286    /// which have their own setter method. If done anyway, the request will fail.
23287    ///
23288    /// # Additional Parameters
23289    ///
23290    /// * *$.xgafv* (query-string) - V1 error format.
23291    /// * *access_token* (query-string) - OAuth access token.
23292    /// * *alt* (query-string) - Data format for response.
23293    /// * *callback* (query-string) - JSONP
23294    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23295    /// * *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.
23296    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23297    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23298    /// * *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.
23299    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23300    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23301    pub fn param<T>(
23302        mut self,
23303        name: T,
23304        value: T,
23305    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
23306    where
23307        T: AsRef<str>,
23308    {
23309        self._additional_params
23310            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23311        self
23312    }
23313
23314    /// Identifies the authorization scope for the method you are building.
23315    ///
23316    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23317    /// [`Scope::CloudPlatform`].
23318    ///
23319    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23320    /// tokens for more than one scope.
23321    ///
23322    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23323    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23324    /// sufficient, a read-write scope will do as well.
23325    pub fn add_scope<St>(
23326        mut self,
23327        scope: St,
23328    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
23329    where
23330        St: AsRef<str>,
23331    {
23332        self._scopes.insert(String::from(scope.as_ref()));
23333        self
23334    }
23335    /// Identifies the authorization scope(s) for the method you are building.
23336    ///
23337    /// See [`Self::add_scope()`] for details.
23338    pub fn add_scopes<I, St>(
23339        mut self,
23340        scopes: I,
23341    ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
23342    where
23343        I: IntoIterator<Item = St>,
23344        St: AsRef<str>,
23345    {
23346        self._scopes
23347            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23348        self
23349    }
23350
23351    /// Removes all scopes, and no default scope will be used either.
23352    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23353    /// for details).
23354    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
23355        self._scopes.clear();
23356        self
23357    }
23358}
23359
23360/// 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.
23361///
23362/// A builder for the *locations.privateConnections.testIamPermissions* method supported by a *project* resource.
23363/// It is not used directly, but through a [`ProjectMethods`] instance.
23364///
23365/// # Example
23366///
23367/// Instantiate a resource method builder
23368///
23369/// ```test_harness,no_run
23370/// # extern crate hyper;
23371/// # extern crate hyper_rustls;
23372/// # extern crate google_datamigration1 as datamigration1;
23373/// use datamigration1::api::TestIamPermissionsRequest;
23374/// # async fn dox() {
23375/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23376///
23377/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23378/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23379/// #     secret,
23380/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23381/// # ).build().await.unwrap();
23382///
23383/// # let client = hyper_util::client::legacy::Client::builder(
23384/// #     hyper_util::rt::TokioExecutor::new()
23385/// # )
23386/// # .build(
23387/// #     hyper_rustls::HttpsConnectorBuilder::new()
23388/// #         .with_native_roots()
23389/// #         .unwrap()
23390/// #         .https_or_http()
23391/// #         .enable_http1()
23392/// #         .build()
23393/// # );
23394/// # let mut hub = DatabaseMigrationService::new(client, auth);
23395/// // As the method needs a request, you would usually fill it with the desired information
23396/// // into the respective structure. Some of the parts shown here might not be applicable !
23397/// // Values shown here are possibly random and not representative !
23398/// let mut req = TestIamPermissionsRequest::default();
23399///
23400/// // You can configure optional parameters by calling the respective setters at will, and
23401/// // execute the final call using `doit()`.
23402/// // Values shown here are possibly random and not representative !
23403/// let result = hub.projects().locations_private_connections_test_iam_permissions(req, "resource")
23404///              .doit().await;
23405/// # }
23406/// ```
23407pub struct ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
23408where
23409    C: 'a,
23410{
23411    hub: &'a DatabaseMigrationService<C>,
23412    _request: TestIamPermissionsRequest,
23413    _resource: String,
23414    _delegate: Option<&'a mut dyn common::Delegate>,
23415    _additional_params: HashMap<String, String>,
23416    _scopes: BTreeSet<String>,
23417}
23418
23419impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {}
23420
23421impl<'a, C> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
23422where
23423    C: common::Connector,
23424{
23425    /// Perform the operation you have build so far.
23426    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
23427        use std::borrow::Cow;
23428        use std::io::{Read, Seek};
23429
23430        use common::{url::Params, ToParts};
23431        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23432
23433        let mut dd = common::DefaultDelegate;
23434        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23435        dlg.begin(common::MethodInfo {
23436            id: "datamigration.projects.locations.privateConnections.testIamPermissions",
23437            http_method: hyper::Method::POST,
23438        });
23439
23440        for &field in ["alt", "resource"].iter() {
23441            if self._additional_params.contains_key(field) {
23442                dlg.finished(false);
23443                return Err(common::Error::FieldClash(field));
23444            }
23445        }
23446
23447        let mut params = Params::with_capacity(4 + self._additional_params.len());
23448        params.push("resource", self._resource);
23449
23450        params.extend(self._additional_params.iter());
23451
23452        params.push("alt", "json");
23453        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
23454        if self._scopes.is_empty() {
23455            self._scopes
23456                .insert(Scope::CloudPlatform.as_ref().to_string());
23457        }
23458
23459        #[allow(clippy::single_element_loop)]
23460        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23461            url = params.uri_replacement(url, param_name, find_this, true);
23462        }
23463        {
23464            let to_remove = ["resource"];
23465            params.remove_params(&to_remove);
23466        }
23467
23468        let url = params.parse_with_url(&url);
23469
23470        let mut json_mime_type = mime::APPLICATION_JSON;
23471        let mut request_value_reader = {
23472            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23473            common::remove_json_null_values(&mut value);
23474            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23475            serde_json::to_writer(&mut dst, &value).unwrap();
23476            dst
23477        };
23478        let request_size = request_value_reader
23479            .seek(std::io::SeekFrom::End(0))
23480            .unwrap();
23481        request_value_reader
23482            .seek(std::io::SeekFrom::Start(0))
23483            .unwrap();
23484
23485        loop {
23486            let token = match self
23487                .hub
23488                .auth
23489                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23490                .await
23491            {
23492                Ok(token) => token,
23493                Err(e) => match dlg.token(e) {
23494                    Ok(token) => token,
23495                    Err(e) => {
23496                        dlg.finished(false);
23497                        return Err(common::Error::MissingToken(e));
23498                    }
23499                },
23500            };
23501            request_value_reader
23502                .seek(std::io::SeekFrom::Start(0))
23503                .unwrap();
23504            let mut req_result = {
23505                let client = &self.hub.client;
23506                dlg.pre_request();
23507                let mut req_builder = hyper::Request::builder()
23508                    .method(hyper::Method::POST)
23509                    .uri(url.as_str())
23510                    .header(USER_AGENT, self.hub._user_agent.clone());
23511
23512                if let Some(token) = token.as_ref() {
23513                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23514                }
23515
23516                let request = req_builder
23517                    .header(CONTENT_TYPE, json_mime_type.to_string())
23518                    .header(CONTENT_LENGTH, request_size as u64)
23519                    .body(common::to_body(
23520                        request_value_reader.get_ref().clone().into(),
23521                    ));
23522
23523                client.request(request.unwrap()).await
23524            };
23525
23526            match req_result {
23527                Err(err) => {
23528                    if let common::Retry::After(d) = dlg.http_error(&err) {
23529                        sleep(d).await;
23530                        continue;
23531                    }
23532                    dlg.finished(false);
23533                    return Err(common::Error::HttpError(err));
23534                }
23535                Ok(res) => {
23536                    let (mut parts, body) = res.into_parts();
23537                    let mut body = common::Body::new(body);
23538                    if !parts.status.is_success() {
23539                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23540                        let error = serde_json::from_str(&common::to_string(&bytes));
23541                        let response = common::to_response(parts, bytes.into());
23542
23543                        if let common::Retry::After(d) =
23544                            dlg.http_failure(&response, error.as_ref().ok())
23545                        {
23546                            sleep(d).await;
23547                            continue;
23548                        }
23549
23550                        dlg.finished(false);
23551
23552                        return Err(match error {
23553                            Ok(value) => common::Error::BadRequest(value),
23554                            _ => common::Error::Failure(response),
23555                        });
23556                    }
23557                    let response = {
23558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23559                        let encoded = common::to_string(&bytes);
23560                        match serde_json::from_str(&encoded) {
23561                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23562                            Err(error) => {
23563                                dlg.response_json_decode_error(&encoded, &error);
23564                                return Err(common::Error::JsonDecodeError(
23565                                    encoded.to_string(),
23566                                    error,
23567                                ));
23568                            }
23569                        }
23570                    };
23571
23572                    dlg.finished(true);
23573                    return Ok(response);
23574                }
23575            }
23576        }
23577    }
23578
23579    ///
23580    /// Sets the *request* property to the given value.
23581    ///
23582    /// Even though the property as already been set when instantiating this call,
23583    /// we provide this method for API completeness.
23584    pub fn request(
23585        mut self,
23586        new_value: TestIamPermissionsRequest,
23587    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
23588        self._request = new_value;
23589        self
23590    }
23591    /// 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.
23592    ///
23593    /// Sets the *resource* path property to the given value.
23594    ///
23595    /// Even though the property as already been set when instantiating this call,
23596    /// we provide this method for API completeness.
23597    pub fn resource(
23598        mut self,
23599        new_value: &str,
23600    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
23601        self._resource = new_value.to_string();
23602        self
23603    }
23604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23605    /// while executing the actual API request.
23606    ///
23607    /// ````text
23608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23609    /// ````
23610    ///
23611    /// Sets the *delegate* property to the given value.
23612    pub fn delegate(
23613        mut self,
23614        new_value: &'a mut dyn common::Delegate,
23615    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
23616        self._delegate = Some(new_value);
23617        self
23618    }
23619
23620    /// Set any additional parameter of the query string used in the request.
23621    /// It should be used to set parameters which are not yet available through their own
23622    /// setters.
23623    ///
23624    /// Please note that this method must not be used to set any of the known parameters
23625    /// which have their own setter method. If done anyway, the request will fail.
23626    ///
23627    /// # Additional Parameters
23628    ///
23629    /// * *$.xgafv* (query-string) - V1 error format.
23630    /// * *access_token* (query-string) - OAuth access token.
23631    /// * *alt* (query-string) - Data format for response.
23632    /// * *callback* (query-string) - JSONP
23633    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23634    /// * *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.
23635    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23636    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23637    /// * *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.
23638    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23639    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23640    pub fn param<T>(
23641        mut self,
23642        name: T,
23643        value: T,
23644    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
23645    where
23646        T: AsRef<str>,
23647    {
23648        self._additional_params
23649            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23650        self
23651    }
23652
23653    /// Identifies the authorization scope for the method you are building.
23654    ///
23655    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23656    /// [`Scope::CloudPlatform`].
23657    ///
23658    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23659    /// tokens for more than one scope.
23660    ///
23661    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23662    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23663    /// sufficient, a read-write scope will do as well.
23664    pub fn add_scope<St>(
23665        mut self,
23666        scope: St,
23667    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
23668    where
23669        St: AsRef<str>,
23670    {
23671        self._scopes.insert(String::from(scope.as_ref()));
23672        self
23673    }
23674    /// Identifies the authorization scope(s) for the method you are building.
23675    ///
23676    /// See [`Self::add_scope()`] for details.
23677    pub fn add_scopes<I, St>(
23678        mut self,
23679        scopes: I,
23680    ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
23681    where
23682        I: IntoIterator<Item = St>,
23683        St: AsRef<str>,
23684    {
23685        self._scopes
23686            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23687        self
23688    }
23689
23690    /// Removes all scopes, and no default scope will be used either.
23691    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23692    /// for details).
23693    pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
23694        self._scopes.clear();
23695        self
23696    }
23697}
23698
23699/// Fetches a set of static IP addresses that need to be allowlisted by the customer when using the static-IP connectivity method.
23700///
23701/// A builder for the *locations.fetchStaticIps* method supported by a *project* resource.
23702/// It is not used directly, but through a [`ProjectMethods`] instance.
23703///
23704/// # Example
23705///
23706/// Instantiate a resource method builder
23707///
23708/// ```test_harness,no_run
23709/// # extern crate hyper;
23710/// # extern crate hyper_rustls;
23711/// # extern crate google_datamigration1 as datamigration1;
23712/// # async fn dox() {
23713/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23714///
23715/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23716/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23717/// #     secret,
23718/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23719/// # ).build().await.unwrap();
23720///
23721/// # let client = hyper_util::client::legacy::Client::builder(
23722/// #     hyper_util::rt::TokioExecutor::new()
23723/// # )
23724/// # .build(
23725/// #     hyper_rustls::HttpsConnectorBuilder::new()
23726/// #         .with_native_roots()
23727/// #         .unwrap()
23728/// #         .https_or_http()
23729/// #         .enable_http1()
23730/// #         .build()
23731/// # );
23732/// # let mut hub = DatabaseMigrationService::new(client, auth);
23733/// // You can configure optional parameters by calling the respective setters at will, and
23734/// // execute the final call using `doit()`.
23735/// // Values shown here are possibly random and not representative !
23736/// let result = hub.projects().locations_fetch_static_ips("name")
23737///              .page_token("eos")
23738///              .page_size(-68)
23739///              .doit().await;
23740/// # }
23741/// ```
23742pub struct ProjectLocationFetchStaticIpCall<'a, C>
23743where
23744    C: 'a,
23745{
23746    hub: &'a DatabaseMigrationService<C>,
23747    _name: String,
23748    _page_token: Option<String>,
23749    _page_size: Option<i32>,
23750    _delegate: Option<&'a mut dyn common::Delegate>,
23751    _additional_params: HashMap<String, String>,
23752    _scopes: BTreeSet<String>,
23753}
23754
23755impl<'a, C> common::CallBuilder for ProjectLocationFetchStaticIpCall<'a, C> {}
23756
23757impl<'a, C> ProjectLocationFetchStaticIpCall<'a, C>
23758where
23759    C: common::Connector,
23760{
23761    /// Perform the operation you have build so far.
23762    pub async fn doit(mut self) -> common::Result<(common::Response, FetchStaticIpsResponse)> {
23763        use std::borrow::Cow;
23764        use std::io::{Read, Seek};
23765
23766        use common::{url::Params, ToParts};
23767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23768
23769        let mut dd = common::DefaultDelegate;
23770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23771        dlg.begin(common::MethodInfo {
23772            id: "datamigration.projects.locations.fetchStaticIps",
23773            http_method: hyper::Method::GET,
23774        });
23775
23776        for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
23777            if self._additional_params.contains_key(field) {
23778                dlg.finished(false);
23779                return Err(common::Error::FieldClash(field));
23780            }
23781        }
23782
23783        let mut params = Params::with_capacity(5 + self._additional_params.len());
23784        params.push("name", self._name);
23785        if let Some(value) = self._page_token.as_ref() {
23786            params.push("pageToken", value);
23787        }
23788        if let Some(value) = self._page_size.as_ref() {
23789            params.push("pageSize", value.to_string());
23790        }
23791
23792        params.extend(self._additional_params.iter());
23793
23794        params.push("alt", "json");
23795        let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchStaticIps";
23796        if self._scopes.is_empty() {
23797            self._scopes
23798                .insert(Scope::CloudPlatform.as_ref().to_string());
23799        }
23800
23801        #[allow(clippy::single_element_loop)]
23802        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23803            url = params.uri_replacement(url, param_name, find_this, true);
23804        }
23805        {
23806            let to_remove = ["name"];
23807            params.remove_params(&to_remove);
23808        }
23809
23810        let url = params.parse_with_url(&url);
23811
23812        loop {
23813            let token = match self
23814                .hub
23815                .auth
23816                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23817                .await
23818            {
23819                Ok(token) => token,
23820                Err(e) => match dlg.token(e) {
23821                    Ok(token) => token,
23822                    Err(e) => {
23823                        dlg.finished(false);
23824                        return Err(common::Error::MissingToken(e));
23825                    }
23826                },
23827            };
23828            let mut req_result = {
23829                let client = &self.hub.client;
23830                dlg.pre_request();
23831                let mut req_builder = hyper::Request::builder()
23832                    .method(hyper::Method::GET)
23833                    .uri(url.as_str())
23834                    .header(USER_AGENT, self.hub._user_agent.clone());
23835
23836                if let Some(token) = token.as_ref() {
23837                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23838                }
23839
23840                let request = req_builder
23841                    .header(CONTENT_LENGTH, 0_u64)
23842                    .body(common::to_body::<String>(None));
23843
23844                client.request(request.unwrap()).await
23845            };
23846
23847            match req_result {
23848                Err(err) => {
23849                    if let common::Retry::After(d) = dlg.http_error(&err) {
23850                        sleep(d).await;
23851                        continue;
23852                    }
23853                    dlg.finished(false);
23854                    return Err(common::Error::HttpError(err));
23855                }
23856                Ok(res) => {
23857                    let (mut parts, body) = res.into_parts();
23858                    let mut body = common::Body::new(body);
23859                    if !parts.status.is_success() {
23860                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23861                        let error = serde_json::from_str(&common::to_string(&bytes));
23862                        let response = common::to_response(parts, bytes.into());
23863
23864                        if let common::Retry::After(d) =
23865                            dlg.http_failure(&response, error.as_ref().ok())
23866                        {
23867                            sleep(d).await;
23868                            continue;
23869                        }
23870
23871                        dlg.finished(false);
23872
23873                        return Err(match error {
23874                            Ok(value) => common::Error::BadRequest(value),
23875                            _ => common::Error::Failure(response),
23876                        });
23877                    }
23878                    let response = {
23879                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23880                        let encoded = common::to_string(&bytes);
23881                        match serde_json::from_str(&encoded) {
23882                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23883                            Err(error) => {
23884                                dlg.response_json_decode_error(&encoded, &error);
23885                                return Err(common::Error::JsonDecodeError(
23886                                    encoded.to_string(),
23887                                    error,
23888                                ));
23889                            }
23890                        }
23891                    };
23892
23893                    dlg.finished(true);
23894                    return Ok(response);
23895                }
23896            }
23897        }
23898    }
23899
23900    /// Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
23901    ///
23902    /// Sets the *name* path property to the given value.
23903    ///
23904    /// Even though the property as already been set when instantiating this call,
23905    /// we provide this method for API completeness.
23906    pub fn name(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
23907        self._name = new_value.to_string();
23908        self
23909    }
23910    /// A page token, received from a previous `FetchStaticIps` call.
23911    ///
23912    /// Sets the *page token* query property to the given value.
23913    pub fn page_token(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
23914        self._page_token = Some(new_value.to_string());
23915        self
23916    }
23917    /// Maximum number of IPs to return.
23918    ///
23919    /// Sets the *page size* query property to the given value.
23920    pub fn page_size(mut self, new_value: i32) -> ProjectLocationFetchStaticIpCall<'a, C> {
23921        self._page_size = Some(new_value);
23922        self
23923    }
23924    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23925    /// while executing the actual API request.
23926    ///
23927    /// ````text
23928    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23929    /// ````
23930    ///
23931    /// Sets the *delegate* property to the given value.
23932    pub fn delegate(
23933        mut self,
23934        new_value: &'a mut dyn common::Delegate,
23935    ) -> ProjectLocationFetchStaticIpCall<'a, C> {
23936        self._delegate = Some(new_value);
23937        self
23938    }
23939
23940    /// Set any additional parameter of the query string used in the request.
23941    /// It should be used to set parameters which are not yet available through their own
23942    /// setters.
23943    ///
23944    /// Please note that this method must not be used to set any of the known parameters
23945    /// which have their own setter method. If done anyway, the request will fail.
23946    ///
23947    /// # Additional Parameters
23948    ///
23949    /// * *$.xgafv* (query-string) - V1 error format.
23950    /// * *access_token* (query-string) - OAuth access token.
23951    /// * *alt* (query-string) - Data format for response.
23952    /// * *callback* (query-string) - JSONP
23953    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23954    /// * *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.
23955    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23956    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23957    /// * *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.
23958    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23959    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23960    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFetchStaticIpCall<'a, C>
23961    where
23962        T: AsRef<str>,
23963    {
23964        self._additional_params
23965            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23966        self
23967    }
23968
23969    /// Identifies the authorization scope for the method you are building.
23970    ///
23971    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23972    /// [`Scope::CloudPlatform`].
23973    ///
23974    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23975    /// tokens for more than one scope.
23976    ///
23977    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23978    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23979    /// sufficient, a read-write scope will do as well.
23980    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFetchStaticIpCall<'a, C>
23981    where
23982        St: AsRef<str>,
23983    {
23984        self._scopes.insert(String::from(scope.as_ref()));
23985        self
23986    }
23987    /// Identifies the authorization scope(s) for the method you are building.
23988    ///
23989    /// See [`Self::add_scope()`] for details.
23990    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFetchStaticIpCall<'a, C>
23991    where
23992        I: IntoIterator<Item = St>,
23993        St: AsRef<str>,
23994    {
23995        self._scopes
23996            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23997        self
23998    }
23999
24000    /// Removes all scopes, and no default scope will be used either.
24001    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24002    /// for details).
24003    pub fn clear_scopes(mut self) -> ProjectLocationFetchStaticIpCall<'a, C> {
24004        self._scopes.clear();
24005        self
24006    }
24007}
24008
24009/// Gets information about a location.
24010///
24011/// A builder for the *locations.get* method supported by a *project* resource.
24012/// It is not used directly, but through a [`ProjectMethods`] instance.
24013///
24014/// # Example
24015///
24016/// Instantiate a resource method builder
24017///
24018/// ```test_harness,no_run
24019/// # extern crate hyper;
24020/// # extern crate hyper_rustls;
24021/// # extern crate google_datamigration1 as datamigration1;
24022/// # async fn dox() {
24023/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24024///
24025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24026/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24027/// #     secret,
24028/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24029/// # ).build().await.unwrap();
24030///
24031/// # let client = hyper_util::client::legacy::Client::builder(
24032/// #     hyper_util::rt::TokioExecutor::new()
24033/// # )
24034/// # .build(
24035/// #     hyper_rustls::HttpsConnectorBuilder::new()
24036/// #         .with_native_roots()
24037/// #         .unwrap()
24038/// #         .https_or_http()
24039/// #         .enable_http1()
24040/// #         .build()
24041/// # );
24042/// # let mut hub = DatabaseMigrationService::new(client, auth);
24043/// // You can configure optional parameters by calling the respective setters at will, and
24044/// // execute the final call using `doit()`.
24045/// // Values shown here are possibly random and not representative !
24046/// let result = hub.projects().locations_get("name")
24047///              .doit().await;
24048/// # }
24049/// ```
24050pub struct ProjectLocationGetCall<'a, C>
24051where
24052    C: 'a,
24053{
24054    hub: &'a DatabaseMigrationService<C>,
24055    _name: String,
24056    _delegate: Option<&'a mut dyn common::Delegate>,
24057    _additional_params: HashMap<String, String>,
24058    _scopes: BTreeSet<String>,
24059}
24060
24061impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
24062
24063impl<'a, C> ProjectLocationGetCall<'a, C>
24064where
24065    C: common::Connector,
24066{
24067    /// Perform the operation you have build so far.
24068    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
24069        use std::borrow::Cow;
24070        use std::io::{Read, Seek};
24071
24072        use common::{url::Params, ToParts};
24073        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24074
24075        let mut dd = common::DefaultDelegate;
24076        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24077        dlg.begin(common::MethodInfo {
24078            id: "datamigration.projects.locations.get",
24079            http_method: hyper::Method::GET,
24080        });
24081
24082        for &field in ["alt", "name"].iter() {
24083            if self._additional_params.contains_key(field) {
24084                dlg.finished(false);
24085                return Err(common::Error::FieldClash(field));
24086            }
24087        }
24088
24089        let mut params = Params::with_capacity(3 + self._additional_params.len());
24090        params.push("name", self._name);
24091
24092        params.extend(self._additional_params.iter());
24093
24094        params.push("alt", "json");
24095        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24096        if self._scopes.is_empty() {
24097            self._scopes
24098                .insert(Scope::CloudPlatform.as_ref().to_string());
24099        }
24100
24101        #[allow(clippy::single_element_loop)]
24102        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24103            url = params.uri_replacement(url, param_name, find_this, true);
24104        }
24105        {
24106            let to_remove = ["name"];
24107            params.remove_params(&to_remove);
24108        }
24109
24110        let url = params.parse_with_url(&url);
24111
24112        loop {
24113            let token = match self
24114                .hub
24115                .auth
24116                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24117                .await
24118            {
24119                Ok(token) => token,
24120                Err(e) => match dlg.token(e) {
24121                    Ok(token) => token,
24122                    Err(e) => {
24123                        dlg.finished(false);
24124                        return Err(common::Error::MissingToken(e));
24125                    }
24126                },
24127            };
24128            let mut req_result = {
24129                let client = &self.hub.client;
24130                dlg.pre_request();
24131                let mut req_builder = hyper::Request::builder()
24132                    .method(hyper::Method::GET)
24133                    .uri(url.as_str())
24134                    .header(USER_AGENT, self.hub._user_agent.clone());
24135
24136                if let Some(token) = token.as_ref() {
24137                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24138                }
24139
24140                let request = req_builder
24141                    .header(CONTENT_LENGTH, 0_u64)
24142                    .body(common::to_body::<String>(None));
24143
24144                client.request(request.unwrap()).await
24145            };
24146
24147            match req_result {
24148                Err(err) => {
24149                    if let common::Retry::After(d) = dlg.http_error(&err) {
24150                        sleep(d).await;
24151                        continue;
24152                    }
24153                    dlg.finished(false);
24154                    return Err(common::Error::HttpError(err));
24155                }
24156                Ok(res) => {
24157                    let (mut parts, body) = res.into_parts();
24158                    let mut body = common::Body::new(body);
24159                    if !parts.status.is_success() {
24160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24161                        let error = serde_json::from_str(&common::to_string(&bytes));
24162                        let response = common::to_response(parts, bytes.into());
24163
24164                        if let common::Retry::After(d) =
24165                            dlg.http_failure(&response, error.as_ref().ok())
24166                        {
24167                            sleep(d).await;
24168                            continue;
24169                        }
24170
24171                        dlg.finished(false);
24172
24173                        return Err(match error {
24174                            Ok(value) => common::Error::BadRequest(value),
24175                            _ => common::Error::Failure(response),
24176                        });
24177                    }
24178                    let response = {
24179                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24180                        let encoded = common::to_string(&bytes);
24181                        match serde_json::from_str(&encoded) {
24182                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24183                            Err(error) => {
24184                                dlg.response_json_decode_error(&encoded, &error);
24185                                return Err(common::Error::JsonDecodeError(
24186                                    encoded.to_string(),
24187                                    error,
24188                                ));
24189                            }
24190                        }
24191                    };
24192
24193                    dlg.finished(true);
24194                    return Ok(response);
24195                }
24196            }
24197        }
24198    }
24199
24200    /// Resource name for the location.
24201    ///
24202    /// Sets the *name* path property to the given value.
24203    ///
24204    /// Even though the property as already been set when instantiating this call,
24205    /// we provide this method for API completeness.
24206    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
24207        self._name = new_value.to_string();
24208        self
24209    }
24210    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24211    /// while executing the actual API request.
24212    ///
24213    /// ````text
24214    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24215    /// ````
24216    ///
24217    /// Sets the *delegate* property to the given value.
24218    pub fn delegate(
24219        mut self,
24220        new_value: &'a mut dyn common::Delegate,
24221    ) -> ProjectLocationGetCall<'a, C> {
24222        self._delegate = Some(new_value);
24223        self
24224    }
24225
24226    /// Set any additional parameter of the query string used in the request.
24227    /// It should be used to set parameters which are not yet available through their own
24228    /// setters.
24229    ///
24230    /// Please note that this method must not be used to set any of the known parameters
24231    /// which have their own setter method. If done anyway, the request will fail.
24232    ///
24233    /// # Additional Parameters
24234    ///
24235    /// * *$.xgafv* (query-string) - V1 error format.
24236    /// * *access_token* (query-string) - OAuth access token.
24237    /// * *alt* (query-string) - Data format for response.
24238    /// * *callback* (query-string) - JSONP
24239    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24240    /// * *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.
24241    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24242    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24243    /// * *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.
24244    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24245    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24246    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
24247    where
24248        T: AsRef<str>,
24249    {
24250        self._additional_params
24251            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24252        self
24253    }
24254
24255    /// Identifies the authorization scope for the method you are building.
24256    ///
24257    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24258    /// [`Scope::CloudPlatform`].
24259    ///
24260    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24261    /// tokens for more than one scope.
24262    ///
24263    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24264    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24265    /// sufficient, a read-write scope will do as well.
24266    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
24267    where
24268        St: AsRef<str>,
24269    {
24270        self._scopes.insert(String::from(scope.as_ref()));
24271        self
24272    }
24273    /// Identifies the authorization scope(s) for the method you are building.
24274    ///
24275    /// See [`Self::add_scope()`] for details.
24276    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
24277    where
24278        I: IntoIterator<Item = St>,
24279        St: AsRef<str>,
24280    {
24281        self._scopes
24282            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24283        self
24284    }
24285
24286    /// Removes all scopes, and no default scope will be used either.
24287    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24288    /// for details).
24289    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
24290        self._scopes.clear();
24291        self
24292    }
24293}
24294
24295/// Lists information about the supported locations for this service.
24296///
24297/// A builder for the *locations.list* method supported by a *project* resource.
24298/// It is not used directly, but through a [`ProjectMethods`] instance.
24299///
24300/// # Example
24301///
24302/// Instantiate a resource method builder
24303///
24304/// ```test_harness,no_run
24305/// # extern crate hyper;
24306/// # extern crate hyper_rustls;
24307/// # extern crate google_datamigration1 as datamigration1;
24308/// # async fn dox() {
24309/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24310///
24311/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24313/// #     secret,
24314/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24315/// # ).build().await.unwrap();
24316///
24317/// # let client = hyper_util::client::legacy::Client::builder(
24318/// #     hyper_util::rt::TokioExecutor::new()
24319/// # )
24320/// # .build(
24321/// #     hyper_rustls::HttpsConnectorBuilder::new()
24322/// #         .with_native_roots()
24323/// #         .unwrap()
24324/// #         .https_or_http()
24325/// #         .enable_http1()
24326/// #         .build()
24327/// # );
24328/// # let mut hub = DatabaseMigrationService::new(client, auth);
24329/// // You can configure optional parameters by calling the respective setters at will, and
24330/// // execute the final call using `doit()`.
24331/// // Values shown here are possibly random and not representative !
24332/// let result = hub.projects().locations_list("name")
24333///              .page_token("At")
24334///              .page_size(-84)
24335///              .filter("eirmod")
24336///              .doit().await;
24337/// # }
24338/// ```
24339pub struct ProjectLocationListCall<'a, C>
24340where
24341    C: 'a,
24342{
24343    hub: &'a DatabaseMigrationService<C>,
24344    _name: String,
24345    _page_token: Option<String>,
24346    _page_size: Option<i32>,
24347    _filter: Option<String>,
24348    _delegate: Option<&'a mut dyn common::Delegate>,
24349    _additional_params: HashMap<String, String>,
24350    _scopes: BTreeSet<String>,
24351}
24352
24353impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
24354
24355impl<'a, C> ProjectLocationListCall<'a, C>
24356where
24357    C: common::Connector,
24358{
24359    /// Perform the operation you have build so far.
24360    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
24361        use std::borrow::Cow;
24362        use std::io::{Read, Seek};
24363
24364        use common::{url::Params, ToParts};
24365        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24366
24367        let mut dd = common::DefaultDelegate;
24368        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24369        dlg.begin(common::MethodInfo {
24370            id: "datamigration.projects.locations.list",
24371            http_method: hyper::Method::GET,
24372        });
24373
24374        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
24375            if self._additional_params.contains_key(field) {
24376                dlg.finished(false);
24377                return Err(common::Error::FieldClash(field));
24378            }
24379        }
24380
24381        let mut params = Params::with_capacity(6 + self._additional_params.len());
24382        params.push("name", self._name);
24383        if let Some(value) = self._page_token.as_ref() {
24384            params.push("pageToken", value);
24385        }
24386        if let Some(value) = self._page_size.as_ref() {
24387            params.push("pageSize", value.to_string());
24388        }
24389        if let Some(value) = self._filter.as_ref() {
24390            params.push("filter", value);
24391        }
24392
24393        params.extend(self._additional_params.iter());
24394
24395        params.push("alt", "json");
24396        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
24397        if self._scopes.is_empty() {
24398            self._scopes
24399                .insert(Scope::CloudPlatform.as_ref().to_string());
24400        }
24401
24402        #[allow(clippy::single_element_loop)]
24403        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24404            url = params.uri_replacement(url, param_name, find_this, true);
24405        }
24406        {
24407            let to_remove = ["name"];
24408            params.remove_params(&to_remove);
24409        }
24410
24411        let url = params.parse_with_url(&url);
24412
24413        loop {
24414            let token = match self
24415                .hub
24416                .auth
24417                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24418                .await
24419            {
24420                Ok(token) => token,
24421                Err(e) => match dlg.token(e) {
24422                    Ok(token) => token,
24423                    Err(e) => {
24424                        dlg.finished(false);
24425                        return Err(common::Error::MissingToken(e));
24426                    }
24427                },
24428            };
24429            let mut req_result = {
24430                let client = &self.hub.client;
24431                dlg.pre_request();
24432                let mut req_builder = hyper::Request::builder()
24433                    .method(hyper::Method::GET)
24434                    .uri(url.as_str())
24435                    .header(USER_AGENT, self.hub._user_agent.clone());
24436
24437                if let Some(token) = token.as_ref() {
24438                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24439                }
24440
24441                let request = req_builder
24442                    .header(CONTENT_LENGTH, 0_u64)
24443                    .body(common::to_body::<String>(None));
24444
24445                client.request(request.unwrap()).await
24446            };
24447
24448            match req_result {
24449                Err(err) => {
24450                    if let common::Retry::After(d) = dlg.http_error(&err) {
24451                        sleep(d).await;
24452                        continue;
24453                    }
24454                    dlg.finished(false);
24455                    return Err(common::Error::HttpError(err));
24456                }
24457                Ok(res) => {
24458                    let (mut parts, body) = res.into_parts();
24459                    let mut body = common::Body::new(body);
24460                    if !parts.status.is_success() {
24461                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24462                        let error = serde_json::from_str(&common::to_string(&bytes));
24463                        let response = common::to_response(parts, bytes.into());
24464
24465                        if let common::Retry::After(d) =
24466                            dlg.http_failure(&response, error.as_ref().ok())
24467                        {
24468                            sleep(d).await;
24469                            continue;
24470                        }
24471
24472                        dlg.finished(false);
24473
24474                        return Err(match error {
24475                            Ok(value) => common::Error::BadRequest(value),
24476                            _ => common::Error::Failure(response),
24477                        });
24478                    }
24479                    let response = {
24480                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24481                        let encoded = common::to_string(&bytes);
24482                        match serde_json::from_str(&encoded) {
24483                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24484                            Err(error) => {
24485                                dlg.response_json_decode_error(&encoded, &error);
24486                                return Err(common::Error::JsonDecodeError(
24487                                    encoded.to_string(),
24488                                    error,
24489                                ));
24490                            }
24491                        }
24492                    };
24493
24494                    dlg.finished(true);
24495                    return Ok(response);
24496                }
24497            }
24498        }
24499    }
24500
24501    /// The resource that owns the locations collection, if applicable.
24502    ///
24503    /// Sets the *name* path property to the given value.
24504    ///
24505    /// Even though the property as already been set when instantiating this call,
24506    /// we provide this method for API completeness.
24507    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24508        self._name = new_value.to_string();
24509        self
24510    }
24511    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
24512    ///
24513    /// Sets the *page token* query property to the given value.
24514    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24515        self._page_token = Some(new_value.to_string());
24516        self
24517    }
24518    /// The maximum number of results to return. If not set, the service selects a default.
24519    ///
24520    /// Sets the *page size* query property to the given value.
24521    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
24522        self._page_size = Some(new_value);
24523        self
24524    }
24525    /// 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).
24526    ///
24527    /// Sets the *filter* query property to the given value.
24528    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
24529        self._filter = Some(new_value.to_string());
24530        self
24531    }
24532    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24533    /// while executing the actual API request.
24534    ///
24535    /// ````text
24536    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24537    /// ````
24538    ///
24539    /// Sets the *delegate* property to the given value.
24540    pub fn delegate(
24541        mut self,
24542        new_value: &'a mut dyn common::Delegate,
24543    ) -> ProjectLocationListCall<'a, C> {
24544        self._delegate = Some(new_value);
24545        self
24546    }
24547
24548    /// Set any additional parameter of the query string used in the request.
24549    /// It should be used to set parameters which are not yet available through their own
24550    /// setters.
24551    ///
24552    /// Please note that this method must not be used to set any of the known parameters
24553    /// which have their own setter method. If done anyway, the request will fail.
24554    ///
24555    /// # Additional Parameters
24556    ///
24557    /// * *$.xgafv* (query-string) - V1 error format.
24558    /// * *access_token* (query-string) - OAuth access token.
24559    /// * *alt* (query-string) - Data format for response.
24560    /// * *callback* (query-string) - JSONP
24561    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24562    /// * *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.
24563    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24564    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24565    /// * *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.
24566    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24567    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24568    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
24569    where
24570        T: AsRef<str>,
24571    {
24572        self._additional_params
24573            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24574        self
24575    }
24576
24577    /// Identifies the authorization scope for the method you are building.
24578    ///
24579    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24580    /// [`Scope::CloudPlatform`].
24581    ///
24582    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24583    /// tokens for more than one scope.
24584    ///
24585    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24586    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24587    /// sufficient, a read-write scope will do as well.
24588    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
24589    where
24590        St: AsRef<str>,
24591    {
24592        self._scopes.insert(String::from(scope.as_ref()));
24593        self
24594    }
24595    /// Identifies the authorization scope(s) for the method you are building.
24596    ///
24597    /// See [`Self::add_scope()`] for details.
24598    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
24599    where
24600        I: IntoIterator<Item = St>,
24601        St: AsRef<str>,
24602    {
24603        self._scopes
24604            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24605        self
24606    }
24607
24608    /// Removes all scopes, and no default scope will be used either.
24609    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24610    /// for details).
24611    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
24612        self._scopes.clear();
24613        self
24614    }
24615}