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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = DatabaseMigrationService::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = ConnectionProfile::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
99/// .validate_only(true)
100/// .skip_validation(false)
101/// .request_id("amet")
102/// .connection_profile_id("duo")
103/// .doit().await;
104///
105/// match result {
106/// Err(e) => match e {
107/// // The Error enum provides details about what exactly happened.
108/// // You can also just use its `Debug`, `Display` or `Error` traits
109/// Error::HttpError(_)
110/// |Error::Io(_)
111/// |Error::MissingAPIKey
112/// |Error::MissingToken(_)
113/// |Error::Cancelled
114/// |Error::UploadSizeLimitExceeded(_, _)
115/// |Error::Failure(_)
116/// |Error::BadRequest(_)
117/// |Error::FieldClash(_)
118/// |Error::JsonDecodeError(_, _) => println!("{}", e),
119/// },
120/// Ok(res) => println!("Success: {:?}", res),
121/// }
122/// # }
123/// ```
124#[derive(Clone)]
125pub struct DatabaseMigrationService<C> {
126 pub client: common::Client<C>,
127 pub auth: Box<dyn common::GetToken>,
128 _user_agent: String,
129 _base_url: String,
130 _root_url: String,
131}
132
133impl<C> common::Hub for DatabaseMigrationService<C> {}
134
135impl<'a, C> DatabaseMigrationService<C> {
136 pub fn new<A: 'static + common::GetToken>(
137 client: common::Client<C>,
138 auth: A,
139 ) -> DatabaseMigrationService<C> {
140 DatabaseMigrationService {
141 client,
142 auth: Box::new(auth),
143 _user_agent: "google-api-rust-client/7.0.0".to_string(),
144 _base_url: "https://datamigration.googleapis.com/".to_string(),
145 _root_url: "https://datamigration.googleapis.com/".to_string(),
146 }
147 }
148
149 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
150 ProjectMethods { hub: self }
151 }
152
153 /// Set the user-agent header field to use in all requests to the server.
154 /// It defaults to `google-api-rust-client/7.0.0`.
155 ///
156 /// Returns the previously set user-agent.
157 pub fn user_agent(&mut self, agent_name: String) -> String {
158 std::mem::replace(&mut self._user_agent, agent_name)
159 }
160
161 /// Set the base url to use in all requests to the server.
162 /// It defaults to `https://datamigration.googleapis.com/`.
163 ///
164 /// Returns the previously set base url.
165 pub fn base_url(&mut self, new_base_url: String) -> String {
166 std::mem::replace(&mut self._base_url, new_base_url)
167 }
168
169 /// Set the root url to use in all requests to the server.
170 /// It defaults to `https://datamigration.googleapis.com/`.
171 ///
172 /// Returns the previously set root url.
173 pub fn root_url(&mut self, new_root_url: String) -> String {
174 std::mem::replace(&mut self._root_url, new_root_url)
175 }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster.
182///
183/// This type is not used in any activity, and only used as *part* of another schema.
184///
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct AlloyDbConnectionProfile {
189 /// Required. The AlloyDB cluster ID that this connection profile is associated with.
190 #[serde(rename = "clusterId")]
191 pub cluster_id: Option<String>,
192 /// Immutable. Metadata used to create the destination AlloyDB cluster.
193 pub settings: Option<AlloyDbSettings>,
194}
195
196impl common::Part for AlloyDbConnectionProfile {}
197
198/// Settings for creating an AlloyDB cluster.
199///
200/// This type is not used in any activity, and only used as *part* of another schema.
201///
202#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
203#[serde_with::serde_as]
204#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
205pub struct AlloyDbSettings {
206 /// 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.
207 #[serde(rename = "databaseVersion")]
208 pub database_version: Option<String>,
209 /// 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.
210 #[serde(rename = "encryptionConfig")]
211 pub encryption_config: Option<EncryptionConfig>,
212 /// Required. Input only. Initial user to setup during cluster creation. Required.
213 #[serde(rename = "initialUser")]
214 pub initial_user: Option<UserPassword>,
215 /// Labels for the AlloyDB cluster created by DMS. An object containing a list of 'key', 'value' pairs.
216 pub labels: Option<HashMap<String, String>>,
217 /// Settings for the cluster's primary instance
218 #[serde(rename = "primaryInstanceSettings")]
219 pub primary_instance_settings: Option<PrimaryInstanceSettings>,
220 /// 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.
221 #[serde(rename = "vpcNetwork")]
222 pub vpc_network: Option<String>,
223}
224
225impl common::Part for AlloyDbSettings {}
226
227/// Request message for ‘ApplyConversionWorkspace’ request.
228///
229/// # Activities
230///
231/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
232/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
233///
234/// * [locations conversion workspaces apply projects](ProjectLocationConversionWorkspaceApplyCall) (request)
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct ApplyConversionWorkspaceRequest {
239 /// Optional. Specifies whether the conversion workspace is to be committed automatically after the apply.
240 #[serde(rename = "autoCommit")]
241 pub auto_commit: Option<bool>,
242 /// Optional. Fully qualified (Uri) name of the destination connection profile.
243 #[serde(rename = "connectionProfile")]
244 pub connection_profile: Option<String>,
245 /// Optional. Only validates the apply process, but doesn't change the destination database. Only works for PostgreSQL destination connection profile.
246 #[serde(rename = "dryRun")]
247 pub dry_run: Option<bool>,
248 /// Filter which entities to apply. Leaving this field empty will apply all of the entities. Supports Google AIP 160 based filtering.
249 pub filter: Option<String>,
250}
251
252impl common::RequestValue for ApplyConversionWorkspaceRequest {}
253
254/// Apply a hash function on the value.
255///
256/// This type is not used in any activity, and only used as *part* of another schema.
257///
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct ApplyHash {
262 /// Optional. Generate UUID from the data's byte array
263 #[serde(rename = "uuidFromBytes")]
264 pub uuid_from_bytes: Option<Empty>,
265}
266
267impl common::Part for ApplyHash {}
268
269/// Details regarding an Apply background job.
270///
271/// This type is not used in any activity, and only used as *part* of another schema.
272///
273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
274#[serde_with::serde_as]
275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
276pub struct ApplyJobDetails {
277 /// Output only. The connection profile which was used for the apply job.
278 #[serde(rename = "connectionProfile")]
279 pub connection_profile: Option<String>,
280 /// Output only. AIP-160 based filter used to specify the entities to apply
281 pub filter: Option<String>,
282}
283
284impl common::Part for ApplyJobDetails {}
285
286/// Set to a specific value (value is converted to fit the target data type)
287///
288/// This type is not used in any activity, and only used as *part* of another schema.
289///
290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
291#[serde_with::serde_as]
292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
293pub struct AssignSpecificValue {
294 /// Required. Specific value to be assigned
295 pub value: Option<String>,
296}
297
298impl common::Part for AssignSpecificValue {}
299
300/// 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.
301///
302/// This type is not used in any activity, and only used as *part* of another schema.
303///
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct AuditConfig {
308 /// The configuration for logging of each type of permission.
309 #[serde(rename = "auditLogConfigs")]
310 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
311 /// 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.
312 pub service: Option<String>,
313}
314
315impl common::Part for AuditConfig {}
316
317/// 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.
318///
319/// This type is not used in any activity, and only used as *part* of another schema.
320///
321#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
322#[serde_with::serde_as]
323#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
324pub struct AuditLogConfig {
325 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
326 #[serde(rename = "exemptedMembers")]
327 pub exempted_members: Option<Vec<String>>,
328 /// The log type that this config enables.
329 #[serde(rename = "logType")]
330 pub log_type: Option<String>,
331}
332
333impl common::Part for AuditLogConfig {}
334
335/// AuthorizedNetwork contains metadata for an authorized network.
336///
337/// This type is not used in any activity, and only used as *part* of another schema.
338///
339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
340#[serde_with::serde_as]
341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
342pub struct AuthorizedNetwork {
343 /// Optional. CIDR range for one authorzied network of the instance.
344 #[serde(rename = "cidrRange")]
345 pub cidr_range: Option<String>,
346}
347
348impl common::Part for AuthorizedNetwork {}
349
350/// Execution log of a background job.
351///
352/// This type is not used in any activity, and only used as *part* of another schema.
353///
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct BackgroundJobLogEntry {
358 /// Output only. Apply job details.
359 #[serde(rename = "applyJobDetails")]
360 pub apply_job_details: Option<ApplyJobDetails>,
361 /// Output only. Job completion comment, such as how many entities were seeded, how many warnings were found during conversion, and similar information.
362 #[serde(rename = "completionComment")]
363 pub completion_comment: Option<String>,
364 /// Output only. Job completion state, i.e. the final state after the job completed.
365 #[serde(rename = "completionState")]
366 pub completion_state: Option<String>,
367 /// Output only. Convert job details.
368 #[serde(rename = "convertJobDetails")]
369 pub convert_job_details: Option<ConvertJobDetails>,
370 /// The timestamp when the background job was finished.
371 #[serde(rename = "finishTime")]
372 pub finish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
373 /// The background job log entry ID.
374 pub id: Option<String>,
375 /// Output only. Import rules job details.
376 #[serde(rename = "importRulesJobDetails")]
377 pub import_rules_job_details: Option<ImportRulesJobDetails>,
378 /// The type of job that was executed.
379 #[serde(rename = "jobType")]
380 pub job_type: Option<String>,
381 /// Output only. Whether the client requested the conversion workspace to be committed after a successful completion of the job.
382 #[serde(rename = "requestAutocommit")]
383 pub request_autocommit: Option<bool>,
384 /// Output only. Seed job details.
385 #[serde(rename = "seedJobDetails")]
386 pub seed_job_details: Option<SeedJobDetails>,
387 /// The timestamp when the background job was started.
388 #[serde(rename = "startTime")]
389 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
390}
391
392impl common::Part for BackgroundJobLogEntry {}
393
394/// Configuration to use Binary Log Parser CDC technique.
395///
396/// This type is not used in any activity, and only used as *part* of another schema.
397///
398#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
399#[serde_with::serde_as]
400#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
401pub struct BinaryLogParser {
402 /// Use Oracle directories.
403 #[serde(rename = "logFileDirectories")]
404 pub log_file_directories: Option<LogFileDirectories>,
405 /// Use Oracle ASM.
406 #[serde(rename = "oracleAsmLogFileAccess")]
407 pub oracle_asm_log_file_access: Option<OracleAsmLogFileAccess>,
408}
409
410impl common::Part for BinaryLogParser {}
411
412/// Associates `members`, or principals, with a `role`.
413///
414/// This type is not used in any activity, and only used as *part* of another schema.
415///
416#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
417#[serde_with::serde_as]
418#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
419pub struct Binding {
420 /// 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).
421 pub condition: Option<Expr>,
422 /// 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`.
423 pub members: Option<Vec<String>>,
424 /// 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).
425 pub role: Option<String>,
426}
427
428impl common::Part for Binding {}
429
430/// The request message for Operations.CancelOperation.
431///
432/// # Activities
433///
434/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
435/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
436///
437/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct CancelOperationRequest {
442 _never_set: Option<bool>,
443}
444
445impl common::RequestValue for CancelOperationRequest {}
446
447/// Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance.
448///
449/// This type is not used in any activity, and only used as *part* of another schema.
450///
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct CloudSqlConnectionProfile {
455 /// 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).
456 #[serde(rename = "additionalPublicIp")]
457 pub additional_public_ip: Option<String>,
458 /// Output only. The Cloud SQL instance ID that this connection profile is associated with.
459 #[serde(rename = "cloudSqlId")]
460 pub cloud_sql_id: Option<String>,
461 /// Output only. The Cloud SQL database instance's private IP.
462 #[serde(rename = "privateIp")]
463 pub private_ip: Option<String>,
464 /// Output only. The Cloud SQL database instance's public IP.
465 #[serde(rename = "publicIp")]
466 pub public_ip: Option<String>,
467 /// Immutable. Metadata used to create the destination Cloud SQL database.
468 pub settings: Option<CloudSqlSettings>,
469}
470
471impl common::Part for CloudSqlConnectionProfile {}
472
473/// Settings for creating a Cloud SQL database instance.
474///
475/// This type is not used in any activity, and only used as *part* of another schema.
476///
477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
478#[serde_with::serde_as]
479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
480pub struct CloudSqlSettings {
481 /// 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.
482 #[serde(rename = "activationPolicy")]
483 pub activation_policy: Option<String>,
484 /// [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.
485 #[serde(rename = "autoStorageIncrease")]
486 pub auto_storage_increase: Option<bool>,
487 /// 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).
488 #[serde(rename = "availabilityType")]
489 pub availability_type: Option<String>,
490 /// The KMS key name used for the csql instance.
491 #[serde(rename = "cmekKeyName")]
492 pub cmek_key_name: Option<String>,
493 /// The Cloud SQL default instance level collation.
494 pub collation: Option<String>,
495 /// 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.
496 #[serde(rename = "dataCacheConfig")]
497 pub data_cache_config: Option<DataCacheConfig>,
498 /// Optional. Provisioned number of I/O operations per second for the data disk. This field is only used for hyperdisk-balanced disk types.
499 #[serde(rename = "dataDiskProvisionedIops")]
500 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
501 pub data_disk_provisioned_iops: Option<i64>,
502 /// Optional. Provisioned throughput measured in MiB per second for the data disk. This field is only used for hyperdisk-balanced disk types.
503 #[serde(rename = "dataDiskProvisionedThroughput")]
504 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
505 pub data_disk_provisioned_throughput: Option<i64>,
506 /// The storage capacity available to the database, in GB. The minimum (and default) size is 10GB.
507 #[serde(rename = "dataDiskSizeGb")]
508 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
509 pub data_disk_size_gb: Option<i64>,
510 /// The type of storage: `PD_SSD` (default) or `PD_HDD` or `HYPERDISK_BALANCED`.
511 #[serde(rename = "dataDiskType")]
512 pub data_disk_type: Option<String>,
513 /// 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" }.
514 #[serde(rename = "databaseFlags")]
515 pub database_flags: Option<HashMap<String, String>>,
516 /// The database engine type and version. Deprecated. Use database_version_name instead.
517 #[serde(rename = "databaseVersion")]
518 pub database_version: Option<String>,
519 /// Optional. The database engine type and version name.
520 #[serde(rename = "databaseVersionName")]
521 pub database_version_name: Option<String>,
522 /// Optional. The edition of the given Cloud SQL instance.
523 pub edition: Option<String>,
524 /// 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.
525 #[serde(rename = "ipConfig")]
526 pub ip_config: Option<SqlIpConfig>,
527 /// Input only. Initial root password.
528 #[serde(rename = "rootPassword")]
529 pub root_password: Option<String>,
530 /// Output only. Indicates If this connection profile root password is stored.
531 #[serde(rename = "rootPasswordSet")]
532 pub root_password_set: Option<bool>,
533 /// 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).
534 #[serde(rename = "secondaryZone")]
535 pub secondary_zone: Option<String>,
536 /// The Database Migration Service source connection profile ID, in the format: `projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID`
537 #[serde(rename = "sourceId")]
538 pub source_id: Option<String>,
539 /// The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.
540 #[serde(rename = "storageAutoResizeLimit")]
541 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
542 pub storage_auto_resize_limit: Option<i64>,
543 /// 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).
544 pub tier: Option<String>,
545 /// 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" }`.
546 #[serde(rename = "userLabels")]
547 pub user_labels: Option<HashMap<String, String>>,
548 /// The Google Cloud Platform zone where your Cloud SQL database instance is located.
549 pub zone: Option<String>,
550}
551
552impl common::Part for CloudSqlSettings {}
553
554/// Column is not used as an independent entity, it is retrieved as part of a Table entity.
555///
556/// This type is not used in any activity, and only used as *part* of another schema.
557///
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct ColumnEntity {
562 /// Is the column of array type.
563 pub array: Option<bool>,
564 /// If the column is array, of which length.
565 #[serde(rename = "arrayLength")]
566 pub array_length: Option<i32>,
567 /// Is the column auto-generated/identity.
568 #[serde(rename = "autoGenerated")]
569 pub auto_generated: Option<bool>,
570 /// Charset override - instead of table level charset.
571 pub charset: Option<String>,
572 /// Collation override - instead of table level collation.
573 pub collation: Option<String>,
574 /// Comment associated with the column.
575 pub comment: Option<String>,
576 /// Is the column a computed column.
577 pub computed: Option<bool>,
578 /// Custom engine specific features.
579 #[serde(rename = "customFeatures")]
580 pub custom_features: Option<HashMap<String, serde_json::Value>>,
581 /// Column data type.
582 #[serde(rename = "dataType")]
583 pub data_type: Option<String>,
584 /// Default value of the column.
585 #[serde(rename = "defaultValue")]
586 pub default_value: Option<String>,
587 /// Column fractional second precision - used for timestamp based datatypes.
588 #[serde(rename = "fractionalSecondsPrecision")]
589 pub fractional_seconds_precision: Option<i32>,
590 /// Column length - e.g. varchar (50).
591 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
592 pub length: Option<i64>,
593 /// Column name.
594 pub name: Option<String>,
595 /// Is the column nullable.
596 pub nullable: Option<bool>,
597 /// Column order in the table.
598 #[serde(rename = "ordinalPosition")]
599 pub ordinal_position: Option<i32>,
600 /// Column precision - when relevant.
601 pub precision: Option<i32>,
602 /// Column scale - when relevant.
603 pub scale: Option<i32>,
604 /// Specifies the list of values allowed in the column. Only used for set data type.
605 #[serde(rename = "setValues")]
606 pub set_values: Option<Vec<String>>,
607 /// Is the column a UDT.
608 pub udt: Option<bool>,
609}
610
611impl common::Part for ColumnEntity {}
612
613/// Request message for ‘CommitConversionWorkspace’ request.
614///
615/// # Activities
616///
617/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
618/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
619///
620/// * [locations conversion workspaces commit projects](ProjectLocationConversionWorkspaceCommitCall) (request)
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct CommitConversionWorkspaceRequest {
625 /// Optional. Optional name of the commit.
626 #[serde(rename = "commitName")]
627 pub commit_name: Option<String>,
628}
629
630impl common::RequestValue for CommitConversionWorkspaceRequest {}
631
632/// 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.
633///
634/// This type is not used in any activity, and only used as *part* of another schema.
635///
636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
637#[serde_with::serde_as]
638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
639pub struct ConditionalColumnSetValue {
640 /// Optional. Custom engine specific features.
641 #[serde(rename = "customFeatures")]
642 pub custom_features: Option<HashMap<String, serde_json::Value>>,
643 /// Optional. Optional filter on source column precision and scale. Used for fixed point numbers such as NUMERIC/NUMBER data types.
644 #[serde(rename = "sourceNumericFilter")]
645 pub source_numeric_filter: Option<SourceNumericFilter>,
646 /// Optional. Optional filter on source column length. Used for text based data types like varchar.
647 #[serde(rename = "sourceTextFilter")]
648 pub source_text_filter: Option<SourceTextFilter>,
649 /// Required. Description of data transformation during migration.
650 #[serde(rename = "valueTransformation")]
651 pub value_transformation: Option<ValueTransformation>,
652}
653
654impl common::Part for ConditionalColumnSetValue {}
655
656/// A connection profile definition.
657///
658/// # Activities
659///
660/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
661/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
662///
663/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (request)
664/// * [locations connection profiles get projects](ProjectLocationConnectionProfileGetCall) (response)
665/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (request)
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct ConnectionProfile {
670 /// An AlloyDB cluster connection profile.
671 pub alloydb: Option<AlloyDbConnectionProfile>,
672 /// A CloudSQL database connection profile.
673 pub cloudsql: Option<CloudSqlConnectionProfile>,
674 /// 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".
675 #[serde(rename = "createTime")]
676 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
677 /// The connection profile display name.
678 #[serde(rename = "displayName")]
679 pub display_name: Option<String>,
680 /// Output only. The error details in case of state FAILED.
681 pub error: Option<Status>,
682 /// 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" }`.
683 pub labels: Option<HashMap<String, String>>,
684 /// A MySQL database connection profile.
685 pub mysql: Option<MySqlConnectionProfile>,
686 /// The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
687 pub name: Option<String>,
688 /// An Oracle database connection profile.
689 pub oracle: Option<OracleConnectionProfile>,
690 /// A PostgreSQL database connection profile.
691 pub postgresql: Option<PostgreSqlConnectionProfile>,
692 /// The database provider.
693 pub provider: Option<String>,
694 /// Optional. The connection profile role.
695 pub role: Option<String>,
696 /// Output only. Reserved for future use.
697 #[serde(rename = "satisfiesPzi")]
698 pub satisfies_pzi: Option<bool>,
699 /// Output only. Reserved for future use.
700 #[serde(rename = "satisfiesPzs")]
701 pub satisfies_pzs: Option<bool>,
702 /// Connection profile for a SQL Server data source.
703 pub sqlserver: Option<SqlServerConnectionProfile>,
704 /// The current connection profile state (e.g. DRAFT, READY, or FAILED).
705 pub state: Option<String>,
706 /// 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".
707 #[serde(rename = "updateTime")]
708 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
709}
710
711impl common::RequestValue for ConnectionProfile {}
712impl common::ResponseResult for ConnectionProfile {}
713
714/// Constraint is not used as an independent entity, it is retrieved as part of another entity such as Table or View.
715///
716/// This type is not used in any activity, and only used as *part* of another schema.
717///
718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
719#[serde_with::serde_as]
720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
721pub struct ConstraintEntity {
722 /// Custom engine specific features.
723 #[serde(rename = "customFeatures")]
724 pub custom_features: Option<HashMap<String, serde_json::Value>>,
725 /// The name of the table constraint.
726 pub name: Option<String>,
727 /// 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.
728 #[serde(rename = "referenceColumns")]
729 pub reference_columns: Option<Vec<String>>,
730 /// 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.
731 #[serde(rename = "referenceTable")]
732 pub reference_table: Option<String>,
733 /// Table columns used as part of the Constraint, for example primary key constraint should list the columns which constitutes the key.
734 #[serde(rename = "tableColumns")]
735 pub table_columns: Option<Vec<String>>,
736 /// 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.
737 #[serde(rename = "tableName")]
738 pub table_name: Option<String>,
739 /// Type of constraint, for example unique, primary key, foreign key (currently only primary key is supported).
740 #[serde(rename = "type")]
741 pub type_: Option<String>,
742}
743
744impl common::Part for ConstraintEntity {}
745
746/// The main conversion workspace resource entity.
747///
748/// # Activities
749///
750/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
751/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
752///
753/// * [locations conversion workspaces create projects](ProjectLocationConversionWorkspaceCreateCall) (request)
754/// * [locations conversion workspaces get projects](ProjectLocationConversionWorkspaceGetCall) (response)
755/// * [locations conversion workspaces patch projects](ProjectLocationConversionWorkspacePatchCall) (request)
756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
757#[serde_with::serde_as]
758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
759pub struct ConversionWorkspace {
760 /// Output only. The timestamp when the workspace resource was created.
761 #[serde(rename = "createTime")]
762 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
763 /// Required. The destination engine details.
764 pub destination: Option<DatabaseEngineInfo>,
765 /// Optional. The provider for the destination database.
766 #[serde(rename = "destinationProvider")]
767 pub destination_provider: Option<String>,
768 /// Optional. The display name for the workspace.
769 #[serde(rename = "displayName")]
770 pub display_name: Option<String>,
771 /// 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
772 #[serde(rename = "globalSettings")]
773 pub global_settings: Option<HashMap<String, String>>,
774 /// Output only. Whether the workspace has uncommitted changes (changes which were made after the workspace was committed).
775 #[serde(rename = "hasUncommittedChanges")]
776 pub has_uncommitted_changes: Option<bool>,
777 /// Output only. The latest commit ID.
778 #[serde(rename = "latestCommitId")]
779 pub latest_commit_id: Option<String>,
780 /// Output only. The timestamp when the workspace was committed.
781 #[serde(rename = "latestCommitTime")]
782 pub latest_commit_time: Option<chrono::DateTime<chrono::offset::Utc>>,
783 /// Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
784 pub name: Option<String>,
785 /// Required. The source engine details.
786 pub source: Option<DatabaseEngineInfo>,
787 /// Optional. The provider for the source database.
788 #[serde(rename = "sourceProvider")]
789 pub source_provider: Option<String>,
790 /// Output only. The timestamp when the workspace resource was last updated.
791 #[serde(rename = "updateTime")]
792 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
793}
794
795impl common::RequestValue for ConversionWorkspace {}
796impl common::ResponseResult for ConversionWorkspace {}
797
798/// A conversion workspace's version.
799///
800/// This type is not used in any activity, and only used as *part* of another schema.
801///
802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
803#[serde_with::serde_as]
804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
805pub struct ConversionWorkspaceInfo {
806 /// The commit ID of the conversion workspace.
807 #[serde(rename = "commitId")]
808 pub commit_id: Option<String>,
809 /// The resource name (URI) of the conversion workspace.
810 pub name: Option<String>,
811}
812
813impl common::Part for ConversionWorkspaceInfo {}
814
815/// Request message for ‘ConvertConversionWorkspace’ request.
816///
817/// # Activities
818///
819/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
820/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
821///
822/// * [locations conversion workspaces convert projects](ProjectLocationConversionWorkspaceConvertCall) (request)
823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
824#[serde_with::serde_as]
825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
826pub struct ConvertConversionWorkspaceRequest {
827 /// Optional. Specifies whether the conversion workspace is to be committed automatically after the conversion.
828 #[serde(rename = "autoCommit")]
829 pub auto_commit: Option<bool>,
830 /// 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.
831 #[serde(rename = "convertFullPath")]
832 pub convert_full_path: Option<bool>,
833 /// Optional. Filter the entities to convert. Leaving this field empty will convert all of the entities. Supports Google AIP-160 style filtering.
834 pub filter: Option<String>,
835}
836
837impl common::RequestValue for ConvertConversionWorkspaceRequest {}
838
839/// Details regarding a Convert background job.
840///
841/// This type is not used in any activity, and only used as *part* of another schema.
842///
843#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
844#[serde_with::serde_as]
845#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
846pub struct ConvertJobDetails {
847 /// Output only. AIP-160 based filter used to specify the entities to convert
848 pub filter: Option<String>,
849}
850
851impl common::Part for ConvertJobDetails {}
852
853/// 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.
854///
855/// This type is not used in any activity, and only used as *part* of another schema.
856///
857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
858#[serde_with::serde_as]
859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
860pub struct ConvertRowIdToColumn {
861 /// Required. Only work on tables without primary key defined
862 #[serde(rename = "onlyIfNoPrimaryKey")]
863 pub only_if_no_primary_key: Option<bool>,
864}
865
866impl common::Part for ConvertRowIdToColumn {}
867
868/// 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.
869///
870/// This type is not used in any activity, and only used as *part* of another schema.
871///
872#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
873#[serde_with::serde_as]
874#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
875pub struct DataCacheConfig {
876 /// Optional. Whether data cache is enabled for the instance.
877 #[serde(rename = "dataCacheEnabled")]
878 pub data_cache_enabled: Option<bool>,
879}
880
881impl common::Part for DataCacheConfig {}
882
883/// The type and version of a source or destination database.
884///
885/// This type is not used in any activity, and only used as *part* of another schema.
886///
887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
888#[serde_with::serde_as]
889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
890pub struct DatabaseEngineInfo {
891 /// Required. Engine type.
892 pub engine: Option<String>,
893 /// Required. Engine version, for example "12.c.1".
894 pub version: Option<String>,
895}
896
897impl common::Part for DatabaseEngineInfo {}
898
899/// 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.
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 DatabaseEntity {
907 /// Database.
908 pub database: Option<DatabaseInstanceEntity>,
909 /// Function.
910 #[serde(rename = "databaseFunction")]
911 pub database_function: Option<FunctionEntity>,
912 /// Package.
913 #[serde(rename = "databasePackage")]
914 pub database_package: Option<PackageEntity>,
915 /// 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.
916 #[serde(rename = "entityDdl")]
917 pub entity_ddl: Option<Vec<EntityDdl>>,
918 /// The type of the database entity (table, view, index, ...).
919 #[serde(rename = "entityType")]
920 pub entity_type: Option<String>,
921 /// Details about the various issues found for the entity.
922 pub issues: Option<Vec<EntityIssue>>,
923 /// 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.
924 pub mappings: Option<Vec<EntityMapping>>,
925 /// Materialized view.
926 #[serde(rename = "materializedView")]
927 pub materialized_view: Option<MaterializedViewEntity>,
928 /// The full name of the parent entity (e.g. schema name).
929 #[serde(rename = "parentEntity")]
930 pub parent_entity: Option<String>,
931 /// Schema.
932 pub schema: Option<SchemaEntity>,
933 /// Sequence.
934 pub sequence: Option<SequenceEntity>,
935 /// The short name (e.g. table name) of the entity.
936 #[serde(rename = "shortName")]
937 pub short_name: Option<String>,
938 /// Stored procedure.
939 #[serde(rename = "storedProcedure")]
940 pub stored_procedure: Option<StoredProcedureEntity>,
941 /// Synonym.
942 pub synonym: Option<SynonymEntity>,
943 /// Table.
944 pub table: Option<TableEntity>,
945 /// The type of tree the entity belongs to.
946 pub tree: Option<String>,
947 /// UDT.
948 pub udt: Option<UDTEntity>,
949 /// View.
950 pub view: Option<ViewEntity>,
951}
952
953impl common::Part for DatabaseEntity {}
954
955/// DatabaseInstance acts as a parent entity to other database entities.
956///
957/// This type is not used in any activity, and only used as *part* of another schema.
958///
959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
960#[serde_with::serde_as]
961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
962pub struct DatabaseInstanceEntity {
963 /// Custom engine specific features.
964 #[serde(rename = "customFeatures")]
965 pub custom_features: Option<HashMap<String, serde_json::Value>>,
966}
967
968impl common::Part for DatabaseInstanceEntity {}
969
970/// A message defining the database engine and provider.
971///
972/// This type is not used in any activity, and only used as *part* of another schema.
973///
974#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
975#[serde_with::serde_as]
976#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
977pub struct DatabaseType {
978 /// The database engine.
979 pub engine: Option<String>,
980 /// The database provider.
981 pub provider: Option<String>,
982}
983
984impl common::Part for DatabaseType {}
985
986/// Request message for ‘DemoteDestination’ request.
987///
988/// # Activities
989///
990/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
991/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
992///
993/// * [locations migration jobs demote destination projects](ProjectLocationMigrationJobDemoteDestinationCall) (request)
994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
995#[serde_with::serde_as]
996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
997pub struct DemoteDestinationRequest {
998 _never_set: Option<bool>,
999}
1000
1001impl common::RequestValue for DemoteDestinationRequest {}
1002
1003/// Response message for ‘DescribeConversionWorkspaceRevisions’ request.
1004///
1005/// # Activities
1006///
1007/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1008/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1009///
1010/// * [locations conversion workspaces describe conversion workspace revisions projects](ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall) (response)
1011#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1012#[serde_with::serde_as]
1013#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1014pub struct DescribeConversionWorkspaceRevisionsResponse {
1015 /// The list of conversion workspace revisions.
1016 pub revisions: Option<Vec<ConversionWorkspace>>,
1017}
1018
1019impl common::ResponseResult for DescribeConversionWorkspaceRevisionsResponse {}
1020
1021/// Response message for ‘DescribeDatabaseEntities’ request.
1022///
1023/// # Activities
1024///
1025/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1026/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1027///
1028/// * [locations conversion workspaces describe database entities projects](ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall) (response)
1029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1030#[serde_with::serde_as]
1031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1032pub struct DescribeDatabaseEntitiesResponse {
1033 /// The list of database entities for the conversion workspace.
1034 #[serde(rename = "databaseEntities")]
1035 pub database_entities: Option<Vec<DatabaseEntity>>,
1036 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1037 #[serde(rename = "nextPageToken")]
1038 pub next_page_token: Option<String>,
1039}
1040
1041impl common::ResponseResult for DescribeDatabaseEntitiesResponse {}
1042
1043/// Filter based on relation between source value and compare value of type double in ConditionalColumnSetValue
1044///
1045/// This type is not used in any activity, and only used as *part* of another schema.
1046///
1047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1048#[serde_with::serde_as]
1049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1050pub struct DoubleComparisonFilter {
1051 /// Required. Double compare value to be used
1052 pub value: Option<f64>,
1053 /// Required. Relation between source value and compare value
1054 #[serde(rename = "valueComparison")]
1055 pub value_comparison: Option<String>,
1056}
1057
1058impl common::Part for DoubleComparisonFilter {}
1059
1060/// Dump flag definition.
1061///
1062/// This type is not used in any activity, and only used as *part* of another schema.
1063///
1064#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1065#[serde_with::serde_as]
1066#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1067pub struct DumpFlag {
1068 /// The name of the flag
1069 pub name: Option<String>,
1070 /// The value of the flag.
1071 pub value: Option<String>,
1072}
1073
1074impl common::Part for DumpFlag {}
1075
1076/// Dump flags definition.
1077///
1078/// This type is not used in any activity, and only used as *part* of another schema.
1079///
1080#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1081#[serde_with::serde_as]
1082#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1083pub struct DumpFlags {
1084 /// The flags for the initial dump.
1085 #[serde(rename = "dumpFlags")]
1086 pub dump_flags: Option<Vec<DumpFlag>>,
1087}
1088
1089impl common::Part for DumpFlags {}
1090
1091/// 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); }
1092///
1093/// # Activities
1094///
1095/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1096/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1097///
1098/// * [locations conversion workspaces mapping rules delete projects](ProjectLocationConversionWorkspaceMappingRuleDeleteCall) (response)
1099/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1100/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1101#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1102#[serde_with::serde_as]
1103#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1104pub struct Empty {
1105 _never_set: Option<bool>,
1106}
1107
1108impl common::ResponseResult for Empty {}
1109
1110/// EncryptionConfig describes the encryption config of a cluster that is encrypted with a CMEK (customer-managed encryption key).
1111///
1112/// This type is not used in any activity, and only used as *part* of another schema.
1113///
1114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1115#[serde_with::serde_as]
1116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1117pub struct EncryptionConfig {
1118 /// 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]
1119 #[serde(rename = "kmsKeyName")]
1120 pub kms_key_name: Option<String>,
1121}
1122
1123impl common::Part for EncryptionConfig {}
1124
1125/// A single DDL statement for a specific entity
1126///
1127/// This type is not used in any activity, and only used as *part* of another schema.
1128///
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct EntityDdl {
1133 /// The actual ddl code.
1134 pub ddl: Option<String>,
1135 /// The DDL Kind selected for apply, or UNSPECIFIED if the entity wasn't converted yet.
1136 #[serde(rename = "ddlKind")]
1137 pub ddl_kind: Option<String>,
1138 /// Type of DDL (Create, Alter).
1139 #[serde(rename = "ddlType")]
1140 pub ddl_type: Option<String>,
1141 /// If ddl_kind is USER_EDIT, this holds the DDL kind of the original content - DETERMINISTIC or AI. Otherwise, this is DDL_KIND_UNSPECIFIED.
1142 #[serde(rename = "editedDdlKind")]
1143 pub edited_ddl_kind: Option<String>,
1144 /// The name of the database entity the ddl refers to.
1145 pub entity: Option<String>,
1146 /// The entity type (if the DDL is for a sub entity).
1147 #[serde(rename = "entityType")]
1148 pub entity_type: Option<String>,
1149 /// EntityIssues found for this ddl.
1150 #[serde(rename = "issueId")]
1151 pub issue_id: Option<Vec<String>>,
1152}
1153
1154impl common::Part for EntityDdl {}
1155
1156/// Issue related to the entity.
1157///
1158/// This type is not used in any activity, and only used as *part* of another schema.
1159///
1160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1161#[serde_with::serde_as]
1162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1163pub struct EntityIssue {
1164 /// Error/Warning code
1165 pub code: Option<String>,
1166 /// The ddl which caused the issue, if relevant.
1167 pub ddl: Option<String>,
1168 /// The entity type (if the DDL is for a sub entity).
1169 #[serde(rename = "entityType")]
1170 pub entity_type: Option<String>,
1171 /// Unique Issue ID.
1172 pub id: Option<String>,
1173 /// Issue detailed message
1174 pub message: Option<String>,
1175 /// The position of the issue found, if relevant.
1176 pub position: Option<Position>,
1177 /// Severity of the issue
1178 pub severity: Option<String>,
1179 /// The type of the issue.
1180 #[serde(rename = "type")]
1181 pub type_: Option<String>,
1182}
1183
1184impl common::Part for EntityIssue {}
1185
1186/// Details of the mappings of a database entity.
1187///
1188/// This type is not used in any activity, and only used as *part* of another schema.
1189///
1190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1191#[serde_with::serde_as]
1192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1193pub struct EntityMapping {
1194 /// Target entity full name. The draft entity can also include a column, index or constraint using the same naming notation schema.table.column.
1195 #[serde(rename = "draftEntity")]
1196 pub draft_entity: Option<String>,
1197 /// Type of draft entity.
1198 #[serde(rename = "draftType")]
1199 pub draft_type: Option<String>,
1200 /// 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.
1201 #[serde(rename = "mappingLog")]
1202 pub mapping_log: Option<Vec<EntityMappingLogEntry>>,
1203 /// Source entity full name. The source entity can also be a column, index or constraint using the same naming notation schema.table.column.
1204 #[serde(rename = "sourceEntity")]
1205 pub source_entity: Option<String>,
1206 /// Type of source entity.
1207 #[serde(rename = "sourceType")]
1208 pub source_type: Option<String>,
1209}
1210
1211impl common::Part for EntityMapping {}
1212
1213/// A single record of a rule which was used for a mapping.
1214///
1215/// This type is not used in any activity, and only used as *part* of another schema.
1216///
1217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1218#[serde_with::serde_as]
1219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1220pub struct EntityMappingLogEntry {
1221 /// Comment.
1222 #[serde(rename = "mappingComment")]
1223 pub mapping_comment: Option<String>,
1224 /// Which rule caused this log entry.
1225 #[serde(rename = "ruleId")]
1226 pub rule_id: Option<String>,
1227 /// Rule revision ID.
1228 #[serde(rename = "ruleRevisionId")]
1229 pub rule_revision_id: Option<String>,
1230}
1231
1232impl common::Part for EntityMappingLogEntry {}
1233
1234/// 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
1235///
1236/// This type is not used in any activity, and only used as *part* of another schema.
1237///
1238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1239#[serde_with::serde_as]
1240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1241pub struct EntityMove {
1242 /// Required. The new schema
1243 #[serde(rename = "newSchema")]
1244 pub new_schema: Option<String>,
1245}
1246
1247impl common::Part for EntityMove {}
1248
1249/// 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.
1250///
1251/// This type is not used in any activity, and only used as *part* of another schema.
1252///
1253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1254#[serde_with::serde_as]
1255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1256pub struct Expr {
1257 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1258 pub description: Option<String>,
1259 /// Textual representation of an expression in Common Expression Language syntax.
1260 pub expression: Option<String>,
1261 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1262 pub location: Option<String>,
1263 /// 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.
1264 pub title: Option<String>,
1265}
1266
1267impl common::Part for Expr {}
1268
1269/// Response message for a ‘FetchStaticIps’ request.
1270///
1271/// # Activities
1272///
1273/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1274/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1275///
1276/// * [locations fetch static ips projects](ProjectLocationFetchStaticIpCall) (response)
1277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1278#[serde_with::serde_as]
1279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1280pub struct FetchStaticIpsResponse {
1281 /// A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1282 #[serde(rename = "nextPageToken")]
1283 pub next_page_token: Option<String>,
1284 /// List of static IPs.
1285 #[serde(rename = "staticIps")]
1286 pub static_ips: Option<Vec<String>>,
1287}
1288
1289impl common::ResponseResult for FetchStaticIpsResponse {}
1290
1291/// 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.
1292///
1293/// This type is not used in any activity, and only used as *part* of another schema.
1294///
1295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1296#[serde_with::serde_as]
1297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1298pub struct FilterTableColumns {
1299 /// Optional. List of columns to be excluded for a particular table.
1300 #[serde(rename = "excludeColumns")]
1301 pub exclude_columns: Option<Vec<String>>,
1302 /// Optional. List of columns to be included for a particular table.
1303 #[serde(rename = "includeColumns")]
1304 pub include_columns: Option<Vec<String>>,
1305}
1306
1307impl common::Part for FilterTableColumns {}
1308
1309/// Forward SSH Tunnel connectivity.
1310///
1311/// This type is not used in any activity, and only used as *part* of another schema.
1312///
1313#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1314#[serde_with::serde_as]
1315#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1316pub struct ForwardSshTunnelConnectivity {
1317 /// Required. Hostname for the SSH tunnel.
1318 pub hostname: Option<String>,
1319 /// Input only. SSH password.
1320 pub password: Option<String>,
1321 /// Port for the SSH tunnel, default value is 22.
1322 pub port: Option<i32>,
1323 /// Input only. SSH private key.
1324 #[serde(rename = "privateKey")]
1325 pub private_key: Option<String>,
1326 /// Required. Username for the SSH tunnel.
1327 pub username: Option<String>,
1328}
1329
1330impl common::Part for ForwardSshTunnelConnectivity {}
1331
1332/// Function's parent is a schema.
1333///
1334/// This type is not used in any activity, and only used as *part* of another schema.
1335///
1336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1337#[serde_with::serde_as]
1338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1339pub struct FunctionEntity {
1340 /// Custom engine specific features.
1341 #[serde(rename = "customFeatures")]
1342 pub custom_features: Option<HashMap<String, serde_json::Value>>,
1343 /// The SQL code which creates the function.
1344 #[serde(rename = "sqlCode")]
1345 pub sql_code: Option<String>,
1346}
1347
1348impl common::Part for FunctionEntity {}
1349
1350/// Request message for ‘GenerateSshScript’ request.
1351///
1352/// # Activities
1353///
1354/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1355/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1356///
1357/// * [locations migration jobs generate ssh script projects](ProjectLocationMigrationJobGenerateSshScriptCall) (request)
1358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1359#[serde_with::serde_as]
1360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1361pub struct GenerateSshScriptRequest {
1362 /// Required. Bastion VM Instance name to use or to create.
1363 pub vm: Option<String>,
1364 /// The VM creation configuration
1365 #[serde(rename = "vmCreationConfig")]
1366 pub vm_creation_config: Option<VmCreationConfig>,
1367 /// The port that will be open on the bastion host.
1368 #[serde(rename = "vmPort")]
1369 pub vm_port: Option<i32>,
1370 /// The VM selection configuration
1371 #[serde(rename = "vmSelectionConfig")]
1372 pub vm_selection_config: Option<VmSelectionConfig>,
1373}
1374
1375impl common::RequestValue for GenerateSshScriptRequest {}
1376
1377/// Request message for ‘GenerateTcpProxyScript’ request.
1378///
1379/// # Activities
1380///
1381/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1383///
1384/// * [locations migration jobs generate tcp proxy script projects](ProjectLocationMigrationJobGenerateTcpProxyScriptCall) (request)
1385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1386#[serde_with::serde_as]
1387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1388pub struct GenerateTcpProxyScriptRequest {
1389 /// Required. The type of the Compute instance that will host the proxy.
1390 #[serde(rename = "vmMachineType")]
1391 pub vm_machine_type: Option<String>,
1392 /// Required. The name of the Compute instance that will host the proxy.
1393 #[serde(rename = "vmName")]
1394 pub vm_name: Option<String>,
1395 /// 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.
1396 #[serde(rename = "vmSubnet")]
1397 pub vm_subnet: Option<String>,
1398 /// 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.
1399 #[serde(rename = "vmZone")]
1400 pub vm_zone: Option<String>,
1401}
1402
1403impl common::RequestValue for GenerateTcpProxyScriptRequest {}
1404
1405/// Metadata for heterogeneous migration jobs objects.
1406///
1407/// This type is not used in any activity, and only used as *part* of another schema.
1408///
1409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1410#[serde_with::serde_as]
1411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1412pub struct HeterogeneousMetadata {
1413 /// The number of unsupported events.
1414 #[serde(rename = "unsupportedEventsCount")]
1415 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1416 pub unsupported_events_count: Option<i64>,
1417}
1418
1419impl common::Part for HeterogeneousMetadata {}
1420
1421/// Request message for ‘ImportMappingRules’ request.
1422///
1423/// # Activities
1424///
1425/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1426/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1427///
1428/// * [locations conversion workspaces mapping rules import projects](ProjectLocationConversionWorkspaceMappingRuleImportCall) (request)
1429#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1430#[serde_with::serde_as]
1431#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1432pub struct ImportMappingRulesRequest {
1433 /// Required. Should the conversion workspace be committed automatically after the import operation.
1434 #[serde(rename = "autoCommit")]
1435 pub auto_commit: Option<bool>,
1436 /// Required. One or more rules files.
1437 #[serde(rename = "rulesFiles")]
1438 pub rules_files: Option<Vec<RulesFile>>,
1439 /// Required. The format of the rules content file.
1440 #[serde(rename = "rulesFormat")]
1441 pub rules_format: Option<String>,
1442}
1443
1444impl common::RequestValue for ImportMappingRulesRequest {}
1445
1446/// Details regarding an Import Rules background job.
1447///
1448/// This type is not used in any activity, and only used as *part* of another schema.
1449///
1450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1451#[serde_with::serde_as]
1452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1453pub struct ImportRulesJobDetails {
1454 /// Output only. The requested file format.
1455 #[serde(rename = "fileFormat")]
1456 pub file_format: Option<String>,
1457 /// Output only. File names used for the import rules job.
1458 pub files: Option<Vec<String>>,
1459}
1460
1461impl common::Part for ImportRulesJobDetails {}
1462
1463/// Index is not used as an independent entity, it is retrieved as part of a Table entity.
1464///
1465/// This type is not used in any activity, and only used as *part* of another schema.
1466///
1467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1468#[serde_with::serde_as]
1469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1470pub struct IndexEntity {
1471 /// Custom engine specific features.
1472 #[serde(rename = "customFeatures")]
1473 pub custom_features: Option<HashMap<String, serde_json::Value>>,
1474 /// The name of the index.
1475 pub name: Option<String>,
1476 /// Table columns used as part of the Index, for example B-TREE index should list the columns which constitutes the index.
1477 #[serde(rename = "tableColumns")]
1478 pub table_columns: Option<Vec<String>>,
1479 /// 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.
1480 #[serde(rename = "tableColumnsDescending")]
1481 pub table_columns_descending: Option<Vec<bool>>,
1482 /// Type of index, for example B-TREE.
1483 #[serde(rename = "type")]
1484 pub type_: Option<String>,
1485 /// Boolean value indicating whether the index is unique.
1486 pub unique: Option<bool>,
1487}
1488
1489impl common::Part for IndexEntity {}
1490
1491/// Metadata related to instance level network configuration.
1492///
1493/// This type is not used in any activity, and only used as *part* of another schema.
1494///
1495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1496#[serde_with::serde_as]
1497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1498pub struct InstanceNetworkConfig {
1499 /// Optional. A list of external network authorized to access this instance.
1500 #[serde(rename = "authorizedExternalNetworks")]
1501 pub authorized_external_networks: Option<Vec<AuthorizedNetwork>>,
1502 /// Optional. Enabling an outbound public IP address to support a database server sending requests out into the internet.
1503 #[serde(rename = "enableOutboundPublicIp")]
1504 pub enable_outbound_public_ip: Option<bool>,
1505 /// Optional. Enabling public ip for the instance.
1506 #[serde(rename = "enablePublicIp")]
1507 pub enable_public_ip: Option<bool>,
1508}
1509
1510impl common::Part for InstanceNetworkConfig {}
1511
1512/// Filter based on relation between source value and compare value of type integer in ConditionalColumnSetValue
1513///
1514/// This type is not used in any activity, and only used as *part* of another schema.
1515///
1516#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1517#[serde_with::serde_as]
1518#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1519pub struct IntComparisonFilter {
1520 /// Required. Integer compare value to be used
1521 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1522 pub value: Option<i64>,
1523 /// Required. Relation between source value and compare value
1524 #[serde(rename = "valueComparison")]
1525 pub value_comparison: Option<String>,
1526}
1527
1528impl common::Part for IntComparisonFilter {}
1529
1530/// Response message for ‘ListConnectionProfiles’ request.
1531///
1532/// # Activities
1533///
1534/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1535/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1536///
1537/// * [locations connection profiles list projects](ProjectLocationConnectionProfileListCall) (response)
1538#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1539#[serde_with::serde_as]
1540#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1541pub struct ListConnectionProfilesResponse {
1542 /// The response list of connection profiles.
1543 #[serde(rename = "connectionProfiles")]
1544 pub connection_profiles: Option<Vec<ConnectionProfile>>,
1545 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1546 #[serde(rename = "nextPageToken")]
1547 pub next_page_token: Option<String>,
1548 /// Locations that could not be reached.
1549 pub unreachable: Option<Vec<String>>,
1550}
1551
1552impl common::ResponseResult for ListConnectionProfilesResponse {}
1553
1554/// Response message for ‘ListConversionWorkspaces’ request.
1555///
1556/// # Activities
1557///
1558/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1559/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1560///
1561/// * [locations conversion workspaces list projects](ProjectLocationConversionWorkspaceListCall) (response)
1562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1563#[serde_with::serde_as]
1564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1565pub struct ListConversionWorkspacesResponse {
1566 /// The list of conversion workspace objects.
1567 #[serde(rename = "conversionWorkspaces")]
1568 pub conversion_workspaces: Option<Vec<ConversionWorkspace>>,
1569 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1570 #[serde(rename = "nextPageToken")]
1571 pub next_page_token: Option<String>,
1572 /// Locations that could not be reached.
1573 pub unreachable: Option<Vec<String>>,
1574}
1575
1576impl common::ResponseResult for ListConversionWorkspacesResponse {}
1577
1578/// The response message for Locations.ListLocations.
1579///
1580/// # Activities
1581///
1582/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1583/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1584///
1585/// * [locations list projects](ProjectLocationListCall) (response)
1586#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1587#[serde_with::serde_as]
1588#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1589pub struct ListLocationsResponse {
1590 /// A list of locations that matches the specified filter in the request.
1591 pub locations: Option<Vec<Location>>,
1592 /// The standard List next-page token.
1593 #[serde(rename = "nextPageToken")]
1594 pub next_page_token: Option<String>,
1595}
1596
1597impl common::ResponseResult for ListLocationsResponse {}
1598
1599/// Response message for ‘ListMappingRulesRequest’ request.
1600///
1601/// # Activities
1602///
1603/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1604/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1605///
1606/// * [locations conversion workspaces mapping rules list projects](ProjectLocationConversionWorkspaceMappingRuleListCall) (response)
1607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1608#[serde_with::serde_as]
1609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1610pub struct ListMappingRulesResponse {
1611 /// The list of conversion workspace mapping rules.
1612 #[serde(rename = "mappingRules")]
1613 pub mapping_rules: Option<Vec<MappingRule>>,
1614 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1615 #[serde(rename = "nextPageToken")]
1616 pub next_page_token: Option<String>,
1617}
1618
1619impl common::ResponseResult for ListMappingRulesResponse {}
1620
1621/// Response containing the objects for a migration job.
1622///
1623/// # Activities
1624///
1625/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1626/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1627///
1628/// * [locations migration jobs objects list projects](ProjectLocationMigrationJobObjectListCall) (response)
1629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1630#[serde_with::serde_as]
1631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1632pub struct ListMigrationJobObjectsResponse {
1633 /// List of migration job objects.
1634 #[serde(rename = "migrationJobObjects")]
1635 pub migration_job_objects: Option<Vec<MigrationJobObject>>,
1636 /// A token, which can be sent as `page_token` to retrieve the next page.
1637 #[serde(rename = "nextPageToken")]
1638 pub next_page_token: Option<String>,
1639}
1640
1641impl common::ResponseResult for ListMigrationJobObjectsResponse {}
1642
1643/// Response message for ‘ListMigrationJobs’ request.
1644///
1645/// # Activities
1646///
1647/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1648/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1649///
1650/// * [locations migration jobs list projects](ProjectLocationMigrationJobListCall) (response)
1651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1652#[serde_with::serde_as]
1653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1654pub struct ListMigrationJobsResponse {
1655 /// The list of migration jobs objects.
1656 #[serde(rename = "migrationJobs")]
1657 pub migration_jobs: Option<Vec<MigrationJob>>,
1658 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1659 #[serde(rename = "nextPageToken")]
1660 pub next_page_token: Option<String>,
1661 /// Locations that could not be reached.
1662 pub unreachable: Option<Vec<String>>,
1663}
1664
1665impl common::ResponseResult for ListMigrationJobsResponse {}
1666
1667/// The response message for Operations.ListOperations.
1668///
1669/// # Activities
1670///
1671/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1672/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1673///
1674/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1676#[serde_with::serde_as]
1677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1678pub struct ListOperationsResponse {
1679 /// The standard List next-page token.
1680 #[serde(rename = "nextPageToken")]
1681 pub next_page_token: Option<String>,
1682 /// A list of operations that matches the specified filter in the request.
1683 pub operations: Option<Vec<Operation>>,
1684 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
1685 pub unreachable: Option<Vec<String>>,
1686}
1687
1688impl common::ResponseResult for ListOperationsResponse {}
1689
1690/// Response message for ‘ListPrivateConnections’ request.
1691///
1692/// # Activities
1693///
1694/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1695/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1696///
1697/// * [locations private connections list projects](ProjectLocationPrivateConnectionListCall) (response)
1698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1699#[serde_with::serde_as]
1700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1701pub struct ListPrivateConnectionsResponse {
1702 /// A token which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1703 #[serde(rename = "nextPageToken")]
1704 pub next_page_token: Option<String>,
1705 /// List of private connections.
1706 #[serde(rename = "privateConnections")]
1707 pub private_connections: Option<Vec<PrivateConnection>>,
1708 /// Locations that could not be reached.
1709 pub unreachable: Option<Vec<String>>,
1710}
1711
1712impl common::ResponseResult for ListPrivateConnectionsResponse {}
1713
1714/// A resource that represents a Google Cloud location.
1715///
1716/// # Activities
1717///
1718/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1719/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1720///
1721/// * [locations get projects](ProjectLocationGetCall) (response)
1722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1723#[serde_with::serde_as]
1724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1725pub struct Location {
1726 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1727 #[serde(rename = "displayName")]
1728 pub display_name: Option<String>,
1729 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1730 pub labels: Option<HashMap<String, String>>,
1731 /// The canonical id for this location. For example: `"us-east1"`.
1732 #[serde(rename = "locationId")]
1733 pub location_id: Option<String>,
1734 /// Service-specific metadata. For example the available capacity at the given location.
1735 pub metadata: Option<HashMap<String, serde_json::Value>>,
1736 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1737 pub name: Option<String>,
1738}
1739
1740impl common::ResponseResult for Location {}
1741
1742/// Configuration to specify the Oracle directories to access the log files.
1743///
1744/// This type is not used in any activity, and only used as *part* of another schema.
1745///
1746#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1747#[serde_with::serde_as]
1748#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1749pub struct LogFileDirectories {
1750 /// Required. Oracle directory for archived logs.
1751 #[serde(rename = "archivedLogDirectory")]
1752 pub archived_log_directory: Option<String>,
1753 /// Required. Oracle directory for online logs.
1754 #[serde(rename = "onlineLogDirectory")]
1755 pub online_log_directory: Option<String>,
1756}
1757
1758impl common::Part for LogFileDirectories {}
1759
1760/// Configuration to use LogMiner CDC method.
1761///
1762/// This type is not used in any activity, and only used as *part* of another schema.
1763///
1764#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1765#[serde_with::serde_as]
1766#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1767pub struct LogMiner {
1768 _never_set: Option<bool>,
1769}
1770
1771impl common::Part for LogMiner {}
1772
1773/// Request for looking up a specific migration job object by its source object identifier.
1774///
1775/// # Activities
1776///
1777/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1778/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1779///
1780/// * [locations migration jobs objects lookup projects](ProjectLocationMigrationJobObjectLookupCall) (request)
1781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1782#[serde_with::serde_as]
1783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1784pub struct LookupMigrationJobObjectRequest {
1785 /// Required. The source object identifier which maps to the migration job object.
1786 #[serde(rename = "sourceObjectIdentifier")]
1787 pub source_object_identifier: Option<SourceObjectIdentifier>,
1788}
1789
1790impl common::RequestValue for LookupMigrationJobObjectRequest {}
1791
1792/// MachineConfig describes the configuration of a machine.
1793///
1794/// This type is not used in any activity, and only used as *part* of another schema.
1795///
1796#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1797#[serde_with::serde_as]
1798#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1799pub struct MachineConfig {
1800 /// The number of CPU's in the VM instance.
1801 #[serde(rename = "cpuCount")]
1802 pub cpu_count: Option<i32>,
1803 /// Optional. Machine type of the VM instance. E.g. "n2-highmem-4", "n2-highmem-8", "c4a-highmem-4-lssd". cpu_count must match the number of vCPUs in the machine type.
1804 #[serde(rename = "machineType")]
1805 pub machine_type: Option<String>,
1806}
1807
1808impl common::Part for MachineConfig {}
1809
1810/// 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.
1811///
1812/// # Activities
1813///
1814/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1815/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1816///
1817/// * [locations conversion workspaces mapping rules create projects](ProjectLocationConversionWorkspaceMappingRuleCreateCall) (request|response)
1818/// * [locations conversion workspaces mapping rules get projects](ProjectLocationConversionWorkspaceMappingRuleGetCall) (response)
1819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1820#[serde_with::serde_as]
1821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1822pub struct MappingRule {
1823 /// 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.
1824 #[serde(rename = "conditionalColumnSetValue")]
1825 pub conditional_column_set_value: Option<ConditionalColumnSetValue>,
1826 /// Optional. Rule to specify how multiple tables should be converted with an additional rowid column.
1827 #[serde(rename = "convertRowidColumn")]
1828 pub convert_rowid_column: Option<ConvertRowIdToColumn>,
1829 /// Optional. A human readable name
1830 #[serde(rename = "displayName")]
1831 pub display_name: Option<String>,
1832 /// Optional. Rule to specify how multiple entities should be relocated into a different schema.
1833 #[serde(rename = "entityMove")]
1834 pub entity_move: Option<EntityMove>,
1835 /// Required. The rule filter
1836 pub filter: Option<MappingRuleFilter>,
1837 /// Optional. Rule to specify the list of columns to include or exclude from a table.
1838 #[serde(rename = "filterTableColumns")]
1839 pub filter_table_columns: Option<FilterTableColumns>,
1840 /// Optional. Rule to specify how multiple columns should be converted to a different data type.
1841 #[serde(rename = "multiColumnDataTypeChange")]
1842 pub multi_column_data_type_change: Option<MultiColumnDatatypeChange>,
1843 /// Optional. Rule to specify how multiple entities should be renamed.
1844 #[serde(rename = "multiEntityRename")]
1845 pub multi_entity_rename: Option<MultiEntityRename>,
1846 /// Full name of the mapping rule resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
1847 pub name: Option<String>,
1848 /// Output only. The timestamp that the revision was created.
1849 #[serde(rename = "revisionCreateTime")]
1850 pub revision_create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1851 /// 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.
1852 #[serde(rename = "revisionId")]
1853 pub revision_id: Option<String>,
1854 /// 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.
1855 #[serde(rename = "ruleOrder")]
1856 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1857 pub rule_order: Option<i64>,
1858 /// Required. The rule scope
1859 #[serde(rename = "ruleScope")]
1860 pub rule_scope: Option<String>,
1861 /// Optional. Rule to specify the primary key for a table
1862 #[serde(rename = "setTablePrimaryKey")]
1863 pub set_table_primary_key: Option<SetTablePrimaryKey>,
1864 /// Optional. Rule to specify how a single column is converted.
1865 #[serde(rename = "singleColumnChange")]
1866 pub single_column_change: Option<SingleColumnChange>,
1867 /// Optional. Rule to specify how a single entity should be renamed.
1868 #[serde(rename = "singleEntityRename")]
1869 pub single_entity_rename: Option<SingleEntityRename>,
1870 /// Optional. Rule to specify how a single package is converted.
1871 #[serde(rename = "singlePackageChange")]
1872 pub single_package_change: Option<SinglePackageChange>,
1873 /// Optional. Rule to change the sql code for an entity, for example, function, procedure.
1874 #[serde(rename = "sourceSqlChange")]
1875 pub source_sql_change: Option<SourceSqlChange>,
1876 /// Optional. The mapping rule state
1877 pub state: Option<String>,
1878}
1879
1880impl common::RequestValue for MappingRule {}
1881impl common::ResponseResult for MappingRule {}
1882
1883/// 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.
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 MappingRuleFilter {
1891 /// Optional. The rule should be applied to specific entities defined by their fully qualified names.
1892 pub entities: Option<Vec<String>>,
1893 /// Optional. The rule should be applied to entities whose non-qualified name contains the given string.
1894 #[serde(rename = "entityNameContains")]
1895 pub entity_name_contains: Option<String>,
1896 /// Optional. The rule should be applied to entities whose non-qualified name starts with the given prefix.
1897 #[serde(rename = "entityNamePrefix")]
1898 pub entity_name_prefix: Option<String>,
1899 /// Optional. The rule should be applied to entities whose non-qualified name ends with the given suffix.
1900 #[serde(rename = "entityNameSuffix")]
1901 pub entity_name_suffix: Option<String>,
1902 /// 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)
1903 #[serde(rename = "parentEntity")]
1904 pub parent_entity: Option<String>,
1905}
1906
1907impl common::Part for MappingRuleFilter {}
1908
1909/// MaterializedView's parent is a schema.
1910///
1911/// This type is not used in any activity, and only used as *part* of another schema.
1912///
1913#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1914#[serde_with::serde_as]
1915#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1916pub struct MaterializedViewEntity {
1917 /// Custom engine specific features.
1918 #[serde(rename = "customFeatures")]
1919 pub custom_features: Option<HashMap<String, serde_json::Value>>,
1920 /// View indices.
1921 pub indices: Option<Vec<IndexEntity>>,
1922 /// The SQL code which creates the view.
1923 #[serde(rename = "sqlCode")]
1924 pub sql_code: Option<String>,
1925}
1926
1927impl common::Part for MaterializedViewEntity {}
1928
1929/// Represents a Database Migration Service migration job object.
1930///
1931/// # Activities
1932///
1933/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1934/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1935///
1936/// * [locations migration jobs create projects](ProjectLocationMigrationJobCreateCall) (request)
1937/// * [locations migration jobs get projects](ProjectLocationMigrationJobGetCall) (response)
1938/// * [locations migration jobs patch projects](ProjectLocationMigrationJobPatchCall) (request)
1939#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1940#[serde_with::serde_as]
1941#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1942pub struct MigrationJob {
1943 /// 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]
1944 #[serde(rename = "cmekKeyName")]
1945 pub cmek_key_name: Option<String>,
1946 /// The conversion workspace used by the migration.
1947 #[serde(rename = "conversionWorkspace")]
1948 pub conversion_workspace: Option<ConversionWorkspaceInfo>,
1949 /// 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".
1950 #[serde(rename = "createTime")]
1951 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1952 /// Required. The resource name (URI) of the destination connection profile.
1953 pub destination: Option<String>,
1954 /// The database engine type and provider of the destination.
1955 #[serde(rename = "destinationDatabase")]
1956 pub destination_database: Option<DatabaseType>,
1957 /// The migration job display name.
1958 #[serde(rename = "displayName")]
1959 pub display_name: Option<String>,
1960 /// The initial dump flags. This field and the "dump_path" field are mutually exclusive.
1961 #[serde(rename = "dumpFlags")]
1962 pub dump_flags: Option<DumpFlags>,
1963 /// 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.
1964 #[serde(rename = "dumpPath")]
1965 pub dump_path: Option<String>,
1966 /// Optional. The type of the data dump. Supported for MySQL to CloudSQL for MySQL migrations only.
1967 #[serde(rename = "dumpType")]
1968 pub dump_type: Option<String>,
1969 /// 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".
1970 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1971 pub duration: Option<chrono::Duration>,
1972 /// Output only. If the migration job is completed, the time when it was completed.
1973 #[serde(rename = "endTime")]
1974 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1975 /// Output only. The error details in case of state FAILED.
1976 pub error: Option<Status>,
1977 /// 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.
1978 pub filter: Option<String>,
1979 /// 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" }`.
1980 pub labels: Option<HashMap<String, String>>,
1981 /// The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
1982 pub name: Option<String>,
1983 /// Optional. The objects that need to be migrated.
1984 #[serde(rename = "objectsConfig")]
1985 pub objects_config: Option<MigrationJobObjectsConfig>,
1986 /// Configuration for heterogeneous **Oracle to Cloud SQL for PostgreSQL** and **Oracle to AlloyDB for PostgreSQL** migrations.
1987 #[serde(rename = "oracleToPostgresConfig")]
1988 pub oracle_to_postgres_config: Option<OracleToPostgresConfig>,
1989 /// Optional. Data dump parallelism settings used by the migration.
1990 #[serde(rename = "performanceConfig")]
1991 pub performance_config: Option<PerformanceConfig>,
1992 /// Output only. The current migration job phase.
1993 pub phase: Option<String>,
1994 /// The details needed to communicate to the source over Reverse SSH tunnel connectivity.
1995 #[serde(rename = "reverseSshConnectivity")]
1996 pub reverse_ssh_connectivity: Option<ReverseSshConnectivity>,
1997 /// Output only. Reserved for future use.
1998 #[serde(rename = "satisfiesPzi")]
1999 pub satisfies_pzi: Option<bool>,
2000 /// Output only. Reserved for future use.
2001 #[serde(rename = "satisfiesPzs")]
2002 pub satisfies_pzs: Option<bool>,
2003 /// Required. The resource name (URI) of the source connection profile.
2004 pub source: Option<String>,
2005 /// The database engine type and provider of the source.
2006 #[serde(rename = "sourceDatabase")]
2007 pub source_database: Option<DatabaseType>,
2008 /// Optional. Configuration for SQL Server homogeneous migration.
2009 #[serde(rename = "sqlserverHomogeneousMigrationJobConfig")]
2010 pub sqlserver_homogeneous_migration_job_config: Option<SqlServerHomogeneousMigrationJobConfig>,
2011 /// Configuration for heterogeneous **SQL Server to Cloud SQL for PostgreSQL** migrations.
2012 #[serde(rename = "sqlserverToPostgresConfig")]
2013 pub sqlserver_to_postgres_config: Option<SqlServerToPostgresConfig>,
2014 /// The current migration job state.
2015 pub state: Option<String>,
2016 /// static ip connectivity data (default, no additional details needed).
2017 #[serde(rename = "staticIpConnectivity")]
2018 pub static_ip_connectivity: Option<StaticIpConnectivity>,
2019 /// Required. The migration job type.
2020 #[serde(rename = "type")]
2021 pub type_: Option<String>,
2022 /// 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".
2023 #[serde(rename = "updateTime")]
2024 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2025 /// The details of the VPC network that the source database is located in.
2026 #[serde(rename = "vpcPeeringConnectivity")]
2027 pub vpc_peering_connectivity: Option<VpcPeeringConnectivity>,
2028}
2029
2030impl common::RequestValue for MigrationJob {}
2031impl common::ResponseResult for MigrationJob {}
2032
2033/// A specific Migration Job Object (e.g. a specifc DB Table)
2034///
2035/// # Activities
2036///
2037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2039///
2040/// * [locations migration jobs objects get projects](ProjectLocationMigrationJobObjectGetCall) (response)
2041/// * [locations migration jobs objects lookup projects](ProjectLocationMigrationJobObjectLookupCall) (response)
2042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2043#[serde_with::serde_as]
2044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2045pub struct MigrationJobObject {
2046 /// Output only. The creation time of the migration job object.
2047 #[serde(rename = "createTime")]
2048 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2049 /// Output only. The error details in case of failure.
2050 pub error: Option<Status>,
2051 /// Output only. Metadata for heterogeneous migration jobs objects.
2052 #[serde(rename = "heterogeneousMetadata")]
2053 pub heterogeneous_metadata: Option<HeterogeneousMetadata>,
2054 /// The object's name.
2055 pub name: Option<String>,
2056 /// Output only. The phase of the migration job object.
2057 pub phase: Option<String>,
2058 /// The object identifier in the data source.
2059 #[serde(rename = "sourceObject")]
2060 pub source_object: Option<SourceObjectIdentifier>,
2061 /// The state of the migration job object.
2062 pub state: Option<String>,
2063 /// Output only. The last update time of the migration job object.
2064 #[serde(rename = "updateTime")]
2065 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2066}
2067
2068impl common::ResponseResult for MigrationJobObject {}
2069
2070/// Configuration for the objects to be migrated.
2071///
2072/// This type is not used in any activity, and only used as *part* of another schema.
2073///
2074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2075#[serde_with::serde_as]
2076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2077pub struct MigrationJobObjectsConfig {
2078 /// The list of the migration job objects.
2079 #[serde(rename = "sourceObjectsConfig")]
2080 pub source_objects_config: Option<SourceObjectsConfig>,
2081}
2082
2083impl common::Part for MigrationJobObjectsConfig {}
2084
2085/// 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).
2086///
2087/// This type is not used in any activity, and only used as *part* of another schema.
2088///
2089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2090#[serde_with::serde_as]
2091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2092pub struct MultiColumnDatatypeChange {
2093 /// Optional. Custom engine specific features.
2094 #[serde(rename = "customFeatures")]
2095 pub custom_features: Option<HashMap<String, serde_json::Value>>,
2096 /// Required. New data type.
2097 #[serde(rename = "newDataType")]
2098 pub new_data_type: Option<String>,
2099 /// Optional. Column fractional seconds precision - used only for timestamp based datatypes - if not specified and relevant uses the source column fractional seconds precision.
2100 #[serde(rename = "overrideFractionalSecondsPrecision")]
2101 pub override_fractional_seconds_precision: Option<i32>,
2102 /// Optional. Column length - e.g. varchar (50) - if not specified and relevant uses the source column length.
2103 #[serde(rename = "overrideLength")]
2104 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2105 pub override_length: Option<i64>,
2106 /// Optional. Column precision - when relevant - if not specified and relevant uses the source column precision.
2107 #[serde(rename = "overridePrecision")]
2108 pub override_precision: Option<i32>,
2109 /// Optional. Column scale - when relevant - if not specified and relevant uses the source column scale.
2110 #[serde(rename = "overrideScale")]
2111 pub override_scale: Option<i32>,
2112 /// Required. Filter on source data type.
2113 #[serde(rename = "sourceDataTypeFilter")]
2114 pub source_data_type_filter: Option<String>,
2115 /// Optional. Filter for fixed point number data types such as NUMERIC/NUMBER.
2116 #[serde(rename = "sourceNumericFilter")]
2117 pub source_numeric_filter: Option<SourceNumericFilter>,
2118 /// Optional. Filter for text-based data types like varchar.
2119 #[serde(rename = "sourceTextFilter")]
2120 pub source_text_filter: Option<SourceTextFilter>,
2121}
2122
2123impl common::Part for MultiColumnDatatypeChange {}
2124
2125/// 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
2126///
2127/// This type is not used in any activity, and only used as *part* of another schema.
2128///
2129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2130#[serde_with::serde_as]
2131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2132pub struct MultiEntityRename {
2133 /// 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}'
2134 #[serde(rename = "newNamePattern")]
2135 pub new_name_pattern: Option<String>,
2136 /// 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
2137 #[serde(rename = "sourceNameTransformation")]
2138 pub source_name_transformation: Option<String>,
2139}
2140
2141impl common::Part for MultiEntityRename {}
2142
2143/// Specifies connection parameters required specifically for MySQL databases.
2144///
2145/// This type is not used in any activity, and only used as *part* of another schema.
2146///
2147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2148#[serde_with::serde_as]
2149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2150pub struct MySqlConnectionProfile {
2151 /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
2152 #[serde(rename = "cloudSqlId")]
2153 pub cloud_sql_id: Option<String>,
2154 /// Required. The IP or hostname of the source MySQL database.
2155 pub host: Option<String>,
2156 /// 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.
2157 pub password: Option<String>,
2158 /// Output only. Indicates If this connection profile password is stored.
2159 #[serde(rename = "passwordSet")]
2160 pub password_set: Option<bool>,
2161 /// Required. The network port of the source MySQL database.
2162 pub port: Option<i32>,
2163 /// SSL configuration for the destination to connect to the source database.
2164 pub ssl: Option<SslConfig>,
2165 /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
2166 pub username: Option<String>,
2167}
2168
2169impl common::Part for MySqlConnectionProfile {}
2170
2171/// This resource represents a long-running operation that is the result of a network API call.
2172///
2173/// # Activities
2174///
2175/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2176/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2177///
2178/// * [locations connection profiles create projects](ProjectLocationConnectionProfileCreateCall) (response)
2179/// * [locations connection profiles delete projects](ProjectLocationConnectionProfileDeleteCall) (response)
2180/// * [locations connection profiles patch projects](ProjectLocationConnectionProfilePatchCall) (response)
2181/// * [locations conversion workspaces mapping rules import projects](ProjectLocationConversionWorkspaceMappingRuleImportCall) (response)
2182/// * [locations conversion workspaces apply projects](ProjectLocationConversionWorkspaceApplyCall) (response)
2183/// * [locations conversion workspaces commit projects](ProjectLocationConversionWorkspaceCommitCall) (response)
2184/// * [locations conversion workspaces convert projects](ProjectLocationConversionWorkspaceConvertCall) (response)
2185/// * [locations conversion workspaces create projects](ProjectLocationConversionWorkspaceCreateCall) (response)
2186/// * [locations conversion workspaces delete projects](ProjectLocationConversionWorkspaceDeleteCall) (response)
2187/// * [locations conversion workspaces patch projects](ProjectLocationConversionWorkspacePatchCall) (response)
2188/// * [locations conversion workspaces rollback projects](ProjectLocationConversionWorkspaceRollbackCall) (response)
2189/// * [locations conversion workspaces seed projects](ProjectLocationConversionWorkspaceSeedCall) (response)
2190/// * [locations migration jobs create projects](ProjectLocationMigrationJobCreateCall) (response)
2191/// * [locations migration jobs delete projects](ProjectLocationMigrationJobDeleteCall) (response)
2192/// * [locations migration jobs demote destination projects](ProjectLocationMigrationJobDemoteDestinationCall) (response)
2193/// * [locations migration jobs fetch source objects projects](ProjectLocationMigrationJobFetchSourceObjectCall) (response)
2194/// * [locations migration jobs patch projects](ProjectLocationMigrationJobPatchCall) (response)
2195/// * [locations migration jobs promote projects](ProjectLocationMigrationJobPromoteCall) (response)
2196/// * [locations migration jobs restart projects](ProjectLocationMigrationJobRestartCall) (response)
2197/// * [locations migration jobs resume projects](ProjectLocationMigrationJobResumeCall) (response)
2198/// * [locations migration jobs start projects](ProjectLocationMigrationJobStartCall) (response)
2199/// * [locations migration jobs stop projects](ProjectLocationMigrationJobStopCall) (response)
2200/// * [locations migration jobs verify projects](ProjectLocationMigrationJobVerifyCall) (response)
2201/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2202/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (response)
2203/// * [locations private connections delete projects](ProjectLocationPrivateConnectionDeleteCall) (response)
2204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2205#[serde_with::serde_as]
2206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2207pub struct Operation {
2208 /// 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.
2209 pub done: Option<bool>,
2210 /// The error result of the operation in case of failure or cancellation.
2211 pub error: Option<Status>,
2212 /// 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.
2213 pub metadata: Option<HashMap<String, serde_json::Value>>,
2214 /// 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}`.
2215 pub name: Option<String>,
2216 /// 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`.
2217 pub response: Option<HashMap<String, serde_json::Value>>,
2218}
2219
2220impl common::ResponseResult for Operation {}
2221
2222/// Configuration for Oracle Automatic Storage Management (ASM) connection.
2223///
2224/// This type is not used in any activity, and only used as *part* of another schema.
2225///
2226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2227#[serde_with::serde_as]
2228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2229pub struct OracleAsmConfig {
2230 /// Required. ASM service name for the Oracle ASM connection.
2231 #[serde(rename = "asmService")]
2232 pub asm_service: Option<String>,
2233 /// Required. Hostname for the Oracle ASM connection.
2234 pub hostname: Option<String>,
2235 /// Required. Input only. Password for the Oracle ASM connection.
2236 pub password: Option<String>,
2237 /// Output only. Indicates whether a new password is included in the request.
2238 #[serde(rename = "passwordSet")]
2239 pub password_set: Option<bool>,
2240 /// Required. Port for the Oracle ASM connection.
2241 pub port: Option<i32>,
2242 /// Optional. SSL configuration for the Oracle connection.
2243 pub ssl: Option<SslConfig>,
2244 /// Required. Username for the Oracle ASM connection.
2245 pub username: Option<String>,
2246}
2247
2248impl common::Part for OracleAsmConfig {}
2249
2250/// Configuration to use Oracle ASM to access the log files.
2251///
2252/// This type is not used in any activity, and only used as *part* of another schema.
2253///
2254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2255#[serde_with::serde_as]
2256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2257pub struct OracleAsmLogFileAccess {
2258 _never_set: Option<bool>,
2259}
2260
2261impl common::Part for OracleAsmLogFileAccess {}
2262
2263/// Specifies connection parameters required specifically for Oracle databases.
2264///
2265/// This type is not used in any activity, and only used as *part* of another schema.
2266///
2267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2268#[serde_with::serde_as]
2269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2270pub struct OracleConnectionProfile {
2271 /// Required. Database service for the Oracle connection.
2272 #[serde(rename = "databaseService")]
2273 pub database_service: Option<String>,
2274 /// Forward SSH tunnel connectivity.
2275 #[serde(rename = "forwardSshConnectivity")]
2276 pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
2277 /// Required. The IP or hostname of the source Oracle database.
2278 pub host: Option<String>,
2279 /// Optional. Configuration for Oracle ASM connection.
2280 #[serde(rename = "oracleAsmConfig")]
2281 pub oracle_asm_config: Option<OracleAsmConfig>,
2282 /// 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.
2283 pub password: Option<String>,
2284 /// Output only. Indicates whether a new password is included in the request.
2285 #[serde(rename = "passwordSet")]
2286 pub password_set: Option<bool>,
2287 /// Required. The network port of the source Oracle database.
2288 pub port: Option<i32>,
2289 /// Private connectivity.
2290 #[serde(rename = "privateConnectivity")]
2291 pub private_connectivity: Option<PrivateConnectivity>,
2292 /// 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.
2293 pub ssl: Option<SslConfig>,
2294 /// Static Service IP connectivity.
2295 #[serde(rename = "staticServiceIpConnectivity")]
2296 pub static_service_ip_connectivity: Option<StaticServiceIpConnectivity>,
2297 /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
2298 pub username: Option<String>,
2299}
2300
2301impl common::Part for OracleConnectionProfile {}
2302
2303/// Configuration for Oracle as a source in a migration.
2304///
2305/// This type is not used in any activity, and only used as *part* of another schema.
2306///
2307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2308#[serde_with::serde_as]
2309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2310pub struct OracleSourceConfig {
2311 /// Use Binary Log Parser.
2312 #[serde(rename = "binaryLogParser")]
2313 pub binary_log_parser: Option<BinaryLogParser>,
2314 /// Optional. The schema change number (SCN) to start CDC data migration from.
2315 #[serde(rename = "cdcStartPosition")]
2316 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2317 pub cdc_start_position: Option<i64>,
2318 /// Use LogMiner.
2319 #[serde(rename = "logMiner")]
2320 pub log_miner: Option<LogMiner>,
2321 /// Optional. Maximum number of connections Database Migration Service will open to the source for CDC phase.
2322 #[serde(rename = "maxConcurrentCdcConnections")]
2323 pub max_concurrent_cdc_connections: Option<i32>,
2324 /// Optional. Maximum number of connections Database Migration Service will open to the source for full dump phase.
2325 #[serde(rename = "maxConcurrentFullDumpConnections")]
2326 pub max_concurrent_full_dump_connections: Option<i32>,
2327 /// Optional. Whether to skip full dump or not.
2328 #[serde(rename = "skipFullDump")]
2329 pub skip_full_dump: Option<bool>,
2330}
2331
2332impl common::Part for OracleSourceConfig {}
2333
2334/// Configuration for heterogeneous **Oracle to Cloud SQL for PostgreSQL** and **Oracle to AlloyDB for PostgreSQL** migrations.
2335///
2336/// This type is not used in any activity, and only used as *part* of another schema.
2337///
2338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2339#[serde_with::serde_as]
2340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2341pub struct OracleToPostgresConfig {
2342 /// Optional. Configuration for Oracle source.
2343 #[serde(rename = "oracleSourceConfig")]
2344 pub oracle_source_config: Option<OracleSourceConfig>,
2345 /// Optional. Configuration for Postgres destination.
2346 #[serde(rename = "postgresDestinationConfig")]
2347 pub postgres_destination_config: Option<PostgresDestinationConfig>,
2348}
2349
2350impl common::Part for OracleToPostgresConfig {}
2351
2352/// Package's parent is a schema.
2353///
2354/// This type is not used in any activity, and only used as *part* of another schema.
2355///
2356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2357#[serde_with::serde_as]
2358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2359pub struct PackageEntity {
2360 /// Custom engine specific features.
2361 #[serde(rename = "customFeatures")]
2362 pub custom_features: Option<HashMap<String, serde_json::Value>>,
2363 /// The SQL code which creates the package body. If the package specification has cursors or subprograms, then the package body is mandatory.
2364 #[serde(rename = "packageBody")]
2365 pub package_body: Option<String>,
2366 /// The SQL code which creates the package.
2367 #[serde(rename = "packageSqlCode")]
2368 pub package_sql_code: Option<String>,
2369}
2370
2371impl common::Part for PackageEntity {}
2372
2373/// Performance configuration definition.
2374///
2375/// This type is not used in any activity, and only used as *part* of another schema.
2376///
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct PerformanceConfig {
2381 /// Initial dump parallelism level.
2382 #[serde(rename = "dumpParallelLevel")]
2383 pub dump_parallel_level: Option<String>,
2384}
2385
2386impl common::Part for PerformanceConfig {}
2387
2388/// 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/).
2389///
2390/// # Activities
2391///
2392/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2393/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2394///
2395/// * [locations connection profiles get iam policy projects](ProjectLocationConnectionProfileGetIamPolicyCall) (response)
2396/// * [locations connection profiles set iam policy projects](ProjectLocationConnectionProfileSetIamPolicyCall) (response)
2397/// * [locations conversion workspaces get iam policy projects](ProjectLocationConversionWorkspaceGetIamPolicyCall) (response)
2398/// * [locations conversion workspaces set iam policy projects](ProjectLocationConversionWorkspaceSetIamPolicyCall) (response)
2399/// * [locations migration jobs objects get iam policy projects](ProjectLocationMigrationJobObjectGetIamPolicyCall) (response)
2400/// * [locations migration jobs objects set iam policy projects](ProjectLocationMigrationJobObjectSetIamPolicyCall) (response)
2401/// * [locations migration jobs get iam policy projects](ProjectLocationMigrationJobGetIamPolicyCall) (response)
2402/// * [locations migration jobs set iam policy projects](ProjectLocationMigrationJobSetIamPolicyCall) (response)
2403/// * [locations private connections get iam policy projects](ProjectLocationPrivateConnectionGetIamPolicyCall) (response)
2404/// * [locations private connections set iam policy projects](ProjectLocationPrivateConnectionSetIamPolicyCall) (response)
2405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2406#[serde_with::serde_as]
2407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2408pub struct Policy {
2409 /// Specifies cloud audit logging configuration for this policy.
2410 #[serde(rename = "auditConfigs")]
2411 pub audit_configs: Option<Vec<AuditConfig>>,
2412 /// 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`.
2413 pub bindings: Option<Vec<Binding>>,
2414 /// `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.
2415 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2416 pub etag: Option<Vec<u8>>,
2417 /// 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).
2418 pub version: Option<i32>,
2419}
2420
2421impl common::ResponseResult for Policy {}
2422
2423/// Issue position.
2424///
2425/// This type is not used in any activity, and only used as *part* of another schema.
2426///
2427#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2428#[serde_with::serde_as]
2429#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2430pub struct Position {
2431 /// Issue column number
2432 pub column: Option<i32>,
2433 /// Issue length
2434 pub length: Option<i32>,
2435 /// Issue line number
2436 pub line: Option<i32>,
2437 /// Issue offset
2438 pub offset: Option<i32>,
2439}
2440
2441impl common::Part for Position {}
2442
2443/// Specifies connection parameters required specifically for PostgreSQL databases.
2444///
2445/// This type is not used in any activity, and only used as *part* of another schema.
2446///
2447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2448#[serde_with::serde_as]
2449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2450pub struct PostgreSqlConnectionProfile {
2451 /// Optional. If the destination is an AlloyDB database, use this field to provide the AlloyDB cluster ID.
2452 #[serde(rename = "alloydbClusterId")]
2453 pub alloydb_cluster_id: Option<String>,
2454 /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
2455 #[serde(rename = "cloudSqlId")]
2456 pub cloud_sql_id: Option<String>,
2457 /// Optional. The name of the specific database within the host.
2458 pub database: Option<String>,
2459 /// Required. The IP or hostname of the source PostgreSQL database.
2460 pub host: Option<String>,
2461 /// Output only. If the source is a Cloud SQL database, this field indicates the network architecture it's associated with.
2462 #[serde(rename = "networkArchitecture")]
2463 pub network_architecture: Option<String>,
2464 /// 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.
2465 pub password: Option<String>,
2466 /// Output only. Indicates If this connection profile password is stored.
2467 #[serde(rename = "passwordSet")]
2468 pub password_set: Option<bool>,
2469 /// Required. The network port of the source PostgreSQL database.
2470 pub port: Option<i32>,
2471 /// Private service connect connectivity.
2472 #[serde(rename = "privateServiceConnectConnectivity")]
2473 pub private_service_connect_connectivity: Option<PrivateServiceConnectConnectivity>,
2474 /// SSL configuration for the destination to connect to the source database.
2475 pub ssl: Option<SslConfig>,
2476 /// Static ip connectivity data (default, no additional details needed).
2477 #[serde(rename = "staticIpConnectivity")]
2478 pub static_ip_connectivity: Option<StaticIpConnectivity>,
2479 /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
2480 pub username: Option<String>,
2481}
2482
2483impl common::Part for PostgreSqlConnectionProfile {}
2484
2485/// Configuration for Postgres as a destination in a migration.
2486///
2487/// This type is not used in any activity, and only used as *part* of another schema.
2488///
2489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2490#[serde_with::serde_as]
2491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2492pub struct PostgresDestinationConfig {
2493 /// Optional. Maximum number of connections Database Migration Service will open to the destination for data migration.
2494 #[serde(rename = "maxConcurrentConnections")]
2495 pub max_concurrent_connections: Option<i32>,
2496 /// Optional. Timeout for data migration transactions.
2497 #[serde(rename = "transactionTimeout")]
2498 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2499 pub transaction_timeout: Option<chrono::Duration>,
2500}
2501
2502impl common::Part for PostgresDestinationConfig {}
2503
2504/// Settings for the cluster's primary instance
2505///
2506/// This type is not used in any activity, and only used as *part* of another schema.
2507///
2508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2509#[serde_with::serde_as]
2510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2511pub struct PrimaryInstanceSettings {
2512 /// 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.
2513 #[serde(rename = "databaseFlags")]
2514 pub database_flags: Option<HashMap<String, String>>,
2515 /// Required. The ID of the AlloyDB primary instance. The ID must satisfy the regex expression "[a-z0-9-]+".
2516 pub id: Option<String>,
2517 /// Optional. Metadata related to instance level network configuration.
2518 #[serde(rename = "instanceNetworkConfig")]
2519 pub instance_network_config: Option<InstanceNetworkConfig>,
2520 /// Labels for the AlloyDB primary instance created by DMS. An object containing a list of 'key', 'value' pairs.
2521 pub labels: Option<HashMap<String, String>>,
2522 /// Configuration for the machines that host the underlying database engine.
2523 #[serde(rename = "machineConfig")]
2524 pub machine_config: Option<MachineConfig>,
2525 /// Output only. All outbound public IP addresses configured for the instance.
2526 #[serde(rename = "outboundPublicIpAddresses")]
2527 pub outbound_public_ip_addresses: Option<Vec<String>>,
2528 /// Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application.
2529 #[serde(rename = "privateIp")]
2530 pub private_ip: Option<String>,
2531}
2532
2533impl common::Part for PrimaryInstanceSettings {}
2534
2535/// The PrivateConnection resource is used to establish private connectivity with the customer’s network.
2536///
2537/// # Activities
2538///
2539/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2540/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2541///
2542/// * [locations private connections create projects](ProjectLocationPrivateConnectionCreateCall) (request)
2543/// * [locations private connections get projects](ProjectLocationPrivateConnectionGetCall) (response)
2544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2545#[serde_with::serde_as]
2546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2547pub struct PrivateConnection {
2548 /// Output only. The create time of the resource.
2549 #[serde(rename = "createTime")]
2550 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2551 /// The private connection display name.
2552 #[serde(rename = "displayName")]
2553 pub display_name: Option<String>,
2554 /// Output only. The error details in case of state FAILED.
2555 pub error: Option<Status>,
2556 /// 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" }`.
2557 pub labels: Option<HashMap<String, String>>,
2558 /// The name of the resource.
2559 pub name: Option<String>,
2560 /// PSC Interface configuration.
2561 #[serde(rename = "pscInterfaceConfig")]
2562 pub psc_interface_config: Option<PscInterfaceConfig>,
2563 /// Output only. Reserved for future use.
2564 #[serde(rename = "satisfiesPzi")]
2565 pub satisfies_pzi: Option<bool>,
2566 /// Output only. Reserved for future use.
2567 #[serde(rename = "satisfiesPzs")]
2568 pub satisfies_pzs: Option<bool>,
2569 /// Output only. The state of the private connection.
2570 pub state: Option<String>,
2571 /// Output only. The last update time of the resource.
2572 #[serde(rename = "updateTime")]
2573 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2574 /// VPC peering configuration.
2575 #[serde(rename = "vpcPeeringConfig")]
2576 pub vpc_peering_config: Option<VpcPeeringConfig>,
2577}
2578
2579impl common::RequestValue for PrivateConnection {}
2580impl common::ResponseResult for PrivateConnection {}
2581
2582/// Private Connectivity.
2583///
2584/// This type is not used in any activity, and only used as *part* of another schema.
2585///
2586#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2587#[serde_with::serde_as]
2588#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2589pub struct PrivateConnectivity {
2590 /// Required. The resource name (URI) of the private connection.
2591 #[serde(rename = "privateConnection")]
2592 pub private_connection: Option<String>,
2593}
2594
2595impl common::Part for PrivateConnectivity {}
2596
2597/// [Private Service Connect connectivity](https://cloud.google.com/vpc/docs/private-service-connect#service-attachments)
2598///
2599/// This type is not used in any activity, and only used as *part* of another schema.
2600///
2601#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2602#[serde_with::serde_as]
2603#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2604pub struct PrivateServiceConnectConnectivity {
2605 /// Required. A service attachment that exposes a database, and has the following format: projects/{project}/regions/{region}/serviceAttachments/{service_attachment_name}
2606 #[serde(rename = "serviceAttachment")]
2607 pub service_attachment: Option<String>,
2608}
2609
2610impl common::Part for PrivateServiceConnectConnectivity {}
2611
2612/// Request message for ‘PromoteMigrationJob’ request.
2613///
2614/// # Activities
2615///
2616/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2617/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2618///
2619/// * [locations migration jobs promote projects](ProjectLocationMigrationJobPromoteCall) (request)
2620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2621#[serde_with::serde_as]
2622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2623pub struct PromoteMigrationJobRequest {
2624 /// Optional. The object filter to apply to the migration job.
2625 #[serde(rename = "objectsFilter")]
2626 pub objects_filter: Option<MigrationJobObjectsConfig>,
2627}
2628
2629impl common::RequestValue for PromoteMigrationJobRequest {}
2630
2631/// The PSC Interface configuration is used to create PSC Interface between DMS's internal VPC and the consumer's PSC.
2632///
2633/// This type is not used in any activity, and only used as *part* of another schema.
2634///
2635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2636#[serde_with::serde_as]
2637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2638pub struct PscInterfaceConfig {
2639 /// Required. Fully qualified name of the Network Attachment that DMS will connect to. Format: `projects/{{project}}/regions/{{region}}/networkAttachments/{{name}}`
2640 #[serde(rename = "networkAttachment")]
2641 pub network_attachment: Option<String>,
2642}
2643
2644impl common::Part for PscInterfaceConfig {}
2645
2646/// Request message for ‘RestartMigrationJob’ request.
2647///
2648/// # Activities
2649///
2650/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2651/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2652///
2653/// * [locations migration jobs restart projects](ProjectLocationMigrationJobRestartCall) (request)
2654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2655#[serde_with::serde_as]
2656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2657pub struct RestartMigrationJobRequest {
2658 /// Optional. The object filter to apply to the migration job.
2659 #[serde(rename = "objectsFilter")]
2660 pub objects_filter: Option<MigrationJobObjectsConfig>,
2661 /// Optional. If true, only failed objects will be restarted.
2662 #[serde(rename = "restartFailedObjects")]
2663 pub restart_failed_objects: Option<bool>,
2664 /// Optional. Restart the migration job without running prior configuration verification. Defaults to `false`.
2665 #[serde(rename = "skipValidation")]
2666 pub skip_validation: Option<bool>,
2667}
2668
2669impl common::RequestValue for RestartMigrationJobRequest {}
2670
2671/// Request message for ‘ResumeMigrationJob’ request.
2672///
2673/// # Activities
2674///
2675/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2676/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2677///
2678/// * [locations migration jobs resume projects](ProjectLocationMigrationJobResumeCall) (request)
2679#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2680#[serde_with::serde_as]
2681#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2682pub struct ResumeMigrationJobRequest {
2683 /// Optional. Resume the migration job without running prior configuration verification. Defaults to `false`.
2684 #[serde(rename = "skipValidation")]
2685 pub skip_validation: Option<bool>,
2686}
2687
2688impl common::RequestValue for ResumeMigrationJobRequest {}
2689
2690/// 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.
2691///
2692/// This type is not used in any activity, and only used as *part* of another schema.
2693///
2694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2695#[serde_with::serde_as]
2696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2697pub struct ReverseSshConnectivity {
2698 /// The name of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2699 pub vm: Option<String>,
2700 /// Required. The IP of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2701 #[serde(rename = "vmIp")]
2702 pub vm_ip: Option<String>,
2703 /// Required. The forwarding port of the virtual machine (Compute Engine) used as the bastion server for the SSH tunnel.
2704 #[serde(rename = "vmPort")]
2705 pub vm_port: Option<i32>,
2706 /// The name of the VPC to peer with the Cloud SQL private network.
2707 pub vpc: Option<String>,
2708}
2709
2710impl common::Part for ReverseSshConnectivity {}
2711
2712/// Request message for ‘RollbackConversionWorkspace’ request.
2713///
2714/// # Activities
2715///
2716/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2717/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2718///
2719/// * [locations conversion workspaces rollback projects](ProjectLocationConversionWorkspaceRollbackCall) (request)
2720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2721#[serde_with::serde_as]
2722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2723pub struct RollbackConversionWorkspaceRequest {
2724 _never_set: Option<bool>,
2725}
2726
2727impl common::RequestValue for RollbackConversionWorkspaceRequest {}
2728
2729/// 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.
2730///
2731/// This type is not used in any activity, and only used as *part* of another schema.
2732///
2733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2734#[serde_with::serde_as]
2735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2736pub struct RoundToScale {
2737 /// Required. Scale value to be used
2738 pub scale: Option<i32>,
2739}
2740
2741impl common::Part for RoundToScale {}
2742
2743/// Details of a single rules file.
2744///
2745/// This type is not used in any activity, and only used as *part* of another schema.
2746///
2747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2748#[serde_with::serde_as]
2749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2750pub struct RulesFile {
2751 /// Required. The text content of the rules that needs to be converted.
2752 #[serde(rename = "rulesContent")]
2753 pub rules_content: Option<String>,
2754 /// 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.
2755 #[serde(rename = "rulesSourceFilename")]
2756 pub rules_source_filename: Option<String>,
2757}
2758
2759impl common::Part for RulesFile {}
2760
2761/// 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.
2762///
2763/// This type is not used in any activity, and only used as *part* of another schema.
2764///
2765#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2766#[serde_with::serde_as]
2767#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2768pub struct SchemaEntity {
2769 /// Custom engine specific features.
2770 #[serde(rename = "customFeatures")]
2771 pub custom_features: Option<HashMap<String, serde_json::Value>>,
2772}
2773
2774impl common::Part for SchemaEntity {}
2775
2776/// Response message for ‘SearchBackgroundJobs’ request.
2777///
2778/// # Activities
2779///
2780/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2781/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2782///
2783/// * [locations conversion workspaces search background jobs projects](ProjectLocationConversionWorkspaceSearchBackgroundJobCall) (response)
2784#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2785#[serde_with::serde_as]
2786#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2787pub struct SearchBackgroundJobsResponse {
2788 /// The list of conversion workspace mapping rules.
2789 pub jobs: Option<Vec<BackgroundJobLogEntry>>,
2790}
2791
2792impl common::ResponseResult for SearchBackgroundJobsResponse {}
2793
2794/// Request message for ‘SeedConversionWorkspace’ request.
2795///
2796/// # Activities
2797///
2798/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2799/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2800///
2801/// * [locations conversion workspaces seed projects](ProjectLocationConversionWorkspaceSeedCall) (request)
2802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2803#[serde_with::serde_as]
2804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2805pub struct SeedConversionWorkspaceRequest {
2806 /// Should the conversion workspace be committed automatically after the seed operation.
2807 #[serde(rename = "autoCommit")]
2808 pub auto_commit: Option<bool>,
2809 /// Optional. Fully qualified (Uri) name of the destination connection profile.
2810 #[serde(rename = "destinationConnectionProfile")]
2811 pub destination_connection_profile: Option<String>,
2812 /// Optional. Fully qualified (Uri) name of the source connection profile.
2813 #[serde(rename = "sourceConnectionProfile")]
2814 pub source_connection_profile: Option<String>,
2815}
2816
2817impl common::RequestValue for SeedConversionWorkspaceRequest {}
2818
2819/// Details regarding a Seed background job.
2820///
2821/// This type is not used in any activity, and only used as *part* of another schema.
2822///
2823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2824#[serde_with::serde_as]
2825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2826pub struct SeedJobDetails {
2827 /// Output only. The connection profile which was used for the seed job.
2828 #[serde(rename = "connectionProfile")]
2829 pub connection_profile: Option<String>,
2830}
2831
2832impl common::Part for SeedJobDetails {}
2833
2834/// Sequence's parent is a schema.
2835///
2836/// This type is not used in any activity, and only used as *part* of another schema.
2837///
2838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2839#[serde_with::serde_as]
2840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2841pub struct SequenceEntity {
2842 /// Indicates number of entries to cache / precreate.
2843 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2844 pub cache: Option<i64>,
2845 /// Custom engine specific features.
2846 #[serde(rename = "customFeatures")]
2847 pub custom_features: Option<HashMap<String, serde_json::Value>>,
2848 /// Indicates whether the sequence value should cycle through.
2849 pub cycle: Option<bool>,
2850 /// Increment value for the sequence.
2851 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2852 pub increment: Option<i64>,
2853 /// Maximum number for the sequence represented as bytes to accommodate large. numbers
2854 #[serde(rename = "maxValue")]
2855 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2856 pub max_value: Option<Vec<u8>>,
2857 /// Minimum number for the sequence represented as bytes to accommodate large. numbers
2858 #[serde(rename = "minValue")]
2859 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2860 pub min_value: Option<Vec<u8>>,
2861 /// Start number for the sequence represented as bytes to accommodate large. numbers
2862 #[serde(rename = "startValue")]
2863 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2864 pub start_value: Option<Vec<u8>>,
2865}
2866
2867impl common::Part for SequenceEntity {}
2868
2869/// Request message for `SetIamPolicy` method.
2870///
2871/// # Activities
2872///
2873/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2874/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2875///
2876/// * [locations connection profiles set iam policy projects](ProjectLocationConnectionProfileSetIamPolicyCall) (request)
2877/// * [locations conversion workspaces set iam policy projects](ProjectLocationConversionWorkspaceSetIamPolicyCall) (request)
2878/// * [locations migration jobs objects set iam policy projects](ProjectLocationMigrationJobObjectSetIamPolicyCall) (request)
2879/// * [locations migration jobs set iam policy projects](ProjectLocationMigrationJobSetIamPolicyCall) (request)
2880/// * [locations private connections set iam policy projects](ProjectLocationPrivateConnectionSetIamPolicyCall) (request)
2881#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2882#[serde_with::serde_as]
2883#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2884pub struct SetIamPolicyRequest {
2885 /// 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.
2886 pub policy: Option<Policy>,
2887 /// 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"`
2888 #[serde(rename = "updateMask")]
2889 pub update_mask: Option<common::FieldMask>,
2890}
2891
2892impl common::RequestValue for SetIamPolicyRequest {}
2893
2894/// 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.
2895///
2896/// This type is not used in any activity, and only used as *part* of another schema.
2897///
2898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2899#[serde_with::serde_as]
2900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2901pub struct SetTablePrimaryKey {
2902 /// Optional. Name for the primary key
2903 #[serde(rename = "primaryKey")]
2904 pub primary_key: Option<String>,
2905 /// Required. List of column names for the primary key
2906 #[serde(rename = "primaryKeyColumns")]
2907 pub primary_key_columns: Option<Vec<String>>,
2908}
2909
2910impl common::Part for SetTablePrimaryKey {}
2911
2912/// 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..
2913///
2914/// This type is not used in any activity, and only used as *part* of another schema.
2915///
2916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2917#[serde_with::serde_as]
2918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2919pub struct SingleColumnChange {
2920 /// Optional. Is the column of array type.
2921 pub array: Option<bool>,
2922 /// Optional. The length of the array, only relevant if the column type is an array.
2923 #[serde(rename = "arrayLength")]
2924 pub array_length: Option<i32>,
2925 /// Optional. Is the column auto-generated/identity.
2926 #[serde(rename = "autoGenerated")]
2927 pub auto_generated: Option<bool>,
2928 /// Optional. Charset override - instead of table level charset.
2929 pub charset: Option<String>,
2930 /// Optional. Collation override - instead of table level collation.
2931 pub collation: Option<String>,
2932 /// Optional. Comment associated with the column.
2933 pub comment: Option<String>,
2934 /// Optional. Custom engine specific features.
2935 #[serde(rename = "customFeatures")]
2936 pub custom_features: Option<HashMap<String, serde_json::Value>>,
2937 /// Optional. Column data type name.
2938 #[serde(rename = "dataType")]
2939 pub data_type: Option<String>,
2940 /// Optional. Column fractional seconds precision - e.g. 2 as in timestamp (2) - when relevant.
2941 #[serde(rename = "fractionalSecondsPrecision")]
2942 pub fractional_seconds_precision: Option<i32>,
2943 /// Optional. Column length - e.g. 50 as in varchar (50) - when relevant.
2944 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2945 pub length: Option<i64>,
2946 /// Optional. Is the column nullable.
2947 pub nullable: Option<bool>,
2948 /// Optional. Column precision - e.g. 8 as in double (8,2) - when relevant.
2949 pub precision: Option<i32>,
2950 /// Optional. Column scale - e.g. 2 as in double (8,2) - when relevant.
2951 pub scale: Option<i32>,
2952 /// Optional. Specifies the list of values allowed in the column.
2953 #[serde(rename = "setValues")]
2954 pub set_values: Option<Vec<String>>,
2955 /// Optional. Is the column a UDT (User-defined Type).
2956 pub udt: Option<bool>,
2957}
2958
2959impl common::Part for SingleColumnChange {}
2960
2961/// 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
2962///
2963/// This type is not used in any activity, and only used as *part* of another schema.
2964///
2965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2966#[serde_with::serde_as]
2967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2968pub struct SingleEntityRename {
2969 /// Required. The new name of the destination entity
2970 #[serde(rename = "newName")]
2971 pub new_name: Option<String>,
2972}
2973
2974impl common::Part for SingleEntityRename {}
2975
2976/// 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
2977///
2978/// This type is not used in any activity, and only used as *part* of another schema.
2979///
2980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2981#[serde_with::serde_as]
2982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2983pub struct SinglePackageChange {
2984 /// Optional. Sql code for package body
2985 #[serde(rename = "packageBody")]
2986 pub package_body: Option<String>,
2987 /// Optional. Sql code for package description
2988 #[serde(rename = "packageDescription")]
2989 pub package_description: Option<String>,
2990}
2991
2992impl common::Part for SinglePackageChange {}
2993
2994/// Filter for fixed point number data types such as NUMERIC/NUMBER
2995///
2996/// This type is not used in any activity, and only used as *part* of another schema.
2997///
2998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2999#[serde_with::serde_as]
3000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3001pub struct SourceNumericFilter {
3002 /// Required. Enum to set the option defining the datatypes numeric filter has to be applied to
3003 #[serde(rename = "numericFilterOption")]
3004 pub numeric_filter_option: Option<String>,
3005 /// Optional. The filter will match columns with precision smaller than or equal to this number.
3006 #[serde(rename = "sourceMaxPrecisionFilter")]
3007 pub source_max_precision_filter: Option<i32>,
3008 /// Optional. The filter will match columns with scale smaller than or equal to this number.
3009 #[serde(rename = "sourceMaxScaleFilter")]
3010 pub source_max_scale_filter: Option<i32>,
3011 /// Optional. The filter will match columns with precision greater than or equal to this number.
3012 #[serde(rename = "sourceMinPrecisionFilter")]
3013 pub source_min_precision_filter: Option<i32>,
3014 /// Optional. The filter will match columns with scale greater than or equal to this number.
3015 #[serde(rename = "sourceMinScaleFilter")]
3016 pub source_min_scale_filter: Option<i32>,
3017}
3018
3019impl common::Part for SourceNumericFilter {}
3020
3021/// Config for a single migration job object.
3022///
3023/// This type is not used in any activity, and only used as *part* of another schema.
3024///
3025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3026#[serde_with::serde_as]
3027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3028pub struct SourceObjectConfig {
3029 /// Optional. The object identifier.
3030 #[serde(rename = "objectIdentifier")]
3031 pub object_identifier: Option<SourceObjectIdentifier>,
3032}
3033
3034impl common::Part for SourceObjectConfig {}
3035
3036/// An identifier for the Migration Job Object.
3037///
3038/// This type is not used in any activity, and only used as *part* of another schema.
3039///
3040#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3041#[serde_with::serde_as]
3042#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3043pub struct SourceObjectIdentifier {
3044 /// Optional. The database name. This will be required only if the object uses a database name as part of its unique identifier.
3045 pub database: Option<String>,
3046 /// Optional. The schema name. This will be required only if the object uses a schema name as part of its unique identifier.
3047 pub schema: Option<String>,
3048 /// Optional. The table name. This will be required only if the object is a level below database or schema.
3049 pub table: Option<String>,
3050 /// Required. The type of the migration job object.
3051 #[serde(rename = "type")]
3052 pub type_: Option<String>,
3053}
3054
3055impl common::Part for SourceObjectIdentifier {}
3056
3057/// List of configurations for the source objects to be migrated.
3058///
3059/// This type is not used in any activity, and only used as *part* of another schema.
3060///
3061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3062#[serde_with::serde_as]
3063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3064pub struct SourceObjectsConfig {
3065 /// Optional. The list of the objects to be migrated.
3066 #[serde(rename = "objectConfigs")]
3067 pub object_configs: Option<Vec<SourceObjectConfig>>,
3068 /// Optional. The objects selection type of the migration job.
3069 #[serde(rename = "objectsSelectionType")]
3070 pub objects_selection_type: Option<String>,
3071}
3072
3073impl common::Part for SourceObjectsConfig {}
3074
3075/// 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
3076///
3077/// This type is not used in any activity, and only used as *part* of another schema.
3078///
3079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3080#[serde_with::serde_as]
3081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3082pub struct SourceSqlChange {
3083 /// Required. Sql code for source (stored procedure, function, trigger or view)
3084 #[serde(rename = "sqlCode")]
3085 pub sql_code: Option<String>,
3086}
3087
3088impl common::Part for SourceSqlChange {}
3089
3090/// Filter for text-based data types like varchar.
3091///
3092/// This type is not used in any activity, and only used as *part* of another schema.
3093///
3094#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3095#[serde_with::serde_as]
3096#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3097pub struct SourceTextFilter {
3098 /// Optional. The filter will match columns with length smaller than or equal to this number.
3099 #[serde(rename = "sourceMaxLengthFilter")]
3100 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3101 pub source_max_length_filter: Option<i64>,
3102 /// Optional. The filter will match columns with length greater than or equal to this number.
3103 #[serde(rename = "sourceMinLengthFilter")]
3104 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3105 pub source_min_length_filter: Option<i64>,
3106}
3107
3108impl common::Part for SourceTextFilter {}
3109
3110/// An entry for an Access Control list.
3111///
3112/// This type is not used in any activity, and only used as *part* of another schema.
3113///
3114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3115#[serde_with::serde_as]
3116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3117pub struct SqlAclEntry {
3118 /// 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`.
3119 #[serde(rename = "expireTime")]
3120 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3121 /// A label to identify this entry.
3122 pub label: Option<String>,
3123 /// Input only. The time-to-leave of this access control entry.
3124 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3125 pub ttl: Option<chrono::Duration>,
3126 /// The allowlisted value for the access control list.
3127 pub value: Option<String>,
3128}
3129
3130impl common::Part for SqlAclEntry {}
3131
3132/// IP Management configuration.
3133///
3134/// This type is not used in any activity, and only used as *part* of another schema.
3135///
3136#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3137#[serde_with::serde_as]
3138#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3139pub struct SqlIpConfig {
3140 /// 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.
3141 #[serde(rename = "allocatedIpRange")]
3142 pub allocated_ip_range: Option<String>,
3143 /// 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`).
3144 #[serde(rename = "authorizedNetworks")]
3145 pub authorized_networks: Option<Vec<SqlAclEntry>>,
3146 /// Whether the instance should be assigned an IPv4 address or not.
3147 #[serde(rename = "enableIpv4")]
3148 pub enable_ipv4: Option<bool>,
3149 /// 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.
3150 #[serde(rename = "privateNetwork")]
3151 pub private_network: Option<String>,
3152 /// Whether SSL connections over IP should be enforced or not.
3153 #[serde(rename = "requireSsl")]
3154 pub require_ssl: Option<bool>,
3155}
3156
3157impl common::Part for SqlIpConfig {}
3158
3159/// Specifies the backup details in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
3160///
3161/// This type is not used in any activity, and only used as *part* of another schema.
3162///
3163#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3164#[serde_with::serde_as]
3165#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3166pub struct SqlServerBackups {
3167 /// Required. The Cloud Storage bucket that stores backups for all replicated databases.
3168 #[serde(rename = "gcsBucket")]
3169 pub gcs_bucket: Option<String>,
3170 /// Optional. Cloud Storage path inside the bucket that stores backups.
3171 #[serde(rename = "gcsPrefix")]
3172 pub gcs_prefix: Option<String>,
3173}
3174
3175impl common::Part for SqlServerBackups {}
3176
3177/// Specifies connection parameters required specifically for SQL Server databases.
3178///
3179/// This type is not used in any activity, and only used as *part* of another schema.
3180///
3181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3182#[serde_with::serde_as]
3183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3184pub struct SqlServerConnectionProfile {
3185 /// The backup details in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
3186 pub backups: Option<SqlServerBackups>,
3187 /// If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source.
3188 #[serde(rename = "cloudSqlId")]
3189 pub cloud_sql_id: Option<String>,
3190 /// Optional. The project id of the Cloud SQL instance. If not provided, the project id of the connection profile will be used.
3191 #[serde(rename = "cloudSqlProjectId")]
3192 pub cloud_sql_project_id: Option<String>,
3193 /// Required. The name of the specific database within the host.
3194 pub database: Option<String>,
3195 /// Optional. The Database Mirroring (DBM) port of the source SQL Server instance.
3196 #[serde(rename = "dbmPort")]
3197 pub dbm_port: Option<i32>,
3198 /// Forward SSH tunnel connectivity.
3199 #[serde(rename = "forwardSshConnectivity")]
3200 pub forward_ssh_connectivity: Option<ForwardSshTunnelConnectivity>,
3201 /// Required. The IP or hostname of the source SQL Server database.
3202 pub host: Option<String>,
3203 /// 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.
3204 pub password: Option<String>,
3205 /// Output only. Indicates whether a new password is included in the request.
3206 #[serde(rename = "passwordSet")]
3207 pub password_set: Option<bool>,
3208 /// Required. The network port of the source SQL Server database.
3209 pub port: Option<i32>,
3210 /// Private connectivity.
3211 #[serde(rename = "privateConnectivity")]
3212 pub private_connectivity: Option<PrivateConnectivity>,
3213 /// Private Service Connect connectivity.
3214 #[serde(rename = "privateServiceConnectConnectivity")]
3215 pub private_service_connect_connectivity: Option<PrivateServiceConnectConnectivity>,
3216 /// SSL configuration for the destination to connect to the source database.
3217 pub ssl: Option<SslConfig>,
3218 /// Static IP connectivity data (default, no additional details needed).
3219 #[serde(rename = "staticIpConnectivity")]
3220 pub static_ip_connectivity: Option<StaticIpConnectivity>,
3221 /// Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service.
3222 pub username: Option<String>,
3223}
3224
3225impl common::Part for SqlServerConnectionProfile {}
3226
3227/// Configuration for distributed availability group (DAG) for the SQL Server homogeneous migration.
3228///
3229/// This type is not used in any activity, and only used as *part* of another schema.
3230///
3231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3232#[serde_with::serde_as]
3233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3234pub struct SqlServerDagConfig {
3235 /// Required. The name of the linked server that points to the source SQL Server instance. Only used by DAG migrations.
3236 #[serde(rename = "linkedServer")]
3237 pub linked_server: Option<String>,
3238 /// Required. The name of the source availability group. Only used by DAG migrations.
3239 #[serde(rename = "sourceAg")]
3240 pub source_ag: Option<String>,
3241}
3242
3243impl common::Part for SqlServerDagConfig {}
3244
3245/// Specifies the backup details for a single database in Cloud Storage for homogeneous migration to Cloud SQL for SQL Server.
3246///
3247/// This type is not used in any activity, and only used as *part* of another schema.
3248///
3249#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3250#[serde_with::serde_as]
3251#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3252pub struct SqlServerDatabaseBackup {
3253 /// Required. Name of a SQL Server database for which to define backup configuration.
3254 pub database: Option<String>,
3255 /// 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.
3256 #[serde(rename = "encryptionOptions")]
3257 pub encryption_options: Option<SqlServerEncryptionOptions>,
3258}
3259
3260impl common::Part for SqlServerDatabaseBackup {}
3261
3262/// Encryption settings for the SQL Server database.
3263///
3264/// This type is not used in any activity, and only used as *part* of another schema.
3265///
3266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3267#[serde_with::serde_as]
3268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3269pub struct SqlServerEncryptionOptions {
3270 /// Required. Path to the Certificate (.cer) in Cloud Storage, in the form `gs://bucketName/fileName`. The instance must have write permissions to the bucket and read access to the file.
3271 #[serde(rename = "certPath")]
3272 pub cert_path: Option<String>,
3273 /// Required. Input only. Password that encrypts the private key.
3274 #[serde(rename = "pvkPassword")]
3275 pub pvk_password: Option<String>,
3276 /// Required. Path to the Certificate Private Key (.pvk) in Cloud Storage, in the form `gs://bucketName/fileName`. The instance must have write permissions to the bucket and read access to the file.
3277 #[serde(rename = "pvkPath")]
3278 pub pvk_path: Option<String>,
3279}
3280
3281impl common::Part for SqlServerEncryptionOptions {}
3282
3283/// Configuration for homogeneous migration to Cloud SQL for SQL Server.
3284///
3285/// This type is not used in any activity, and only used as *part* of another schema.
3286///
3287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3288#[serde_with::serde_as]
3289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3290pub struct SqlServerHomogeneousMigrationJobConfig {
3291 /// 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
3292 #[serde(rename = "backupFilePattern")]
3293 pub backup_file_pattern: Option<String>,
3294 /// Optional. Configuration for distributed availability group (DAG) for the SQL Server homogeneous migration.
3295 #[serde(rename = "dagConfig")]
3296 pub dag_config: Option<SqlServerDagConfig>,
3297 /// Required. Backup details per database in Cloud Storage.
3298 #[serde(rename = "databaseBackups")]
3299 pub database_backups: Option<Vec<SqlServerDatabaseBackup>>,
3300 /// Optional. Promote databases when ready.
3301 #[serde(rename = "promoteWhenReady")]
3302 pub promote_when_ready: Option<bool>,
3303 /// Optional. Enable differential backups.
3304 #[serde(rename = "useDiffBackup")]
3305 pub use_diff_backup: Option<bool>,
3306}
3307
3308impl common::Part for SqlServerHomogeneousMigrationJobConfig {}
3309
3310/// Configuration for SQL Server as a source in a migration.
3311///
3312/// This type is not used in any activity, and only used as *part* of another schema.
3313///
3314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3315#[serde_with::serde_as]
3316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3317pub struct SqlServerSourceConfig {
3318 /// Optional. The log sequence number (LSN) to start CDC data migration from.
3319 #[serde(rename = "cdcStartPosition")]
3320 pub cdc_start_position: Option<String>,
3321 /// Optional. Maximum number of connections Database Migration Service will open to the source for CDC phase.
3322 #[serde(rename = "maxConcurrentCdcConnections")]
3323 pub max_concurrent_cdc_connections: Option<i32>,
3324 /// Optional. Maximum number of connections Database Migration Service will open to the source for full dump phase.
3325 #[serde(rename = "maxConcurrentFullDumpConnections")]
3326 pub max_concurrent_full_dump_connections: Option<i32>,
3327 /// Optional. Whether to skip full dump or not.
3328 #[serde(rename = "skipFullDump")]
3329 pub skip_full_dump: Option<bool>,
3330}
3331
3332impl common::Part for SqlServerSourceConfig {}
3333
3334/// Configuration for heterogeneous **SQL Server to Cloud SQL for PostgreSQL** migrations.
3335///
3336/// This type is not used in any activity, and only used as *part* of another schema.
3337///
3338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3339#[serde_with::serde_as]
3340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3341pub struct SqlServerToPostgresConfig {
3342 /// Optional. Configuration for Postgres destination.
3343 #[serde(rename = "postgresDestinationConfig")]
3344 pub postgres_destination_config: Option<PostgresDestinationConfig>,
3345 /// Optional. Configuration for SQL Server source.
3346 #[serde(rename = "sqlserverSourceConfig")]
3347 pub sqlserver_source_config: Option<SqlServerSourceConfig>,
3348}
3349
3350impl common::Part for SqlServerToPostgresConfig {}
3351
3352/// Response message for ‘GenerateSshScript’ request.
3353///
3354/// # Activities
3355///
3356/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3357/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3358///
3359/// * [locations migration jobs generate ssh script projects](ProjectLocationMigrationJobGenerateSshScriptCall) (response)
3360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3361#[serde_with::serde_as]
3362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3363pub struct SshScript {
3364 /// The ssh configuration script.
3365 pub script: Option<String>,
3366}
3367
3368impl common::ResponseResult for SshScript {}
3369
3370/// SSL configuration information.
3371///
3372/// This type is not used in any activity, and only used as *part* of another schema.
3373///
3374#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3375#[serde_with::serde_as]
3376#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3377pub struct SslConfig {
3378 /// 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.
3379 #[serde(rename = "caCertificate")]
3380 pub ca_certificate: Option<String>,
3381 /// 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.
3382 #[serde(rename = "clientCertificate")]
3383 pub client_certificate: Option<String>,
3384 /// 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.
3385 #[serde(rename = "clientKey")]
3386 pub client_key: Option<String>,
3387 /// Optional. SSL flags used for establishing SSL connection to the source database. Only source specific flags are supported. An object containing a list of "key": "value" pairs. Example: { "server_certificate_hostname": "server.com"}.
3388 #[serde(rename = "sslFlags")]
3389 pub ssl_flags: Option<HashMap<String, String>>,
3390 /// Optional. The ssl config type according to 'client_key', 'client_certificate' and 'ca_certificate'.
3391 #[serde(rename = "type")]
3392 pub type_: Option<String>,
3393}
3394
3395impl common::Part for SslConfig {}
3396
3397/// Request message for ‘StartMigrationJob’ request.
3398///
3399/// # Activities
3400///
3401/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3402/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3403///
3404/// * [locations migration jobs start projects](ProjectLocationMigrationJobStartCall) (request)
3405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3406#[serde_with::serde_as]
3407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3408pub struct StartMigrationJobRequest {
3409 /// Optional. Start the migration job without running prior configuration verification. Defaults to `false`.
3410 #[serde(rename = "skipValidation")]
3411 pub skip_validation: Option<bool>,
3412}
3413
3414impl common::RequestValue for StartMigrationJobRequest {}
3415
3416/// 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.
3417///
3418/// This type is not used in any activity, and only used as *part* of another schema.
3419///
3420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3421#[serde_with::serde_as]
3422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3423pub struct StaticIpConnectivity {
3424 _never_set: Option<bool>,
3425}
3426
3427impl common::Part for StaticIpConnectivity {}
3428
3429/// Static IP address connectivity configured on service project.
3430///
3431/// This type is not used in any activity, and only used as *part* of another schema.
3432///
3433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3434#[serde_with::serde_as]
3435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3436pub struct StaticServiceIpConnectivity {
3437 _never_set: Option<bool>,
3438}
3439
3440impl common::Part for StaticServiceIpConnectivity {}
3441
3442/// 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).
3443///
3444/// This type is not used in any activity, and only used as *part* of another schema.
3445///
3446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3447#[serde_with::serde_as]
3448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3449pub struct Status {
3450 /// The status code, which should be an enum value of google.rpc.Code.
3451 pub code: Option<i32>,
3452 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3453 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3454 /// 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.
3455 pub message: Option<String>,
3456}
3457
3458impl common::Part for Status {}
3459
3460/// Request message for ‘StopMigrationJob’ request.
3461///
3462/// # Activities
3463///
3464/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3465/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3466///
3467/// * [locations migration jobs stop projects](ProjectLocationMigrationJobStopCall) (request)
3468#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3469#[serde_with::serde_as]
3470#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3471pub struct StopMigrationJobRequest {
3472 _never_set: Option<bool>,
3473}
3474
3475impl common::RequestValue for StopMigrationJobRequest {}
3476
3477/// Stored procedure's parent is a schema.
3478///
3479/// This type is not used in any activity, and only used as *part* of another schema.
3480///
3481#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3482#[serde_with::serde_as]
3483#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3484pub struct StoredProcedureEntity {
3485 /// Custom engine specific features.
3486 #[serde(rename = "customFeatures")]
3487 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3488 /// The SQL code which creates the stored procedure.
3489 #[serde(rename = "sqlCode")]
3490 pub sql_code: Option<String>,
3491}
3492
3493impl common::Part for StoredProcedureEntity {}
3494
3495/// Synonym's parent is a schema.
3496///
3497/// This type is not used in any activity, and only used as *part* of another schema.
3498///
3499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3500#[serde_with::serde_as]
3501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3502pub struct SynonymEntity {
3503 /// Custom engine specific features.
3504 #[serde(rename = "customFeatures")]
3505 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3506 /// The name of the entity for which the synonym is being created (the source).
3507 #[serde(rename = "sourceEntity")]
3508 pub source_entity: Option<String>,
3509 /// The type of the entity for which the synonym is being created (usually a table or a sequence).
3510 #[serde(rename = "sourceType")]
3511 pub source_type: Option<String>,
3512}
3513
3514impl common::Part for SynonymEntity {}
3515
3516/// Table's parent is a schema.
3517///
3518/// This type is not used in any activity, and only used as *part* of another schema.
3519///
3520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3521#[serde_with::serde_as]
3522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3523pub struct TableEntity {
3524 /// Table columns.
3525 pub columns: Option<Vec<ColumnEntity>>,
3526 /// Comment associated with the table.
3527 pub comment: Option<String>,
3528 /// Table constraints.
3529 pub constraints: Option<Vec<ConstraintEntity>>,
3530 /// Custom engine specific features.
3531 #[serde(rename = "customFeatures")]
3532 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3533 /// Table indices.
3534 pub indices: Option<Vec<IndexEntity>>,
3535 /// Table triggers.
3536 pub triggers: Option<Vec<TriggerEntity>>,
3537}
3538
3539impl common::Part for TableEntity {}
3540
3541/// Response message for ‘GenerateTcpProxyScript’ request.
3542///
3543/// # Activities
3544///
3545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3547///
3548/// * [locations migration jobs generate tcp proxy script projects](ProjectLocationMigrationJobGenerateTcpProxyScriptCall) (response)
3549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3550#[serde_with::serde_as]
3551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3552pub struct TcpProxyScript {
3553 /// The TCP Proxy configuration script.
3554 pub script: Option<String>,
3555}
3556
3557impl common::ResponseResult for TcpProxyScript {}
3558
3559/// Request message for `TestIamPermissions` method.
3560///
3561/// # Activities
3562///
3563/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3564/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3565///
3566/// * [locations connection profiles test iam permissions projects](ProjectLocationConnectionProfileTestIamPermissionCall) (request)
3567/// * [locations conversion workspaces test iam permissions projects](ProjectLocationConversionWorkspaceTestIamPermissionCall) (request)
3568/// * [locations migration jobs objects test iam permissions projects](ProjectLocationMigrationJobObjectTestIamPermissionCall) (request)
3569/// * [locations migration jobs test iam permissions projects](ProjectLocationMigrationJobTestIamPermissionCall) (request)
3570/// * [locations private connections test iam permissions projects](ProjectLocationPrivateConnectionTestIamPermissionCall) (request)
3571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3572#[serde_with::serde_as]
3573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3574pub struct TestIamPermissionsRequest {
3575 /// 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).
3576 pub permissions: Option<Vec<String>>,
3577}
3578
3579impl common::RequestValue for TestIamPermissionsRequest {}
3580
3581/// Response message for `TestIamPermissions` method.
3582///
3583/// # Activities
3584///
3585/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3586/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3587///
3588/// * [locations connection profiles test iam permissions projects](ProjectLocationConnectionProfileTestIamPermissionCall) (response)
3589/// * [locations conversion workspaces test iam permissions projects](ProjectLocationConversionWorkspaceTestIamPermissionCall) (response)
3590/// * [locations migration jobs objects test iam permissions projects](ProjectLocationMigrationJobObjectTestIamPermissionCall) (response)
3591/// * [locations migration jobs test iam permissions projects](ProjectLocationMigrationJobTestIamPermissionCall) (response)
3592/// * [locations private connections test iam permissions projects](ProjectLocationPrivateConnectionTestIamPermissionCall) (response)
3593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3594#[serde_with::serde_as]
3595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3596pub struct TestIamPermissionsResponse {
3597 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3598 pub permissions: Option<Vec<String>>,
3599}
3600
3601impl common::ResponseResult for TestIamPermissionsResponse {}
3602
3603/// Trigger is not used as an independent entity, it is retrieved as part of a Table entity.
3604///
3605/// This type is not used in any activity, and only used as *part* of another schema.
3606///
3607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3608#[serde_with::serde_as]
3609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3610pub struct TriggerEntity {
3611 /// Custom engine specific features.
3612 #[serde(rename = "customFeatures")]
3613 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3614 /// The name of the trigger.
3615 pub name: Option<String>,
3616 /// The SQL code which creates the trigger.
3617 #[serde(rename = "sqlCode")]
3618 pub sql_code: Option<String>,
3619 /// Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH ROW.
3620 #[serde(rename = "triggerType")]
3621 pub trigger_type: Option<String>,
3622 /// The DML, DDL, or database events that fire the trigger, for example INSERT, UPDATE.
3623 #[serde(rename = "triggeringEvents")]
3624 pub triggering_events: Option<Vec<String>>,
3625}
3626
3627impl common::Part for TriggerEntity {}
3628
3629/// UDT's parent is a schema.
3630///
3631/// This type is not used in any activity, and only used as *part* of another schema.
3632///
3633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3634#[serde_with::serde_as]
3635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3636pub struct UDTEntity {
3637 /// Custom engine specific features.
3638 #[serde(rename = "customFeatures")]
3639 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3640 /// The SQL code which creates the udt body.
3641 #[serde(rename = "udtBody")]
3642 pub udt_body: Option<String>,
3643 /// The SQL code which creates the udt.
3644 #[serde(rename = "udtSqlCode")]
3645 pub udt_sql_code: Option<String>,
3646}
3647
3648impl common::Part for UDTEntity {}
3649
3650/// The username/password for a database user. Used for specifying initial users at cluster creation time.
3651///
3652/// This type is not used in any activity, and only used as *part* of another schema.
3653///
3654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3655#[serde_with::serde_as]
3656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3657pub struct UserPassword {
3658 /// The initial password for the user.
3659 pub password: Option<String>,
3660 /// Output only. Indicates if the initial_user.password field has been set.
3661 #[serde(rename = "passwordSet")]
3662 pub password_set: Option<bool>,
3663 /// The database username.
3664 pub user: Option<String>,
3665}
3666
3667impl common::Part for UserPassword {}
3668
3669/// A list of values to filter by in ConditionalColumnSetValue
3670///
3671/// This type is not used in any activity, and only used as *part* of another schema.
3672///
3673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3674#[serde_with::serde_as]
3675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3676pub struct ValueListFilter {
3677 /// Required. Whether to ignore case when filtering by values. Defaults to false
3678 #[serde(rename = "ignoreCase")]
3679 pub ignore_case: Option<bool>,
3680 /// Required. Indicates whether the filter matches rows with values that are present in the list or those with values not present in it.
3681 #[serde(rename = "valuePresentList")]
3682 pub value_present_list: Option<String>,
3683 /// Required. The list to be used to filter by
3684 pub values: Option<Vec<String>>,
3685}
3686
3687impl common::Part for ValueListFilter {}
3688
3689/// Description of data transformation during migration as part of the ConditionalColumnSetValue.
3690///
3691/// This type is not used in any activity, and only used as *part* of another schema.
3692///
3693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3694#[serde_with::serde_as]
3695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3696pub struct ValueTransformation {
3697 /// Optional. Applies a hash function on the data
3698 #[serde(rename = "applyHash")]
3699 pub apply_hash: Option<ApplyHash>,
3700 /// Optional. Set to max_value - if integer or numeric, will use int.maxvalue, etc
3701 #[serde(rename = "assignMaxValue")]
3702 pub assign_max_value: Option<Empty>,
3703 /// Optional. Set to min_value - if integer or numeric, will use int.minvalue, etc
3704 #[serde(rename = "assignMinValue")]
3705 pub assign_min_value: Option<Empty>,
3706 /// Optional. Set to null
3707 #[serde(rename = "assignNull")]
3708 pub assign_null: Option<Empty>,
3709 /// Optional. Set to a specific value (value is converted to fit the target data type)
3710 #[serde(rename = "assignSpecificValue")]
3711 pub assign_specific_value: Option<AssignSpecificValue>,
3712 /// Optional. Filter on relation between source value and compare value of type double.
3713 #[serde(rename = "doubleComparison")]
3714 pub double_comparison: Option<DoubleComparisonFilter>,
3715 /// Optional. Filter on relation between source value and compare value of type integer.
3716 #[serde(rename = "intComparison")]
3717 pub int_comparison: Option<IntComparisonFilter>,
3718 /// Optional. Value is null
3719 #[serde(rename = "isNull")]
3720 pub is_null: Option<Empty>,
3721 /// Optional. Allows the data to change scale
3722 #[serde(rename = "roundScale")]
3723 pub round_scale: Option<RoundToScale>,
3724 /// Optional. Value is found in the specified list.
3725 #[serde(rename = "valueList")]
3726 pub value_list: Option<ValueListFilter>,
3727}
3728
3729impl common::Part for ValueTransformation {}
3730
3731/// Request message for ‘VerifyMigrationJob’ request.
3732///
3733/// # Activities
3734///
3735/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3736/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3737///
3738/// * [locations migration jobs verify projects](ProjectLocationMigrationJobVerifyCall) (request)
3739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3740#[serde_with::serde_as]
3741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3742pub struct VerifyMigrationJobRequest {
3743 /// Optional. The changed migration job parameters to verify. It will not update the migration job.
3744 #[serde(rename = "migrationJob")]
3745 pub migration_job: Option<MigrationJob>,
3746 /// Optional. Field mask is used to specify the changed fields to be verified. It will not update the migration job.
3747 #[serde(rename = "updateMask")]
3748 pub update_mask: Option<common::FieldMask>,
3749}
3750
3751impl common::RequestValue for VerifyMigrationJobRequest {}
3752
3753/// View's parent is a schema.
3754///
3755/// This type is not used in any activity, and only used as *part* of another schema.
3756///
3757#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3758#[serde_with::serde_as]
3759#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3760pub struct ViewEntity {
3761 /// View constraints.
3762 pub constraints: Option<Vec<ConstraintEntity>>,
3763 /// Custom engine specific features.
3764 #[serde(rename = "customFeatures")]
3765 pub custom_features: Option<HashMap<String, serde_json::Value>>,
3766 /// The SQL code which creates the view.
3767 #[serde(rename = "sqlCode")]
3768 pub sql_code: Option<String>,
3769}
3770
3771impl common::Part for ViewEntity {}
3772
3773/// VM creation configuration message
3774///
3775/// This type is not used in any activity, and only used as *part* of another schema.
3776///
3777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3778#[serde_with::serde_as]
3779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3780pub struct VmCreationConfig {
3781 /// The subnet name the vm needs to be created in.
3782 pub subnet: Option<String>,
3783 /// Required. VM instance machine type to create.
3784 #[serde(rename = "vmMachineType")]
3785 pub vm_machine_type: Option<String>,
3786 /// The Google Cloud Platform zone to create the VM in.
3787 #[serde(rename = "vmZone")]
3788 pub vm_zone: Option<String>,
3789}
3790
3791impl common::Part for VmCreationConfig {}
3792
3793/// VM selection configuration message
3794///
3795/// This type is not used in any activity, and only used as *part* of another schema.
3796///
3797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3798#[serde_with::serde_as]
3799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3800pub struct VmSelectionConfig {
3801 /// Required. The Google Cloud Platform zone the VM is located.
3802 #[serde(rename = "vmZone")]
3803 pub vm_zone: Option<String>,
3804}
3805
3806impl common::Part for VmSelectionConfig {}
3807
3808/// The VPC peering configuration is used to create VPC peering with the consumer's VPC.
3809///
3810/// This type is not used in any activity, and only used as *part* of another schema.
3811///
3812#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3813#[serde_with::serde_as]
3814#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3815pub struct VpcPeeringConfig {
3816 /// Required. A free subnet for peering. (CIDR of /29)
3817 pub subnet: Option<String>,
3818 /// Required. Fully qualified name of the VPC that Database Migration Service will peer to.
3819 #[serde(rename = "vpcName")]
3820 pub vpc_name: Option<String>,
3821}
3822
3823impl common::Part for VpcPeeringConfig {}
3824
3825/// 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.
3826///
3827/// This type is not used in any activity, and only used as *part* of another schema.
3828///
3829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3830#[serde_with::serde_as]
3831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3832pub struct VpcPeeringConnectivity {
3833 /// The name of the VPC network to peer with the Cloud SQL private network.
3834 pub vpc: Option<String>,
3835}
3836
3837impl common::Part for VpcPeeringConnectivity {}
3838
3839// ###################
3840// MethodBuilders ###
3841// #################
3842
3843/// A builder providing access to all methods supported on *project* resources.
3844/// It is not used directly, but through the [`DatabaseMigrationService`] hub.
3845///
3846/// # Example
3847///
3848/// Instantiate a resource builder
3849///
3850/// ```test_harness,no_run
3851/// extern crate hyper;
3852/// extern crate hyper_rustls;
3853/// extern crate google_datamigration1 as datamigration1;
3854///
3855/// # async fn dox() {
3856/// use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3857///
3858/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3859/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3860/// .with_native_roots()
3861/// .unwrap()
3862/// .https_only()
3863/// .enable_http2()
3864/// .build();
3865///
3866/// let executor = hyper_util::rt::TokioExecutor::new();
3867/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3868/// secret,
3869/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3870/// yup_oauth2::client::CustomHyperClientBuilder::from(
3871/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3872/// ),
3873/// ).build().await.unwrap();
3874///
3875/// let client = hyper_util::client::legacy::Client::builder(
3876/// hyper_util::rt::TokioExecutor::new()
3877/// )
3878/// .build(
3879/// hyper_rustls::HttpsConnectorBuilder::new()
3880/// .with_native_roots()
3881/// .unwrap()
3882/// .https_or_http()
3883/// .enable_http2()
3884/// .build()
3885/// );
3886/// let mut hub = DatabaseMigrationService::new(client, auth);
3887/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3888/// // 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_fetch_source_objects(...)`, `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_objects_get(...)`, `locations_migration_jobs_objects_get_iam_policy(...)`, `locations_migration_jobs_objects_list(...)`, `locations_migration_jobs_objects_lookup(...)`, `locations_migration_jobs_objects_set_iam_policy(...)`, `locations_migration_jobs_objects_test_iam_permissions(...)`, `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(...)`
3889/// // to build up your call.
3890/// let rb = hub.projects();
3891/// # }
3892/// ```
3893pub struct ProjectMethods<'a, C>
3894where
3895 C: 'a,
3896{
3897 hub: &'a DatabaseMigrationService<C>,
3898}
3899
3900impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3901
3902impl<'a, C> ProjectMethods<'a, C> {
3903 /// Create a builder to help you perform the following task:
3904 ///
3905 /// Creates a new connection profile in a given project and location.
3906 ///
3907 /// # Arguments
3908 ///
3909 /// * `request` - No description provided.
3910 /// * `parent` - Required. The parent which owns this collection of connection profiles.
3911 pub fn locations_connection_profiles_create(
3912 &self,
3913 request: ConnectionProfile,
3914 parent: &str,
3915 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
3916 ProjectLocationConnectionProfileCreateCall {
3917 hub: self.hub,
3918 _request: request,
3919 _parent: parent.to_string(),
3920 _validate_only: Default::default(),
3921 _skip_validation: Default::default(),
3922 _request_id: Default::default(),
3923 _connection_profile_id: Default::default(),
3924 _delegate: Default::default(),
3925 _additional_params: Default::default(),
3926 _scopes: Default::default(),
3927 }
3928 }
3929
3930 /// Create a builder to help you perform the following task:
3931 ///
3932 /// 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.
3933 ///
3934 /// # Arguments
3935 ///
3936 /// * `name` - Required. Name of the connection profile resource to delete.
3937 pub fn locations_connection_profiles_delete(
3938 &self,
3939 name: &str,
3940 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
3941 ProjectLocationConnectionProfileDeleteCall {
3942 hub: self.hub,
3943 _name: name.to_string(),
3944 _request_id: Default::default(),
3945 _force: Default::default(),
3946 _delegate: Default::default(),
3947 _additional_params: Default::default(),
3948 _scopes: Default::default(),
3949 }
3950 }
3951
3952 /// Create a builder to help you perform the following task:
3953 ///
3954 /// Gets details of a single connection profile.
3955 ///
3956 /// # Arguments
3957 ///
3958 /// * `name` - Required. Name of the connection profile resource to get.
3959 pub fn locations_connection_profiles_get(
3960 &self,
3961 name: &str,
3962 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
3963 ProjectLocationConnectionProfileGetCall {
3964 hub: self.hub,
3965 _name: name.to_string(),
3966 _delegate: Default::default(),
3967 _additional_params: Default::default(),
3968 _scopes: Default::default(),
3969 }
3970 }
3971
3972 /// Create a builder to help you perform the following task:
3973 ///
3974 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3975 ///
3976 /// # Arguments
3977 ///
3978 /// * `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.
3979 pub fn locations_connection_profiles_get_iam_policy(
3980 &self,
3981 resource: &str,
3982 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
3983 ProjectLocationConnectionProfileGetIamPolicyCall {
3984 hub: self.hub,
3985 _resource: resource.to_string(),
3986 _options_requested_policy_version: Default::default(),
3987 _delegate: Default::default(),
3988 _additional_params: Default::default(),
3989 _scopes: Default::default(),
3990 }
3991 }
3992
3993 /// Create a builder to help you perform the following task:
3994 ///
3995 /// Retrieves a list of all connection profiles in a given project and location.
3996 ///
3997 /// # Arguments
3998 ///
3999 /// * `parent` - Required. The parent which owns this collection of connection profiles.
4000 pub fn locations_connection_profiles_list(
4001 &self,
4002 parent: &str,
4003 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
4004 ProjectLocationConnectionProfileListCall {
4005 hub: self.hub,
4006 _parent: parent.to_string(),
4007 _page_token: Default::default(),
4008 _page_size: Default::default(),
4009 _order_by: Default::default(),
4010 _filter: Default::default(),
4011 _delegate: Default::default(),
4012 _additional_params: Default::default(),
4013 _scopes: Default::default(),
4014 }
4015 }
4016
4017 /// Create a builder to help you perform the following task:
4018 ///
4019 /// Update the configuration of a single connection profile.
4020 ///
4021 /// # Arguments
4022 ///
4023 /// * `request` - No description provided.
4024 /// * `name` - The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
4025 pub fn locations_connection_profiles_patch(
4026 &self,
4027 request: ConnectionProfile,
4028 name: &str,
4029 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
4030 ProjectLocationConnectionProfilePatchCall {
4031 hub: self.hub,
4032 _request: request,
4033 _name: name.to_string(),
4034 _validate_only: Default::default(),
4035 _update_mask: Default::default(),
4036 _skip_validation: Default::default(),
4037 _request_id: Default::default(),
4038 _delegate: Default::default(),
4039 _additional_params: Default::default(),
4040 _scopes: Default::default(),
4041 }
4042 }
4043
4044 /// Create a builder to help you perform the following task:
4045 ///
4046 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4047 ///
4048 /// # Arguments
4049 ///
4050 /// * `request` - No description provided.
4051 /// * `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.
4052 pub fn locations_connection_profiles_set_iam_policy(
4053 &self,
4054 request: SetIamPolicyRequest,
4055 resource: &str,
4056 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
4057 ProjectLocationConnectionProfileSetIamPolicyCall {
4058 hub: self.hub,
4059 _request: request,
4060 _resource: resource.to_string(),
4061 _delegate: Default::default(),
4062 _additional_params: Default::default(),
4063 _scopes: Default::default(),
4064 }
4065 }
4066
4067 /// Create a builder to help you perform the following task:
4068 ///
4069 /// 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.
4070 ///
4071 /// # Arguments
4072 ///
4073 /// * `request` - No description provided.
4074 /// * `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.
4075 pub fn locations_connection_profiles_test_iam_permissions(
4076 &self,
4077 request: TestIamPermissionsRequest,
4078 resource: &str,
4079 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
4080 ProjectLocationConnectionProfileTestIamPermissionCall {
4081 hub: self.hub,
4082 _request: request,
4083 _resource: resource.to_string(),
4084 _delegate: Default::default(),
4085 _additional_params: Default::default(),
4086 _scopes: Default::default(),
4087 }
4088 }
4089
4090 /// Create a builder to help you perform the following task:
4091 ///
4092 /// Creates a new mapping rule for a given conversion workspace.
4093 ///
4094 /// # Arguments
4095 ///
4096 /// * `request` - No description provided.
4097 /// * `parent` - Required. The parent which owns this collection of mapping rules.
4098 pub fn locations_conversion_workspaces_mapping_rules_create(
4099 &self,
4100 request: MappingRule,
4101 parent: &str,
4102 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
4103 ProjectLocationConversionWorkspaceMappingRuleCreateCall {
4104 hub: self.hub,
4105 _request: request,
4106 _parent: parent.to_string(),
4107 _request_id: Default::default(),
4108 _mapping_rule_id: Default::default(),
4109 _delegate: Default::default(),
4110 _additional_params: Default::default(),
4111 _scopes: Default::default(),
4112 }
4113 }
4114
4115 /// Create a builder to help you perform the following task:
4116 ///
4117 /// Deletes a single mapping rule.
4118 ///
4119 /// # Arguments
4120 ///
4121 /// * `name` - Required. Name of the mapping rule resource to delete.
4122 pub fn locations_conversion_workspaces_mapping_rules_delete(
4123 &self,
4124 name: &str,
4125 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
4126 ProjectLocationConversionWorkspaceMappingRuleDeleteCall {
4127 hub: self.hub,
4128 _name: name.to_string(),
4129 _request_id: Default::default(),
4130 _delegate: Default::default(),
4131 _additional_params: Default::default(),
4132 _scopes: Default::default(),
4133 }
4134 }
4135
4136 /// Create a builder to help you perform the following task:
4137 ///
4138 /// Gets the details of a mapping rule.
4139 ///
4140 /// # Arguments
4141 ///
4142 /// * `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
4143 pub fn locations_conversion_workspaces_mapping_rules_get(
4144 &self,
4145 name: &str,
4146 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
4147 ProjectLocationConversionWorkspaceMappingRuleGetCall {
4148 hub: self.hub,
4149 _name: name.to_string(),
4150 _delegate: Default::default(),
4151 _additional_params: Default::default(),
4152 _scopes: Default::default(),
4153 }
4154 }
4155
4156 /// Create a builder to help you perform the following task:
4157 ///
4158 /// Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files.
4159 ///
4160 /// # Arguments
4161 ///
4162 /// * `request` - No description provided.
4163 /// * `parent` - Required. Name of the conversion workspace resource to import the rules to in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4164 pub fn locations_conversion_workspaces_mapping_rules_import(
4165 &self,
4166 request: ImportMappingRulesRequest,
4167 parent: &str,
4168 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
4169 ProjectLocationConversionWorkspaceMappingRuleImportCall {
4170 hub: self.hub,
4171 _request: request,
4172 _parent: parent.to_string(),
4173 _delegate: Default::default(),
4174 _additional_params: Default::default(),
4175 _scopes: Default::default(),
4176 }
4177 }
4178
4179 /// Create a builder to help you perform the following task:
4180 ///
4181 /// Lists the mapping rules for a specific conversion workspace.
4182 ///
4183 /// # Arguments
4184 ///
4185 /// * `parent` - Required. Name of the conversion workspace resource whose mapping rules are listed in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4186 pub fn locations_conversion_workspaces_mapping_rules_list(
4187 &self,
4188 parent: &str,
4189 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
4190 ProjectLocationConversionWorkspaceMappingRuleListCall {
4191 hub: self.hub,
4192 _parent: parent.to_string(),
4193 _page_token: Default::default(),
4194 _page_size: Default::default(),
4195 _delegate: Default::default(),
4196 _additional_params: Default::default(),
4197 _scopes: Default::default(),
4198 }
4199 }
4200
4201 /// Create a builder to help you perform the following task:
4202 ///
4203 /// Applies draft tree onto a specific destination database.
4204 ///
4205 /// # Arguments
4206 ///
4207 /// * `request` - No description provided.
4208 /// * `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}.
4209 pub fn locations_conversion_workspaces_apply(
4210 &self,
4211 request: ApplyConversionWorkspaceRequest,
4212 name: &str,
4213 ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
4214 ProjectLocationConversionWorkspaceApplyCall {
4215 hub: self.hub,
4216 _request: request,
4217 _name: name.to_string(),
4218 _delegate: Default::default(),
4219 _additional_params: Default::default(),
4220 _scopes: Default::default(),
4221 }
4222 }
4223
4224 /// Create a builder to help you perform the following task:
4225 ///
4226 /// Marks all the data in the conversion workspace as committed.
4227 ///
4228 /// # Arguments
4229 ///
4230 /// * `request` - No description provided.
4231 /// * `name` - Required. Name of the conversion workspace resource to commit.
4232 pub fn locations_conversion_workspaces_commit(
4233 &self,
4234 request: CommitConversionWorkspaceRequest,
4235 name: &str,
4236 ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
4237 ProjectLocationConversionWorkspaceCommitCall {
4238 hub: self.hub,
4239 _request: request,
4240 _name: name.to_string(),
4241 _delegate: Default::default(),
4242 _additional_params: Default::default(),
4243 _scopes: Default::default(),
4244 }
4245 }
4246
4247 /// Create a builder to help you perform the following task:
4248 ///
4249 /// Creates a draft tree schema for the destination database.
4250 ///
4251 /// # Arguments
4252 ///
4253 /// * `request` - No description provided.
4254 /// * `name` - Name of the conversion workspace resource to convert in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4255 pub fn locations_conversion_workspaces_convert(
4256 &self,
4257 request: ConvertConversionWorkspaceRequest,
4258 name: &str,
4259 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
4260 ProjectLocationConversionWorkspaceConvertCall {
4261 hub: self.hub,
4262 _request: request,
4263 _name: name.to_string(),
4264 _delegate: Default::default(),
4265 _additional_params: Default::default(),
4266 _scopes: Default::default(),
4267 }
4268 }
4269
4270 /// Create a builder to help you perform the following task:
4271 ///
4272 /// Creates a new conversion workspace in a given project and location.
4273 ///
4274 /// # Arguments
4275 ///
4276 /// * `request` - No description provided.
4277 /// * `parent` - Required. The parent which owns this collection of conversion workspaces.
4278 pub fn locations_conversion_workspaces_create(
4279 &self,
4280 request: ConversionWorkspace,
4281 parent: &str,
4282 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
4283 ProjectLocationConversionWorkspaceCreateCall {
4284 hub: self.hub,
4285 _request: request,
4286 _parent: parent.to_string(),
4287 _request_id: Default::default(),
4288 _conversion_workspace_id: Default::default(),
4289 _delegate: Default::default(),
4290 _additional_params: Default::default(),
4291 _scopes: Default::default(),
4292 }
4293 }
4294
4295 /// Create a builder to help you perform the following task:
4296 ///
4297 /// Deletes a single conversion workspace.
4298 ///
4299 /// # Arguments
4300 ///
4301 /// * `name` - Required. Name of the conversion workspace resource to delete.
4302 pub fn locations_conversion_workspaces_delete(
4303 &self,
4304 name: &str,
4305 ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
4306 ProjectLocationConversionWorkspaceDeleteCall {
4307 hub: self.hub,
4308 _name: name.to_string(),
4309 _request_id: Default::default(),
4310 _force: Default::default(),
4311 _delegate: Default::default(),
4312 _additional_params: Default::default(),
4313 _scopes: Default::default(),
4314 }
4315 }
4316
4317 /// Create a builder to help you perform the following task:
4318 ///
4319 /// Retrieves a list of committed revisions of a specific conversion workspace.
4320 ///
4321 /// # Arguments
4322 ///
4323 /// * `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}.
4324 pub fn locations_conversion_workspaces_describe_conversion_workspace_revisions(
4325 &self,
4326 conversion_workspace: &str,
4327 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
4328 ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall {
4329 hub: self.hub,
4330 _conversion_workspace: conversion_workspace.to_string(),
4331 _commit_id: Default::default(),
4332 _delegate: Default::default(),
4333 _additional_params: Default::default(),
4334 _scopes: Default::default(),
4335 }
4336 }
4337
4338 /// Create a builder to help you perform the following task:
4339 ///
4340 /// 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.
4341 ///
4342 /// # Arguments
4343 ///
4344 /// * `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}.
4345 pub fn locations_conversion_workspaces_describe_database_entities(
4346 &self,
4347 conversion_workspace: &str,
4348 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
4349 ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall {
4350 hub: self.hub,
4351 _conversion_workspace: conversion_workspace.to_string(),
4352 _view: Default::default(),
4353 _uncommitted: Default::default(),
4354 _tree: Default::default(),
4355 _page_token: Default::default(),
4356 _page_size: Default::default(),
4357 _filter: Default::default(),
4358 _commit_id: Default::default(),
4359 _delegate: Default::default(),
4360 _additional_params: Default::default(),
4361 _scopes: Default::default(),
4362 }
4363 }
4364
4365 /// Create a builder to help you perform the following task:
4366 ///
4367 /// Gets details of a single conversion workspace.
4368 ///
4369 /// # Arguments
4370 ///
4371 /// * `name` - Required. Name of the conversion workspace resource to get.
4372 pub fn locations_conversion_workspaces_get(
4373 &self,
4374 name: &str,
4375 ) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
4376 ProjectLocationConversionWorkspaceGetCall {
4377 hub: self.hub,
4378 _name: name.to_string(),
4379 _delegate: Default::default(),
4380 _additional_params: Default::default(),
4381 _scopes: Default::default(),
4382 }
4383 }
4384
4385 /// Create a builder to help you perform the following task:
4386 ///
4387 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4388 ///
4389 /// # Arguments
4390 ///
4391 /// * `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.
4392 pub fn locations_conversion_workspaces_get_iam_policy(
4393 &self,
4394 resource: &str,
4395 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
4396 ProjectLocationConversionWorkspaceGetIamPolicyCall {
4397 hub: self.hub,
4398 _resource: resource.to_string(),
4399 _options_requested_policy_version: Default::default(),
4400 _delegate: Default::default(),
4401 _additional_params: Default::default(),
4402 _scopes: Default::default(),
4403 }
4404 }
4405
4406 /// Create a builder to help you perform the following task:
4407 ///
4408 /// Lists conversion workspaces in a given project and location.
4409 ///
4410 /// # Arguments
4411 ///
4412 /// * `parent` - Required. The parent which owns this collection of conversion workspaces.
4413 pub fn locations_conversion_workspaces_list(
4414 &self,
4415 parent: &str,
4416 ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
4417 ProjectLocationConversionWorkspaceListCall {
4418 hub: self.hub,
4419 _parent: parent.to_string(),
4420 _page_token: Default::default(),
4421 _page_size: Default::default(),
4422 _filter: Default::default(),
4423 _delegate: Default::default(),
4424 _additional_params: Default::default(),
4425 _scopes: Default::default(),
4426 }
4427 }
4428
4429 /// Create a builder to help you perform the following task:
4430 ///
4431 /// Updates the parameters of a single conversion workspace.
4432 ///
4433 /// # Arguments
4434 ///
4435 /// * `request` - No description provided.
4436 /// * `name` - Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4437 pub fn locations_conversion_workspaces_patch(
4438 &self,
4439 request: ConversionWorkspace,
4440 name: &str,
4441 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
4442 ProjectLocationConversionWorkspacePatchCall {
4443 hub: self.hub,
4444 _request: request,
4445 _name: name.to_string(),
4446 _update_mask: Default::default(),
4447 _request_id: Default::default(),
4448 _delegate: Default::default(),
4449 _additional_params: Default::default(),
4450 _scopes: Default::default(),
4451 }
4452 }
4453
4454 /// Create a builder to help you perform the following task:
4455 ///
4456 /// Rolls back a conversion workspace to the last committed snapshot.
4457 ///
4458 /// # Arguments
4459 ///
4460 /// * `request` - No description provided.
4461 /// * `name` - Required. Name of the conversion workspace resource to roll back to.
4462 pub fn locations_conversion_workspaces_rollback(
4463 &self,
4464 request: RollbackConversionWorkspaceRequest,
4465 name: &str,
4466 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
4467 ProjectLocationConversionWorkspaceRollbackCall {
4468 hub: self.hub,
4469 _request: request,
4470 _name: name.to_string(),
4471 _delegate: Default::default(),
4472 _additional_params: Default::default(),
4473 _scopes: Default::default(),
4474 }
4475 }
4476
4477 /// Create a builder to help you perform the following task:
4478 ///
4479 /// 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.
4480 ///
4481 /// # Arguments
4482 ///
4483 /// * `conversionWorkspace` - Required. Name of the conversion workspace resource whose jobs are listed, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4484 pub fn locations_conversion_workspaces_search_background_jobs(
4485 &self,
4486 conversion_workspace: &str,
4487 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
4488 ProjectLocationConversionWorkspaceSearchBackgroundJobCall {
4489 hub: self.hub,
4490 _conversion_workspace: conversion_workspace.to_string(),
4491 _return_most_recent_per_job_type: Default::default(),
4492 _max_size: Default::default(),
4493 _completed_until_time: Default::default(),
4494 _delegate: Default::default(),
4495 _additional_params: Default::default(),
4496 _scopes: Default::default(),
4497 }
4498 }
4499
4500 /// Create a builder to help you perform the following task:
4501 ///
4502 /// Imports a snapshot of the source database into the conversion workspace.
4503 ///
4504 /// # Arguments
4505 ///
4506 /// * `request` - No description provided.
4507 /// * `name` - Name of the conversion workspace resource to seed with new database structure, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
4508 pub fn locations_conversion_workspaces_seed(
4509 &self,
4510 request: SeedConversionWorkspaceRequest,
4511 name: &str,
4512 ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
4513 ProjectLocationConversionWorkspaceSeedCall {
4514 hub: self.hub,
4515 _request: request,
4516 _name: name.to_string(),
4517 _delegate: Default::default(),
4518 _additional_params: Default::default(),
4519 _scopes: Default::default(),
4520 }
4521 }
4522
4523 /// Create a builder to help you perform the following task:
4524 ///
4525 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4526 ///
4527 /// # Arguments
4528 ///
4529 /// * `request` - No description provided.
4530 /// * `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.
4531 pub fn locations_conversion_workspaces_set_iam_policy(
4532 &self,
4533 request: SetIamPolicyRequest,
4534 resource: &str,
4535 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
4536 ProjectLocationConversionWorkspaceSetIamPolicyCall {
4537 hub: self.hub,
4538 _request: request,
4539 _resource: resource.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 /// 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.
4549 ///
4550 /// # Arguments
4551 ///
4552 /// * `request` - No description provided.
4553 /// * `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.
4554 pub fn locations_conversion_workspaces_test_iam_permissions(
4555 &self,
4556 request: TestIamPermissionsRequest,
4557 resource: &str,
4558 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
4559 ProjectLocationConversionWorkspaceTestIamPermissionCall {
4560 hub: self.hub,
4561 _request: request,
4562 _resource: resource.to_string(),
4563 _delegate: Default::default(),
4564 _additional_params: Default::default(),
4565 _scopes: Default::default(),
4566 }
4567 }
4568
4569 /// Create a builder to help you perform the following task:
4570 ///
4571 /// Use this method to get details about a migration job object.
4572 ///
4573 /// # Arguments
4574 ///
4575 /// * `name` - Required. The name of the migration job object resource to get.
4576 pub fn locations_migration_jobs_objects_get(
4577 &self,
4578 name: &str,
4579 ) -> ProjectLocationMigrationJobObjectGetCall<'a, C> {
4580 ProjectLocationMigrationJobObjectGetCall {
4581 hub: self.hub,
4582 _name: name.to_string(),
4583 _delegate: Default::default(),
4584 _additional_params: Default::default(),
4585 _scopes: Default::default(),
4586 }
4587 }
4588
4589 /// Create a builder to help you perform the following task:
4590 ///
4591 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4592 ///
4593 /// # Arguments
4594 ///
4595 /// * `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.
4596 pub fn locations_migration_jobs_objects_get_iam_policy(
4597 &self,
4598 resource: &str,
4599 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {
4600 ProjectLocationMigrationJobObjectGetIamPolicyCall {
4601 hub: self.hub,
4602 _resource: resource.to_string(),
4603 _options_requested_policy_version: Default::default(),
4604 _delegate: Default::default(),
4605 _additional_params: Default::default(),
4606 _scopes: Default::default(),
4607 }
4608 }
4609
4610 /// Create a builder to help you perform the following task:
4611 ///
4612 /// Use this method to list the objects of a specific migration job.
4613 ///
4614 /// # Arguments
4615 ///
4616 /// * `parent` - Required. The parent migration job that owns the collection of objects.
4617 pub fn locations_migration_jobs_objects_list(
4618 &self,
4619 parent: &str,
4620 ) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
4621 ProjectLocationMigrationJobObjectListCall {
4622 hub: self.hub,
4623 _parent: parent.to_string(),
4624 _page_token: Default::default(),
4625 _page_size: Default::default(),
4626 _delegate: Default::default(),
4627 _additional_params: Default::default(),
4628 _scopes: Default::default(),
4629 }
4630 }
4631
4632 /// Create a builder to help you perform the following task:
4633 ///
4634 /// Use this method to look up a migration job object by its source object identifier.
4635 ///
4636 /// # Arguments
4637 ///
4638 /// * `request` - No description provided.
4639 /// * `parent` - Required. The parent migration job that owns the collection of objects.
4640 pub fn locations_migration_jobs_objects_lookup(
4641 &self,
4642 request: LookupMigrationJobObjectRequest,
4643 parent: &str,
4644 ) -> ProjectLocationMigrationJobObjectLookupCall<'a, C> {
4645 ProjectLocationMigrationJobObjectLookupCall {
4646 hub: self.hub,
4647 _request: request,
4648 _parent: parent.to_string(),
4649 _delegate: Default::default(),
4650 _additional_params: Default::default(),
4651 _scopes: Default::default(),
4652 }
4653 }
4654
4655 /// Create a builder to help you perform the following task:
4656 ///
4657 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4658 ///
4659 /// # Arguments
4660 ///
4661 /// * `request` - No description provided.
4662 /// * `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.
4663 pub fn locations_migration_jobs_objects_set_iam_policy(
4664 &self,
4665 request: SetIamPolicyRequest,
4666 resource: &str,
4667 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {
4668 ProjectLocationMigrationJobObjectSetIamPolicyCall {
4669 hub: self.hub,
4670 _request: request,
4671 _resource: resource.to_string(),
4672 _delegate: Default::default(),
4673 _additional_params: Default::default(),
4674 _scopes: Default::default(),
4675 }
4676 }
4677
4678 /// Create a builder to help you perform the following task:
4679 ///
4680 /// 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.
4681 ///
4682 /// # Arguments
4683 ///
4684 /// * `request` - No description provided.
4685 /// * `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.
4686 pub fn locations_migration_jobs_objects_test_iam_permissions(
4687 &self,
4688 request: TestIamPermissionsRequest,
4689 resource: &str,
4690 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {
4691 ProjectLocationMigrationJobObjectTestIamPermissionCall {
4692 hub: self.hub,
4693 _request: request,
4694 _resource: resource.to_string(),
4695 _delegate: Default::default(),
4696 _additional_params: Default::default(),
4697 _scopes: Default::default(),
4698 }
4699 }
4700
4701 /// Create a builder to help you perform the following task:
4702 ///
4703 /// Creates a new migration job in a given project and location.
4704 ///
4705 /// # Arguments
4706 ///
4707 /// * `request` - No description provided.
4708 /// * `parent` - Required. The parent which owns this collection of migration jobs.
4709 pub fn locations_migration_jobs_create(
4710 &self,
4711 request: MigrationJob,
4712 parent: &str,
4713 ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
4714 ProjectLocationMigrationJobCreateCall {
4715 hub: self.hub,
4716 _request: request,
4717 _parent: parent.to_string(),
4718 _request_id: Default::default(),
4719 _migration_job_id: Default::default(),
4720 _delegate: Default::default(),
4721 _additional_params: Default::default(),
4722 _scopes: Default::default(),
4723 }
4724 }
4725
4726 /// Create a builder to help you perform the following task:
4727 ///
4728 /// Deletes a single migration job.
4729 ///
4730 /// # Arguments
4731 ///
4732 /// * `name` - Required. Name of the migration job resource to delete.
4733 pub fn locations_migration_jobs_delete(
4734 &self,
4735 name: &str,
4736 ) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
4737 ProjectLocationMigrationJobDeleteCall {
4738 hub: self.hub,
4739 _name: name.to_string(),
4740 _request_id: Default::default(),
4741 _force: Default::default(),
4742 _delegate: Default::default(),
4743 _additional_params: Default::default(),
4744 _scopes: Default::default(),
4745 }
4746 }
4747
4748 /// Create a builder to help you perform the following task:
4749 ///
4750 /// 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.
4751 ///
4752 /// # Arguments
4753 ///
4754 /// * `request` - No description provided.
4755 /// * `name` - Name of the migration job resource to demote its destination.
4756 pub fn locations_migration_jobs_demote_destination(
4757 &self,
4758 request: DemoteDestinationRequest,
4759 name: &str,
4760 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
4761 ProjectLocationMigrationJobDemoteDestinationCall {
4762 hub: self.hub,
4763 _request: request,
4764 _name: name.to_string(),
4765 _delegate: Default::default(),
4766 _additional_params: Default::default(),
4767 _scopes: Default::default(),
4768 }
4769 }
4770
4771 /// Create a builder to help you perform the following task:
4772 ///
4773 /// Retrieves objects from the source database that can be selected for data migration. This is applicable for the following migrations: 1. PostgreSQL to Cloud SQL for PostgreSQL 2. PostgreSQL to AlloyDB for PostgreSQL.
4774 ///
4775 /// # Arguments
4776 ///
4777 /// * `name` - Required. The resource name for the migration job for which source objects should be returned.
4778 pub fn locations_migration_jobs_fetch_source_objects(
4779 &self,
4780 name: &str,
4781 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C> {
4782 ProjectLocationMigrationJobFetchSourceObjectCall {
4783 hub: self.hub,
4784 _name: name.to_string(),
4785 _delegate: Default::default(),
4786 _additional_params: Default::default(),
4787 _scopes: Default::default(),
4788 }
4789 }
4790
4791 /// Create a builder to help you perform the following task:
4792 ///
4793 /// Generate a SSH configuration script to configure the reverse SSH connectivity.
4794 ///
4795 /// # Arguments
4796 ///
4797 /// * `request` - No description provided.
4798 /// * `migrationJob` - Name of the migration job resource to generate the SSH script.
4799 pub fn locations_migration_jobs_generate_ssh_script(
4800 &self,
4801 request: GenerateSshScriptRequest,
4802 migration_job: &str,
4803 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
4804 ProjectLocationMigrationJobGenerateSshScriptCall {
4805 hub: self.hub,
4806 _request: request,
4807 _migration_job: migration_job.to_string(),
4808 _delegate: Default::default(),
4809 _additional_params: Default::default(),
4810 _scopes: Default::default(),
4811 }
4812 }
4813
4814 /// Create a builder to help you perform the following task:
4815 ///
4816 /// Generate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
4817 ///
4818 /// # Arguments
4819 ///
4820 /// * `request` - No description provided.
4821 /// * `migrationJob` - Name of the migration job resource to generate the TCP Proxy script.
4822 pub fn locations_migration_jobs_generate_tcp_proxy_script(
4823 &self,
4824 request: GenerateTcpProxyScriptRequest,
4825 migration_job: &str,
4826 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
4827 ProjectLocationMigrationJobGenerateTcpProxyScriptCall {
4828 hub: self.hub,
4829 _request: request,
4830 _migration_job: migration_job.to_string(),
4831 _delegate: Default::default(),
4832 _additional_params: Default::default(),
4833 _scopes: Default::default(),
4834 }
4835 }
4836
4837 /// Create a builder to help you perform the following task:
4838 ///
4839 /// Gets details of a single migration job.
4840 ///
4841 /// # Arguments
4842 ///
4843 /// * `name` - Required. Name of the migration job resource to get.
4844 pub fn locations_migration_jobs_get(
4845 &self,
4846 name: &str,
4847 ) -> ProjectLocationMigrationJobGetCall<'a, C> {
4848 ProjectLocationMigrationJobGetCall {
4849 hub: self.hub,
4850 _name: name.to_string(),
4851 _delegate: Default::default(),
4852 _additional_params: Default::default(),
4853 _scopes: Default::default(),
4854 }
4855 }
4856
4857 /// Create a builder to help you perform the following task:
4858 ///
4859 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4860 ///
4861 /// # Arguments
4862 ///
4863 /// * `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.
4864 pub fn locations_migration_jobs_get_iam_policy(
4865 &self,
4866 resource: &str,
4867 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
4868 ProjectLocationMigrationJobGetIamPolicyCall {
4869 hub: self.hub,
4870 _resource: resource.to_string(),
4871 _options_requested_policy_version: Default::default(),
4872 _delegate: Default::default(),
4873 _additional_params: Default::default(),
4874 _scopes: Default::default(),
4875 }
4876 }
4877
4878 /// Create a builder to help you perform the following task:
4879 ///
4880 /// Lists migration jobs in a given project and location.
4881 ///
4882 /// # Arguments
4883 ///
4884 /// * `parent` - Required. The parent which owns this collection of migrationJobs.
4885 pub fn locations_migration_jobs_list(
4886 &self,
4887 parent: &str,
4888 ) -> ProjectLocationMigrationJobListCall<'a, C> {
4889 ProjectLocationMigrationJobListCall {
4890 hub: self.hub,
4891 _parent: parent.to_string(),
4892 _page_token: Default::default(),
4893 _page_size: Default::default(),
4894 _order_by: Default::default(),
4895 _filter: Default::default(),
4896 _delegate: Default::default(),
4897 _additional_params: Default::default(),
4898 _scopes: Default::default(),
4899 }
4900 }
4901
4902 /// Create a builder to help you perform the following task:
4903 ///
4904 /// Updates the parameters of a single migration job.
4905 ///
4906 /// # Arguments
4907 ///
4908 /// * `request` - No description provided.
4909 /// * `name` - The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
4910 pub fn locations_migration_jobs_patch(
4911 &self,
4912 request: MigrationJob,
4913 name: &str,
4914 ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
4915 ProjectLocationMigrationJobPatchCall {
4916 hub: self.hub,
4917 _request: request,
4918 _name: name.to_string(),
4919 _update_mask: Default::default(),
4920 _request_id: Default::default(),
4921 _delegate: Default::default(),
4922 _additional_params: Default::default(),
4923 _scopes: Default::default(),
4924 }
4925 }
4926
4927 /// Create a builder to help you perform the following task:
4928 ///
4929 /// Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
4930 ///
4931 /// # Arguments
4932 ///
4933 /// * `request` - No description provided.
4934 /// * `name` - Name of the migration job resource to promote.
4935 pub fn locations_migration_jobs_promote(
4936 &self,
4937 request: PromoteMigrationJobRequest,
4938 name: &str,
4939 ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
4940 ProjectLocationMigrationJobPromoteCall {
4941 hub: self.hub,
4942 _request: request,
4943 _name: name.to_string(),
4944 _delegate: Default::default(),
4945 _additional_params: Default::default(),
4946 _scopes: Default::default(),
4947 }
4948 }
4949
4950 /// Create a builder to help you perform the following task:
4951 ///
4952 /// Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
4953 ///
4954 /// # Arguments
4955 ///
4956 /// * `request` - No description provided.
4957 /// * `name` - Name of the migration job resource to restart.
4958 pub fn locations_migration_jobs_restart(
4959 &self,
4960 request: RestartMigrationJobRequest,
4961 name: &str,
4962 ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
4963 ProjectLocationMigrationJobRestartCall {
4964 hub: self.hub,
4965 _request: request,
4966 _name: name.to_string(),
4967 _delegate: Default::default(),
4968 _additional_params: Default::default(),
4969 _scopes: Default::default(),
4970 }
4971 }
4972
4973 /// Create a builder to help you perform the following task:
4974 ///
4975 /// Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
4976 ///
4977 /// # Arguments
4978 ///
4979 /// * `request` - No description provided.
4980 /// * `name` - Name of the migration job resource to resume.
4981 pub fn locations_migration_jobs_resume(
4982 &self,
4983 request: ResumeMigrationJobRequest,
4984 name: &str,
4985 ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
4986 ProjectLocationMigrationJobResumeCall {
4987 hub: self.hub,
4988 _request: request,
4989 _name: name.to_string(),
4990 _delegate: Default::default(),
4991 _additional_params: Default::default(),
4992 _scopes: Default::default(),
4993 }
4994 }
4995
4996 /// Create a builder to help you perform the following task:
4997 ///
4998 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4999 ///
5000 /// # Arguments
5001 ///
5002 /// * `request` - No description provided.
5003 /// * `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.
5004 pub fn locations_migration_jobs_set_iam_policy(
5005 &self,
5006 request: SetIamPolicyRequest,
5007 resource: &str,
5008 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
5009 ProjectLocationMigrationJobSetIamPolicyCall {
5010 hub: self.hub,
5011 _request: request,
5012 _resource: resource.to_string(),
5013 _delegate: Default::default(),
5014 _additional_params: Default::default(),
5015 _scopes: Default::default(),
5016 }
5017 }
5018
5019 /// Create a builder to help you perform the following task:
5020 ///
5021 /// Start an already created migration job.
5022 ///
5023 /// # Arguments
5024 ///
5025 /// * `request` - No description provided.
5026 /// * `name` - Name of the migration job resource to start.
5027 pub fn locations_migration_jobs_start(
5028 &self,
5029 request: StartMigrationJobRequest,
5030 name: &str,
5031 ) -> ProjectLocationMigrationJobStartCall<'a, C> {
5032 ProjectLocationMigrationJobStartCall {
5033 hub: self.hub,
5034 _request: request,
5035 _name: name.to_string(),
5036 _delegate: Default::default(),
5037 _additional_params: Default::default(),
5038 _scopes: Default::default(),
5039 }
5040 }
5041
5042 /// Create a builder to help you perform the following task:
5043 ///
5044 /// Stops a running migration job.
5045 ///
5046 /// # Arguments
5047 ///
5048 /// * `request` - No description provided.
5049 /// * `name` - Name of the migration job resource to stop.
5050 pub fn locations_migration_jobs_stop(
5051 &self,
5052 request: StopMigrationJobRequest,
5053 name: &str,
5054 ) -> ProjectLocationMigrationJobStopCall<'a, C> {
5055 ProjectLocationMigrationJobStopCall {
5056 hub: self.hub,
5057 _request: request,
5058 _name: name.to_string(),
5059 _delegate: Default::default(),
5060 _additional_params: Default::default(),
5061 _scopes: Default::default(),
5062 }
5063 }
5064
5065 /// Create a builder to help you perform the following task:
5066 ///
5067 /// 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.
5068 ///
5069 /// # Arguments
5070 ///
5071 /// * `request` - No description provided.
5072 /// * `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.
5073 pub fn locations_migration_jobs_test_iam_permissions(
5074 &self,
5075 request: TestIamPermissionsRequest,
5076 resource: &str,
5077 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
5078 ProjectLocationMigrationJobTestIamPermissionCall {
5079 hub: self.hub,
5080 _request: request,
5081 _resource: resource.to_string(),
5082 _delegate: Default::default(),
5083 _additional_params: Default::default(),
5084 _scopes: Default::default(),
5085 }
5086 }
5087
5088 /// Create a builder to help you perform the following task:
5089 ///
5090 /// Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.
5091 ///
5092 /// # Arguments
5093 ///
5094 /// * `request` - No description provided.
5095 /// * `name` - Name of the migration job resource to verify.
5096 pub fn locations_migration_jobs_verify(
5097 &self,
5098 request: VerifyMigrationJobRequest,
5099 name: &str,
5100 ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
5101 ProjectLocationMigrationJobVerifyCall {
5102 hub: self.hub,
5103 _request: request,
5104 _name: name.to_string(),
5105 _delegate: Default::default(),
5106 _additional_params: Default::default(),
5107 _scopes: Default::default(),
5108 }
5109 }
5110
5111 /// Create a builder to help you perform the following task:
5112 ///
5113 /// 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`.
5114 ///
5115 /// # Arguments
5116 ///
5117 /// * `request` - No description provided.
5118 /// * `name` - The name of the operation resource to be cancelled.
5119 pub fn locations_operations_cancel(
5120 &self,
5121 request: CancelOperationRequest,
5122 name: &str,
5123 ) -> ProjectLocationOperationCancelCall<'a, C> {
5124 ProjectLocationOperationCancelCall {
5125 hub: self.hub,
5126 _request: request,
5127 _name: name.to_string(),
5128 _delegate: Default::default(),
5129 _additional_params: Default::default(),
5130 _scopes: Default::default(),
5131 }
5132 }
5133
5134 /// Create a builder to help you perform the following task:
5135 ///
5136 /// 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`.
5137 ///
5138 /// # Arguments
5139 ///
5140 /// * `name` - The name of the operation resource to be deleted.
5141 pub fn locations_operations_delete(
5142 &self,
5143 name: &str,
5144 ) -> ProjectLocationOperationDeleteCall<'a, C> {
5145 ProjectLocationOperationDeleteCall {
5146 hub: self.hub,
5147 _name: name.to_string(),
5148 _delegate: Default::default(),
5149 _additional_params: Default::default(),
5150 _scopes: Default::default(),
5151 }
5152 }
5153
5154 /// Create a builder to help you perform the following task:
5155 ///
5156 /// 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.
5157 ///
5158 /// # Arguments
5159 ///
5160 /// * `name` - The name of the operation resource.
5161 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
5162 ProjectLocationOperationGetCall {
5163 hub: self.hub,
5164 _name: name.to_string(),
5165 _delegate: Default::default(),
5166 _additional_params: Default::default(),
5167 _scopes: Default::default(),
5168 }
5169 }
5170
5171 /// Create a builder to help you perform the following task:
5172 ///
5173 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
5174 ///
5175 /// # Arguments
5176 ///
5177 /// * `name` - The name of the operation's parent resource.
5178 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
5179 ProjectLocationOperationListCall {
5180 hub: self.hub,
5181 _name: name.to_string(),
5182 _return_partial_success: Default::default(),
5183 _page_token: Default::default(),
5184 _page_size: Default::default(),
5185 _filter: Default::default(),
5186 _delegate: Default::default(),
5187 _additional_params: Default::default(),
5188 _scopes: Default::default(),
5189 }
5190 }
5191
5192 /// Create a builder to help you perform the following task:
5193 ///
5194 /// Creates a new private connection in a given project and location.
5195 ///
5196 /// # Arguments
5197 ///
5198 /// * `request` - No description provided.
5199 /// * `parent` - Required. The parent that owns the collection of PrivateConnections.
5200 pub fn locations_private_connections_create(
5201 &self,
5202 request: PrivateConnection,
5203 parent: &str,
5204 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
5205 ProjectLocationPrivateConnectionCreateCall {
5206 hub: self.hub,
5207 _request: request,
5208 _parent: parent.to_string(),
5209 _validate_only: Default::default(),
5210 _skip_validation: Default::default(),
5211 _request_id: Default::default(),
5212 _private_connection_id: Default::default(),
5213 _delegate: Default::default(),
5214 _additional_params: Default::default(),
5215 _scopes: Default::default(),
5216 }
5217 }
5218
5219 /// Create a builder to help you perform the following task:
5220 ///
5221 /// Deletes a single Database Migration Service private connection.
5222 ///
5223 /// # Arguments
5224 ///
5225 /// * `name` - Required. The name of the private connection to delete.
5226 pub fn locations_private_connections_delete(
5227 &self,
5228 name: &str,
5229 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
5230 ProjectLocationPrivateConnectionDeleteCall {
5231 hub: self.hub,
5232 _name: name.to_string(),
5233 _request_id: Default::default(),
5234 _delegate: Default::default(),
5235 _additional_params: Default::default(),
5236 _scopes: Default::default(),
5237 }
5238 }
5239
5240 /// Create a builder to help you perform the following task:
5241 ///
5242 /// Gets details of a single private connection.
5243 ///
5244 /// # Arguments
5245 ///
5246 /// * `name` - Required. The name of the private connection to get.
5247 pub fn locations_private_connections_get(
5248 &self,
5249 name: &str,
5250 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
5251 ProjectLocationPrivateConnectionGetCall {
5252 hub: self.hub,
5253 _name: name.to_string(),
5254 _delegate: Default::default(),
5255 _additional_params: Default::default(),
5256 _scopes: Default::default(),
5257 }
5258 }
5259
5260 /// Create a builder to help you perform the following task:
5261 ///
5262 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5263 ///
5264 /// # Arguments
5265 ///
5266 /// * `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.
5267 pub fn locations_private_connections_get_iam_policy(
5268 &self,
5269 resource: &str,
5270 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
5271 ProjectLocationPrivateConnectionGetIamPolicyCall {
5272 hub: self.hub,
5273 _resource: resource.to_string(),
5274 _options_requested_policy_version: Default::default(),
5275 _delegate: Default::default(),
5276 _additional_params: Default::default(),
5277 _scopes: Default::default(),
5278 }
5279 }
5280
5281 /// Create a builder to help you perform the following task:
5282 ///
5283 /// Retrieves a list of private connections in a given project and location.
5284 ///
5285 /// # Arguments
5286 ///
5287 /// * `parent` - Required. The parent that owns the collection of private connections.
5288 pub fn locations_private_connections_list(
5289 &self,
5290 parent: &str,
5291 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
5292 ProjectLocationPrivateConnectionListCall {
5293 hub: self.hub,
5294 _parent: parent.to_string(),
5295 _page_token: Default::default(),
5296 _page_size: Default::default(),
5297 _order_by: Default::default(),
5298 _filter: Default::default(),
5299 _delegate: Default::default(),
5300 _additional_params: Default::default(),
5301 _scopes: Default::default(),
5302 }
5303 }
5304
5305 /// Create a builder to help you perform the following task:
5306 ///
5307 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
5308 ///
5309 /// # Arguments
5310 ///
5311 /// * `request` - No description provided.
5312 /// * `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.
5313 pub fn locations_private_connections_set_iam_policy(
5314 &self,
5315 request: SetIamPolicyRequest,
5316 resource: &str,
5317 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
5318 ProjectLocationPrivateConnectionSetIamPolicyCall {
5319 hub: self.hub,
5320 _request: request,
5321 _resource: resource.to_string(),
5322 _delegate: Default::default(),
5323 _additional_params: Default::default(),
5324 _scopes: Default::default(),
5325 }
5326 }
5327
5328 /// Create a builder to help you perform the following task:
5329 ///
5330 /// 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.
5331 ///
5332 /// # Arguments
5333 ///
5334 /// * `request` - No description provided.
5335 /// * `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.
5336 pub fn locations_private_connections_test_iam_permissions(
5337 &self,
5338 request: TestIamPermissionsRequest,
5339 resource: &str,
5340 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
5341 ProjectLocationPrivateConnectionTestIamPermissionCall {
5342 hub: self.hub,
5343 _request: request,
5344 _resource: resource.to_string(),
5345 _delegate: Default::default(),
5346 _additional_params: Default::default(),
5347 _scopes: Default::default(),
5348 }
5349 }
5350
5351 /// Create a builder to help you perform the following task:
5352 ///
5353 /// Fetches a set of static IP addresses that need to be allowlisted by the customer when using the static-IP connectivity method.
5354 ///
5355 /// # Arguments
5356 ///
5357 /// * `name` - Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
5358 pub fn locations_fetch_static_ips(
5359 &self,
5360 name: &str,
5361 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
5362 ProjectLocationFetchStaticIpCall {
5363 hub: self.hub,
5364 _name: name.to_string(),
5365 _page_token: Default::default(),
5366 _page_size: Default::default(),
5367 _delegate: Default::default(),
5368 _additional_params: Default::default(),
5369 _scopes: Default::default(),
5370 }
5371 }
5372
5373 /// Create a builder to help you perform the following task:
5374 ///
5375 /// Gets information about a location.
5376 ///
5377 /// # Arguments
5378 ///
5379 /// * `name` - Resource name for the location.
5380 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
5381 ProjectLocationGetCall {
5382 hub: self.hub,
5383 _name: name.to_string(),
5384 _delegate: Default::default(),
5385 _additional_params: Default::default(),
5386 _scopes: Default::default(),
5387 }
5388 }
5389
5390 /// Create a builder to help you perform the following task:
5391 ///
5392 /// Lists information about the supported locations for this service.
5393 ///
5394 /// # Arguments
5395 ///
5396 /// * `name` - The resource that owns the locations collection, if applicable.
5397 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
5398 ProjectLocationListCall {
5399 hub: self.hub,
5400 _name: name.to_string(),
5401 _page_token: Default::default(),
5402 _page_size: Default::default(),
5403 _filter: Default::default(),
5404 _extra_location_types: Default::default(),
5405 _delegate: Default::default(),
5406 _additional_params: Default::default(),
5407 _scopes: Default::default(),
5408 }
5409 }
5410}
5411
5412// ###################
5413// CallBuilders ###
5414// #################
5415
5416/// Creates a new connection profile in a given project and location.
5417///
5418/// A builder for the *locations.connectionProfiles.create* method supported by a *project* resource.
5419/// It is not used directly, but through a [`ProjectMethods`] instance.
5420///
5421/// # Example
5422///
5423/// Instantiate a resource method builder
5424///
5425/// ```test_harness,no_run
5426/// # extern crate hyper;
5427/// # extern crate hyper_rustls;
5428/// # extern crate google_datamigration1 as datamigration1;
5429/// use datamigration1::api::ConnectionProfile;
5430/// # async fn dox() {
5431/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5432///
5433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5434/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5435/// # .with_native_roots()
5436/// # .unwrap()
5437/// # .https_only()
5438/// # .enable_http2()
5439/// # .build();
5440///
5441/// # let executor = hyper_util::rt::TokioExecutor::new();
5442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5443/// # secret,
5444/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5445/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5446/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5447/// # ),
5448/// # ).build().await.unwrap();
5449///
5450/// # let client = hyper_util::client::legacy::Client::builder(
5451/// # hyper_util::rt::TokioExecutor::new()
5452/// # )
5453/// # .build(
5454/// # hyper_rustls::HttpsConnectorBuilder::new()
5455/// # .with_native_roots()
5456/// # .unwrap()
5457/// # .https_or_http()
5458/// # .enable_http2()
5459/// # .build()
5460/// # );
5461/// # let mut hub = DatabaseMigrationService::new(client, auth);
5462/// // As the method needs a request, you would usually fill it with the desired information
5463/// // into the respective structure. Some of the parts shown here might not be applicable !
5464/// // Values shown here are possibly random and not representative !
5465/// let mut req = ConnectionProfile::default();
5466///
5467/// // You can configure optional parameters by calling the respective setters at will, and
5468/// // execute the final call using `doit()`.
5469/// // Values shown here are possibly random and not representative !
5470/// let result = hub.projects().locations_connection_profiles_create(req, "parent")
5471/// .validate_only(false)
5472/// .skip_validation(true)
5473/// .request_id("ipsum")
5474/// .connection_profile_id("ipsum")
5475/// .doit().await;
5476/// # }
5477/// ```
5478pub struct ProjectLocationConnectionProfileCreateCall<'a, C>
5479where
5480 C: 'a,
5481{
5482 hub: &'a DatabaseMigrationService<C>,
5483 _request: ConnectionProfile,
5484 _parent: String,
5485 _validate_only: Option<bool>,
5486 _skip_validation: Option<bool>,
5487 _request_id: Option<String>,
5488 _connection_profile_id: Option<String>,
5489 _delegate: Option<&'a mut dyn common::Delegate>,
5490 _additional_params: HashMap<String, String>,
5491 _scopes: BTreeSet<String>,
5492}
5493
5494impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileCreateCall<'a, C> {}
5495
5496impl<'a, C> ProjectLocationConnectionProfileCreateCall<'a, C>
5497where
5498 C: common::Connector,
5499{
5500 /// Perform the operation you have build so far.
5501 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5502 use std::borrow::Cow;
5503 use std::io::{Read, Seek};
5504
5505 use common::{url::Params, ToParts};
5506 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5507
5508 let mut dd = common::DefaultDelegate;
5509 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5510 dlg.begin(common::MethodInfo {
5511 id: "datamigration.projects.locations.connectionProfiles.create",
5512 http_method: hyper::Method::POST,
5513 });
5514
5515 for &field in [
5516 "alt",
5517 "parent",
5518 "validateOnly",
5519 "skipValidation",
5520 "requestId",
5521 "connectionProfileId",
5522 ]
5523 .iter()
5524 {
5525 if self._additional_params.contains_key(field) {
5526 dlg.finished(false);
5527 return Err(common::Error::FieldClash(field));
5528 }
5529 }
5530
5531 let mut params = Params::with_capacity(8 + self._additional_params.len());
5532 params.push("parent", self._parent);
5533 if let Some(value) = self._validate_only.as_ref() {
5534 params.push("validateOnly", value.to_string());
5535 }
5536 if let Some(value) = self._skip_validation.as_ref() {
5537 params.push("skipValidation", value.to_string());
5538 }
5539 if let Some(value) = self._request_id.as_ref() {
5540 params.push("requestId", value);
5541 }
5542 if let Some(value) = self._connection_profile_id.as_ref() {
5543 params.push("connectionProfileId", value);
5544 }
5545
5546 params.extend(self._additional_params.iter());
5547
5548 params.push("alt", "json");
5549 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
5550 if self._scopes.is_empty() {
5551 self._scopes
5552 .insert(Scope::CloudPlatform.as_ref().to_string());
5553 }
5554
5555 #[allow(clippy::single_element_loop)]
5556 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5557 url = params.uri_replacement(url, param_name, find_this, true);
5558 }
5559 {
5560 let to_remove = ["parent"];
5561 params.remove_params(&to_remove);
5562 }
5563
5564 let url = params.parse_with_url(&url);
5565
5566 let mut json_mime_type = mime::APPLICATION_JSON;
5567 let mut request_value_reader = {
5568 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5569 common::remove_json_null_values(&mut value);
5570 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5571 serde_json::to_writer(&mut dst, &value).unwrap();
5572 dst
5573 };
5574 let request_size = request_value_reader
5575 .seek(std::io::SeekFrom::End(0))
5576 .unwrap();
5577 request_value_reader
5578 .seek(std::io::SeekFrom::Start(0))
5579 .unwrap();
5580
5581 loop {
5582 let token = match self
5583 .hub
5584 .auth
5585 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5586 .await
5587 {
5588 Ok(token) => token,
5589 Err(e) => match dlg.token(e) {
5590 Ok(token) => token,
5591 Err(e) => {
5592 dlg.finished(false);
5593 return Err(common::Error::MissingToken(e));
5594 }
5595 },
5596 };
5597 request_value_reader
5598 .seek(std::io::SeekFrom::Start(0))
5599 .unwrap();
5600 let mut req_result = {
5601 let client = &self.hub.client;
5602 dlg.pre_request();
5603 let mut req_builder = hyper::Request::builder()
5604 .method(hyper::Method::POST)
5605 .uri(url.as_str())
5606 .header(USER_AGENT, self.hub._user_agent.clone());
5607
5608 if let Some(token) = token.as_ref() {
5609 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5610 }
5611
5612 let request = req_builder
5613 .header(CONTENT_TYPE, json_mime_type.to_string())
5614 .header(CONTENT_LENGTH, request_size as u64)
5615 .body(common::to_body(
5616 request_value_reader.get_ref().clone().into(),
5617 ));
5618
5619 client.request(request.unwrap()).await
5620 };
5621
5622 match req_result {
5623 Err(err) => {
5624 if let common::Retry::After(d) = dlg.http_error(&err) {
5625 sleep(d).await;
5626 continue;
5627 }
5628 dlg.finished(false);
5629 return Err(common::Error::HttpError(err));
5630 }
5631 Ok(res) => {
5632 let (mut parts, body) = res.into_parts();
5633 let mut body = common::Body::new(body);
5634 if !parts.status.is_success() {
5635 let bytes = common::to_bytes(body).await.unwrap_or_default();
5636 let error = serde_json::from_str(&common::to_string(&bytes));
5637 let response = common::to_response(parts, bytes.into());
5638
5639 if let common::Retry::After(d) =
5640 dlg.http_failure(&response, error.as_ref().ok())
5641 {
5642 sleep(d).await;
5643 continue;
5644 }
5645
5646 dlg.finished(false);
5647
5648 return Err(match error {
5649 Ok(value) => common::Error::BadRequest(value),
5650 _ => common::Error::Failure(response),
5651 });
5652 }
5653 let response = {
5654 let bytes = common::to_bytes(body).await.unwrap_or_default();
5655 let encoded = common::to_string(&bytes);
5656 match serde_json::from_str(&encoded) {
5657 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5658 Err(error) => {
5659 dlg.response_json_decode_error(&encoded, &error);
5660 return Err(common::Error::JsonDecodeError(
5661 encoded.to_string(),
5662 error,
5663 ));
5664 }
5665 }
5666 };
5667
5668 dlg.finished(true);
5669 return Ok(response);
5670 }
5671 }
5672 }
5673 }
5674
5675 ///
5676 /// Sets the *request* property to the given value.
5677 ///
5678 /// Even though the property as already been set when instantiating this call,
5679 /// we provide this method for API completeness.
5680 pub fn request(
5681 mut self,
5682 new_value: ConnectionProfile,
5683 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5684 self._request = new_value;
5685 self
5686 }
5687 /// Required. The parent which owns this collection of connection profiles.
5688 ///
5689 /// Sets the *parent* path property to the given value.
5690 ///
5691 /// Even though the property as already been set when instantiating this call,
5692 /// we provide this method for API completeness.
5693 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5694 self._parent = new_value.to_string();
5695 self
5696 }
5697 /// Optional. Only validate the connection profile, but don't create any resources. The default is false. Only supported for Oracle connection profiles.
5698 ///
5699 /// Sets the *validate only* query property to the given value.
5700 pub fn validate_only(
5701 mut self,
5702 new_value: bool,
5703 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5704 self._validate_only = Some(new_value);
5705 self
5706 }
5707 /// Optional. Create the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.
5708 ///
5709 /// Sets the *skip validation* query property to the given value.
5710 pub fn skip_validation(
5711 mut self,
5712 new_value: bool,
5713 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5714 self._skip_validation = Some(new_value);
5715 self
5716 }
5717 /// 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.
5718 ///
5719 /// Sets the *request id* query property to the given value.
5720 pub fn request_id(
5721 mut self,
5722 new_value: &str,
5723 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5724 self._request_id = Some(new_value.to_string());
5725 self
5726 }
5727 /// Required. The connection profile identifier.
5728 ///
5729 /// Sets the *connection profile id* query property to the given value.
5730 pub fn connection_profile_id(
5731 mut self,
5732 new_value: &str,
5733 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5734 self._connection_profile_id = Some(new_value.to_string());
5735 self
5736 }
5737 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5738 /// while executing the actual API request.
5739 ///
5740 /// ````text
5741 /// It should be used to handle progress information, and to implement a certain level of resilience.
5742 /// ````
5743 ///
5744 /// Sets the *delegate* property to the given value.
5745 pub fn delegate(
5746 mut self,
5747 new_value: &'a mut dyn common::Delegate,
5748 ) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5749 self._delegate = Some(new_value);
5750 self
5751 }
5752
5753 /// Set any additional parameter of the query string used in the request.
5754 /// It should be used to set parameters which are not yet available through their own
5755 /// setters.
5756 ///
5757 /// Please note that this method must not be used to set any of the known parameters
5758 /// which have their own setter method. If done anyway, the request will fail.
5759 ///
5760 /// # Additional Parameters
5761 ///
5762 /// * *$.xgafv* (query-string) - V1 error format.
5763 /// * *access_token* (query-string) - OAuth access token.
5764 /// * *alt* (query-string) - Data format for response.
5765 /// * *callback* (query-string) - JSONP
5766 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5767 /// * *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.
5768 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5769 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5770 /// * *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.
5771 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5772 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5773 pub fn param<T>(
5774 mut self,
5775 name: T,
5776 value: T,
5777 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5778 where
5779 T: AsRef<str>,
5780 {
5781 self._additional_params
5782 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5783 self
5784 }
5785
5786 /// Identifies the authorization scope for the method you are building.
5787 ///
5788 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5789 /// [`Scope::CloudPlatform`].
5790 ///
5791 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5792 /// tokens for more than one scope.
5793 ///
5794 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5795 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5796 /// sufficient, a read-write scope will do as well.
5797 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5798 where
5799 St: AsRef<str>,
5800 {
5801 self._scopes.insert(String::from(scope.as_ref()));
5802 self
5803 }
5804 /// Identifies the authorization scope(s) for the method you are building.
5805 ///
5806 /// See [`Self::add_scope()`] for details.
5807 pub fn add_scopes<I, St>(
5808 mut self,
5809 scopes: I,
5810 ) -> ProjectLocationConnectionProfileCreateCall<'a, C>
5811 where
5812 I: IntoIterator<Item = St>,
5813 St: AsRef<str>,
5814 {
5815 self._scopes
5816 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5817 self
5818 }
5819
5820 /// Removes all scopes, and no default scope will be used either.
5821 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5822 /// for details).
5823 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileCreateCall<'a, C> {
5824 self._scopes.clear();
5825 self
5826 }
5827}
5828
5829/// 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.
5830///
5831/// A builder for the *locations.connectionProfiles.delete* method supported by a *project* resource.
5832/// It is not used directly, but through a [`ProjectMethods`] instance.
5833///
5834/// # Example
5835///
5836/// Instantiate a resource method builder
5837///
5838/// ```test_harness,no_run
5839/// # extern crate hyper;
5840/// # extern crate hyper_rustls;
5841/// # extern crate google_datamigration1 as datamigration1;
5842/// # async fn dox() {
5843/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5844///
5845/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5846/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5847/// # .with_native_roots()
5848/// # .unwrap()
5849/// # .https_only()
5850/// # .enable_http2()
5851/// # .build();
5852///
5853/// # let executor = hyper_util::rt::TokioExecutor::new();
5854/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5855/// # secret,
5856/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5857/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5858/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5859/// # ),
5860/// # ).build().await.unwrap();
5861///
5862/// # let client = hyper_util::client::legacy::Client::builder(
5863/// # hyper_util::rt::TokioExecutor::new()
5864/// # )
5865/// # .build(
5866/// # hyper_rustls::HttpsConnectorBuilder::new()
5867/// # .with_native_roots()
5868/// # .unwrap()
5869/// # .https_or_http()
5870/// # .enable_http2()
5871/// # .build()
5872/// # );
5873/// # let mut hub = DatabaseMigrationService::new(client, auth);
5874/// // You can configure optional parameters by calling the respective setters at will, and
5875/// // execute the final call using `doit()`.
5876/// // Values shown here are possibly random and not representative !
5877/// let result = hub.projects().locations_connection_profiles_delete("name")
5878/// .request_id("gubergren")
5879/// .force(false)
5880/// .doit().await;
5881/// # }
5882/// ```
5883pub struct ProjectLocationConnectionProfileDeleteCall<'a, C>
5884where
5885 C: 'a,
5886{
5887 hub: &'a DatabaseMigrationService<C>,
5888 _name: String,
5889 _request_id: Option<String>,
5890 _force: Option<bool>,
5891 _delegate: Option<&'a mut dyn common::Delegate>,
5892 _additional_params: HashMap<String, String>,
5893 _scopes: BTreeSet<String>,
5894}
5895
5896impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileDeleteCall<'a, C> {}
5897
5898impl<'a, C> ProjectLocationConnectionProfileDeleteCall<'a, C>
5899where
5900 C: common::Connector,
5901{
5902 /// Perform the operation you have build so far.
5903 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5904 use std::borrow::Cow;
5905 use std::io::{Read, Seek};
5906
5907 use common::{url::Params, ToParts};
5908 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5909
5910 let mut dd = common::DefaultDelegate;
5911 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5912 dlg.begin(common::MethodInfo {
5913 id: "datamigration.projects.locations.connectionProfiles.delete",
5914 http_method: hyper::Method::DELETE,
5915 });
5916
5917 for &field in ["alt", "name", "requestId", "force"].iter() {
5918 if self._additional_params.contains_key(field) {
5919 dlg.finished(false);
5920 return Err(common::Error::FieldClash(field));
5921 }
5922 }
5923
5924 let mut params = Params::with_capacity(5 + self._additional_params.len());
5925 params.push("name", self._name);
5926 if let Some(value) = self._request_id.as_ref() {
5927 params.push("requestId", value);
5928 }
5929 if let Some(value) = self._force.as_ref() {
5930 params.push("force", value.to_string());
5931 }
5932
5933 params.extend(self._additional_params.iter());
5934
5935 params.push("alt", "json");
5936 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5937 if self._scopes.is_empty() {
5938 self._scopes
5939 .insert(Scope::CloudPlatform.as_ref().to_string());
5940 }
5941
5942 #[allow(clippy::single_element_loop)]
5943 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5944 url = params.uri_replacement(url, param_name, find_this, true);
5945 }
5946 {
5947 let to_remove = ["name"];
5948 params.remove_params(&to_remove);
5949 }
5950
5951 let url = params.parse_with_url(&url);
5952
5953 loop {
5954 let token = match self
5955 .hub
5956 .auth
5957 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5958 .await
5959 {
5960 Ok(token) => token,
5961 Err(e) => match dlg.token(e) {
5962 Ok(token) => token,
5963 Err(e) => {
5964 dlg.finished(false);
5965 return Err(common::Error::MissingToken(e));
5966 }
5967 },
5968 };
5969 let mut req_result = {
5970 let client = &self.hub.client;
5971 dlg.pre_request();
5972 let mut req_builder = hyper::Request::builder()
5973 .method(hyper::Method::DELETE)
5974 .uri(url.as_str())
5975 .header(USER_AGENT, self.hub._user_agent.clone());
5976
5977 if let Some(token) = token.as_ref() {
5978 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5979 }
5980
5981 let request = req_builder
5982 .header(CONTENT_LENGTH, 0_u64)
5983 .body(common::to_body::<String>(None));
5984
5985 client.request(request.unwrap()).await
5986 };
5987
5988 match req_result {
5989 Err(err) => {
5990 if let common::Retry::After(d) = dlg.http_error(&err) {
5991 sleep(d).await;
5992 continue;
5993 }
5994 dlg.finished(false);
5995 return Err(common::Error::HttpError(err));
5996 }
5997 Ok(res) => {
5998 let (mut parts, body) = res.into_parts();
5999 let mut body = common::Body::new(body);
6000 if !parts.status.is_success() {
6001 let bytes = common::to_bytes(body).await.unwrap_or_default();
6002 let error = serde_json::from_str(&common::to_string(&bytes));
6003 let response = common::to_response(parts, bytes.into());
6004
6005 if let common::Retry::After(d) =
6006 dlg.http_failure(&response, error.as_ref().ok())
6007 {
6008 sleep(d).await;
6009 continue;
6010 }
6011
6012 dlg.finished(false);
6013
6014 return Err(match error {
6015 Ok(value) => common::Error::BadRequest(value),
6016 _ => common::Error::Failure(response),
6017 });
6018 }
6019 let response = {
6020 let bytes = common::to_bytes(body).await.unwrap_or_default();
6021 let encoded = common::to_string(&bytes);
6022 match serde_json::from_str(&encoded) {
6023 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6024 Err(error) => {
6025 dlg.response_json_decode_error(&encoded, &error);
6026 return Err(common::Error::JsonDecodeError(
6027 encoded.to_string(),
6028 error,
6029 ));
6030 }
6031 }
6032 };
6033
6034 dlg.finished(true);
6035 return Ok(response);
6036 }
6037 }
6038 }
6039 }
6040
6041 /// Required. Name of the connection profile resource to delete.
6042 ///
6043 /// Sets the *name* path property to the given value.
6044 ///
6045 /// Even though the property as already been set when instantiating this call,
6046 /// we provide this method for API completeness.
6047 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
6048 self._name = new_value.to_string();
6049 self
6050 }
6051 /// 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.
6052 ///
6053 /// Sets the *request id* query property to the given value.
6054 pub fn request_id(
6055 mut self,
6056 new_value: &str,
6057 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
6058 self._request_id = Some(new_value.to_string());
6059 self
6060 }
6061 /// In case of force delete, the CloudSQL replica database is also deleted (only for CloudSQL connection profile).
6062 ///
6063 /// Sets the *force* query property to the given value.
6064 pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
6065 self._force = Some(new_value);
6066 self
6067 }
6068 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6069 /// while executing the actual API request.
6070 ///
6071 /// ````text
6072 /// It should be used to handle progress information, and to implement a certain level of resilience.
6073 /// ````
6074 ///
6075 /// Sets the *delegate* property to the given value.
6076 pub fn delegate(
6077 mut self,
6078 new_value: &'a mut dyn common::Delegate,
6079 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
6080 self._delegate = Some(new_value);
6081 self
6082 }
6083
6084 /// Set any additional parameter of the query string used in the request.
6085 /// It should be used to set parameters which are not yet available through their own
6086 /// setters.
6087 ///
6088 /// Please note that this method must not be used to set any of the known parameters
6089 /// which have their own setter method. If done anyway, the request will fail.
6090 ///
6091 /// # Additional Parameters
6092 ///
6093 /// * *$.xgafv* (query-string) - V1 error format.
6094 /// * *access_token* (query-string) - OAuth access token.
6095 /// * *alt* (query-string) - Data format for response.
6096 /// * *callback* (query-string) - JSONP
6097 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6098 /// * *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.
6099 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6100 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6101 /// * *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.
6102 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6103 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6104 pub fn param<T>(
6105 mut self,
6106 name: T,
6107 value: T,
6108 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
6109 where
6110 T: AsRef<str>,
6111 {
6112 self._additional_params
6113 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6114 self
6115 }
6116
6117 /// Identifies the authorization scope for the method you are building.
6118 ///
6119 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6120 /// [`Scope::CloudPlatform`].
6121 ///
6122 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6123 /// tokens for more than one scope.
6124 ///
6125 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6126 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6127 /// sufficient, a read-write scope will do as well.
6128 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
6129 where
6130 St: AsRef<str>,
6131 {
6132 self._scopes.insert(String::from(scope.as_ref()));
6133 self
6134 }
6135 /// Identifies the authorization scope(s) for the method you are building.
6136 ///
6137 /// See [`Self::add_scope()`] for details.
6138 pub fn add_scopes<I, St>(
6139 mut self,
6140 scopes: I,
6141 ) -> ProjectLocationConnectionProfileDeleteCall<'a, C>
6142 where
6143 I: IntoIterator<Item = St>,
6144 St: AsRef<str>,
6145 {
6146 self._scopes
6147 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6148 self
6149 }
6150
6151 /// Removes all scopes, and no default scope will be used either.
6152 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6153 /// for details).
6154 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileDeleteCall<'a, C> {
6155 self._scopes.clear();
6156 self
6157 }
6158}
6159
6160/// Gets details of a single connection profile.
6161///
6162/// A builder for the *locations.connectionProfiles.get* method supported by a *project* resource.
6163/// It is not used directly, but through a [`ProjectMethods`] instance.
6164///
6165/// # Example
6166///
6167/// Instantiate a resource method builder
6168///
6169/// ```test_harness,no_run
6170/// # extern crate hyper;
6171/// # extern crate hyper_rustls;
6172/// # extern crate google_datamigration1 as datamigration1;
6173/// # async fn dox() {
6174/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6175///
6176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6177/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6178/// # .with_native_roots()
6179/// # .unwrap()
6180/// # .https_only()
6181/// # .enable_http2()
6182/// # .build();
6183///
6184/// # let executor = hyper_util::rt::TokioExecutor::new();
6185/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6186/// # secret,
6187/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6188/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6189/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6190/// # ),
6191/// # ).build().await.unwrap();
6192///
6193/// # let client = hyper_util::client::legacy::Client::builder(
6194/// # hyper_util::rt::TokioExecutor::new()
6195/// # )
6196/// # .build(
6197/// # hyper_rustls::HttpsConnectorBuilder::new()
6198/// # .with_native_roots()
6199/// # .unwrap()
6200/// # .https_or_http()
6201/// # .enable_http2()
6202/// # .build()
6203/// # );
6204/// # let mut hub = DatabaseMigrationService::new(client, auth);
6205/// // You can configure optional parameters by calling the respective setters at will, and
6206/// // execute the final call using `doit()`.
6207/// // Values shown here are possibly random and not representative !
6208/// let result = hub.projects().locations_connection_profiles_get("name")
6209/// .doit().await;
6210/// # }
6211/// ```
6212pub struct ProjectLocationConnectionProfileGetCall<'a, C>
6213where
6214 C: 'a,
6215{
6216 hub: &'a DatabaseMigrationService<C>,
6217 _name: String,
6218 _delegate: Option<&'a mut dyn common::Delegate>,
6219 _additional_params: HashMap<String, String>,
6220 _scopes: BTreeSet<String>,
6221}
6222
6223impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetCall<'a, C> {}
6224
6225impl<'a, C> ProjectLocationConnectionProfileGetCall<'a, C>
6226where
6227 C: common::Connector,
6228{
6229 /// Perform the operation you have build so far.
6230 pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionProfile)> {
6231 use std::borrow::Cow;
6232 use std::io::{Read, Seek};
6233
6234 use common::{url::Params, ToParts};
6235 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6236
6237 let mut dd = common::DefaultDelegate;
6238 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6239 dlg.begin(common::MethodInfo {
6240 id: "datamigration.projects.locations.connectionProfiles.get",
6241 http_method: hyper::Method::GET,
6242 });
6243
6244 for &field in ["alt", "name"].iter() {
6245 if self._additional_params.contains_key(field) {
6246 dlg.finished(false);
6247 return Err(common::Error::FieldClash(field));
6248 }
6249 }
6250
6251 let mut params = Params::with_capacity(3 + self._additional_params.len());
6252 params.push("name", self._name);
6253
6254 params.extend(self._additional_params.iter());
6255
6256 params.push("alt", "json");
6257 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6258 if self._scopes.is_empty() {
6259 self._scopes
6260 .insert(Scope::CloudPlatform.as_ref().to_string());
6261 }
6262
6263 #[allow(clippy::single_element_loop)]
6264 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6265 url = params.uri_replacement(url, param_name, find_this, true);
6266 }
6267 {
6268 let to_remove = ["name"];
6269 params.remove_params(&to_remove);
6270 }
6271
6272 let url = params.parse_with_url(&url);
6273
6274 loop {
6275 let token = match self
6276 .hub
6277 .auth
6278 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6279 .await
6280 {
6281 Ok(token) => token,
6282 Err(e) => match dlg.token(e) {
6283 Ok(token) => token,
6284 Err(e) => {
6285 dlg.finished(false);
6286 return Err(common::Error::MissingToken(e));
6287 }
6288 },
6289 };
6290 let mut req_result = {
6291 let client = &self.hub.client;
6292 dlg.pre_request();
6293 let mut req_builder = hyper::Request::builder()
6294 .method(hyper::Method::GET)
6295 .uri(url.as_str())
6296 .header(USER_AGENT, self.hub._user_agent.clone());
6297
6298 if let Some(token) = token.as_ref() {
6299 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6300 }
6301
6302 let request = req_builder
6303 .header(CONTENT_LENGTH, 0_u64)
6304 .body(common::to_body::<String>(None));
6305
6306 client.request(request.unwrap()).await
6307 };
6308
6309 match req_result {
6310 Err(err) => {
6311 if let common::Retry::After(d) = dlg.http_error(&err) {
6312 sleep(d).await;
6313 continue;
6314 }
6315 dlg.finished(false);
6316 return Err(common::Error::HttpError(err));
6317 }
6318 Ok(res) => {
6319 let (mut parts, body) = res.into_parts();
6320 let mut body = common::Body::new(body);
6321 if !parts.status.is_success() {
6322 let bytes = common::to_bytes(body).await.unwrap_or_default();
6323 let error = serde_json::from_str(&common::to_string(&bytes));
6324 let response = common::to_response(parts, bytes.into());
6325
6326 if let common::Retry::After(d) =
6327 dlg.http_failure(&response, error.as_ref().ok())
6328 {
6329 sleep(d).await;
6330 continue;
6331 }
6332
6333 dlg.finished(false);
6334
6335 return Err(match error {
6336 Ok(value) => common::Error::BadRequest(value),
6337 _ => common::Error::Failure(response),
6338 });
6339 }
6340 let response = {
6341 let bytes = common::to_bytes(body).await.unwrap_or_default();
6342 let encoded = common::to_string(&bytes);
6343 match serde_json::from_str(&encoded) {
6344 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6345 Err(error) => {
6346 dlg.response_json_decode_error(&encoded, &error);
6347 return Err(common::Error::JsonDecodeError(
6348 encoded.to_string(),
6349 error,
6350 ));
6351 }
6352 }
6353 };
6354
6355 dlg.finished(true);
6356 return Ok(response);
6357 }
6358 }
6359 }
6360 }
6361
6362 /// Required. Name of the connection profile resource to get.
6363 ///
6364 /// Sets the *name* path property to the given value.
6365 ///
6366 /// Even though the property as already been set when instantiating this call,
6367 /// we provide this method for API completeness.
6368 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfileGetCall<'a, C> {
6369 self._name = new_value.to_string();
6370 self
6371 }
6372 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6373 /// while executing the actual API request.
6374 ///
6375 /// ````text
6376 /// It should be used to handle progress information, and to implement a certain level of resilience.
6377 /// ````
6378 ///
6379 /// Sets the *delegate* property to the given value.
6380 pub fn delegate(
6381 mut self,
6382 new_value: &'a mut dyn common::Delegate,
6383 ) -> ProjectLocationConnectionProfileGetCall<'a, C> {
6384 self._delegate = Some(new_value);
6385 self
6386 }
6387
6388 /// Set any additional parameter of the query string used in the request.
6389 /// It should be used to set parameters which are not yet available through their own
6390 /// setters.
6391 ///
6392 /// Please note that this method must not be used to set any of the known parameters
6393 /// which have their own setter method. If done anyway, the request will fail.
6394 ///
6395 /// # Additional Parameters
6396 ///
6397 /// * *$.xgafv* (query-string) - V1 error format.
6398 /// * *access_token* (query-string) - OAuth access token.
6399 /// * *alt* (query-string) - Data format for response.
6400 /// * *callback* (query-string) - JSONP
6401 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6402 /// * *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.
6403 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6404 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6405 /// * *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.
6406 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6407 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6408 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileGetCall<'a, C>
6409 where
6410 T: AsRef<str>,
6411 {
6412 self._additional_params
6413 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6414 self
6415 }
6416
6417 /// Identifies the authorization scope for the method you are building.
6418 ///
6419 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6420 /// [`Scope::CloudPlatform`].
6421 ///
6422 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6423 /// tokens for more than one scope.
6424 ///
6425 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6426 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6427 /// sufficient, a read-write scope will do as well.
6428 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileGetCall<'a, C>
6429 where
6430 St: AsRef<str>,
6431 {
6432 self._scopes.insert(String::from(scope.as_ref()));
6433 self
6434 }
6435 /// Identifies the authorization scope(s) for the method you are building.
6436 ///
6437 /// See [`Self::add_scope()`] for details.
6438 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileGetCall<'a, C>
6439 where
6440 I: IntoIterator<Item = St>,
6441 St: AsRef<str>,
6442 {
6443 self._scopes
6444 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6445 self
6446 }
6447
6448 /// Removes all scopes, and no default scope will be used either.
6449 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6450 /// for details).
6451 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetCall<'a, C> {
6452 self._scopes.clear();
6453 self
6454 }
6455}
6456
6457/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6458///
6459/// A builder for the *locations.connectionProfiles.getIamPolicy* method supported by a *project* resource.
6460/// It is not used directly, but through a [`ProjectMethods`] instance.
6461///
6462/// # Example
6463///
6464/// Instantiate a resource method builder
6465///
6466/// ```test_harness,no_run
6467/// # extern crate hyper;
6468/// # extern crate hyper_rustls;
6469/// # extern crate google_datamigration1 as datamigration1;
6470/// # async fn dox() {
6471/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6472///
6473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6475/// # .with_native_roots()
6476/// # .unwrap()
6477/// # .https_only()
6478/// # .enable_http2()
6479/// # .build();
6480///
6481/// # let executor = hyper_util::rt::TokioExecutor::new();
6482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6483/// # secret,
6484/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6485/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6486/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6487/// # ),
6488/// # ).build().await.unwrap();
6489///
6490/// # let client = hyper_util::client::legacy::Client::builder(
6491/// # hyper_util::rt::TokioExecutor::new()
6492/// # )
6493/// # .build(
6494/// # hyper_rustls::HttpsConnectorBuilder::new()
6495/// # .with_native_roots()
6496/// # .unwrap()
6497/// # .https_or_http()
6498/// # .enable_http2()
6499/// # .build()
6500/// # );
6501/// # let mut hub = DatabaseMigrationService::new(client, auth);
6502/// // You can configure optional parameters by calling the respective setters at will, and
6503/// // execute the final call using `doit()`.
6504/// // Values shown here are possibly random and not representative !
6505/// let result = hub.projects().locations_connection_profiles_get_iam_policy("resource")
6506/// .options_requested_policy_version(-86)
6507/// .doit().await;
6508/// # }
6509/// ```
6510pub struct ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6511where
6512 C: 'a,
6513{
6514 hub: &'a DatabaseMigrationService<C>,
6515 _resource: String,
6516 _options_requested_policy_version: Option<i32>,
6517 _delegate: Option<&'a mut dyn common::Delegate>,
6518 _additional_params: HashMap<String, String>,
6519 _scopes: BTreeSet<String>,
6520}
6521
6522impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {}
6523
6524impl<'a, C> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6525where
6526 C: common::Connector,
6527{
6528 /// Perform the operation you have build so far.
6529 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6530 use std::borrow::Cow;
6531 use std::io::{Read, Seek};
6532
6533 use common::{url::Params, ToParts};
6534 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6535
6536 let mut dd = common::DefaultDelegate;
6537 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6538 dlg.begin(common::MethodInfo {
6539 id: "datamigration.projects.locations.connectionProfiles.getIamPolicy",
6540 http_method: hyper::Method::GET,
6541 });
6542
6543 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6544 if self._additional_params.contains_key(field) {
6545 dlg.finished(false);
6546 return Err(common::Error::FieldClash(field));
6547 }
6548 }
6549
6550 let mut params = Params::with_capacity(4 + self._additional_params.len());
6551 params.push("resource", self._resource);
6552 if let Some(value) = self._options_requested_policy_version.as_ref() {
6553 params.push("options.requestedPolicyVersion", value.to_string());
6554 }
6555
6556 params.extend(self._additional_params.iter());
6557
6558 params.push("alt", "json");
6559 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
6560 if self._scopes.is_empty() {
6561 self._scopes
6562 .insert(Scope::CloudPlatform.as_ref().to_string());
6563 }
6564
6565 #[allow(clippy::single_element_loop)]
6566 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6567 url = params.uri_replacement(url, param_name, find_this, true);
6568 }
6569 {
6570 let to_remove = ["resource"];
6571 params.remove_params(&to_remove);
6572 }
6573
6574 let url = params.parse_with_url(&url);
6575
6576 loop {
6577 let token = match self
6578 .hub
6579 .auth
6580 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6581 .await
6582 {
6583 Ok(token) => token,
6584 Err(e) => match dlg.token(e) {
6585 Ok(token) => token,
6586 Err(e) => {
6587 dlg.finished(false);
6588 return Err(common::Error::MissingToken(e));
6589 }
6590 },
6591 };
6592 let mut req_result = {
6593 let client = &self.hub.client;
6594 dlg.pre_request();
6595 let mut req_builder = hyper::Request::builder()
6596 .method(hyper::Method::GET)
6597 .uri(url.as_str())
6598 .header(USER_AGENT, self.hub._user_agent.clone());
6599
6600 if let Some(token) = token.as_ref() {
6601 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6602 }
6603
6604 let request = req_builder
6605 .header(CONTENT_LENGTH, 0_u64)
6606 .body(common::to_body::<String>(None));
6607
6608 client.request(request.unwrap()).await
6609 };
6610
6611 match req_result {
6612 Err(err) => {
6613 if let common::Retry::After(d) = dlg.http_error(&err) {
6614 sleep(d).await;
6615 continue;
6616 }
6617 dlg.finished(false);
6618 return Err(common::Error::HttpError(err));
6619 }
6620 Ok(res) => {
6621 let (mut parts, body) = res.into_parts();
6622 let mut body = common::Body::new(body);
6623 if !parts.status.is_success() {
6624 let bytes = common::to_bytes(body).await.unwrap_or_default();
6625 let error = serde_json::from_str(&common::to_string(&bytes));
6626 let response = common::to_response(parts, bytes.into());
6627
6628 if let common::Retry::After(d) =
6629 dlg.http_failure(&response, error.as_ref().ok())
6630 {
6631 sleep(d).await;
6632 continue;
6633 }
6634
6635 dlg.finished(false);
6636
6637 return Err(match error {
6638 Ok(value) => common::Error::BadRequest(value),
6639 _ => common::Error::Failure(response),
6640 });
6641 }
6642 let response = {
6643 let bytes = common::to_bytes(body).await.unwrap_or_default();
6644 let encoded = common::to_string(&bytes);
6645 match serde_json::from_str(&encoded) {
6646 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6647 Err(error) => {
6648 dlg.response_json_decode_error(&encoded, &error);
6649 return Err(common::Error::JsonDecodeError(
6650 encoded.to_string(),
6651 error,
6652 ));
6653 }
6654 }
6655 };
6656
6657 dlg.finished(true);
6658 return Ok(response);
6659 }
6660 }
6661 }
6662 }
6663
6664 /// 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.
6665 ///
6666 /// Sets the *resource* path property to the given value.
6667 ///
6668 /// Even though the property as already been set when instantiating this call,
6669 /// we provide this method for API completeness.
6670 pub fn resource(
6671 mut self,
6672 new_value: &str,
6673 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
6674 self._resource = new_value.to_string();
6675 self
6676 }
6677 /// 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).
6678 ///
6679 /// Sets the *options.requested policy version* query property to the given value.
6680 pub fn options_requested_policy_version(
6681 mut self,
6682 new_value: i32,
6683 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
6684 self._options_requested_policy_version = Some(new_value);
6685 self
6686 }
6687 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6688 /// while executing the actual API request.
6689 ///
6690 /// ````text
6691 /// It should be used to handle progress information, and to implement a certain level of resilience.
6692 /// ````
6693 ///
6694 /// Sets the *delegate* property to the given value.
6695 pub fn delegate(
6696 mut self,
6697 new_value: &'a mut dyn common::Delegate,
6698 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
6699 self._delegate = Some(new_value);
6700 self
6701 }
6702
6703 /// Set any additional parameter of the query string used in the request.
6704 /// It should be used to set parameters which are not yet available through their own
6705 /// setters.
6706 ///
6707 /// Please note that this method must not be used to set any of the known parameters
6708 /// which have their own setter method. If done anyway, the request will fail.
6709 ///
6710 /// # Additional Parameters
6711 ///
6712 /// * *$.xgafv* (query-string) - V1 error format.
6713 /// * *access_token* (query-string) - OAuth access token.
6714 /// * *alt* (query-string) - Data format for response.
6715 /// * *callback* (query-string) - JSONP
6716 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6717 /// * *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.
6718 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6719 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6720 /// * *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.
6721 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6722 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6723 pub fn param<T>(
6724 mut self,
6725 name: T,
6726 value: T,
6727 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6728 where
6729 T: AsRef<str>,
6730 {
6731 self._additional_params
6732 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6733 self
6734 }
6735
6736 /// Identifies the authorization scope for the method you are building.
6737 ///
6738 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6739 /// [`Scope::CloudPlatform`].
6740 ///
6741 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6742 /// tokens for more than one scope.
6743 ///
6744 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6745 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6746 /// sufficient, a read-write scope will do as well.
6747 pub fn add_scope<St>(
6748 mut self,
6749 scope: St,
6750 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6751 where
6752 St: AsRef<str>,
6753 {
6754 self._scopes.insert(String::from(scope.as_ref()));
6755 self
6756 }
6757 /// Identifies the authorization scope(s) for the method you are building.
6758 ///
6759 /// See [`Self::add_scope()`] for details.
6760 pub fn add_scopes<I, St>(
6761 mut self,
6762 scopes: I,
6763 ) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C>
6764 where
6765 I: IntoIterator<Item = St>,
6766 St: AsRef<str>,
6767 {
6768 self._scopes
6769 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6770 self
6771 }
6772
6773 /// Removes all scopes, and no default scope will be used either.
6774 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6775 /// for details).
6776 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileGetIamPolicyCall<'a, C> {
6777 self._scopes.clear();
6778 self
6779 }
6780}
6781
6782/// Retrieves a list of all connection profiles in a given project and location.
6783///
6784/// A builder for the *locations.connectionProfiles.list* method supported by a *project* resource.
6785/// It is not used directly, but through a [`ProjectMethods`] instance.
6786///
6787/// # Example
6788///
6789/// Instantiate a resource method builder
6790///
6791/// ```test_harness,no_run
6792/// # extern crate hyper;
6793/// # extern crate hyper_rustls;
6794/// # extern crate google_datamigration1 as datamigration1;
6795/// # async fn dox() {
6796/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6797///
6798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6799/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6800/// # .with_native_roots()
6801/// # .unwrap()
6802/// # .https_only()
6803/// # .enable_http2()
6804/// # .build();
6805///
6806/// # let executor = hyper_util::rt::TokioExecutor::new();
6807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6808/// # secret,
6809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6810/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6811/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6812/// # ),
6813/// # ).build().await.unwrap();
6814///
6815/// # let client = hyper_util::client::legacy::Client::builder(
6816/// # hyper_util::rt::TokioExecutor::new()
6817/// # )
6818/// # .build(
6819/// # hyper_rustls::HttpsConnectorBuilder::new()
6820/// # .with_native_roots()
6821/// # .unwrap()
6822/// # .https_or_http()
6823/// # .enable_http2()
6824/// # .build()
6825/// # );
6826/// # let mut hub = DatabaseMigrationService::new(client, auth);
6827/// // You can configure optional parameters by calling the respective setters at will, and
6828/// // execute the final call using `doit()`.
6829/// // Values shown here are possibly random and not representative !
6830/// let result = hub.projects().locations_connection_profiles_list("parent")
6831/// .page_token("duo")
6832/// .page_size(-80)
6833/// .order_by("no")
6834/// .filter("Stet")
6835/// .doit().await;
6836/// # }
6837/// ```
6838pub struct ProjectLocationConnectionProfileListCall<'a, C>
6839where
6840 C: 'a,
6841{
6842 hub: &'a DatabaseMigrationService<C>,
6843 _parent: String,
6844 _page_token: Option<String>,
6845 _page_size: Option<i32>,
6846 _order_by: Option<String>,
6847 _filter: Option<String>,
6848 _delegate: Option<&'a mut dyn common::Delegate>,
6849 _additional_params: HashMap<String, String>,
6850 _scopes: BTreeSet<String>,
6851}
6852
6853impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileListCall<'a, C> {}
6854
6855impl<'a, C> ProjectLocationConnectionProfileListCall<'a, C>
6856where
6857 C: common::Connector,
6858{
6859 /// Perform the operation you have build so far.
6860 pub async fn doit(
6861 mut self,
6862 ) -> common::Result<(common::Response, ListConnectionProfilesResponse)> {
6863 use std::borrow::Cow;
6864 use std::io::{Read, Seek};
6865
6866 use common::{url::Params, ToParts};
6867 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6868
6869 let mut dd = common::DefaultDelegate;
6870 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6871 dlg.begin(common::MethodInfo {
6872 id: "datamigration.projects.locations.connectionProfiles.list",
6873 http_method: hyper::Method::GET,
6874 });
6875
6876 for &field in [
6877 "alt",
6878 "parent",
6879 "pageToken",
6880 "pageSize",
6881 "orderBy",
6882 "filter",
6883 ]
6884 .iter()
6885 {
6886 if self._additional_params.contains_key(field) {
6887 dlg.finished(false);
6888 return Err(common::Error::FieldClash(field));
6889 }
6890 }
6891
6892 let mut params = Params::with_capacity(7 + self._additional_params.len());
6893 params.push("parent", self._parent);
6894 if let Some(value) = self._page_token.as_ref() {
6895 params.push("pageToken", value);
6896 }
6897 if let Some(value) = self._page_size.as_ref() {
6898 params.push("pageSize", value.to_string());
6899 }
6900 if let Some(value) = self._order_by.as_ref() {
6901 params.push("orderBy", value);
6902 }
6903 if let Some(value) = self._filter.as_ref() {
6904 params.push("filter", value);
6905 }
6906
6907 params.extend(self._additional_params.iter());
6908
6909 params.push("alt", "json");
6910 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectionProfiles";
6911 if self._scopes.is_empty() {
6912 self._scopes
6913 .insert(Scope::CloudPlatform.as_ref().to_string());
6914 }
6915
6916 #[allow(clippy::single_element_loop)]
6917 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6918 url = params.uri_replacement(url, param_name, find_this, true);
6919 }
6920 {
6921 let to_remove = ["parent"];
6922 params.remove_params(&to_remove);
6923 }
6924
6925 let url = params.parse_with_url(&url);
6926
6927 loop {
6928 let token = match self
6929 .hub
6930 .auth
6931 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6932 .await
6933 {
6934 Ok(token) => token,
6935 Err(e) => match dlg.token(e) {
6936 Ok(token) => token,
6937 Err(e) => {
6938 dlg.finished(false);
6939 return Err(common::Error::MissingToken(e));
6940 }
6941 },
6942 };
6943 let mut req_result = {
6944 let client = &self.hub.client;
6945 dlg.pre_request();
6946 let mut req_builder = hyper::Request::builder()
6947 .method(hyper::Method::GET)
6948 .uri(url.as_str())
6949 .header(USER_AGENT, self.hub._user_agent.clone());
6950
6951 if let Some(token) = token.as_ref() {
6952 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6953 }
6954
6955 let request = req_builder
6956 .header(CONTENT_LENGTH, 0_u64)
6957 .body(common::to_body::<String>(None));
6958
6959 client.request(request.unwrap()).await
6960 };
6961
6962 match req_result {
6963 Err(err) => {
6964 if let common::Retry::After(d) = dlg.http_error(&err) {
6965 sleep(d).await;
6966 continue;
6967 }
6968 dlg.finished(false);
6969 return Err(common::Error::HttpError(err));
6970 }
6971 Ok(res) => {
6972 let (mut parts, body) = res.into_parts();
6973 let mut body = common::Body::new(body);
6974 if !parts.status.is_success() {
6975 let bytes = common::to_bytes(body).await.unwrap_or_default();
6976 let error = serde_json::from_str(&common::to_string(&bytes));
6977 let response = common::to_response(parts, bytes.into());
6978
6979 if let common::Retry::After(d) =
6980 dlg.http_failure(&response, error.as_ref().ok())
6981 {
6982 sleep(d).await;
6983 continue;
6984 }
6985
6986 dlg.finished(false);
6987
6988 return Err(match error {
6989 Ok(value) => common::Error::BadRequest(value),
6990 _ => common::Error::Failure(response),
6991 });
6992 }
6993 let response = {
6994 let bytes = common::to_bytes(body).await.unwrap_or_default();
6995 let encoded = common::to_string(&bytes);
6996 match serde_json::from_str(&encoded) {
6997 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6998 Err(error) => {
6999 dlg.response_json_decode_error(&encoded, &error);
7000 return Err(common::Error::JsonDecodeError(
7001 encoded.to_string(),
7002 error,
7003 ));
7004 }
7005 }
7006 };
7007
7008 dlg.finished(true);
7009 return Ok(response);
7010 }
7011 }
7012 }
7013 }
7014
7015 /// Required. The parent which owns this collection of connection profiles.
7016 ///
7017 /// Sets the *parent* path property to the given value.
7018 ///
7019 /// Even though the property as already been set when instantiating this call,
7020 /// we provide this method for API completeness.
7021 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
7022 self._parent = new_value.to_string();
7023 self
7024 }
7025 /// 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.
7026 ///
7027 /// Sets the *page token* query property to the given value.
7028 pub fn page_token(
7029 mut self,
7030 new_value: &str,
7031 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
7032 self._page_token = Some(new_value.to_string());
7033 self
7034 }
7035 /// 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.
7036 ///
7037 /// Sets the *page size* query property to the given value.
7038 pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionProfileListCall<'a, C> {
7039 self._page_size = Some(new_value);
7040 self
7041 }
7042 /// A comma-separated list of fields to order results according to.
7043 ///
7044 /// Sets the *order by* query property to the given value.
7045 pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
7046 self._order_by = Some(new_value.to_string());
7047 self
7048 }
7049 /// 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.
7050 ///
7051 /// Sets the *filter* query property to the given value.
7052 pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionProfileListCall<'a, C> {
7053 self._filter = Some(new_value.to_string());
7054 self
7055 }
7056 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7057 /// while executing the actual API request.
7058 ///
7059 /// ````text
7060 /// It should be used to handle progress information, and to implement a certain level of resilience.
7061 /// ````
7062 ///
7063 /// Sets the *delegate* property to the given value.
7064 pub fn delegate(
7065 mut self,
7066 new_value: &'a mut dyn common::Delegate,
7067 ) -> ProjectLocationConnectionProfileListCall<'a, C> {
7068 self._delegate = Some(new_value);
7069 self
7070 }
7071
7072 /// Set any additional parameter of the query string used in the request.
7073 /// It should be used to set parameters which are not yet available through their own
7074 /// setters.
7075 ///
7076 /// Please note that this method must not be used to set any of the known parameters
7077 /// which have their own setter method. If done anyway, the request will fail.
7078 ///
7079 /// # Additional Parameters
7080 ///
7081 /// * *$.xgafv* (query-string) - V1 error format.
7082 /// * *access_token* (query-string) - OAuth access token.
7083 /// * *alt* (query-string) - Data format for response.
7084 /// * *callback* (query-string) - JSONP
7085 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7086 /// * *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.
7087 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7088 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7089 /// * *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.
7090 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7091 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7092 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfileListCall<'a, C>
7093 where
7094 T: AsRef<str>,
7095 {
7096 self._additional_params
7097 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7098 self
7099 }
7100
7101 /// Identifies the authorization scope for the method you are building.
7102 ///
7103 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7104 /// [`Scope::CloudPlatform`].
7105 ///
7106 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7107 /// tokens for more than one scope.
7108 ///
7109 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7110 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7111 /// sufficient, a read-write scope will do as well.
7112 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfileListCall<'a, C>
7113 where
7114 St: AsRef<str>,
7115 {
7116 self._scopes.insert(String::from(scope.as_ref()));
7117 self
7118 }
7119 /// Identifies the authorization scope(s) for the method you are building.
7120 ///
7121 /// See [`Self::add_scope()`] for details.
7122 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionProfileListCall<'a, C>
7123 where
7124 I: IntoIterator<Item = St>,
7125 St: AsRef<str>,
7126 {
7127 self._scopes
7128 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7129 self
7130 }
7131
7132 /// Removes all scopes, and no default scope will be used either.
7133 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7134 /// for details).
7135 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileListCall<'a, C> {
7136 self._scopes.clear();
7137 self
7138 }
7139}
7140
7141/// Update the configuration of a single connection profile.
7142///
7143/// A builder for the *locations.connectionProfiles.patch* method supported by a *project* resource.
7144/// It is not used directly, but through a [`ProjectMethods`] instance.
7145///
7146/// # Example
7147///
7148/// Instantiate a resource method builder
7149///
7150/// ```test_harness,no_run
7151/// # extern crate hyper;
7152/// # extern crate hyper_rustls;
7153/// # extern crate google_datamigration1 as datamigration1;
7154/// use datamigration1::api::ConnectionProfile;
7155/// # async fn dox() {
7156/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7157///
7158/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7159/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7160/// # .with_native_roots()
7161/// # .unwrap()
7162/// # .https_only()
7163/// # .enable_http2()
7164/// # .build();
7165///
7166/// # let executor = hyper_util::rt::TokioExecutor::new();
7167/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7168/// # secret,
7169/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7170/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7171/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7172/// # ),
7173/// # ).build().await.unwrap();
7174///
7175/// # let client = hyper_util::client::legacy::Client::builder(
7176/// # hyper_util::rt::TokioExecutor::new()
7177/// # )
7178/// # .build(
7179/// # hyper_rustls::HttpsConnectorBuilder::new()
7180/// # .with_native_roots()
7181/// # .unwrap()
7182/// # .https_or_http()
7183/// # .enable_http2()
7184/// # .build()
7185/// # );
7186/// # let mut hub = DatabaseMigrationService::new(client, auth);
7187/// // As the method needs a request, you would usually fill it with the desired information
7188/// // into the respective structure. Some of the parts shown here might not be applicable !
7189/// // Values shown here are possibly random and not representative !
7190/// let mut req = ConnectionProfile::default();
7191///
7192/// // You can configure optional parameters by calling the respective setters at will, and
7193/// // execute the final call using `doit()`.
7194/// // Values shown here are possibly random and not representative !
7195/// let result = hub.projects().locations_connection_profiles_patch(req, "name")
7196/// .validate_only(true)
7197/// .update_mask(FieldMask::new::<&str>(&[]))
7198/// .skip_validation(true)
7199/// .request_id("vero")
7200/// .doit().await;
7201/// # }
7202/// ```
7203pub struct ProjectLocationConnectionProfilePatchCall<'a, C>
7204where
7205 C: 'a,
7206{
7207 hub: &'a DatabaseMigrationService<C>,
7208 _request: ConnectionProfile,
7209 _name: String,
7210 _validate_only: Option<bool>,
7211 _update_mask: Option<common::FieldMask>,
7212 _skip_validation: Option<bool>,
7213 _request_id: Option<String>,
7214 _delegate: Option<&'a mut dyn common::Delegate>,
7215 _additional_params: HashMap<String, String>,
7216 _scopes: BTreeSet<String>,
7217}
7218
7219impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfilePatchCall<'a, C> {}
7220
7221impl<'a, C> ProjectLocationConnectionProfilePatchCall<'a, C>
7222where
7223 C: common::Connector,
7224{
7225 /// Perform the operation you have build so far.
7226 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7227 use std::borrow::Cow;
7228 use std::io::{Read, Seek};
7229
7230 use common::{url::Params, ToParts};
7231 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7232
7233 let mut dd = common::DefaultDelegate;
7234 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7235 dlg.begin(common::MethodInfo {
7236 id: "datamigration.projects.locations.connectionProfiles.patch",
7237 http_method: hyper::Method::PATCH,
7238 });
7239
7240 for &field in [
7241 "alt",
7242 "name",
7243 "validateOnly",
7244 "updateMask",
7245 "skipValidation",
7246 "requestId",
7247 ]
7248 .iter()
7249 {
7250 if self._additional_params.contains_key(field) {
7251 dlg.finished(false);
7252 return Err(common::Error::FieldClash(field));
7253 }
7254 }
7255
7256 let mut params = Params::with_capacity(8 + self._additional_params.len());
7257 params.push("name", self._name);
7258 if let Some(value) = self._validate_only.as_ref() {
7259 params.push("validateOnly", value.to_string());
7260 }
7261 if let Some(value) = self._update_mask.as_ref() {
7262 params.push("updateMask", value.to_string());
7263 }
7264 if let Some(value) = self._skip_validation.as_ref() {
7265 params.push("skipValidation", value.to_string());
7266 }
7267 if let Some(value) = self._request_id.as_ref() {
7268 params.push("requestId", value);
7269 }
7270
7271 params.extend(self._additional_params.iter());
7272
7273 params.push("alt", "json");
7274 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7275 if self._scopes.is_empty() {
7276 self._scopes
7277 .insert(Scope::CloudPlatform.as_ref().to_string());
7278 }
7279
7280 #[allow(clippy::single_element_loop)]
7281 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7282 url = params.uri_replacement(url, param_name, find_this, true);
7283 }
7284 {
7285 let to_remove = ["name"];
7286 params.remove_params(&to_remove);
7287 }
7288
7289 let url = params.parse_with_url(&url);
7290
7291 let mut json_mime_type = mime::APPLICATION_JSON;
7292 let mut request_value_reader = {
7293 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7294 common::remove_json_null_values(&mut value);
7295 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7296 serde_json::to_writer(&mut dst, &value).unwrap();
7297 dst
7298 };
7299 let request_size = request_value_reader
7300 .seek(std::io::SeekFrom::End(0))
7301 .unwrap();
7302 request_value_reader
7303 .seek(std::io::SeekFrom::Start(0))
7304 .unwrap();
7305
7306 loop {
7307 let token = match self
7308 .hub
7309 .auth
7310 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7311 .await
7312 {
7313 Ok(token) => token,
7314 Err(e) => match dlg.token(e) {
7315 Ok(token) => token,
7316 Err(e) => {
7317 dlg.finished(false);
7318 return Err(common::Error::MissingToken(e));
7319 }
7320 },
7321 };
7322 request_value_reader
7323 .seek(std::io::SeekFrom::Start(0))
7324 .unwrap();
7325 let mut req_result = {
7326 let client = &self.hub.client;
7327 dlg.pre_request();
7328 let mut req_builder = hyper::Request::builder()
7329 .method(hyper::Method::PATCH)
7330 .uri(url.as_str())
7331 .header(USER_AGENT, self.hub._user_agent.clone());
7332
7333 if let Some(token) = token.as_ref() {
7334 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7335 }
7336
7337 let request = req_builder
7338 .header(CONTENT_TYPE, json_mime_type.to_string())
7339 .header(CONTENT_LENGTH, request_size as u64)
7340 .body(common::to_body(
7341 request_value_reader.get_ref().clone().into(),
7342 ));
7343
7344 client.request(request.unwrap()).await
7345 };
7346
7347 match req_result {
7348 Err(err) => {
7349 if let common::Retry::After(d) = dlg.http_error(&err) {
7350 sleep(d).await;
7351 continue;
7352 }
7353 dlg.finished(false);
7354 return Err(common::Error::HttpError(err));
7355 }
7356 Ok(res) => {
7357 let (mut parts, body) = res.into_parts();
7358 let mut body = common::Body::new(body);
7359 if !parts.status.is_success() {
7360 let bytes = common::to_bytes(body).await.unwrap_or_default();
7361 let error = serde_json::from_str(&common::to_string(&bytes));
7362 let response = common::to_response(parts, bytes.into());
7363
7364 if let common::Retry::After(d) =
7365 dlg.http_failure(&response, error.as_ref().ok())
7366 {
7367 sleep(d).await;
7368 continue;
7369 }
7370
7371 dlg.finished(false);
7372
7373 return Err(match error {
7374 Ok(value) => common::Error::BadRequest(value),
7375 _ => common::Error::Failure(response),
7376 });
7377 }
7378 let response = {
7379 let bytes = common::to_bytes(body).await.unwrap_or_default();
7380 let encoded = common::to_string(&bytes);
7381 match serde_json::from_str(&encoded) {
7382 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7383 Err(error) => {
7384 dlg.response_json_decode_error(&encoded, &error);
7385 return Err(common::Error::JsonDecodeError(
7386 encoded.to_string(),
7387 error,
7388 ));
7389 }
7390 }
7391 };
7392
7393 dlg.finished(true);
7394 return Ok(response);
7395 }
7396 }
7397 }
7398 }
7399
7400 ///
7401 /// Sets the *request* property to the given value.
7402 ///
7403 /// Even though the property as already been set when instantiating this call,
7404 /// we provide this method for API completeness.
7405 pub fn request(
7406 mut self,
7407 new_value: ConnectionProfile,
7408 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7409 self._request = new_value;
7410 self
7411 }
7412 /// The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}.
7413 ///
7414 /// Sets the *name* path property to the given value.
7415 ///
7416 /// Even though the property as already been set when instantiating this call,
7417 /// we provide this method for API completeness.
7418 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7419 self._name = new_value.to_string();
7420 self
7421 }
7422 /// Optional. Only validate the connection profile, but don't update any resources. The default is false. Only supported for Oracle connection profiles.
7423 ///
7424 /// Sets the *validate only* query property to the given value.
7425 pub fn validate_only(
7426 mut self,
7427 new_value: bool,
7428 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7429 self._validate_only = Some(new_value);
7430 self
7431 }
7432 /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
7433 ///
7434 /// Sets the *update mask* query property to the given value.
7435 pub fn update_mask(
7436 mut self,
7437 new_value: common::FieldMask,
7438 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7439 self._update_mask = Some(new_value);
7440 self
7441 }
7442 /// Optional. Update the connection profile without validating it. The default is false. Only supported for Oracle connection profiles.
7443 ///
7444 /// Sets the *skip validation* query property to the given value.
7445 pub fn skip_validation(
7446 mut self,
7447 new_value: bool,
7448 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7449 self._skip_validation = Some(new_value);
7450 self
7451 }
7452 /// 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.
7453 ///
7454 /// Sets the *request id* query property to the given value.
7455 pub fn request_id(
7456 mut self,
7457 new_value: &str,
7458 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7459 self._request_id = Some(new_value.to_string());
7460 self
7461 }
7462 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7463 /// while executing the actual API request.
7464 ///
7465 /// ````text
7466 /// It should be used to handle progress information, and to implement a certain level of resilience.
7467 /// ````
7468 ///
7469 /// Sets the *delegate* property to the given value.
7470 pub fn delegate(
7471 mut self,
7472 new_value: &'a mut dyn common::Delegate,
7473 ) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7474 self._delegate = Some(new_value);
7475 self
7476 }
7477
7478 /// Set any additional parameter of the query string used in the request.
7479 /// It should be used to set parameters which are not yet available through their own
7480 /// setters.
7481 ///
7482 /// Please note that this method must not be used to set any of the known parameters
7483 /// which have their own setter method. If done anyway, the request will fail.
7484 ///
7485 /// # Additional Parameters
7486 ///
7487 /// * *$.xgafv* (query-string) - V1 error format.
7488 /// * *access_token* (query-string) - OAuth access token.
7489 /// * *alt* (query-string) - Data format for response.
7490 /// * *callback* (query-string) - JSONP
7491 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7492 /// * *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.
7493 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7494 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7495 /// * *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.
7496 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7497 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7498 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionProfilePatchCall<'a, C>
7499 where
7500 T: AsRef<str>,
7501 {
7502 self._additional_params
7503 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7504 self
7505 }
7506
7507 /// Identifies the authorization scope for the method you are building.
7508 ///
7509 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7510 /// [`Scope::CloudPlatform`].
7511 ///
7512 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7513 /// tokens for more than one scope.
7514 ///
7515 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7516 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7517 /// sufficient, a read-write scope will do as well.
7518 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionProfilePatchCall<'a, C>
7519 where
7520 St: AsRef<str>,
7521 {
7522 self._scopes.insert(String::from(scope.as_ref()));
7523 self
7524 }
7525 /// Identifies the authorization scope(s) for the method you are building.
7526 ///
7527 /// See [`Self::add_scope()`] for details.
7528 pub fn add_scopes<I, St>(
7529 mut self,
7530 scopes: I,
7531 ) -> ProjectLocationConnectionProfilePatchCall<'a, C>
7532 where
7533 I: IntoIterator<Item = St>,
7534 St: AsRef<str>,
7535 {
7536 self._scopes
7537 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7538 self
7539 }
7540
7541 /// Removes all scopes, and no default scope will be used either.
7542 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7543 /// for details).
7544 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfilePatchCall<'a, C> {
7545 self._scopes.clear();
7546 self
7547 }
7548}
7549
7550/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7551///
7552/// A builder for the *locations.connectionProfiles.setIamPolicy* method supported by a *project* resource.
7553/// It is not used directly, but through a [`ProjectMethods`] instance.
7554///
7555/// # Example
7556///
7557/// Instantiate a resource method builder
7558///
7559/// ```test_harness,no_run
7560/// # extern crate hyper;
7561/// # extern crate hyper_rustls;
7562/// # extern crate google_datamigration1 as datamigration1;
7563/// use datamigration1::api::SetIamPolicyRequest;
7564/// # async fn dox() {
7565/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7566///
7567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7569/// # .with_native_roots()
7570/// # .unwrap()
7571/// # .https_only()
7572/// # .enable_http2()
7573/// # .build();
7574///
7575/// # let executor = hyper_util::rt::TokioExecutor::new();
7576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7577/// # secret,
7578/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7579/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7580/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7581/// # ),
7582/// # ).build().await.unwrap();
7583///
7584/// # let client = hyper_util::client::legacy::Client::builder(
7585/// # hyper_util::rt::TokioExecutor::new()
7586/// # )
7587/// # .build(
7588/// # hyper_rustls::HttpsConnectorBuilder::new()
7589/// # .with_native_roots()
7590/// # .unwrap()
7591/// # .https_or_http()
7592/// # .enable_http2()
7593/// # .build()
7594/// # );
7595/// # let mut hub = DatabaseMigrationService::new(client, auth);
7596/// // As the method needs a request, you would usually fill it with the desired information
7597/// // into the respective structure. Some of the parts shown here might not be applicable !
7598/// // Values shown here are possibly random and not representative !
7599/// let mut req = SetIamPolicyRequest::default();
7600///
7601/// // You can configure optional parameters by calling the respective setters at will, and
7602/// // execute the final call using `doit()`.
7603/// // Values shown here are possibly random and not representative !
7604/// let result = hub.projects().locations_connection_profiles_set_iam_policy(req, "resource")
7605/// .doit().await;
7606/// # }
7607/// ```
7608pub struct ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7609where
7610 C: 'a,
7611{
7612 hub: &'a DatabaseMigrationService<C>,
7613 _request: SetIamPolicyRequest,
7614 _resource: String,
7615 _delegate: Option<&'a mut dyn common::Delegate>,
7616 _additional_params: HashMap<String, String>,
7617 _scopes: BTreeSet<String>,
7618}
7619
7620impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {}
7621
7622impl<'a, C> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7623where
7624 C: common::Connector,
7625{
7626 /// Perform the operation you have build so far.
7627 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7628 use std::borrow::Cow;
7629 use std::io::{Read, Seek};
7630
7631 use common::{url::Params, ToParts};
7632 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7633
7634 let mut dd = common::DefaultDelegate;
7635 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7636 dlg.begin(common::MethodInfo {
7637 id: "datamigration.projects.locations.connectionProfiles.setIamPolicy",
7638 http_method: hyper::Method::POST,
7639 });
7640
7641 for &field in ["alt", "resource"].iter() {
7642 if self._additional_params.contains_key(field) {
7643 dlg.finished(false);
7644 return Err(common::Error::FieldClash(field));
7645 }
7646 }
7647
7648 let mut params = Params::with_capacity(4 + self._additional_params.len());
7649 params.push("resource", self._resource);
7650
7651 params.extend(self._additional_params.iter());
7652
7653 params.push("alt", "json");
7654 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
7655 if self._scopes.is_empty() {
7656 self._scopes
7657 .insert(Scope::CloudPlatform.as_ref().to_string());
7658 }
7659
7660 #[allow(clippy::single_element_loop)]
7661 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7662 url = params.uri_replacement(url, param_name, find_this, true);
7663 }
7664 {
7665 let to_remove = ["resource"];
7666 params.remove_params(&to_remove);
7667 }
7668
7669 let url = params.parse_with_url(&url);
7670
7671 let mut json_mime_type = mime::APPLICATION_JSON;
7672 let mut request_value_reader = {
7673 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7674 common::remove_json_null_values(&mut value);
7675 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7676 serde_json::to_writer(&mut dst, &value).unwrap();
7677 dst
7678 };
7679 let request_size = request_value_reader
7680 .seek(std::io::SeekFrom::End(0))
7681 .unwrap();
7682 request_value_reader
7683 .seek(std::io::SeekFrom::Start(0))
7684 .unwrap();
7685
7686 loop {
7687 let token = match self
7688 .hub
7689 .auth
7690 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7691 .await
7692 {
7693 Ok(token) => token,
7694 Err(e) => match dlg.token(e) {
7695 Ok(token) => token,
7696 Err(e) => {
7697 dlg.finished(false);
7698 return Err(common::Error::MissingToken(e));
7699 }
7700 },
7701 };
7702 request_value_reader
7703 .seek(std::io::SeekFrom::Start(0))
7704 .unwrap();
7705 let mut req_result = {
7706 let client = &self.hub.client;
7707 dlg.pre_request();
7708 let mut req_builder = hyper::Request::builder()
7709 .method(hyper::Method::POST)
7710 .uri(url.as_str())
7711 .header(USER_AGENT, self.hub._user_agent.clone());
7712
7713 if let Some(token) = token.as_ref() {
7714 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7715 }
7716
7717 let request = req_builder
7718 .header(CONTENT_TYPE, json_mime_type.to_string())
7719 .header(CONTENT_LENGTH, request_size as u64)
7720 .body(common::to_body(
7721 request_value_reader.get_ref().clone().into(),
7722 ));
7723
7724 client.request(request.unwrap()).await
7725 };
7726
7727 match req_result {
7728 Err(err) => {
7729 if let common::Retry::After(d) = dlg.http_error(&err) {
7730 sleep(d).await;
7731 continue;
7732 }
7733 dlg.finished(false);
7734 return Err(common::Error::HttpError(err));
7735 }
7736 Ok(res) => {
7737 let (mut parts, body) = res.into_parts();
7738 let mut body = common::Body::new(body);
7739 if !parts.status.is_success() {
7740 let bytes = common::to_bytes(body).await.unwrap_or_default();
7741 let error = serde_json::from_str(&common::to_string(&bytes));
7742 let response = common::to_response(parts, bytes.into());
7743
7744 if let common::Retry::After(d) =
7745 dlg.http_failure(&response, error.as_ref().ok())
7746 {
7747 sleep(d).await;
7748 continue;
7749 }
7750
7751 dlg.finished(false);
7752
7753 return Err(match error {
7754 Ok(value) => common::Error::BadRequest(value),
7755 _ => common::Error::Failure(response),
7756 });
7757 }
7758 let response = {
7759 let bytes = common::to_bytes(body).await.unwrap_or_default();
7760 let encoded = common::to_string(&bytes);
7761 match serde_json::from_str(&encoded) {
7762 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7763 Err(error) => {
7764 dlg.response_json_decode_error(&encoded, &error);
7765 return Err(common::Error::JsonDecodeError(
7766 encoded.to_string(),
7767 error,
7768 ));
7769 }
7770 }
7771 };
7772
7773 dlg.finished(true);
7774 return Ok(response);
7775 }
7776 }
7777 }
7778 }
7779
7780 ///
7781 /// Sets the *request* property to the given value.
7782 ///
7783 /// Even though the property as already been set when instantiating this call,
7784 /// we provide this method for API completeness.
7785 pub fn request(
7786 mut self,
7787 new_value: SetIamPolicyRequest,
7788 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7789 self._request = new_value;
7790 self
7791 }
7792 /// 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.
7793 ///
7794 /// Sets the *resource* path property to the given value.
7795 ///
7796 /// Even though the property as already been set when instantiating this call,
7797 /// we provide this method for API completeness.
7798 pub fn resource(
7799 mut self,
7800 new_value: &str,
7801 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7802 self._resource = new_value.to_string();
7803 self
7804 }
7805 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7806 /// while executing the actual API request.
7807 ///
7808 /// ````text
7809 /// It should be used to handle progress information, and to implement a certain level of resilience.
7810 /// ````
7811 ///
7812 /// Sets the *delegate* property to the given value.
7813 pub fn delegate(
7814 mut self,
7815 new_value: &'a mut dyn common::Delegate,
7816 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7817 self._delegate = Some(new_value);
7818 self
7819 }
7820
7821 /// Set any additional parameter of the query string used in the request.
7822 /// It should be used to set parameters which are not yet available through their own
7823 /// setters.
7824 ///
7825 /// Please note that this method must not be used to set any of the known parameters
7826 /// which have their own setter method. If done anyway, the request will fail.
7827 ///
7828 /// # Additional Parameters
7829 ///
7830 /// * *$.xgafv* (query-string) - V1 error format.
7831 /// * *access_token* (query-string) - OAuth access token.
7832 /// * *alt* (query-string) - Data format for response.
7833 /// * *callback* (query-string) - JSONP
7834 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7835 /// * *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.
7836 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7837 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7838 /// * *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.
7839 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7840 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7841 pub fn param<T>(
7842 mut self,
7843 name: T,
7844 value: T,
7845 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7846 where
7847 T: AsRef<str>,
7848 {
7849 self._additional_params
7850 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7851 self
7852 }
7853
7854 /// Identifies the authorization scope for the method you are building.
7855 ///
7856 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7857 /// [`Scope::CloudPlatform`].
7858 ///
7859 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7860 /// tokens for more than one scope.
7861 ///
7862 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7863 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7864 /// sufficient, a read-write scope will do as well.
7865 pub fn add_scope<St>(
7866 mut self,
7867 scope: St,
7868 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7869 where
7870 St: AsRef<str>,
7871 {
7872 self._scopes.insert(String::from(scope.as_ref()));
7873 self
7874 }
7875 /// Identifies the authorization scope(s) for the method you are building.
7876 ///
7877 /// See [`Self::add_scope()`] for details.
7878 pub fn add_scopes<I, St>(
7879 mut self,
7880 scopes: I,
7881 ) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C>
7882 where
7883 I: IntoIterator<Item = St>,
7884 St: AsRef<str>,
7885 {
7886 self._scopes
7887 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7888 self
7889 }
7890
7891 /// Removes all scopes, and no default scope will be used either.
7892 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7893 /// for details).
7894 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileSetIamPolicyCall<'a, C> {
7895 self._scopes.clear();
7896 self
7897 }
7898}
7899
7900/// 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.
7901///
7902/// A builder for the *locations.connectionProfiles.testIamPermissions* method supported by a *project* resource.
7903/// It is not used directly, but through a [`ProjectMethods`] instance.
7904///
7905/// # Example
7906///
7907/// Instantiate a resource method builder
7908///
7909/// ```test_harness,no_run
7910/// # extern crate hyper;
7911/// # extern crate hyper_rustls;
7912/// # extern crate google_datamigration1 as datamigration1;
7913/// use datamigration1::api::TestIamPermissionsRequest;
7914/// # async fn dox() {
7915/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7916///
7917/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7918/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7919/// # .with_native_roots()
7920/// # .unwrap()
7921/// # .https_only()
7922/// # .enable_http2()
7923/// # .build();
7924///
7925/// # let executor = hyper_util::rt::TokioExecutor::new();
7926/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7927/// # secret,
7928/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7929/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7930/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7931/// # ),
7932/// # ).build().await.unwrap();
7933///
7934/// # let client = hyper_util::client::legacy::Client::builder(
7935/// # hyper_util::rt::TokioExecutor::new()
7936/// # )
7937/// # .build(
7938/// # hyper_rustls::HttpsConnectorBuilder::new()
7939/// # .with_native_roots()
7940/// # .unwrap()
7941/// # .https_or_http()
7942/// # .enable_http2()
7943/// # .build()
7944/// # );
7945/// # let mut hub = DatabaseMigrationService::new(client, auth);
7946/// // As the method needs a request, you would usually fill it with the desired information
7947/// // into the respective structure. Some of the parts shown here might not be applicable !
7948/// // Values shown here are possibly random and not representative !
7949/// let mut req = TestIamPermissionsRequest::default();
7950///
7951/// // You can configure optional parameters by calling the respective setters at will, and
7952/// // execute the final call using `doit()`.
7953/// // Values shown here are possibly random and not representative !
7954/// let result = hub.projects().locations_connection_profiles_test_iam_permissions(req, "resource")
7955/// .doit().await;
7956/// # }
7957/// ```
7958pub struct ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7959where
7960 C: 'a,
7961{
7962 hub: &'a DatabaseMigrationService<C>,
7963 _request: TestIamPermissionsRequest,
7964 _resource: String,
7965 _delegate: Option<&'a mut dyn common::Delegate>,
7966 _additional_params: HashMap<String, String>,
7967 _scopes: BTreeSet<String>,
7968}
7969
7970impl<'a, C> common::CallBuilder for ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {}
7971
7972impl<'a, C> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
7973where
7974 C: common::Connector,
7975{
7976 /// Perform the operation you have build so far.
7977 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
7978 use std::borrow::Cow;
7979 use std::io::{Read, Seek};
7980
7981 use common::{url::Params, ToParts};
7982 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7983
7984 let mut dd = common::DefaultDelegate;
7985 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7986 dlg.begin(common::MethodInfo {
7987 id: "datamigration.projects.locations.connectionProfiles.testIamPermissions",
7988 http_method: hyper::Method::POST,
7989 });
7990
7991 for &field in ["alt", "resource"].iter() {
7992 if self._additional_params.contains_key(field) {
7993 dlg.finished(false);
7994 return Err(common::Error::FieldClash(field));
7995 }
7996 }
7997
7998 let mut params = Params::with_capacity(4 + self._additional_params.len());
7999 params.push("resource", self._resource);
8000
8001 params.extend(self._additional_params.iter());
8002
8003 params.push("alt", "json");
8004 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
8005 if self._scopes.is_empty() {
8006 self._scopes
8007 .insert(Scope::CloudPlatform.as_ref().to_string());
8008 }
8009
8010 #[allow(clippy::single_element_loop)]
8011 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
8012 url = params.uri_replacement(url, param_name, find_this, true);
8013 }
8014 {
8015 let to_remove = ["resource"];
8016 params.remove_params(&to_remove);
8017 }
8018
8019 let url = params.parse_with_url(&url);
8020
8021 let mut json_mime_type = mime::APPLICATION_JSON;
8022 let mut request_value_reader = {
8023 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8024 common::remove_json_null_values(&mut value);
8025 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8026 serde_json::to_writer(&mut dst, &value).unwrap();
8027 dst
8028 };
8029 let request_size = request_value_reader
8030 .seek(std::io::SeekFrom::End(0))
8031 .unwrap();
8032 request_value_reader
8033 .seek(std::io::SeekFrom::Start(0))
8034 .unwrap();
8035
8036 loop {
8037 let token = match self
8038 .hub
8039 .auth
8040 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8041 .await
8042 {
8043 Ok(token) => token,
8044 Err(e) => match dlg.token(e) {
8045 Ok(token) => token,
8046 Err(e) => {
8047 dlg.finished(false);
8048 return Err(common::Error::MissingToken(e));
8049 }
8050 },
8051 };
8052 request_value_reader
8053 .seek(std::io::SeekFrom::Start(0))
8054 .unwrap();
8055 let mut req_result = {
8056 let client = &self.hub.client;
8057 dlg.pre_request();
8058 let mut req_builder = hyper::Request::builder()
8059 .method(hyper::Method::POST)
8060 .uri(url.as_str())
8061 .header(USER_AGENT, self.hub._user_agent.clone());
8062
8063 if let Some(token) = token.as_ref() {
8064 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8065 }
8066
8067 let request = req_builder
8068 .header(CONTENT_TYPE, json_mime_type.to_string())
8069 .header(CONTENT_LENGTH, request_size as u64)
8070 .body(common::to_body(
8071 request_value_reader.get_ref().clone().into(),
8072 ));
8073
8074 client.request(request.unwrap()).await
8075 };
8076
8077 match req_result {
8078 Err(err) => {
8079 if let common::Retry::After(d) = dlg.http_error(&err) {
8080 sleep(d).await;
8081 continue;
8082 }
8083 dlg.finished(false);
8084 return Err(common::Error::HttpError(err));
8085 }
8086 Ok(res) => {
8087 let (mut parts, body) = res.into_parts();
8088 let mut body = common::Body::new(body);
8089 if !parts.status.is_success() {
8090 let bytes = common::to_bytes(body).await.unwrap_or_default();
8091 let error = serde_json::from_str(&common::to_string(&bytes));
8092 let response = common::to_response(parts, bytes.into());
8093
8094 if let common::Retry::After(d) =
8095 dlg.http_failure(&response, error.as_ref().ok())
8096 {
8097 sleep(d).await;
8098 continue;
8099 }
8100
8101 dlg.finished(false);
8102
8103 return Err(match error {
8104 Ok(value) => common::Error::BadRequest(value),
8105 _ => common::Error::Failure(response),
8106 });
8107 }
8108 let response = {
8109 let bytes = common::to_bytes(body).await.unwrap_or_default();
8110 let encoded = common::to_string(&bytes);
8111 match serde_json::from_str(&encoded) {
8112 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8113 Err(error) => {
8114 dlg.response_json_decode_error(&encoded, &error);
8115 return Err(common::Error::JsonDecodeError(
8116 encoded.to_string(),
8117 error,
8118 ));
8119 }
8120 }
8121 };
8122
8123 dlg.finished(true);
8124 return Ok(response);
8125 }
8126 }
8127 }
8128 }
8129
8130 ///
8131 /// Sets the *request* property to the given value.
8132 ///
8133 /// Even though the property as already been set when instantiating this call,
8134 /// we provide this method for API completeness.
8135 pub fn request(
8136 mut self,
8137 new_value: TestIamPermissionsRequest,
8138 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
8139 self._request = new_value;
8140 self
8141 }
8142 /// 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.
8143 ///
8144 /// Sets the *resource* path property to the given value.
8145 ///
8146 /// Even though the property as already been set when instantiating this call,
8147 /// we provide this method for API completeness.
8148 pub fn resource(
8149 mut self,
8150 new_value: &str,
8151 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
8152 self._resource = new_value.to_string();
8153 self
8154 }
8155 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8156 /// while executing the actual API request.
8157 ///
8158 /// ````text
8159 /// It should be used to handle progress information, and to implement a certain level of resilience.
8160 /// ````
8161 ///
8162 /// Sets the *delegate* property to the given value.
8163 pub fn delegate(
8164 mut self,
8165 new_value: &'a mut dyn common::Delegate,
8166 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
8167 self._delegate = Some(new_value);
8168 self
8169 }
8170
8171 /// Set any additional parameter of the query string used in the request.
8172 /// It should be used to set parameters which are not yet available through their own
8173 /// setters.
8174 ///
8175 /// Please note that this method must not be used to set any of the known parameters
8176 /// which have their own setter method. If done anyway, the request will fail.
8177 ///
8178 /// # Additional Parameters
8179 ///
8180 /// * *$.xgafv* (query-string) - V1 error format.
8181 /// * *access_token* (query-string) - OAuth access token.
8182 /// * *alt* (query-string) - Data format for response.
8183 /// * *callback* (query-string) - JSONP
8184 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8185 /// * *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.
8186 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8187 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8188 /// * *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.
8189 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8190 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8191 pub fn param<T>(
8192 mut self,
8193 name: T,
8194 value: T,
8195 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
8196 where
8197 T: AsRef<str>,
8198 {
8199 self._additional_params
8200 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8201 self
8202 }
8203
8204 /// Identifies the authorization scope for the method you are building.
8205 ///
8206 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8207 /// [`Scope::CloudPlatform`].
8208 ///
8209 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8210 /// tokens for more than one scope.
8211 ///
8212 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8213 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8214 /// sufficient, a read-write scope will do as well.
8215 pub fn add_scope<St>(
8216 mut self,
8217 scope: St,
8218 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
8219 where
8220 St: AsRef<str>,
8221 {
8222 self._scopes.insert(String::from(scope.as_ref()));
8223 self
8224 }
8225 /// Identifies the authorization scope(s) for the method you are building.
8226 ///
8227 /// See [`Self::add_scope()`] for details.
8228 pub fn add_scopes<I, St>(
8229 mut self,
8230 scopes: I,
8231 ) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C>
8232 where
8233 I: IntoIterator<Item = St>,
8234 St: AsRef<str>,
8235 {
8236 self._scopes
8237 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8238 self
8239 }
8240
8241 /// Removes all scopes, and no default scope will be used either.
8242 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8243 /// for details).
8244 pub fn clear_scopes(mut self) -> ProjectLocationConnectionProfileTestIamPermissionCall<'a, C> {
8245 self._scopes.clear();
8246 self
8247 }
8248}
8249
8250/// Creates a new mapping rule for a given conversion workspace.
8251///
8252/// A builder for the *locations.conversionWorkspaces.mappingRules.create* method supported by a *project* resource.
8253/// It is not used directly, but through a [`ProjectMethods`] instance.
8254///
8255/// # Example
8256///
8257/// Instantiate a resource method builder
8258///
8259/// ```test_harness,no_run
8260/// # extern crate hyper;
8261/// # extern crate hyper_rustls;
8262/// # extern crate google_datamigration1 as datamigration1;
8263/// use datamigration1::api::MappingRule;
8264/// # async fn dox() {
8265/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8266///
8267/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8268/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8269/// # .with_native_roots()
8270/// # .unwrap()
8271/// # .https_only()
8272/// # .enable_http2()
8273/// # .build();
8274///
8275/// # let executor = hyper_util::rt::TokioExecutor::new();
8276/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8277/// # secret,
8278/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8279/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8280/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8281/// # ),
8282/// # ).build().await.unwrap();
8283///
8284/// # let client = hyper_util::client::legacy::Client::builder(
8285/// # hyper_util::rt::TokioExecutor::new()
8286/// # )
8287/// # .build(
8288/// # hyper_rustls::HttpsConnectorBuilder::new()
8289/// # .with_native_roots()
8290/// # .unwrap()
8291/// # .https_or_http()
8292/// # .enable_http2()
8293/// # .build()
8294/// # );
8295/// # let mut hub = DatabaseMigrationService::new(client, auth);
8296/// // As the method needs a request, you would usually fill it with the desired information
8297/// // into the respective structure. Some of the parts shown here might not be applicable !
8298/// // Values shown here are possibly random and not representative !
8299/// let mut req = MappingRule::default();
8300///
8301/// // You can configure optional parameters by calling the respective setters at will, and
8302/// // execute the final call using `doit()`.
8303/// // Values shown here are possibly random and not representative !
8304/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_create(req, "parent")
8305/// .request_id("dolore")
8306/// .mapping_rule_id("et")
8307/// .doit().await;
8308/// # }
8309/// ```
8310pub struct ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
8311where
8312 C: 'a,
8313{
8314 hub: &'a DatabaseMigrationService<C>,
8315 _request: MappingRule,
8316 _parent: String,
8317 _request_id: Option<String>,
8318 _mapping_rule_id: Option<String>,
8319 _delegate: Option<&'a mut dyn common::Delegate>,
8320 _additional_params: HashMap<String, String>,
8321 _scopes: BTreeSet<String>,
8322}
8323
8324impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {}
8325
8326impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
8327where
8328 C: common::Connector,
8329{
8330 /// Perform the operation you have build so far.
8331 pub async fn doit(mut self) -> common::Result<(common::Response, MappingRule)> {
8332 use std::borrow::Cow;
8333 use std::io::{Read, Seek};
8334
8335 use common::{url::Params, ToParts};
8336 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8337
8338 let mut dd = common::DefaultDelegate;
8339 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8340 dlg.begin(common::MethodInfo {
8341 id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.create",
8342 http_method: hyper::Method::POST,
8343 });
8344
8345 for &field in ["alt", "parent", "requestId", "mappingRuleId"].iter() {
8346 if self._additional_params.contains_key(field) {
8347 dlg.finished(false);
8348 return Err(common::Error::FieldClash(field));
8349 }
8350 }
8351
8352 let mut params = Params::with_capacity(6 + self._additional_params.len());
8353 params.push("parent", self._parent);
8354 if let Some(value) = self._request_id.as_ref() {
8355 params.push("requestId", value);
8356 }
8357 if let Some(value) = self._mapping_rule_id.as_ref() {
8358 params.push("mappingRuleId", value);
8359 }
8360
8361 params.extend(self._additional_params.iter());
8362
8363 params.push("alt", "json");
8364 let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules";
8365 if self._scopes.is_empty() {
8366 self._scopes
8367 .insert(Scope::CloudPlatform.as_ref().to_string());
8368 }
8369
8370 #[allow(clippy::single_element_loop)]
8371 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8372 url = params.uri_replacement(url, param_name, find_this, true);
8373 }
8374 {
8375 let to_remove = ["parent"];
8376 params.remove_params(&to_remove);
8377 }
8378
8379 let url = params.parse_with_url(&url);
8380
8381 let mut json_mime_type = mime::APPLICATION_JSON;
8382 let mut request_value_reader = {
8383 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8384 common::remove_json_null_values(&mut value);
8385 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8386 serde_json::to_writer(&mut dst, &value).unwrap();
8387 dst
8388 };
8389 let request_size = request_value_reader
8390 .seek(std::io::SeekFrom::End(0))
8391 .unwrap();
8392 request_value_reader
8393 .seek(std::io::SeekFrom::Start(0))
8394 .unwrap();
8395
8396 loop {
8397 let token = match self
8398 .hub
8399 .auth
8400 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8401 .await
8402 {
8403 Ok(token) => token,
8404 Err(e) => match dlg.token(e) {
8405 Ok(token) => token,
8406 Err(e) => {
8407 dlg.finished(false);
8408 return Err(common::Error::MissingToken(e));
8409 }
8410 },
8411 };
8412 request_value_reader
8413 .seek(std::io::SeekFrom::Start(0))
8414 .unwrap();
8415 let mut req_result = {
8416 let client = &self.hub.client;
8417 dlg.pre_request();
8418 let mut req_builder = hyper::Request::builder()
8419 .method(hyper::Method::POST)
8420 .uri(url.as_str())
8421 .header(USER_AGENT, self.hub._user_agent.clone());
8422
8423 if let Some(token) = token.as_ref() {
8424 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8425 }
8426
8427 let request = req_builder
8428 .header(CONTENT_TYPE, json_mime_type.to_string())
8429 .header(CONTENT_LENGTH, request_size as u64)
8430 .body(common::to_body(
8431 request_value_reader.get_ref().clone().into(),
8432 ));
8433
8434 client.request(request.unwrap()).await
8435 };
8436
8437 match req_result {
8438 Err(err) => {
8439 if let common::Retry::After(d) = dlg.http_error(&err) {
8440 sleep(d).await;
8441 continue;
8442 }
8443 dlg.finished(false);
8444 return Err(common::Error::HttpError(err));
8445 }
8446 Ok(res) => {
8447 let (mut parts, body) = res.into_parts();
8448 let mut body = common::Body::new(body);
8449 if !parts.status.is_success() {
8450 let bytes = common::to_bytes(body).await.unwrap_or_default();
8451 let error = serde_json::from_str(&common::to_string(&bytes));
8452 let response = common::to_response(parts, bytes.into());
8453
8454 if let common::Retry::After(d) =
8455 dlg.http_failure(&response, error.as_ref().ok())
8456 {
8457 sleep(d).await;
8458 continue;
8459 }
8460
8461 dlg.finished(false);
8462
8463 return Err(match error {
8464 Ok(value) => common::Error::BadRequest(value),
8465 _ => common::Error::Failure(response),
8466 });
8467 }
8468 let response = {
8469 let bytes = common::to_bytes(body).await.unwrap_or_default();
8470 let encoded = common::to_string(&bytes);
8471 match serde_json::from_str(&encoded) {
8472 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8473 Err(error) => {
8474 dlg.response_json_decode_error(&encoded, &error);
8475 return Err(common::Error::JsonDecodeError(
8476 encoded.to_string(),
8477 error,
8478 ));
8479 }
8480 }
8481 };
8482
8483 dlg.finished(true);
8484 return Ok(response);
8485 }
8486 }
8487 }
8488 }
8489
8490 ///
8491 /// Sets the *request* property to the given value.
8492 ///
8493 /// Even though the property as already been set when instantiating this call,
8494 /// we provide this method for API completeness.
8495 pub fn request(
8496 mut self,
8497 new_value: MappingRule,
8498 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8499 self._request = new_value;
8500 self
8501 }
8502 /// Required. The parent which owns this collection of mapping rules.
8503 ///
8504 /// Sets the *parent* path property to the given value.
8505 ///
8506 /// Even though the property as already been set when instantiating this call,
8507 /// we provide this method for API completeness.
8508 pub fn parent(
8509 mut self,
8510 new_value: &str,
8511 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8512 self._parent = new_value.to_string();
8513 self
8514 }
8515 /// 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.
8516 ///
8517 /// Sets the *request id* query property to the given value.
8518 pub fn request_id(
8519 mut self,
8520 new_value: &str,
8521 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8522 self._request_id = Some(new_value.to_string());
8523 self
8524 }
8525 /// Required. The ID of the rule to create.
8526 ///
8527 /// Sets the *mapping rule id* query property to the given value.
8528 pub fn mapping_rule_id(
8529 mut self,
8530 new_value: &str,
8531 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8532 self._mapping_rule_id = Some(new_value.to_string());
8533 self
8534 }
8535 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8536 /// while executing the actual API request.
8537 ///
8538 /// ````text
8539 /// It should be used to handle progress information, and to implement a certain level of resilience.
8540 /// ````
8541 ///
8542 /// Sets the *delegate* property to the given value.
8543 pub fn delegate(
8544 mut self,
8545 new_value: &'a mut dyn common::Delegate,
8546 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8547 self._delegate = Some(new_value);
8548 self
8549 }
8550
8551 /// Set any additional parameter of the query string used in the request.
8552 /// It should be used to set parameters which are not yet available through their own
8553 /// setters.
8554 ///
8555 /// Please note that this method must not be used to set any of the known parameters
8556 /// which have their own setter method. If done anyway, the request will fail.
8557 ///
8558 /// # Additional Parameters
8559 ///
8560 /// * *$.xgafv* (query-string) - V1 error format.
8561 /// * *access_token* (query-string) - OAuth access token.
8562 /// * *alt* (query-string) - Data format for response.
8563 /// * *callback* (query-string) - JSONP
8564 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8565 /// * *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.
8566 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8567 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8568 /// * *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.
8569 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8570 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8571 pub fn param<T>(
8572 mut self,
8573 name: T,
8574 value: T,
8575 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
8576 where
8577 T: AsRef<str>,
8578 {
8579 self._additional_params
8580 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8581 self
8582 }
8583
8584 /// Identifies the authorization scope for the method you are building.
8585 ///
8586 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8587 /// [`Scope::CloudPlatform`].
8588 ///
8589 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8590 /// tokens for more than one scope.
8591 ///
8592 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8593 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8594 /// sufficient, a read-write scope will do as well.
8595 pub fn add_scope<St>(
8596 mut self,
8597 scope: St,
8598 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
8599 where
8600 St: AsRef<str>,
8601 {
8602 self._scopes.insert(String::from(scope.as_ref()));
8603 self
8604 }
8605 /// Identifies the authorization scope(s) for the method you are building.
8606 ///
8607 /// See [`Self::add_scope()`] for details.
8608 pub fn add_scopes<I, St>(
8609 mut self,
8610 scopes: I,
8611 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C>
8612 where
8613 I: IntoIterator<Item = St>,
8614 St: AsRef<str>,
8615 {
8616 self._scopes
8617 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8618 self
8619 }
8620
8621 /// Removes all scopes, and no default scope will be used either.
8622 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8623 /// for details).
8624 pub fn clear_scopes(
8625 mut self,
8626 ) -> ProjectLocationConversionWorkspaceMappingRuleCreateCall<'a, C> {
8627 self._scopes.clear();
8628 self
8629 }
8630}
8631
8632/// Deletes a single mapping rule.
8633///
8634/// A builder for the *locations.conversionWorkspaces.mappingRules.delete* method supported by a *project* resource.
8635/// It is not used directly, but through a [`ProjectMethods`] instance.
8636///
8637/// # Example
8638///
8639/// Instantiate a resource method builder
8640///
8641/// ```test_harness,no_run
8642/// # extern crate hyper;
8643/// # extern crate hyper_rustls;
8644/// # extern crate google_datamigration1 as datamigration1;
8645/// # async fn dox() {
8646/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8647///
8648/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8649/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8650/// # .with_native_roots()
8651/// # .unwrap()
8652/// # .https_only()
8653/// # .enable_http2()
8654/// # .build();
8655///
8656/// # let executor = hyper_util::rt::TokioExecutor::new();
8657/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8658/// # secret,
8659/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8660/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8661/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8662/// # ),
8663/// # ).build().await.unwrap();
8664///
8665/// # let client = hyper_util::client::legacy::Client::builder(
8666/// # hyper_util::rt::TokioExecutor::new()
8667/// # )
8668/// # .build(
8669/// # hyper_rustls::HttpsConnectorBuilder::new()
8670/// # .with_native_roots()
8671/// # .unwrap()
8672/// # .https_or_http()
8673/// # .enable_http2()
8674/// # .build()
8675/// # );
8676/// # let mut hub = DatabaseMigrationService::new(client, auth);
8677/// // You can configure optional parameters by calling the respective setters at will, and
8678/// // execute the final call using `doit()`.
8679/// // Values shown here are possibly random and not representative !
8680/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_delete("name")
8681/// .request_id("amet.")
8682/// .doit().await;
8683/// # }
8684/// ```
8685pub struct ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8686where
8687 C: 'a,
8688{
8689 hub: &'a DatabaseMigrationService<C>,
8690 _name: String,
8691 _request_id: Option<String>,
8692 _delegate: Option<&'a mut dyn common::Delegate>,
8693 _additional_params: HashMap<String, String>,
8694 _scopes: BTreeSet<String>,
8695}
8696
8697impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {}
8698
8699impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8700where
8701 C: common::Connector,
8702{
8703 /// Perform the operation you have build so far.
8704 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
8705 use std::borrow::Cow;
8706 use std::io::{Read, Seek};
8707
8708 use common::{url::Params, ToParts};
8709 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8710
8711 let mut dd = common::DefaultDelegate;
8712 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8713 dlg.begin(common::MethodInfo {
8714 id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.delete",
8715 http_method: hyper::Method::DELETE,
8716 });
8717
8718 for &field in ["alt", "name", "requestId"].iter() {
8719 if self._additional_params.contains_key(field) {
8720 dlg.finished(false);
8721 return Err(common::Error::FieldClash(field));
8722 }
8723 }
8724
8725 let mut params = Params::with_capacity(4 + self._additional_params.len());
8726 params.push("name", self._name);
8727 if let Some(value) = self._request_id.as_ref() {
8728 params.push("requestId", value);
8729 }
8730
8731 params.extend(self._additional_params.iter());
8732
8733 params.push("alt", "json");
8734 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8735 if self._scopes.is_empty() {
8736 self._scopes
8737 .insert(Scope::CloudPlatform.as_ref().to_string());
8738 }
8739
8740 #[allow(clippy::single_element_loop)]
8741 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8742 url = params.uri_replacement(url, param_name, find_this, true);
8743 }
8744 {
8745 let to_remove = ["name"];
8746 params.remove_params(&to_remove);
8747 }
8748
8749 let url = params.parse_with_url(&url);
8750
8751 loop {
8752 let token = match self
8753 .hub
8754 .auth
8755 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8756 .await
8757 {
8758 Ok(token) => token,
8759 Err(e) => match dlg.token(e) {
8760 Ok(token) => token,
8761 Err(e) => {
8762 dlg.finished(false);
8763 return Err(common::Error::MissingToken(e));
8764 }
8765 },
8766 };
8767 let mut req_result = {
8768 let client = &self.hub.client;
8769 dlg.pre_request();
8770 let mut req_builder = hyper::Request::builder()
8771 .method(hyper::Method::DELETE)
8772 .uri(url.as_str())
8773 .header(USER_AGENT, self.hub._user_agent.clone());
8774
8775 if let Some(token) = token.as_ref() {
8776 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8777 }
8778
8779 let request = req_builder
8780 .header(CONTENT_LENGTH, 0_u64)
8781 .body(common::to_body::<String>(None));
8782
8783 client.request(request.unwrap()).await
8784 };
8785
8786 match req_result {
8787 Err(err) => {
8788 if let common::Retry::After(d) = dlg.http_error(&err) {
8789 sleep(d).await;
8790 continue;
8791 }
8792 dlg.finished(false);
8793 return Err(common::Error::HttpError(err));
8794 }
8795 Ok(res) => {
8796 let (mut parts, body) = res.into_parts();
8797 let mut body = common::Body::new(body);
8798 if !parts.status.is_success() {
8799 let bytes = common::to_bytes(body).await.unwrap_or_default();
8800 let error = serde_json::from_str(&common::to_string(&bytes));
8801 let response = common::to_response(parts, bytes.into());
8802
8803 if let common::Retry::After(d) =
8804 dlg.http_failure(&response, error.as_ref().ok())
8805 {
8806 sleep(d).await;
8807 continue;
8808 }
8809
8810 dlg.finished(false);
8811
8812 return Err(match error {
8813 Ok(value) => common::Error::BadRequest(value),
8814 _ => common::Error::Failure(response),
8815 });
8816 }
8817 let response = {
8818 let bytes = common::to_bytes(body).await.unwrap_or_default();
8819 let encoded = common::to_string(&bytes);
8820 match serde_json::from_str(&encoded) {
8821 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8822 Err(error) => {
8823 dlg.response_json_decode_error(&encoded, &error);
8824 return Err(common::Error::JsonDecodeError(
8825 encoded.to_string(),
8826 error,
8827 ));
8828 }
8829 }
8830 };
8831
8832 dlg.finished(true);
8833 return Ok(response);
8834 }
8835 }
8836 }
8837 }
8838
8839 /// Required. Name of the mapping rule resource to delete.
8840 ///
8841 /// Sets the *name* path property to the given value.
8842 ///
8843 /// Even though the property as already been set when instantiating this call,
8844 /// we provide this method for API completeness.
8845 pub fn name(
8846 mut self,
8847 new_value: &str,
8848 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8849 self._name = new_value.to_string();
8850 self
8851 }
8852 /// 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.
8853 ///
8854 /// Sets the *request id* query property to the given value.
8855 pub fn request_id(
8856 mut self,
8857 new_value: &str,
8858 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8859 self._request_id = Some(new_value.to_string());
8860 self
8861 }
8862 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8863 /// while executing the actual API request.
8864 ///
8865 /// ````text
8866 /// It should be used to handle progress information, and to implement a certain level of resilience.
8867 /// ````
8868 ///
8869 /// Sets the *delegate* property to the given value.
8870 pub fn delegate(
8871 mut self,
8872 new_value: &'a mut dyn common::Delegate,
8873 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8874 self._delegate = Some(new_value);
8875 self
8876 }
8877
8878 /// Set any additional parameter of the query string used in the request.
8879 /// It should be used to set parameters which are not yet available through their own
8880 /// setters.
8881 ///
8882 /// Please note that this method must not be used to set any of the known parameters
8883 /// which have their own setter method. If done anyway, the request will fail.
8884 ///
8885 /// # Additional Parameters
8886 ///
8887 /// * *$.xgafv* (query-string) - V1 error format.
8888 /// * *access_token* (query-string) - OAuth access token.
8889 /// * *alt* (query-string) - Data format for response.
8890 /// * *callback* (query-string) - JSONP
8891 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8892 /// * *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.
8893 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8894 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8895 /// * *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.
8896 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8897 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8898 pub fn param<T>(
8899 mut self,
8900 name: T,
8901 value: T,
8902 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8903 where
8904 T: AsRef<str>,
8905 {
8906 self._additional_params
8907 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8908 self
8909 }
8910
8911 /// Identifies the authorization scope for the method you are building.
8912 ///
8913 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8914 /// [`Scope::CloudPlatform`].
8915 ///
8916 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8917 /// tokens for more than one scope.
8918 ///
8919 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8920 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8921 /// sufficient, a read-write scope will do as well.
8922 pub fn add_scope<St>(
8923 mut self,
8924 scope: St,
8925 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8926 where
8927 St: AsRef<str>,
8928 {
8929 self._scopes.insert(String::from(scope.as_ref()));
8930 self
8931 }
8932 /// Identifies the authorization scope(s) for the method you are building.
8933 ///
8934 /// See [`Self::add_scope()`] for details.
8935 pub fn add_scopes<I, St>(
8936 mut self,
8937 scopes: I,
8938 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C>
8939 where
8940 I: IntoIterator<Item = St>,
8941 St: AsRef<str>,
8942 {
8943 self._scopes
8944 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8945 self
8946 }
8947
8948 /// Removes all scopes, and no default scope will be used either.
8949 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8950 /// for details).
8951 pub fn clear_scopes(
8952 mut self,
8953 ) -> ProjectLocationConversionWorkspaceMappingRuleDeleteCall<'a, C> {
8954 self._scopes.clear();
8955 self
8956 }
8957}
8958
8959/// Gets the details of a mapping rule.
8960///
8961/// A builder for the *locations.conversionWorkspaces.mappingRules.get* method supported by a *project* resource.
8962/// It is not used directly, but through a [`ProjectMethods`] instance.
8963///
8964/// # Example
8965///
8966/// Instantiate a resource method builder
8967///
8968/// ```test_harness,no_run
8969/// # extern crate hyper;
8970/// # extern crate hyper_rustls;
8971/// # extern crate google_datamigration1 as datamigration1;
8972/// # async fn dox() {
8973/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8974///
8975/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8976/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8977/// # .with_native_roots()
8978/// # .unwrap()
8979/// # .https_only()
8980/// # .enable_http2()
8981/// # .build();
8982///
8983/// # let executor = hyper_util::rt::TokioExecutor::new();
8984/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8985/// # secret,
8986/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8987/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8988/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8989/// # ),
8990/// # ).build().await.unwrap();
8991///
8992/// # let client = hyper_util::client::legacy::Client::builder(
8993/// # hyper_util::rt::TokioExecutor::new()
8994/// # )
8995/// # .build(
8996/// # hyper_rustls::HttpsConnectorBuilder::new()
8997/// # .with_native_roots()
8998/// # .unwrap()
8999/// # .https_or_http()
9000/// # .enable_http2()
9001/// # .build()
9002/// # );
9003/// # let mut hub = DatabaseMigrationService::new(client, auth);
9004/// // You can configure optional parameters by calling the respective setters at will, and
9005/// // execute the final call using `doit()`.
9006/// // Values shown here are possibly random and not representative !
9007/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_get("name")
9008/// .doit().await;
9009/// # }
9010/// ```
9011pub struct ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
9012where
9013 C: 'a,
9014{
9015 hub: &'a DatabaseMigrationService<C>,
9016 _name: String,
9017 _delegate: Option<&'a mut dyn common::Delegate>,
9018 _additional_params: HashMap<String, String>,
9019 _scopes: BTreeSet<String>,
9020}
9021
9022impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {}
9023
9024impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
9025where
9026 C: common::Connector,
9027{
9028 /// Perform the operation you have build so far.
9029 pub async fn doit(mut self) -> common::Result<(common::Response, MappingRule)> {
9030 use std::borrow::Cow;
9031 use std::io::{Read, Seek};
9032
9033 use common::{url::Params, ToParts};
9034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9035
9036 let mut dd = common::DefaultDelegate;
9037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9038 dlg.begin(common::MethodInfo {
9039 id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.get",
9040 http_method: hyper::Method::GET,
9041 });
9042
9043 for &field in ["alt", "name"].iter() {
9044 if self._additional_params.contains_key(field) {
9045 dlg.finished(false);
9046 return Err(common::Error::FieldClash(field));
9047 }
9048 }
9049
9050 let mut params = Params::with_capacity(3 + self._additional_params.len());
9051 params.push("name", self._name);
9052
9053 params.extend(self._additional_params.iter());
9054
9055 params.push("alt", "json");
9056 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9057 if self._scopes.is_empty() {
9058 self._scopes
9059 .insert(Scope::CloudPlatform.as_ref().to_string());
9060 }
9061
9062 #[allow(clippy::single_element_loop)]
9063 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9064 url = params.uri_replacement(url, param_name, find_this, true);
9065 }
9066 {
9067 let to_remove = ["name"];
9068 params.remove_params(&to_remove);
9069 }
9070
9071 let url = params.parse_with_url(&url);
9072
9073 loop {
9074 let token = match self
9075 .hub
9076 .auth
9077 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9078 .await
9079 {
9080 Ok(token) => token,
9081 Err(e) => match dlg.token(e) {
9082 Ok(token) => token,
9083 Err(e) => {
9084 dlg.finished(false);
9085 return Err(common::Error::MissingToken(e));
9086 }
9087 },
9088 };
9089 let mut req_result = {
9090 let client = &self.hub.client;
9091 dlg.pre_request();
9092 let mut req_builder = hyper::Request::builder()
9093 .method(hyper::Method::GET)
9094 .uri(url.as_str())
9095 .header(USER_AGENT, self.hub._user_agent.clone());
9096
9097 if let Some(token) = token.as_ref() {
9098 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9099 }
9100
9101 let request = req_builder
9102 .header(CONTENT_LENGTH, 0_u64)
9103 .body(common::to_body::<String>(None));
9104
9105 client.request(request.unwrap()).await
9106 };
9107
9108 match req_result {
9109 Err(err) => {
9110 if let common::Retry::After(d) = dlg.http_error(&err) {
9111 sleep(d).await;
9112 continue;
9113 }
9114 dlg.finished(false);
9115 return Err(common::Error::HttpError(err));
9116 }
9117 Ok(res) => {
9118 let (mut parts, body) = res.into_parts();
9119 let mut body = common::Body::new(body);
9120 if !parts.status.is_success() {
9121 let bytes = common::to_bytes(body).await.unwrap_or_default();
9122 let error = serde_json::from_str(&common::to_string(&bytes));
9123 let response = common::to_response(parts, bytes.into());
9124
9125 if let common::Retry::After(d) =
9126 dlg.http_failure(&response, error.as_ref().ok())
9127 {
9128 sleep(d).await;
9129 continue;
9130 }
9131
9132 dlg.finished(false);
9133
9134 return Err(match error {
9135 Ok(value) => common::Error::BadRequest(value),
9136 _ => common::Error::Failure(response),
9137 });
9138 }
9139 let response = {
9140 let bytes = common::to_bytes(body).await.unwrap_or_default();
9141 let encoded = common::to_string(&bytes);
9142 match serde_json::from_str(&encoded) {
9143 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9144 Err(error) => {
9145 dlg.response_json_decode_error(&encoded, &error);
9146 return Err(common::Error::JsonDecodeError(
9147 encoded.to_string(),
9148 error,
9149 ));
9150 }
9151 }
9152 };
9153
9154 dlg.finished(true);
9155 return Ok(response);
9156 }
9157 }
9158 }
9159 }
9160
9161 /// 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
9162 ///
9163 /// Sets the *name* path property to the given value.
9164 ///
9165 /// Even though the property as already been set when instantiating this call,
9166 /// we provide this method for API completeness.
9167 pub fn name(
9168 mut self,
9169 new_value: &str,
9170 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
9171 self._name = new_value.to_string();
9172 self
9173 }
9174 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9175 /// while executing the actual API request.
9176 ///
9177 /// ````text
9178 /// It should be used to handle progress information, and to implement a certain level of resilience.
9179 /// ````
9180 ///
9181 /// Sets the *delegate* property to the given value.
9182 pub fn delegate(
9183 mut self,
9184 new_value: &'a mut dyn common::Delegate,
9185 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
9186 self._delegate = Some(new_value);
9187 self
9188 }
9189
9190 /// Set any additional parameter of the query string used in the request.
9191 /// It should be used to set parameters which are not yet available through their own
9192 /// setters.
9193 ///
9194 /// Please note that this method must not be used to set any of the known parameters
9195 /// which have their own setter method. If done anyway, the request will fail.
9196 ///
9197 /// # Additional Parameters
9198 ///
9199 /// * *$.xgafv* (query-string) - V1 error format.
9200 /// * *access_token* (query-string) - OAuth access token.
9201 /// * *alt* (query-string) - Data format for response.
9202 /// * *callback* (query-string) - JSONP
9203 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9204 /// * *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.
9205 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9206 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9207 /// * *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.
9208 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9209 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9210 pub fn param<T>(
9211 mut self,
9212 name: T,
9213 value: T,
9214 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
9215 where
9216 T: AsRef<str>,
9217 {
9218 self._additional_params
9219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9220 self
9221 }
9222
9223 /// Identifies the authorization scope for the method you are building.
9224 ///
9225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9226 /// [`Scope::CloudPlatform`].
9227 ///
9228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9229 /// tokens for more than one scope.
9230 ///
9231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9233 /// sufficient, a read-write scope will do as well.
9234 pub fn add_scope<St>(
9235 mut self,
9236 scope: St,
9237 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
9238 where
9239 St: AsRef<str>,
9240 {
9241 self._scopes.insert(String::from(scope.as_ref()));
9242 self
9243 }
9244 /// Identifies the authorization scope(s) for the method you are building.
9245 ///
9246 /// See [`Self::add_scope()`] for details.
9247 pub fn add_scopes<I, St>(
9248 mut self,
9249 scopes: I,
9250 ) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C>
9251 where
9252 I: IntoIterator<Item = St>,
9253 St: AsRef<str>,
9254 {
9255 self._scopes
9256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9257 self
9258 }
9259
9260 /// Removes all scopes, and no default scope will be used either.
9261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9262 /// for details).
9263 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceMappingRuleGetCall<'a, C> {
9264 self._scopes.clear();
9265 self
9266 }
9267}
9268
9269/// Imports the mapping rules for a given conversion workspace. Supports various formats of external rules files.
9270///
9271/// A builder for the *locations.conversionWorkspaces.mappingRules.import* method supported by a *project* resource.
9272/// It is not used directly, but through a [`ProjectMethods`] instance.
9273///
9274/// # Example
9275///
9276/// Instantiate a resource method builder
9277///
9278/// ```test_harness,no_run
9279/// # extern crate hyper;
9280/// # extern crate hyper_rustls;
9281/// # extern crate google_datamigration1 as datamigration1;
9282/// use datamigration1::api::ImportMappingRulesRequest;
9283/// # async fn dox() {
9284/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9285///
9286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9288/// # .with_native_roots()
9289/// # .unwrap()
9290/// # .https_only()
9291/// # .enable_http2()
9292/// # .build();
9293///
9294/// # let executor = hyper_util::rt::TokioExecutor::new();
9295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9296/// # secret,
9297/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9298/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9299/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9300/// # ),
9301/// # ).build().await.unwrap();
9302///
9303/// # let client = hyper_util::client::legacy::Client::builder(
9304/// # hyper_util::rt::TokioExecutor::new()
9305/// # )
9306/// # .build(
9307/// # hyper_rustls::HttpsConnectorBuilder::new()
9308/// # .with_native_roots()
9309/// # .unwrap()
9310/// # .https_or_http()
9311/// # .enable_http2()
9312/// # .build()
9313/// # );
9314/// # let mut hub = DatabaseMigrationService::new(client, auth);
9315/// // As the method needs a request, you would usually fill it with the desired information
9316/// // into the respective structure. Some of the parts shown here might not be applicable !
9317/// // Values shown here are possibly random and not representative !
9318/// let mut req = ImportMappingRulesRequest::default();
9319///
9320/// // You can configure optional parameters by calling the respective setters at will, and
9321/// // execute the final call using `doit()`.
9322/// // Values shown here are possibly random and not representative !
9323/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_import(req, "parent")
9324/// .doit().await;
9325/// # }
9326/// ```
9327pub struct ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
9328where
9329 C: 'a,
9330{
9331 hub: &'a DatabaseMigrationService<C>,
9332 _request: ImportMappingRulesRequest,
9333 _parent: String,
9334 _delegate: Option<&'a mut dyn common::Delegate>,
9335 _additional_params: HashMap<String, String>,
9336 _scopes: BTreeSet<String>,
9337}
9338
9339impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {}
9340
9341impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
9342where
9343 C: common::Connector,
9344{
9345 /// Perform the operation you have build so far.
9346 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9347 use std::borrow::Cow;
9348 use std::io::{Read, Seek};
9349
9350 use common::{url::Params, ToParts};
9351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9352
9353 let mut dd = common::DefaultDelegate;
9354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9355 dlg.begin(common::MethodInfo {
9356 id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.import",
9357 http_method: hyper::Method::POST,
9358 });
9359
9360 for &field in ["alt", "parent"].iter() {
9361 if self._additional_params.contains_key(field) {
9362 dlg.finished(false);
9363 return Err(common::Error::FieldClash(field));
9364 }
9365 }
9366
9367 let mut params = Params::with_capacity(4 + self._additional_params.len());
9368 params.push("parent", self._parent);
9369
9370 params.extend(self._additional_params.iter());
9371
9372 params.push("alt", "json");
9373 let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules:import";
9374 if self._scopes.is_empty() {
9375 self._scopes
9376 .insert(Scope::CloudPlatform.as_ref().to_string());
9377 }
9378
9379 #[allow(clippy::single_element_loop)]
9380 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9381 url = params.uri_replacement(url, param_name, find_this, true);
9382 }
9383 {
9384 let to_remove = ["parent"];
9385 params.remove_params(&to_remove);
9386 }
9387
9388 let url = params.parse_with_url(&url);
9389
9390 let mut json_mime_type = mime::APPLICATION_JSON;
9391 let mut request_value_reader = {
9392 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9393 common::remove_json_null_values(&mut value);
9394 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9395 serde_json::to_writer(&mut dst, &value).unwrap();
9396 dst
9397 };
9398 let request_size = request_value_reader
9399 .seek(std::io::SeekFrom::End(0))
9400 .unwrap();
9401 request_value_reader
9402 .seek(std::io::SeekFrom::Start(0))
9403 .unwrap();
9404
9405 loop {
9406 let token = match self
9407 .hub
9408 .auth
9409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9410 .await
9411 {
9412 Ok(token) => token,
9413 Err(e) => match dlg.token(e) {
9414 Ok(token) => token,
9415 Err(e) => {
9416 dlg.finished(false);
9417 return Err(common::Error::MissingToken(e));
9418 }
9419 },
9420 };
9421 request_value_reader
9422 .seek(std::io::SeekFrom::Start(0))
9423 .unwrap();
9424 let mut req_result = {
9425 let client = &self.hub.client;
9426 dlg.pre_request();
9427 let mut req_builder = hyper::Request::builder()
9428 .method(hyper::Method::POST)
9429 .uri(url.as_str())
9430 .header(USER_AGENT, self.hub._user_agent.clone());
9431
9432 if let Some(token) = token.as_ref() {
9433 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9434 }
9435
9436 let request = req_builder
9437 .header(CONTENT_TYPE, json_mime_type.to_string())
9438 .header(CONTENT_LENGTH, request_size as u64)
9439 .body(common::to_body(
9440 request_value_reader.get_ref().clone().into(),
9441 ));
9442
9443 client.request(request.unwrap()).await
9444 };
9445
9446 match req_result {
9447 Err(err) => {
9448 if let common::Retry::After(d) = dlg.http_error(&err) {
9449 sleep(d).await;
9450 continue;
9451 }
9452 dlg.finished(false);
9453 return Err(common::Error::HttpError(err));
9454 }
9455 Ok(res) => {
9456 let (mut parts, body) = res.into_parts();
9457 let mut body = common::Body::new(body);
9458 if !parts.status.is_success() {
9459 let bytes = common::to_bytes(body).await.unwrap_or_default();
9460 let error = serde_json::from_str(&common::to_string(&bytes));
9461 let response = common::to_response(parts, bytes.into());
9462
9463 if let common::Retry::After(d) =
9464 dlg.http_failure(&response, error.as_ref().ok())
9465 {
9466 sleep(d).await;
9467 continue;
9468 }
9469
9470 dlg.finished(false);
9471
9472 return Err(match error {
9473 Ok(value) => common::Error::BadRequest(value),
9474 _ => common::Error::Failure(response),
9475 });
9476 }
9477 let response = {
9478 let bytes = common::to_bytes(body).await.unwrap_or_default();
9479 let encoded = common::to_string(&bytes);
9480 match serde_json::from_str(&encoded) {
9481 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9482 Err(error) => {
9483 dlg.response_json_decode_error(&encoded, &error);
9484 return Err(common::Error::JsonDecodeError(
9485 encoded.to_string(),
9486 error,
9487 ));
9488 }
9489 }
9490 };
9491
9492 dlg.finished(true);
9493 return Ok(response);
9494 }
9495 }
9496 }
9497 }
9498
9499 ///
9500 /// Sets the *request* property to the given value.
9501 ///
9502 /// Even though the property as already been set when instantiating this call,
9503 /// we provide this method for API completeness.
9504 pub fn request(
9505 mut self,
9506 new_value: ImportMappingRulesRequest,
9507 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
9508 self._request = new_value;
9509 self
9510 }
9511 /// Required. Name of the conversion workspace resource to import the rules to in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
9512 ///
9513 /// Sets the *parent* path property to the given value.
9514 ///
9515 /// Even though the property as already been set when instantiating this call,
9516 /// we provide this method for API completeness.
9517 pub fn parent(
9518 mut self,
9519 new_value: &str,
9520 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
9521 self._parent = new_value.to_string();
9522 self
9523 }
9524 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9525 /// while executing the actual API request.
9526 ///
9527 /// ````text
9528 /// It should be used to handle progress information, and to implement a certain level of resilience.
9529 /// ````
9530 ///
9531 /// Sets the *delegate* property to the given value.
9532 pub fn delegate(
9533 mut self,
9534 new_value: &'a mut dyn common::Delegate,
9535 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
9536 self._delegate = Some(new_value);
9537 self
9538 }
9539
9540 /// Set any additional parameter of the query string used in the request.
9541 /// It should be used to set parameters which are not yet available through their own
9542 /// setters.
9543 ///
9544 /// Please note that this method must not be used to set any of the known parameters
9545 /// which have their own setter method. If done anyway, the request will fail.
9546 ///
9547 /// # Additional Parameters
9548 ///
9549 /// * *$.xgafv* (query-string) - V1 error format.
9550 /// * *access_token* (query-string) - OAuth access token.
9551 /// * *alt* (query-string) - Data format for response.
9552 /// * *callback* (query-string) - JSONP
9553 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9554 /// * *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.
9555 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9556 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9557 /// * *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.
9558 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9559 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9560 pub fn param<T>(
9561 mut self,
9562 name: T,
9563 value: T,
9564 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
9565 where
9566 T: AsRef<str>,
9567 {
9568 self._additional_params
9569 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9570 self
9571 }
9572
9573 /// Identifies the authorization scope for the method you are building.
9574 ///
9575 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9576 /// [`Scope::CloudPlatform`].
9577 ///
9578 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9579 /// tokens for more than one scope.
9580 ///
9581 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9582 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9583 /// sufficient, a read-write scope will do as well.
9584 pub fn add_scope<St>(
9585 mut self,
9586 scope: St,
9587 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
9588 where
9589 St: AsRef<str>,
9590 {
9591 self._scopes.insert(String::from(scope.as_ref()));
9592 self
9593 }
9594 /// Identifies the authorization scope(s) for the method you are building.
9595 ///
9596 /// See [`Self::add_scope()`] for details.
9597 pub fn add_scopes<I, St>(
9598 mut self,
9599 scopes: I,
9600 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C>
9601 where
9602 I: IntoIterator<Item = St>,
9603 St: AsRef<str>,
9604 {
9605 self._scopes
9606 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9607 self
9608 }
9609
9610 /// Removes all scopes, and no default scope will be used either.
9611 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9612 /// for details).
9613 pub fn clear_scopes(
9614 mut self,
9615 ) -> ProjectLocationConversionWorkspaceMappingRuleImportCall<'a, C> {
9616 self._scopes.clear();
9617 self
9618 }
9619}
9620
9621/// Lists the mapping rules for a specific conversion workspace.
9622///
9623/// A builder for the *locations.conversionWorkspaces.mappingRules.list* method supported by a *project* resource.
9624/// It is not used directly, but through a [`ProjectMethods`] instance.
9625///
9626/// # Example
9627///
9628/// Instantiate a resource method builder
9629///
9630/// ```test_harness,no_run
9631/// # extern crate hyper;
9632/// # extern crate hyper_rustls;
9633/// # extern crate google_datamigration1 as datamigration1;
9634/// # async fn dox() {
9635/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9636///
9637/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9638/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9639/// # .with_native_roots()
9640/// # .unwrap()
9641/// # .https_only()
9642/// # .enable_http2()
9643/// # .build();
9644///
9645/// # let executor = hyper_util::rt::TokioExecutor::new();
9646/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9647/// # secret,
9648/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9649/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9650/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9651/// # ),
9652/// # ).build().await.unwrap();
9653///
9654/// # let client = hyper_util::client::legacy::Client::builder(
9655/// # hyper_util::rt::TokioExecutor::new()
9656/// # )
9657/// # .build(
9658/// # hyper_rustls::HttpsConnectorBuilder::new()
9659/// # .with_native_roots()
9660/// # .unwrap()
9661/// # .https_or_http()
9662/// # .enable_http2()
9663/// # .build()
9664/// # );
9665/// # let mut hub = DatabaseMigrationService::new(client, auth);
9666/// // You can configure optional parameters by calling the respective setters at will, and
9667/// // execute the final call using `doit()`.
9668/// // Values shown here are possibly random and not representative !
9669/// let result = hub.projects().locations_conversion_workspaces_mapping_rules_list("parent")
9670/// .page_token("et")
9671/// .page_size(-22)
9672/// .doit().await;
9673/// # }
9674/// ```
9675pub struct ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9676where
9677 C: 'a,
9678{
9679 hub: &'a DatabaseMigrationService<C>,
9680 _parent: String,
9681 _page_token: Option<String>,
9682 _page_size: Option<i32>,
9683 _delegate: Option<&'a mut dyn common::Delegate>,
9684 _additional_params: HashMap<String, String>,
9685 _scopes: BTreeSet<String>,
9686}
9687
9688impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {}
9689
9690impl<'a, C> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9691where
9692 C: common::Connector,
9693{
9694 /// Perform the operation you have build so far.
9695 pub async fn doit(mut self) -> common::Result<(common::Response, ListMappingRulesResponse)> {
9696 use std::borrow::Cow;
9697 use std::io::{Read, Seek};
9698
9699 use common::{url::Params, ToParts};
9700 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9701
9702 let mut dd = common::DefaultDelegate;
9703 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9704 dlg.begin(common::MethodInfo {
9705 id: "datamigration.projects.locations.conversionWorkspaces.mappingRules.list",
9706 http_method: hyper::Method::GET,
9707 });
9708
9709 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9710 if self._additional_params.contains_key(field) {
9711 dlg.finished(false);
9712 return Err(common::Error::FieldClash(field));
9713 }
9714 }
9715
9716 let mut params = Params::with_capacity(5 + self._additional_params.len());
9717 params.push("parent", self._parent);
9718 if let Some(value) = self._page_token.as_ref() {
9719 params.push("pageToken", value);
9720 }
9721 if let Some(value) = self._page_size.as_ref() {
9722 params.push("pageSize", value.to_string());
9723 }
9724
9725 params.extend(self._additional_params.iter());
9726
9727 params.push("alt", "json");
9728 let mut url = self.hub._base_url.clone() + "v1/{+parent}/mappingRules";
9729 if self._scopes.is_empty() {
9730 self._scopes
9731 .insert(Scope::CloudPlatform.as_ref().to_string());
9732 }
9733
9734 #[allow(clippy::single_element_loop)]
9735 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9736 url = params.uri_replacement(url, param_name, find_this, true);
9737 }
9738 {
9739 let to_remove = ["parent"];
9740 params.remove_params(&to_remove);
9741 }
9742
9743 let url = params.parse_with_url(&url);
9744
9745 loop {
9746 let token = match self
9747 .hub
9748 .auth
9749 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9750 .await
9751 {
9752 Ok(token) => token,
9753 Err(e) => match dlg.token(e) {
9754 Ok(token) => token,
9755 Err(e) => {
9756 dlg.finished(false);
9757 return Err(common::Error::MissingToken(e));
9758 }
9759 },
9760 };
9761 let mut req_result = {
9762 let client = &self.hub.client;
9763 dlg.pre_request();
9764 let mut req_builder = hyper::Request::builder()
9765 .method(hyper::Method::GET)
9766 .uri(url.as_str())
9767 .header(USER_AGENT, self.hub._user_agent.clone());
9768
9769 if let Some(token) = token.as_ref() {
9770 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9771 }
9772
9773 let request = req_builder
9774 .header(CONTENT_LENGTH, 0_u64)
9775 .body(common::to_body::<String>(None));
9776
9777 client.request(request.unwrap()).await
9778 };
9779
9780 match req_result {
9781 Err(err) => {
9782 if let common::Retry::After(d) = dlg.http_error(&err) {
9783 sleep(d).await;
9784 continue;
9785 }
9786 dlg.finished(false);
9787 return Err(common::Error::HttpError(err));
9788 }
9789 Ok(res) => {
9790 let (mut parts, body) = res.into_parts();
9791 let mut body = common::Body::new(body);
9792 if !parts.status.is_success() {
9793 let bytes = common::to_bytes(body).await.unwrap_or_default();
9794 let error = serde_json::from_str(&common::to_string(&bytes));
9795 let response = common::to_response(parts, bytes.into());
9796
9797 if let common::Retry::After(d) =
9798 dlg.http_failure(&response, error.as_ref().ok())
9799 {
9800 sleep(d).await;
9801 continue;
9802 }
9803
9804 dlg.finished(false);
9805
9806 return Err(match error {
9807 Ok(value) => common::Error::BadRequest(value),
9808 _ => common::Error::Failure(response),
9809 });
9810 }
9811 let response = {
9812 let bytes = common::to_bytes(body).await.unwrap_or_default();
9813 let encoded = common::to_string(&bytes);
9814 match serde_json::from_str(&encoded) {
9815 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9816 Err(error) => {
9817 dlg.response_json_decode_error(&encoded, &error);
9818 return Err(common::Error::JsonDecodeError(
9819 encoded.to_string(),
9820 error,
9821 ));
9822 }
9823 }
9824 };
9825
9826 dlg.finished(true);
9827 return Ok(response);
9828 }
9829 }
9830 }
9831 }
9832
9833 /// Required. Name of the conversion workspace resource whose mapping rules are listed in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
9834 ///
9835 /// Sets the *parent* path property to the given value.
9836 ///
9837 /// Even though the property as already been set when instantiating this call,
9838 /// we provide this method for API completeness.
9839 pub fn parent(
9840 mut self,
9841 new_value: &str,
9842 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9843 self._parent = new_value.to_string();
9844 self
9845 }
9846 /// 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.
9847 ///
9848 /// Sets the *page token* query property to the given value.
9849 pub fn page_token(
9850 mut self,
9851 new_value: &str,
9852 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9853 self._page_token = Some(new_value.to_string());
9854 self
9855 }
9856 /// The maximum number of rules to return. The service may return fewer than this value.
9857 ///
9858 /// Sets the *page size* query property to the given value.
9859 pub fn page_size(
9860 mut self,
9861 new_value: i32,
9862 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9863 self._page_size = Some(new_value);
9864 self
9865 }
9866 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9867 /// while executing the actual API request.
9868 ///
9869 /// ````text
9870 /// It should be used to handle progress information, and to implement a certain level of resilience.
9871 /// ````
9872 ///
9873 /// Sets the *delegate* property to the given value.
9874 pub fn delegate(
9875 mut self,
9876 new_value: &'a mut dyn common::Delegate,
9877 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9878 self._delegate = Some(new_value);
9879 self
9880 }
9881
9882 /// Set any additional parameter of the query string used in the request.
9883 /// It should be used to set parameters which are not yet available through their own
9884 /// setters.
9885 ///
9886 /// Please note that this method must not be used to set any of the known parameters
9887 /// which have their own setter method. If done anyway, the request will fail.
9888 ///
9889 /// # Additional Parameters
9890 ///
9891 /// * *$.xgafv* (query-string) - V1 error format.
9892 /// * *access_token* (query-string) - OAuth access token.
9893 /// * *alt* (query-string) - Data format for response.
9894 /// * *callback* (query-string) - JSONP
9895 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9896 /// * *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.
9897 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9898 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9899 /// * *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.
9900 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9901 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9902 pub fn param<T>(
9903 mut self,
9904 name: T,
9905 value: T,
9906 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9907 where
9908 T: AsRef<str>,
9909 {
9910 self._additional_params
9911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9912 self
9913 }
9914
9915 /// Identifies the authorization scope for the method you are building.
9916 ///
9917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9918 /// [`Scope::CloudPlatform`].
9919 ///
9920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9921 /// tokens for more than one scope.
9922 ///
9923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9925 /// sufficient, a read-write scope will do as well.
9926 pub fn add_scope<St>(
9927 mut self,
9928 scope: St,
9929 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9930 where
9931 St: AsRef<str>,
9932 {
9933 self._scopes.insert(String::from(scope.as_ref()));
9934 self
9935 }
9936 /// Identifies the authorization scope(s) for the method you are building.
9937 ///
9938 /// See [`Self::add_scope()`] for details.
9939 pub fn add_scopes<I, St>(
9940 mut self,
9941 scopes: I,
9942 ) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C>
9943 where
9944 I: IntoIterator<Item = St>,
9945 St: AsRef<str>,
9946 {
9947 self._scopes
9948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9949 self
9950 }
9951
9952 /// Removes all scopes, and no default scope will be used either.
9953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9954 /// for details).
9955 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceMappingRuleListCall<'a, C> {
9956 self._scopes.clear();
9957 self
9958 }
9959}
9960
9961/// Applies draft tree onto a specific destination database.
9962///
9963/// A builder for the *locations.conversionWorkspaces.apply* method supported by a *project* resource.
9964/// It is not used directly, but through a [`ProjectMethods`] instance.
9965///
9966/// # Example
9967///
9968/// Instantiate a resource method builder
9969///
9970/// ```test_harness,no_run
9971/// # extern crate hyper;
9972/// # extern crate hyper_rustls;
9973/// # extern crate google_datamigration1 as datamigration1;
9974/// use datamigration1::api::ApplyConversionWorkspaceRequest;
9975/// # async fn dox() {
9976/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9977///
9978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9979/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9980/// # .with_native_roots()
9981/// # .unwrap()
9982/// # .https_only()
9983/// # .enable_http2()
9984/// # .build();
9985///
9986/// # let executor = hyper_util::rt::TokioExecutor::new();
9987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9988/// # secret,
9989/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9990/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9991/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9992/// # ),
9993/// # ).build().await.unwrap();
9994///
9995/// # let client = hyper_util::client::legacy::Client::builder(
9996/// # hyper_util::rt::TokioExecutor::new()
9997/// # )
9998/// # .build(
9999/// # hyper_rustls::HttpsConnectorBuilder::new()
10000/// # .with_native_roots()
10001/// # .unwrap()
10002/// # .https_or_http()
10003/// # .enable_http2()
10004/// # .build()
10005/// # );
10006/// # let mut hub = DatabaseMigrationService::new(client, auth);
10007/// // As the method needs a request, you would usually fill it with the desired information
10008/// // into the respective structure. Some of the parts shown here might not be applicable !
10009/// // Values shown here are possibly random and not representative !
10010/// let mut req = ApplyConversionWorkspaceRequest::default();
10011///
10012/// // You can configure optional parameters by calling the respective setters at will, and
10013/// // execute the final call using `doit()`.
10014/// // Values shown here are possibly random and not representative !
10015/// let result = hub.projects().locations_conversion_workspaces_apply(req, "name")
10016/// .doit().await;
10017/// # }
10018/// ```
10019pub struct ProjectLocationConversionWorkspaceApplyCall<'a, C>
10020where
10021 C: 'a,
10022{
10023 hub: &'a DatabaseMigrationService<C>,
10024 _request: ApplyConversionWorkspaceRequest,
10025 _name: String,
10026 _delegate: Option<&'a mut dyn common::Delegate>,
10027 _additional_params: HashMap<String, String>,
10028 _scopes: BTreeSet<String>,
10029}
10030
10031impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceApplyCall<'a, C> {}
10032
10033impl<'a, C> ProjectLocationConversionWorkspaceApplyCall<'a, C>
10034where
10035 C: common::Connector,
10036{
10037 /// Perform the operation you have build so far.
10038 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10039 use std::borrow::Cow;
10040 use std::io::{Read, Seek};
10041
10042 use common::{url::Params, ToParts};
10043 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10044
10045 let mut dd = common::DefaultDelegate;
10046 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10047 dlg.begin(common::MethodInfo {
10048 id: "datamigration.projects.locations.conversionWorkspaces.apply",
10049 http_method: hyper::Method::POST,
10050 });
10051
10052 for &field in ["alt", "name"].iter() {
10053 if self._additional_params.contains_key(field) {
10054 dlg.finished(false);
10055 return Err(common::Error::FieldClash(field));
10056 }
10057 }
10058
10059 let mut params = Params::with_capacity(4 + self._additional_params.len());
10060 params.push("name", self._name);
10061
10062 params.extend(self._additional_params.iter());
10063
10064 params.push("alt", "json");
10065 let mut url = self.hub._base_url.clone() + "v1/{+name}:apply";
10066 if self._scopes.is_empty() {
10067 self._scopes
10068 .insert(Scope::CloudPlatform.as_ref().to_string());
10069 }
10070
10071 #[allow(clippy::single_element_loop)]
10072 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10073 url = params.uri_replacement(url, param_name, find_this, true);
10074 }
10075 {
10076 let to_remove = ["name"];
10077 params.remove_params(&to_remove);
10078 }
10079
10080 let url = params.parse_with_url(&url);
10081
10082 let mut json_mime_type = mime::APPLICATION_JSON;
10083 let mut request_value_reader = {
10084 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10085 common::remove_json_null_values(&mut value);
10086 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10087 serde_json::to_writer(&mut dst, &value).unwrap();
10088 dst
10089 };
10090 let request_size = request_value_reader
10091 .seek(std::io::SeekFrom::End(0))
10092 .unwrap();
10093 request_value_reader
10094 .seek(std::io::SeekFrom::Start(0))
10095 .unwrap();
10096
10097 loop {
10098 let token = match self
10099 .hub
10100 .auth
10101 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10102 .await
10103 {
10104 Ok(token) => token,
10105 Err(e) => match dlg.token(e) {
10106 Ok(token) => token,
10107 Err(e) => {
10108 dlg.finished(false);
10109 return Err(common::Error::MissingToken(e));
10110 }
10111 },
10112 };
10113 request_value_reader
10114 .seek(std::io::SeekFrom::Start(0))
10115 .unwrap();
10116 let mut req_result = {
10117 let client = &self.hub.client;
10118 dlg.pre_request();
10119 let mut req_builder = hyper::Request::builder()
10120 .method(hyper::Method::POST)
10121 .uri(url.as_str())
10122 .header(USER_AGENT, self.hub._user_agent.clone());
10123
10124 if let Some(token) = token.as_ref() {
10125 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10126 }
10127
10128 let request = req_builder
10129 .header(CONTENT_TYPE, json_mime_type.to_string())
10130 .header(CONTENT_LENGTH, request_size as u64)
10131 .body(common::to_body(
10132 request_value_reader.get_ref().clone().into(),
10133 ));
10134
10135 client.request(request.unwrap()).await
10136 };
10137
10138 match req_result {
10139 Err(err) => {
10140 if let common::Retry::After(d) = dlg.http_error(&err) {
10141 sleep(d).await;
10142 continue;
10143 }
10144 dlg.finished(false);
10145 return Err(common::Error::HttpError(err));
10146 }
10147 Ok(res) => {
10148 let (mut parts, body) = res.into_parts();
10149 let mut body = common::Body::new(body);
10150 if !parts.status.is_success() {
10151 let bytes = common::to_bytes(body).await.unwrap_or_default();
10152 let error = serde_json::from_str(&common::to_string(&bytes));
10153 let response = common::to_response(parts, bytes.into());
10154
10155 if let common::Retry::After(d) =
10156 dlg.http_failure(&response, error.as_ref().ok())
10157 {
10158 sleep(d).await;
10159 continue;
10160 }
10161
10162 dlg.finished(false);
10163
10164 return Err(match error {
10165 Ok(value) => common::Error::BadRequest(value),
10166 _ => common::Error::Failure(response),
10167 });
10168 }
10169 let response = {
10170 let bytes = common::to_bytes(body).await.unwrap_or_default();
10171 let encoded = common::to_string(&bytes);
10172 match serde_json::from_str(&encoded) {
10173 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10174 Err(error) => {
10175 dlg.response_json_decode_error(&encoded, &error);
10176 return Err(common::Error::JsonDecodeError(
10177 encoded.to_string(),
10178 error,
10179 ));
10180 }
10181 }
10182 };
10183
10184 dlg.finished(true);
10185 return Ok(response);
10186 }
10187 }
10188 }
10189 }
10190
10191 ///
10192 /// Sets the *request* property to the given value.
10193 ///
10194 /// Even though the property as already been set when instantiating this call,
10195 /// we provide this method for API completeness.
10196 pub fn request(
10197 mut self,
10198 new_value: ApplyConversionWorkspaceRequest,
10199 ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
10200 self._request = new_value;
10201 self
10202 }
10203 /// 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}.
10204 ///
10205 /// Sets the *name* path property to the given value.
10206 ///
10207 /// Even though the property as already been set when instantiating this call,
10208 /// we provide this method for API completeness.
10209 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
10210 self._name = new_value.to_string();
10211 self
10212 }
10213 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10214 /// while executing the actual API request.
10215 ///
10216 /// ````text
10217 /// It should be used to handle progress information, and to implement a certain level of resilience.
10218 /// ````
10219 ///
10220 /// Sets the *delegate* property to the given value.
10221 pub fn delegate(
10222 mut self,
10223 new_value: &'a mut dyn common::Delegate,
10224 ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
10225 self._delegate = Some(new_value);
10226 self
10227 }
10228
10229 /// Set any additional parameter of the query string used in the request.
10230 /// It should be used to set parameters which are not yet available through their own
10231 /// setters.
10232 ///
10233 /// Please note that this method must not be used to set any of the known parameters
10234 /// which have their own setter method. If done anyway, the request will fail.
10235 ///
10236 /// # Additional Parameters
10237 ///
10238 /// * *$.xgafv* (query-string) - V1 error format.
10239 /// * *access_token* (query-string) - OAuth access token.
10240 /// * *alt* (query-string) - Data format for response.
10241 /// * *callback* (query-string) - JSONP
10242 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10243 /// * *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.
10244 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10245 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10246 /// * *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.
10247 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10248 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10249 pub fn param<T>(
10250 mut self,
10251 name: T,
10252 value: T,
10253 ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
10254 where
10255 T: AsRef<str>,
10256 {
10257 self._additional_params
10258 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10259 self
10260 }
10261
10262 /// Identifies the authorization scope for the method you are building.
10263 ///
10264 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10265 /// [`Scope::CloudPlatform`].
10266 ///
10267 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10268 /// tokens for more than one scope.
10269 ///
10270 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10271 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10272 /// sufficient, a read-write scope will do as well.
10273 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
10274 where
10275 St: AsRef<str>,
10276 {
10277 self._scopes.insert(String::from(scope.as_ref()));
10278 self
10279 }
10280 /// Identifies the authorization scope(s) for the method you are building.
10281 ///
10282 /// See [`Self::add_scope()`] for details.
10283 pub fn add_scopes<I, St>(
10284 mut self,
10285 scopes: I,
10286 ) -> ProjectLocationConversionWorkspaceApplyCall<'a, C>
10287 where
10288 I: IntoIterator<Item = St>,
10289 St: AsRef<str>,
10290 {
10291 self._scopes
10292 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10293 self
10294 }
10295
10296 /// Removes all scopes, and no default scope will be used either.
10297 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10298 /// for details).
10299 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceApplyCall<'a, C> {
10300 self._scopes.clear();
10301 self
10302 }
10303}
10304
10305/// Marks all the data in the conversion workspace as committed.
10306///
10307/// A builder for the *locations.conversionWorkspaces.commit* method supported by a *project* resource.
10308/// It is not used directly, but through a [`ProjectMethods`] instance.
10309///
10310/// # Example
10311///
10312/// Instantiate a resource method builder
10313///
10314/// ```test_harness,no_run
10315/// # extern crate hyper;
10316/// # extern crate hyper_rustls;
10317/// # extern crate google_datamigration1 as datamigration1;
10318/// use datamigration1::api::CommitConversionWorkspaceRequest;
10319/// # async fn dox() {
10320/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10321///
10322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10323/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10324/// # .with_native_roots()
10325/// # .unwrap()
10326/// # .https_only()
10327/// # .enable_http2()
10328/// # .build();
10329///
10330/// # let executor = hyper_util::rt::TokioExecutor::new();
10331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10332/// # secret,
10333/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10334/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10335/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10336/// # ),
10337/// # ).build().await.unwrap();
10338///
10339/// # let client = hyper_util::client::legacy::Client::builder(
10340/// # hyper_util::rt::TokioExecutor::new()
10341/// # )
10342/// # .build(
10343/// # hyper_rustls::HttpsConnectorBuilder::new()
10344/// # .with_native_roots()
10345/// # .unwrap()
10346/// # .https_or_http()
10347/// # .enable_http2()
10348/// # .build()
10349/// # );
10350/// # let mut hub = DatabaseMigrationService::new(client, auth);
10351/// // As the method needs a request, you would usually fill it with the desired information
10352/// // into the respective structure. Some of the parts shown here might not be applicable !
10353/// // Values shown here are possibly random and not representative !
10354/// let mut req = CommitConversionWorkspaceRequest::default();
10355///
10356/// // You can configure optional parameters by calling the respective setters at will, and
10357/// // execute the final call using `doit()`.
10358/// // Values shown here are possibly random and not representative !
10359/// let result = hub.projects().locations_conversion_workspaces_commit(req, "name")
10360/// .doit().await;
10361/// # }
10362/// ```
10363pub struct ProjectLocationConversionWorkspaceCommitCall<'a, C>
10364where
10365 C: 'a,
10366{
10367 hub: &'a DatabaseMigrationService<C>,
10368 _request: CommitConversionWorkspaceRequest,
10369 _name: String,
10370 _delegate: Option<&'a mut dyn common::Delegate>,
10371 _additional_params: HashMap<String, String>,
10372 _scopes: BTreeSet<String>,
10373}
10374
10375impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceCommitCall<'a, C> {}
10376
10377impl<'a, C> ProjectLocationConversionWorkspaceCommitCall<'a, C>
10378where
10379 C: common::Connector,
10380{
10381 /// Perform the operation you have build so far.
10382 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10383 use std::borrow::Cow;
10384 use std::io::{Read, Seek};
10385
10386 use common::{url::Params, ToParts};
10387 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10388
10389 let mut dd = common::DefaultDelegate;
10390 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10391 dlg.begin(common::MethodInfo {
10392 id: "datamigration.projects.locations.conversionWorkspaces.commit",
10393 http_method: hyper::Method::POST,
10394 });
10395
10396 for &field in ["alt", "name"].iter() {
10397 if self._additional_params.contains_key(field) {
10398 dlg.finished(false);
10399 return Err(common::Error::FieldClash(field));
10400 }
10401 }
10402
10403 let mut params = Params::with_capacity(4 + self._additional_params.len());
10404 params.push("name", self._name);
10405
10406 params.extend(self._additional_params.iter());
10407
10408 params.push("alt", "json");
10409 let mut url = self.hub._base_url.clone() + "v1/{+name}:commit";
10410 if self._scopes.is_empty() {
10411 self._scopes
10412 .insert(Scope::CloudPlatform.as_ref().to_string());
10413 }
10414
10415 #[allow(clippy::single_element_loop)]
10416 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10417 url = params.uri_replacement(url, param_name, find_this, true);
10418 }
10419 {
10420 let to_remove = ["name"];
10421 params.remove_params(&to_remove);
10422 }
10423
10424 let url = params.parse_with_url(&url);
10425
10426 let mut json_mime_type = mime::APPLICATION_JSON;
10427 let mut request_value_reader = {
10428 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10429 common::remove_json_null_values(&mut value);
10430 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10431 serde_json::to_writer(&mut dst, &value).unwrap();
10432 dst
10433 };
10434 let request_size = request_value_reader
10435 .seek(std::io::SeekFrom::End(0))
10436 .unwrap();
10437 request_value_reader
10438 .seek(std::io::SeekFrom::Start(0))
10439 .unwrap();
10440
10441 loop {
10442 let token = match self
10443 .hub
10444 .auth
10445 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10446 .await
10447 {
10448 Ok(token) => token,
10449 Err(e) => match dlg.token(e) {
10450 Ok(token) => token,
10451 Err(e) => {
10452 dlg.finished(false);
10453 return Err(common::Error::MissingToken(e));
10454 }
10455 },
10456 };
10457 request_value_reader
10458 .seek(std::io::SeekFrom::Start(0))
10459 .unwrap();
10460 let mut req_result = {
10461 let client = &self.hub.client;
10462 dlg.pre_request();
10463 let mut req_builder = hyper::Request::builder()
10464 .method(hyper::Method::POST)
10465 .uri(url.as_str())
10466 .header(USER_AGENT, self.hub._user_agent.clone());
10467
10468 if let Some(token) = token.as_ref() {
10469 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10470 }
10471
10472 let request = req_builder
10473 .header(CONTENT_TYPE, json_mime_type.to_string())
10474 .header(CONTENT_LENGTH, request_size as u64)
10475 .body(common::to_body(
10476 request_value_reader.get_ref().clone().into(),
10477 ));
10478
10479 client.request(request.unwrap()).await
10480 };
10481
10482 match req_result {
10483 Err(err) => {
10484 if let common::Retry::After(d) = dlg.http_error(&err) {
10485 sleep(d).await;
10486 continue;
10487 }
10488 dlg.finished(false);
10489 return Err(common::Error::HttpError(err));
10490 }
10491 Ok(res) => {
10492 let (mut parts, body) = res.into_parts();
10493 let mut body = common::Body::new(body);
10494 if !parts.status.is_success() {
10495 let bytes = common::to_bytes(body).await.unwrap_or_default();
10496 let error = serde_json::from_str(&common::to_string(&bytes));
10497 let response = common::to_response(parts, bytes.into());
10498
10499 if let common::Retry::After(d) =
10500 dlg.http_failure(&response, error.as_ref().ok())
10501 {
10502 sleep(d).await;
10503 continue;
10504 }
10505
10506 dlg.finished(false);
10507
10508 return Err(match error {
10509 Ok(value) => common::Error::BadRequest(value),
10510 _ => common::Error::Failure(response),
10511 });
10512 }
10513 let response = {
10514 let bytes = common::to_bytes(body).await.unwrap_or_default();
10515 let encoded = common::to_string(&bytes);
10516 match serde_json::from_str(&encoded) {
10517 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10518 Err(error) => {
10519 dlg.response_json_decode_error(&encoded, &error);
10520 return Err(common::Error::JsonDecodeError(
10521 encoded.to_string(),
10522 error,
10523 ));
10524 }
10525 }
10526 };
10527
10528 dlg.finished(true);
10529 return Ok(response);
10530 }
10531 }
10532 }
10533 }
10534
10535 ///
10536 /// Sets the *request* property to the given value.
10537 ///
10538 /// Even though the property as already been set when instantiating this call,
10539 /// we provide this method for API completeness.
10540 pub fn request(
10541 mut self,
10542 new_value: CommitConversionWorkspaceRequest,
10543 ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
10544 self._request = new_value;
10545 self
10546 }
10547 /// Required. Name of the conversion workspace resource to commit.
10548 ///
10549 /// Sets the *name* path property to the given value.
10550 ///
10551 /// Even though the property as already been set when instantiating this call,
10552 /// we provide this method for API completeness.
10553 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
10554 self._name = new_value.to_string();
10555 self
10556 }
10557 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10558 /// while executing the actual API request.
10559 ///
10560 /// ````text
10561 /// It should be used to handle progress information, and to implement a certain level of resilience.
10562 /// ````
10563 ///
10564 /// Sets the *delegate* property to the given value.
10565 pub fn delegate(
10566 mut self,
10567 new_value: &'a mut dyn common::Delegate,
10568 ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
10569 self._delegate = Some(new_value);
10570 self
10571 }
10572
10573 /// Set any additional parameter of the query string used in the request.
10574 /// It should be used to set parameters which are not yet available through their own
10575 /// setters.
10576 ///
10577 /// Please note that this method must not be used to set any of the known parameters
10578 /// which have their own setter method. If done anyway, the request will fail.
10579 ///
10580 /// # Additional Parameters
10581 ///
10582 /// * *$.xgafv* (query-string) - V1 error format.
10583 /// * *access_token* (query-string) - OAuth access token.
10584 /// * *alt* (query-string) - Data format for response.
10585 /// * *callback* (query-string) - JSONP
10586 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10587 /// * *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.
10588 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10589 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10590 /// * *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.
10591 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10592 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10593 pub fn param<T>(
10594 mut self,
10595 name: T,
10596 value: T,
10597 ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
10598 where
10599 T: AsRef<str>,
10600 {
10601 self._additional_params
10602 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10603 self
10604 }
10605
10606 /// Identifies the authorization scope for the method you are building.
10607 ///
10608 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10609 /// [`Scope::CloudPlatform`].
10610 ///
10611 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10612 /// tokens for more than one scope.
10613 ///
10614 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10615 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10616 /// sufficient, a read-write scope will do as well.
10617 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
10618 where
10619 St: AsRef<str>,
10620 {
10621 self._scopes.insert(String::from(scope.as_ref()));
10622 self
10623 }
10624 /// Identifies the authorization scope(s) for the method you are building.
10625 ///
10626 /// See [`Self::add_scope()`] for details.
10627 pub fn add_scopes<I, St>(
10628 mut self,
10629 scopes: I,
10630 ) -> ProjectLocationConversionWorkspaceCommitCall<'a, C>
10631 where
10632 I: IntoIterator<Item = St>,
10633 St: AsRef<str>,
10634 {
10635 self._scopes
10636 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10637 self
10638 }
10639
10640 /// Removes all scopes, and no default scope will be used either.
10641 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10642 /// for details).
10643 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceCommitCall<'a, C> {
10644 self._scopes.clear();
10645 self
10646 }
10647}
10648
10649/// Creates a draft tree schema for the destination database.
10650///
10651/// A builder for the *locations.conversionWorkspaces.convert* method supported by a *project* resource.
10652/// It is not used directly, but through a [`ProjectMethods`] instance.
10653///
10654/// # Example
10655///
10656/// Instantiate a resource method builder
10657///
10658/// ```test_harness,no_run
10659/// # extern crate hyper;
10660/// # extern crate hyper_rustls;
10661/// # extern crate google_datamigration1 as datamigration1;
10662/// use datamigration1::api::ConvertConversionWorkspaceRequest;
10663/// # async fn dox() {
10664/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10665///
10666/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10667/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10668/// # .with_native_roots()
10669/// # .unwrap()
10670/// # .https_only()
10671/// # .enable_http2()
10672/// # .build();
10673///
10674/// # let executor = hyper_util::rt::TokioExecutor::new();
10675/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10676/// # secret,
10677/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10678/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10679/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10680/// # ),
10681/// # ).build().await.unwrap();
10682///
10683/// # let client = hyper_util::client::legacy::Client::builder(
10684/// # hyper_util::rt::TokioExecutor::new()
10685/// # )
10686/// # .build(
10687/// # hyper_rustls::HttpsConnectorBuilder::new()
10688/// # .with_native_roots()
10689/// # .unwrap()
10690/// # .https_or_http()
10691/// # .enable_http2()
10692/// # .build()
10693/// # );
10694/// # let mut hub = DatabaseMigrationService::new(client, auth);
10695/// // As the method needs a request, you would usually fill it with the desired information
10696/// // into the respective structure. Some of the parts shown here might not be applicable !
10697/// // Values shown here are possibly random and not representative !
10698/// let mut req = ConvertConversionWorkspaceRequest::default();
10699///
10700/// // You can configure optional parameters by calling the respective setters at will, and
10701/// // execute the final call using `doit()`.
10702/// // Values shown here are possibly random and not representative !
10703/// let result = hub.projects().locations_conversion_workspaces_convert(req, "name")
10704/// .doit().await;
10705/// # }
10706/// ```
10707pub struct ProjectLocationConversionWorkspaceConvertCall<'a, C>
10708where
10709 C: 'a,
10710{
10711 hub: &'a DatabaseMigrationService<C>,
10712 _request: ConvertConversionWorkspaceRequest,
10713 _name: String,
10714 _delegate: Option<&'a mut dyn common::Delegate>,
10715 _additional_params: HashMap<String, String>,
10716 _scopes: BTreeSet<String>,
10717}
10718
10719impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceConvertCall<'a, C> {}
10720
10721impl<'a, C> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10722where
10723 C: common::Connector,
10724{
10725 /// Perform the operation you have build so far.
10726 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10727 use std::borrow::Cow;
10728 use std::io::{Read, Seek};
10729
10730 use common::{url::Params, ToParts};
10731 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10732
10733 let mut dd = common::DefaultDelegate;
10734 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10735 dlg.begin(common::MethodInfo {
10736 id: "datamigration.projects.locations.conversionWorkspaces.convert",
10737 http_method: hyper::Method::POST,
10738 });
10739
10740 for &field in ["alt", "name"].iter() {
10741 if self._additional_params.contains_key(field) {
10742 dlg.finished(false);
10743 return Err(common::Error::FieldClash(field));
10744 }
10745 }
10746
10747 let mut params = Params::with_capacity(4 + self._additional_params.len());
10748 params.push("name", self._name);
10749
10750 params.extend(self._additional_params.iter());
10751
10752 params.push("alt", "json");
10753 let mut url = self.hub._base_url.clone() + "v1/{+name}:convert";
10754 if self._scopes.is_empty() {
10755 self._scopes
10756 .insert(Scope::CloudPlatform.as_ref().to_string());
10757 }
10758
10759 #[allow(clippy::single_element_loop)]
10760 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10761 url = params.uri_replacement(url, param_name, find_this, true);
10762 }
10763 {
10764 let to_remove = ["name"];
10765 params.remove_params(&to_remove);
10766 }
10767
10768 let url = params.parse_with_url(&url);
10769
10770 let mut json_mime_type = mime::APPLICATION_JSON;
10771 let mut request_value_reader = {
10772 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10773 common::remove_json_null_values(&mut value);
10774 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10775 serde_json::to_writer(&mut dst, &value).unwrap();
10776 dst
10777 };
10778 let request_size = request_value_reader
10779 .seek(std::io::SeekFrom::End(0))
10780 .unwrap();
10781 request_value_reader
10782 .seek(std::io::SeekFrom::Start(0))
10783 .unwrap();
10784
10785 loop {
10786 let token = match self
10787 .hub
10788 .auth
10789 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10790 .await
10791 {
10792 Ok(token) => token,
10793 Err(e) => match dlg.token(e) {
10794 Ok(token) => token,
10795 Err(e) => {
10796 dlg.finished(false);
10797 return Err(common::Error::MissingToken(e));
10798 }
10799 },
10800 };
10801 request_value_reader
10802 .seek(std::io::SeekFrom::Start(0))
10803 .unwrap();
10804 let mut req_result = {
10805 let client = &self.hub.client;
10806 dlg.pre_request();
10807 let mut req_builder = hyper::Request::builder()
10808 .method(hyper::Method::POST)
10809 .uri(url.as_str())
10810 .header(USER_AGENT, self.hub._user_agent.clone());
10811
10812 if let Some(token) = token.as_ref() {
10813 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10814 }
10815
10816 let request = req_builder
10817 .header(CONTENT_TYPE, json_mime_type.to_string())
10818 .header(CONTENT_LENGTH, request_size as u64)
10819 .body(common::to_body(
10820 request_value_reader.get_ref().clone().into(),
10821 ));
10822
10823 client.request(request.unwrap()).await
10824 };
10825
10826 match req_result {
10827 Err(err) => {
10828 if let common::Retry::After(d) = dlg.http_error(&err) {
10829 sleep(d).await;
10830 continue;
10831 }
10832 dlg.finished(false);
10833 return Err(common::Error::HttpError(err));
10834 }
10835 Ok(res) => {
10836 let (mut parts, body) = res.into_parts();
10837 let mut body = common::Body::new(body);
10838 if !parts.status.is_success() {
10839 let bytes = common::to_bytes(body).await.unwrap_or_default();
10840 let error = serde_json::from_str(&common::to_string(&bytes));
10841 let response = common::to_response(parts, bytes.into());
10842
10843 if let common::Retry::After(d) =
10844 dlg.http_failure(&response, error.as_ref().ok())
10845 {
10846 sleep(d).await;
10847 continue;
10848 }
10849
10850 dlg.finished(false);
10851
10852 return Err(match error {
10853 Ok(value) => common::Error::BadRequest(value),
10854 _ => common::Error::Failure(response),
10855 });
10856 }
10857 let response = {
10858 let bytes = common::to_bytes(body).await.unwrap_or_default();
10859 let encoded = common::to_string(&bytes);
10860 match serde_json::from_str(&encoded) {
10861 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10862 Err(error) => {
10863 dlg.response_json_decode_error(&encoded, &error);
10864 return Err(common::Error::JsonDecodeError(
10865 encoded.to_string(),
10866 error,
10867 ));
10868 }
10869 }
10870 };
10871
10872 dlg.finished(true);
10873 return Ok(response);
10874 }
10875 }
10876 }
10877 }
10878
10879 ///
10880 /// Sets the *request* property to the given value.
10881 ///
10882 /// Even though the property as already been set when instantiating this call,
10883 /// we provide this method for API completeness.
10884 pub fn request(
10885 mut self,
10886 new_value: ConvertConversionWorkspaceRequest,
10887 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10888 self._request = new_value;
10889 self
10890 }
10891 /// Name of the conversion workspace resource to convert in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
10892 ///
10893 /// Sets the *name* path property to the given value.
10894 ///
10895 /// Even though the property as already been set when instantiating this call,
10896 /// we provide this method for API completeness.
10897 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10898 self._name = new_value.to_string();
10899 self
10900 }
10901 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10902 /// while executing the actual API request.
10903 ///
10904 /// ````text
10905 /// It should be used to handle progress information, and to implement a certain level of resilience.
10906 /// ````
10907 ///
10908 /// Sets the *delegate* property to the given value.
10909 pub fn delegate(
10910 mut self,
10911 new_value: &'a mut dyn common::Delegate,
10912 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10913 self._delegate = Some(new_value);
10914 self
10915 }
10916
10917 /// Set any additional parameter of the query string used in the request.
10918 /// It should be used to set parameters which are not yet available through their own
10919 /// setters.
10920 ///
10921 /// Please note that this method must not be used to set any of the known parameters
10922 /// which have their own setter method. If done anyway, the request will fail.
10923 ///
10924 /// # Additional Parameters
10925 ///
10926 /// * *$.xgafv* (query-string) - V1 error format.
10927 /// * *access_token* (query-string) - OAuth access token.
10928 /// * *alt* (query-string) - Data format for response.
10929 /// * *callback* (query-string) - JSONP
10930 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10931 /// * *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.
10932 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10933 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10934 /// * *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.
10935 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10936 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10937 pub fn param<T>(
10938 mut self,
10939 name: T,
10940 value: T,
10941 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10942 where
10943 T: AsRef<str>,
10944 {
10945 self._additional_params
10946 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10947 self
10948 }
10949
10950 /// Identifies the authorization scope for the method you are building.
10951 ///
10952 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10953 /// [`Scope::CloudPlatform`].
10954 ///
10955 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10956 /// tokens for more than one scope.
10957 ///
10958 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10959 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10960 /// sufficient, a read-write scope will do as well.
10961 pub fn add_scope<St>(
10962 mut self,
10963 scope: St,
10964 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10965 where
10966 St: AsRef<str>,
10967 {
10968 self._scopes.insert(String::from(scope.as_ref()));
10969 self
10970 }
10971 /// Identifies the authorization scope(s) for the method you are building.
10972 ///
10973 /// See [`Self::add_scope()`] for details.
10974 pub fn add_scopes<I, St>(
10975 mut self,
10976 scopes: I,
10977 ) -> ProjectLocationConversionWorkspaceConvertCall<'a, C>
10978 where
10979 I: IntoIterator<Item = St>,
10980 St: AsRef<str>,
10981 {
10982 self._scopes
10983 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10984 self
10985 }
10986
10987 /// Removes all scopes, and no default scope will be used either.
10988 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10989 /// for details).
10990 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceConvertCall<'a, C> {
10991 self._scopes.clear();
10992 self
10993 }
10994}
10995
10996/// Creates a new conversion workspace in a given project and location.
10997///
10998/// A builder for the *locations.conversionWorkspaces.create* method supported by a *project* resource.
10999/// It is not used directly, but through a [`ProjectMethods`] instance.
11000///
11001/// # Example
11002///
11003/// Instantiate a resource method builder
11004///
11005/// ```test_harness,no_run
11006/// # extern crate hyper;
11007/// # extern crate hyper_rustls;
11008/// # extern crate google_datamigration1 as datamigration1;
11009/// use datamigration1::api::ConversionWorkspace;
11010/// # async fn dox() {
11011/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11012///
11013/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11014/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11015/// # .with_native_roots()
11016/// # .unwrap()
11017/// # .https_only()
11018/// # .enable_http2()
11019/// # .build();
11020///
11021/// # let executor = hyper_util::rt::TokioExecutor::new();
11022/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11023/// # secret,
11024/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11025/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11026/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11027/// # ),
11028/// # ).build().await.unwrap();
11029///
11030/// # let client = hyper_util::client::legacy::Client::builder(
11031/// # hyper_util::rt::TokioExecutor::new()
11032/// # )
11033/// # .build(
11034/// # hyper_rustls::HttpsConnectorBuilder::new()
11035/// # .with_native_roots()
11036/// # .unwrap()
11037/// # .https_or_http()
11038/// # .enable_http2()
11039/// # .build()
11040/// # );
11041/// # let mut hub = DatabaseMigrationService::new(client, auth);
11042/// // As the method needs a request, you would usually fill it with the desired information
11043/// // into the respective structure. Some of the parts shown here might not be applicable !
11044/// // Values shown here are possibly random and not representative !
11045/// let mut req = ConversionWorkspace::default();
11046///
11047/// // You can configure optional parameters by calling the respective setters at will, and
11048/// // execute the final call using `doit()`.
11049/// // Values shown here are possibly random and not representative !
11050/// let result = hub.projects().locations_conversion_workspaces_create(req, "parent")
11051/// .request_id("vero")
11052/// .conversion_workspace_id("vero")
11053/// .doit().await;
11054/// # }
11055/// ```
11056pub struct ProjectLocationConversionWorkspaceCreateCall<'a, C>
11057where
11058 C: 'a,
11059{
11060 hub: &'a DatabaseMigrationService<C>,
11061 _request: ConversionWorkspace,
11062 _parent: String,
11063 _request_id: Option<String>,
11064 _conversion_workspace_id: Option<String>,
11065 _delegate: Option<&'a mut dyn common::Delegate>,
11066 _additional_params: HashMap<String, String>,
11067 _scopes: BTreeSet<String>,
11068}
11069
11070impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceCreateCall<'a, C> {}
11071
11072impl<'a, C> ProjectLocationConversionWorkspaceCreateCall<'a, C>
11073where
11074 C: common::Connector,
11075{
11076 /// Perform the operation you have build so far.
11077 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11078 use std::borrow::Cow;
11079 use std::io::{Read, Seek};
11080
11081 use common::{url::Params, ToParts};
11082 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11083
11084 let mut dd = common::DefaultDelegate;
11085 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11086 dlg.begin(common::MethodInfo {
11087 id: "datamigration.projects.locations.conversionWorkspaces.create",
11088 http_method: hyper::Method::POST,
11089 });
11090
11091 for &field in ["alt", "parent", "requestId", "conversionWorkspaceId"].iter() {
11092 if self._additional_params.contains_key(field) {
11093 dlg.finished(false);
11094 return Err(common::Error::FieldClash(field));
11095 }
11096 }
11097
11098 let mut params = Params::with_capacity(6 + self._additional_params.len());
11099 params.push("parent", self._parent);
11100 if let Some(value) = self._request_id.as_ref() {
11101 params.push("requestId", value);
11102 }
11103 if let Some(value) = self._conversion_workspace_id.as_ref() {
11104 params.push("conversionWorkspaceId", value);
11105 }
11106
11107 params.extend(self._additional_params.iter());
11108
11109 params.push("alt", "json");
11110 let mut url = self.hub._base_url.clone() + "v1/{+parent}/conversionWorkspaces";
11111 if self._scopes.is_empty() {
11112 self._scopes
11113 .insert(Scope::CloudPlatform.as_ref().to_string());
11114 }
11115
11116 #[allow(clippy::single_element_loop)]
11117 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11118 url = params.uri_replacement(url, param_name, find_this, true);
11119 }
11120 {
11121 let to_remove = ["parent"];
11122 params.remove_params(&to_remove);
11123 }
11124
11125 let url = params.parse_with_url(&url);
11126
11127 let mut json_mime_type = mime::APPLICATION_JSON;
11128 let mut request_value_reader = {
11129 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11130 common::remove_json_null_values(&mut value);
11131 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11132 serde_json::to_writer(&mut dst, &value).unwrap();
11133 dst
11134 };
11135 let request_size = request_value_reader
11136 .seek(std::io::SeekFrom::End(0))
11137 .unwrap();
11138 request_value_reader
11139 .seek(std::io::SeekFrom::Start(0))
11140 .unwrap();
11141
11142 loop {
11143 let token = match self
11144 .hub
11145 .auth
11146 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11147 .await
11148 {
11149 Ok(token) => token,
11150 Err(e) => match dlg.token(e) {
11151 Ok(token) => token,
11152 Err(e) => {
11153 dlg.finished(false);
11154 return Err(common::Error::MissingToken(e));
11155 }
11156 },
11157 };
11158 request_value_reader
11159 .seek(std::io::SeekFrom::Start(0))
11160 .unwrap();
11161 let mut req_result = {
11162 let client = &self.hub.client;
11163 dlg.pre_request();
11164 let mut req_builder = hyper::Request::builder()
11165 .method(hyper::Method::POST)
11166 .uri(url.as_str())
11167 .header(USER_AGENT, self.hub._user_agent.clone());
11168
11169 if let Some(token) = token.as_ref() {
11170 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11171 }
11172
11173 let request = req_builder
11174 .header(CONTENT_TYPE, json_mime_type.to_string())
11175 .header(CONTENT_LENGTH, request_size as u64)
11176 .body(common::to_body(
11177 request_value_reader.get_ref().clone().into(),
11178 ));
11179
11180 client.request(request.unwrap()).await
11181 };
11182
11183 match req_result {
11184 Err(err) => {
11185 if let common::Retry::After(d) = dlg.http_error(&err) {
11186 sleep(d).await;
11187 continue;
11188 }
11189 dlg.finished(false);
11190 return Err(common::Error::HttpError(err));
11191 }
11192 Ok(res) => {
11193 let (mut parts, body) = res.into_parts();
11194 let mut body = common::Body::new(body);
11195 if !parts.status.is_success() {
11196 let bytes = common::to_bytes(body).await.unwrap_or_default();
11197 let error = serde_json::from_str(&common::to_string(&bytes));
11198 let response = common::to_response(parts, bytes.into());
11199
11200 if let common::Retry::After(d) =
11201 dlg.http_failure(&response, error.as_ref().ok())
11202 {
11203 sleep(d).await;
11204 continue;
11205 }
11206
11207 dlg.finished(false);
11208
11209 return Err(match error {
11210 Ok(value) => common::Error::BadRequest(value),
11211 _ => common::Error::Failure(response),
11212 });
11213 }
11214 let response = {
11215 let bytes = common::to_bytes(body).await.unwrap_or_default();
11216 let encoded = common::to_string(&bytes);
11217 match serde_json::from_str(&encoded) {
11218 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11219 Err(error) => {
11220 dlg.response_json_decode_error(&encoded, &error);
11221 return Err(common::Error::JsonDecodeError(
11222 encoded.to_string(),
11223 error,
11224 ));
11225 }
11226 }
11227 };
11228
11229 dlg.finished(true);
11230 return Ok(response);
11231 }
11232 }
11233 }
11234 }
11235
11236 ///
11237 /// Sets the *request* property to the given value.
11238 ///
11239 /// Even though the property as already been set when instantiating this call,
11240 /// we provide this method for API completeness.
11241 pub fn request(
11242 mut self,
11243 new_value: ConversionWorkspace,
11244 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11245 self._request = new_value;
11246 self
11247 }
11248 /// Required. The parent which owns this collection of conversion workspaces.
11249 ///
11250 /// Sets the *parent* path property to the given value.
11251 ///
11252 /// Even though the property as already been set when instantiating this call,
11253 /// we provide this method for API completeness.
11254 pub fn parent(
11255 mut self,
11256 new_value: &str,
11257 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11258 self._parent = new_value.to_string();
11259 self
11260 }
11261 /// 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.
11262 ///
11263 /// Sets the *request id* query property to the given value.
11264 pub fn request_id(
11265 mut self,
11266 new_value: &str,
11267 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11268 self._request_id = Some(new_value.to_string());
11269 self
11270 }
11271 /// Required. The ID of the conversion workspace to create.
11272 ///
11273 /// Sets the *conversion workspace id* query property to the given value.
11274 pub fn conversion_workspace_id(
11275 mut self,
11276 new_value: &str,
11277 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11278 self._conversion_workspace_id = Some(new_value.to_string());
11279 self
11280 }
11281 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11282 /// while executing the actual API request.
11283 ///
11284 /// ````text
11285 /// It should be used to handle progress information, and to implement a certain level of resilience.
11286 /// ````
11287 ///
11288 /// Sets the *delegate* property to the given value.
11289 pub fn delegate(
11290 mut self,
11291 new_value: &'a mut dyn common::Delegate,
11292 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11293 self._delegate = Some(new_value);
11294 self
11295 }
11296
11297 /// Set any additional parameter of the query string used in the request.
11298 /// It should be used to set parameters which are not yet available through their own
11299 /// setters.
11300 ///
11301 /// Please note that this method must not be used to set any of the known parameters
11302 /// which have their own setter method. If done anyway, the request will fail.
11303 ///
11304 /// # Additional Parameters
11305 ///
11306 /// * *$.xgafv* (query-string) - V1 error format.
11307 /// * *access_token* (query-string) - OAuth access token.
11308 /// * *alt* (query-string) - Data format for response.
11309 /// * *callback* (query-string) - JSONP
11310 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11311 /// * *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.
11312 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11313 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11314 /// * *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.
11315 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11316 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11317 pub fn param<T>(
11318 mut self,
11319 name: T,
11320 value: T,
11321 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
11322 where
11323 T: AsRef<str>,
11324 {
11325 self._additional_params
11326 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11327 self
11328 }
11329
11330 /// Identifies the authorization scope for the method you are building.
11331 ///
11332 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11333 /// [`Scope::CloudPlatform`].
11334 ///
11335 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11336 /// tokens for more than one scope.
11337 ///
11338 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11339 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11340 /// sufficient, a read-write scope will do as well.
11341 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
11342 where
11343 St: AsRef<str>,
11344 {
11345 self._scopes.insert(String::from(scope.as_ref()));
11346 self
11347 }
11348 /// Identifies the authorization scope(s) for the method you are building.
11349 ///
11350 /// See [`Self::add_scope()`] for details.
11351 pub fn add_scopes<I, St>(
11352 mut self,
11353 scopes: I,
11354 ) -> ProjectLocationConversionWorkspaceCreateCall<'a, C>
11355 where
11356 I: IntoIterator<Item = St>,
11357 St: AsRef<str>,
11358 {
11359 self._scopes
11360 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11361 self
11362 }
11363
11364 /// Removes all scopes, and no default scope will be used either.
11365 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11366 /// for details).
11367 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceCreateCall<'a, C> {
11368 self._scopes.clear();
11369 self
11370 }
11371}
11372
11373/// Deletes a single conversion workspace.
11374///
11375/// A builder for the *locations.conversionWorkspaces.delete* method supported by a *project* resource.
11376/// It is not used directly, but through a [`ProjectMethods`] instance.
11377///
11378/// # Example
11379///
11380/// Instantiate a resource method builder
11381///
11382/// ```test_harness,no_run
11383/// # extern crate hyper;
11384/// # extern crate hyper_rustls;
11385/// # extern crate google_datamigration1 as datamigration1;
11386/// # async fn dox() {
11387/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11388///
11389/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11390/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11391/// # .with_native_roots()
11392/// # .unwrap()
11393/// # .https_only()
11394/// # .enable_http2()
11395/// # .build();
11396///
11397/// # let executor = hyper_util::rt::TokioExecutor::new();
11398/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11399/// # secret,
11400/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11401/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11402/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11403/// # ),
11404/// # ).build().await.unwrap();
11405///
11406/// # let client = hyper_util::client::legacy::Client::builder(
11407/// # hyper_util::rt::TokioExecutor::new()
11408/// # )
11409/// # .build(
11410/// # hyper_rustls::HttpsConnectorBuilder::new()
11411/// # .with_native_roots()
11412/// # .unwrap()
11413/// # .https_or_http()
11414/// # .enable_http2()
11415/// # .build()
11416/// # );
11417/// # let mut hub = DatabaseMigrationService::new(client, auth);
11418/// // You can configure optional parameters by calling the respective setters at will, and
11419/// // execute the final call using `doit()`.
11420/// // Values shown here are possibly random and not representative !
11421/// let result = hub.projects().locations_conversion_workspaces_delete("name")
11422/// .request_id("Stet")
11423/// .force(false)
11424/// .doit().await;
11425/// # }
11426/// ```
11427pub struct ProjectLocationConversionWorkspaceDeleteCall<'a, C>
11428where
11429 C: 'a,
11430{
11431 hub: &'a DatabaseMigrationService<C>,
11432 _name: String,
11433 _request_id: Option<String>,
11434 _force: Option<bool>,
11435 _delegate: Option<&'a mut dyn common::Delegate>,
11436 _additional_params: HashMap<String, String>,
11437 _scopes: BTreeSet<String>,
11438}
11439
11440impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceDeleteCall<'a, C> {}
11441
11442impl<'a, C> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
11443where
11444 C: common::Connector,
11445{
11446 /// Perform the operation you have build so far.
11447 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11448 use std::borrow::Cow;
11449 use std::io::{Read, Seek};
11450
11451 use common::{url::Params, ToParts};
11452 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11453
11454 let mut dd = common::DefaultDelegate;
11455 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11456 dlg.begin(common::MethodInfo {
11457 id: "datamigration.projects.locations.conversionWorkspaces.delete",
11458 http_method: hyper::Method::DELETE,
11459 });
11460
11461 for &field in ["alt", "name", "requestId", "force"].iter() {
11462 if self._additional_params.contains_key(field) {
11463 dlg.finished(false);
11464 return Err(common::Error::FieldClash(field));
11465 }
11466 }
11467
11468 let mut params = Params::with_capacity(5 + self._additional_params.len());
11469 params.push("name", self._name);
11470 if let Some(value) = self._request_id.as_ref() {
11471 params.push("requestId", value);
11472 }
11473 if let Some(value) = self._force.as_ref() {
11474 params.push("force", value.to_string());
11475 }
11476
11477 params.extend(self._additional_params.iter());
11478
11479 params.push("alt", "json");
11480 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11481 if self._scopes.is_empty() {
11482 self._scopes
11483 .insert(Scope::CloudPlatform.as_ref().to_string());
11484 }
11485
11486 #[allow(clippy::single_element_loop)]
11487 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11488 url = params.uri_replacement(url, param_name, find_this, true);
11489 }
11490 {
11491 let to_remove = ["name"];
11492 params.remove_params(&to_remove);
11493 }
11494
11495 let url = params.parse_with_url(&url);
11496
11497 loop {
11498 let token = match self
11499 .hub
11500 .auth
11501 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11502 .await
11503 {
11504 Ok(token) => token,
11505 Err(e) => match dlg.token(e) {
11506 Ok(token) => token,
11507 Err(e) => {
11508 dlg.finished(false);
11509 return Err(common::Error::MissingToken(e));
11510 }
11511 },
11512 };
11513 let mut req_result = {
11514 let client = &self.hub.client;
11515 dlg.pre_request();
11516 let mut req_builder = hyper::Request::builder()
11517 .method(hyper::Method::DELETE)
11518 .uri(url.as_str())
11519 .header(USER_AGENT, self.hub._user_agent.clone());
11520
11521 if let Some(token) = token.as_ref() {
11522 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11523 }
11524
11525 let request = req_builder
11526 .header(CONTENT_LENGTH, 0_u64)
11527 .body(common::to_body::<String>(None));
11528
11529 client.request(request.unwrap()).await
11530 };
11531
11532 match req_result {
11533 Err(err) => {
11534 if let common::Retry::After(d) = dlg.http_error(&err) {
11535 sleep(d).await;
11536 continue;
11537 }
11538 dlg.finished(false);
11539 return Err(common::Error::HttpError(err));
11540 }
11541 Ok(res) => {
11542 let (mut parts, body) = res.into_parts();
11543 let mut body = common::Body::new(body);
11544 if !parts.status.is_success() {
11545 let bytes = common::to_bytes(body).await.unwrap_or_default();
11546 let error = serde_json::from_str(&common::to_string(&bytes));
11547 let response = common::to_response(parts, bytes.into());
11548
11549 if let common::Retry::After(d) =
11550 dlg.http_failure(&response, error.as_ref().ok())
11551 {
11552 sleep(d).await;
11553 continue;
11554 }
11555
11556 dlg.finished(false);
11557
11558 return Err(match error {
11559 Ok(value) => common::Error::BadRequest(value),
11560 _ => common::Error::Failure(response),
11561 });
11562 }
11563 let response = {
11564 let bytes = common::to_bytes(body).await.unwrap_or_default();
11565 let encoded = common::to_string(&bytes);
11566 match serde_json::from_str(&encoded) {
11567 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11568 Err(error) => {
11569 dlg.response_json_decode_error(&encoded, &error);
11570 return Err(common::Error::JsonDecodeError(
11571 encoded.to_string(),
11572 error,
11573 ));
11574 }
11575 }
11576 };
11577
11578 dlg.finished(true);
11579 return Ok(response);
11580 }
11581 }
11582 }
11583 }
11584
11585 /// Required. Name of the conversion workspace resource to delete.
11586 ///
11587 /// Sets the *name* path property to the given value.
11588 ///
11589 /// Even though the property as already been set when instantiating this call,
11590 /// we provide this method for API completeness.
11591 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
11592 self._name = new_value.to_string();
11593 self
11594 }
11595 /// 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.
11596 ///
11597 /// Sets the *request id* query property to the given value.
11598 pub fn request_id(
11599 mut self,
11600 new_value: &str,
11601 ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
11602 self._request_id = Some(new_value.to_string());
11603 self
11604 }
11605 /// Force delete the conversion workspace, even if there's a running migration that is using the workspace.
11606 ///
11607 /// Sets the *force* query property to the given value.
11608 pub fn force(mut self, new_value: bool) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
11609 self._force = Some(new_value);
11610 self
11611 }
11612 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11613 /// while executing the actual API request.
11614 ///
11615 /// ````text
11616 /// It should be used to handle progress information, and to implement a certain level of resilience.
11617 /// ````
11618 ///
11619 /// Sets the *delegate* property to the given value.
11620 pub fn delegate(
11621 mut self,
11622 new_value: &'a mut dyn common::Delegate,
11623 ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
11624 self._delegate = Some(new_value);
11625 self
11626 }
11627
11628 /// Set any additional parameter of the query string used in the request.
11629 /// It should be used to set parameters which are not yet available through their own
11630 /// setters.
11631 ///
11632 /// Please note that this method must not be used to set any of the known parameters
11633 /// which have their own setter method. If done anyway, the request will fail.
11634 ///
11635 /// # Additional Parameters
11636 ///
11637 /// * *$.xgafv* (query-string) - V1 error format.
11638 /// * *access_token* (query-string) - OAuth access token.
11639 /// * *alt* (query-string) - Data format for response.
11640 /// * *callback* (query-string) - JSONP
11641 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11642 /// * *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.
11643 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11644 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11645 /// * *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.
11646 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11647 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11648 pub fn param<T>(
11649 mut self,
11650 name: T,
11651 value: T,
11652 ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
11653 where
11654 T: AsRef<str>,
11655 {
11656 self._additional_params
11657 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11658 self
11659 }
11660
11661 /// Identifies the authorization scope for the method you are building.
11662 ///
11663 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11664 /// [`Scope::CloudPlatform`].
11665 ///
11666 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11667 /// tokens for more than one scope.
11668 ///
11669 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11670 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11671 /// sufficient, a read-write scope will do as well.
11672 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
11673 where
11674 St: AsRef<str>,
11675 {
11676 self._scopes.insert(String::from(scope.as_ref()));
11677 self
11678 }
11679 /// Identifies the authorization scope(s) for the method you are building.
11680 ///
11681 /// See [`Self::add_scope()`] for details.
11682 pub fn add_scopes<I, St>(
11683 mut self,
11684 scopes: I,
11685 ) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C>
11686 where
11687 I: IntoIterator<Item = St>,
11688 St: AsRef<str>,
11689 {
11690 self._scopes
11691 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11692 self
11693 }
11694
11695 /// Removes all scopes, and no default scope will be used either.
11696 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11697 /// for details).
11698 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceDeleteCall<'a, C> {
11699 self._scopes.clear();
11700 self
11701 }
11702}
11703
11704/// Retrieves a list of committed revisions of a specific conversion workspace.
11705///
11706/// A builder for the *locations.conversionWorkspaces.describeConversionWorkspaceRevisions* method supported by a *project* resource.
11707/// It is not used directly, but through a [`ProjectMethods`] instance.
11708///
11709/// # Example
11710///
11711/// Instantiate a resource method builder
11712///
11713/// ```test_harness,no_run
11714/// # extern crate hyper;
11715/// # extern crate hyper_rustls;
11716/// # extern crate google_datamigration1 as datamigration1;
11717/// # async fn dox() {
11718/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11719///
11720/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11721/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11722/// # .with_native_roots()
11723/// # .unwrap()
11724/// # .https_only()
11725/// # .enable_http2()
11726/// # .build();
11727///
11728/// # let executor = hyper_util::rt::TokioExecutor::new();
11729/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11730/// # secret,
11731/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11732/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11733/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11734/// # ),
11735/// # ).build().await.unwrap();
11736///
11737/// # let client = hyper_util::client::legacy::Client::builder(
11738/// # hyper_util::rt::TokioExecutor::new()
11739/// # )
11740/// # .build(
11741/// # hyper_rustls::HttpsConnectorBuilder::new()
11742/// # .with_native_roots()
11743/// # .unwrap()
11744/// # .https_or_http()
11745/// # .enable_http2()
11746/// # .build()
11747/// # );
11748/// # let mut hub = DatabaseMigrationService::new(client, auth);
11749/// // You can configure optional parameters by calling the respective setters at will, and
11750/// // execute the final call using `doit()`.
11751/// // Values shown here are possibly random and not representative !
11752/// let result = hub.projects().locations_conversion_workspaces_describe_conversion_workspace_revisions("conversionWorkspace")
11753/// .commit_id("Lorem")
11754/// .doit().await;
11755/// # }
11756/// ```
11757pub struct ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11758where
11759 C: 'a,
11760{
11761 hub: &'a DatabaseMigrationService<C>,
11762 _conversion_workspace: String,
11763 _commit_id: Option<String>,
11764 _delegate: Option<&'a mut dyn common::Delegate>,
11765 _additional_params: HashMap<String, String>,
11766 _scopes: BTreeSet<String>,
11767}
11768
11769impl<'a, C> common::CallBuilder
11770 for ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11771{
11772}
11773
11774impl<'a, C> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11775where
11776 C: common::Connector,
11777{
11778 /// Perform the operation you have build so far.
11779 pub async fn doit(
11780 mut self,
11781 ) -> common::Result<(
11782 common::Response,
11783 DescribeConversionWorkspaceRevisionsResponse,
11784 )> {
11785 use std::borrow::Cow;
11786 use std::io::{Read, Seek};
11787
11788 use common::{url::Params, ToParts};
11789 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11790
11791 let mut dd = common::DefaultDelegate;
11792 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11793 dlg.begin(common::MethodInfo { id: "datamigration.projects.locations.conversionWorkspaces.describeConversionWorkspaceRevisions",
11794 http_method: hyper::Method::GET });
11795
11796 for &field in ["alt", "conversionWorkspace", "commitId"].iter() {
11797 if self._additional_params.contains_key(field) {
11798 dlg.finished(false);
11799 return Err(common::Error::FieldClash(field));
11800 }
11801 }
11802
11803 let mut params = Params::with_capacity(4 + self._additional_params.len());
11804 params.push("conversionWorkspace", self._conversion_workspace);
11805 if let Some(value) = self._commit_id.as_ref() {
11806 params.push("commitId", value);
11807 }
11808
11809 params.extend(self._additional_params.iter());
11810
11811 params.push("alt", "json");
11812 let mut url = self.hub._base_url.clone()
11813 + "v1/{+conversionWorkspace}:describeConversionWorkspaceRevisions";
11814 if self._scopes.is_empty() {
11815 self._scopes
11816 .insert(Scope::CloudPlatform.as_ref().to_string());
11817 }
11818
11819 #[allow(clippy::single_element_loop)]
11820 for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
11821 url = params.uri_replacement(url, param_name, find_this, true);
11822 }
11823 {
11824 let to_remove = ["conversionWorkspace"];
11825 params.remove_params(&to_remove);
11826 }
11827
11828 let url = params.parse_with_url(&url);
11829
11830 loop {
11831 let token = match self
11832 .hub
11833 .auth
11834 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11835 .await
11836 {
11837 Ok(token) => token,
11838 Err(e) => match dlg.token(e) {
11839 Ok(token) => token,
11840 Err(e) => {
11841 dlg.finished(false);
11842 return Err(common::Error::MissingToken(e));
11843 }
11844 },
11845 };
11846 let mut req_result = {
11847 let client = &self.hub.client;
11848 dlg.pre_request();
11849 let mut req_builder = hyper::Request::builder()
11850 .method(hyper::Method::GET)
11851 .uri(url.as_str())
11852 .header(USER_AGENT, self.hub._user_agent.clone());
11853
11854 if let Some(token) = token.as_ref() {
11855 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11856 }
11857
11858 let request = req_builder
11859 .header(CONTENT_LENGTH, 0_u64)
11860 .body(common::to_body::<String>(None));
11861
11862 client.request(request.unwrap()).await
11863 };
11864
11865 match req_result {
11866 Err(err) => {
11867 if let common::Retry::After(d) = dlg.http_error(&err) {
11868 sleep(d).await;
11869 continue;
11870 }
11871 dlg.finished(false);
11872 return Err(common::Error::HttpError(err));
11873 }
11874 Ok(res) => {
11875 let (mut parts, body) = res.into_parts();
11876 let mut body = common::Body::new(body);
11877 if !parts.status.is_success() {
11878 let bytes = common::to_bytes(body).await.unwrap_or_default();
11879 let error = serde_json::from_str(&common::to_string(&bytes));
11880 let response = common::to_response(parts, bytes.into());
11881
11882 if let common::Retry::After(d) =
11883 dlg.http_failure(&response, error.as_ref().ok())
11884 {
11885 sleep(d).await;
11886 continue;
11887 }
11888
11889 dlg.finished(false);
11890
11891 return Err(match error {
11892 Ok(value) => common::Error::BadRequest(value),
11893 _ => common::Error::Failure(response),
11894 });
11895 }
11896 let response = {
11897 let bytes = common::to_bytes(body).await.unwrap_or_default();
11898 let encoded = common::to_string(&bytes);
11899 match serde_json::from_str(&encoded) {
11900 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11901 Err(error) => {
11902 dlg.response_json_decode_error(&encoded, &error);
11903 return Err(common::Error::JsonDecodeError(
11904 encoded.to_string(),
11905 error,
11906 ));
11907 }
11908 }
11909 };
11910
11911 dlg.finished(true);
11912 return Ok(response);
11913 }
11914 }
11915 }
11916 }
11917
11918 /// Required. Name of the conversion workspace resource whose revisions are listed. Must be in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
11919 ///
11920 /// Sets the *conversion workspace* path property to the given value.
11921 ///
11922 /// Even though the property as already been set when instantiating this call,
11923 /// we provide this method for API completeness.
11924 pub fn conversion_workspace(
11925 mut self,
11926 new_value: &str,
11927 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11928 self._conversion_workspace = new_value.to_string();
11929 self
11930 }
11931 /// Optional. Optional filter to request a specific commit ID.
11932 ///
11933 /// Sets the *commit id* query property to the given value.
11934 pub fn commit_id(
11935 mut self,
11936 new_value: &str,
11937 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11938 self._commit_id = Some(new_value.to_string());
11939 self
11940 }
11941 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11942 /// while executing the actual API request.
11943 ///
11944 /// ````text
11945 /// It should be used to handle progress information, and to implement a certain level of resilience.
11946 /// ````
11947 ///
11948 /// Sets the *delegate* property to the given value.
11949 pub fn delegate(
11950 mut self,
11951 new_value: &'a mut dyn common::Delegate,
11952 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
11953 self._delegate = Some(new_value);
11954 self
11955 }
11956
11957 /// Set any additional parameter of the query string used in the request.
11958 /// It should be used to set parameters which are not yet available through their own
11959 /// setters.
11960 ///
11961 /// Please note that this method must not be used to set any of the known parameters
11962 /// which have their own setter method. If done anyway, the request will fail.
11963 ///
11964 /// # Additional Parameters
11965 ///
11966 /// * *$.xgafv* (query-string) - V1 error format.
11967 /// * *access_token* (query-string) - OAuth access token.
11968 /// * *alt* (query-string) - Data format for response.
11969 /// * *callback* (query-string) - JSONP
11970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11971 /// * *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.
11972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11974 /// * *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.
11975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11977 pub fn param<T>(
11978 mut self,
11979 name: T,
11980 value: T,
11981 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
11982 where
11983 T: AsRef<str>,
11984 {
11985 self._additional_params
11986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11987 self
11988 }
11989
11990 /// Identifies the authorization scope for the method you are building.
11991 ///
11992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11993 /// [`Scope::CloudPlatform`].
11994 ///
11995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11996 /// tokens for more than one scope.
11997 ///
11998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12000 /// sufficient, a read-write scope will do as well.
12001 pub fn add_scope<St>(
12002 mut self,
12003 scope: St,
12004 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
12005 where
12006 St: AsRef<str>,
12007 {
12008 self._scopes.insert(String::from(scope.as_ref()));
12009 self
12010 }
12011 /// Identifies the authorization scope(s) for the method you are building.
12012 ///
12013 /// See [`Self::add_scope()`] for details.
12014 pub fn add_scopes<I, St>(
12015 mut self,
12016 scopes: I,
12017 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C>
12018 where
12019 I: IntoIterator<Item = St>,
12020 St: AsRef<str>,
12021 {
12022 self._scopes
12023 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12024 self
12025 }
12026
12027 /// Removes all scopes, and no default scope will be used either.
12028 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12029 /// for details).
12030 pub fn clear_scopes(
12031 mut self,
12032 ) -> ProjectLocationConversionWorkspaceDescribeConversionWorkspaceRevisionCall<'a, C> {
12033 self._scopes.clear();
12034 self
12035 }
12036}
12037
12038/// 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.
12039///
12040/// A builder for the *locations.conversionWorkspaces.describeDatabaseEntities* method supported by a *project* resource.
12041/// It is not used directly, but through a [`ProjectMethods`] instance.
12042///
12043/// # Example
12044///
12045/// Instantiate a resource method builder
12046///
12047/// ```test_harness,no_run
12048/// # extern crate hyper;
12049/// # extern crate hyper_rustls;
12050/// # extern crate google_datamigration1 as datamigration1;
12051/// # async fn dox() {
12052/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12053///
12054/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12055/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12056/// # .with_native_roots()
12057/// # .unwrap()
12058/// # .https_only()
12059/// # .enable_http2()
12060/// # .build();
12061///
12062/// # let executor = hyper_util::rt::TokioExecutor::new();
12063/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12064/// # secret,
12065/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12066/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12067/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12068/// # ),
12069/// # ).build().await.unwrap();
12070///
12071/// # let client = hyper_util::client::legacy::Client::builder(
12072/// # hyper_util::rt::TokioExecutor::new()
12073/// # )
12074/// # .build(
12075/// # hyper_rustls::HttpsConnectorBuilder::new()
12076/// # .with_native_roots()
12077/// # .unwrap()
12078/// # .https_or_http()
12079/// # .enable_http2()
12080/// # .build()
12081/// # );
12082/// # let mut hub = DatabaseMigrationService::new(client, auth);
12083/// // You can configure optional parameters by calling the respective setters at will, and
12084/// // execute the final call using `doit()`.
12085/// // Values shown here are possibly random and not representative !
12086/// let result = hub.projects().locations_conversion_workspaces_describe_database_entities("conversionWorkspace")
12087/// .view("no")
12088/// .uncommitted(false)
12089/// .tree("accusam")
12090/// .page_token("takimata")
12091/// .page_size(-46)
12092/// .filter("voluptua.")
12093/// .commit_id("et")
12094/// .doit().await;
12095/// # }
12096/// ```
12097pub struct ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12098where
12099 C: 'a,
12100{
12101 hub: &'a DatabaseMigrationService<C>,
12102 _conversion_workspace: String,
12103 _view: Option<String>,
12104 _uncommitted: Option<bool>,
12105 _tree: Option<String>,
12106 _page_token: Option<String>,
12107 _page_size: Option<i32>,
12108 _filter: Option<String>,
12109 _commit_id: Option<String>,
12110 _delegate: Option<&'a mut dyn common::Delegate>,
12111 _additional_params: HashMap<String, String>,
12112 _scopes: BTreeSet<String>,
12113}
12114
12115impl<'a, C> common::CallBuilder
12116 for ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12117{
12118}
12119
12120impl<'a, C> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12121where
12122 C: common::Connector,
12123{
12124 /// Perform the operation you have build so far.
12125 pub async fn doit(
12126 mut self,
12127 ) -> common::Result<(common::Response, DescribeDatabaseEntitiesResponse)> {
12128 use std::borrow::Cow;
12129 use std::io::{Read, Seek};
12130
12131 use common::{url::Params, ToParts};
12132 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12133
12134 let mut dd = common::DefaultDelegate;
12135 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12136 dlg.begin(common::MethodInfo {
12137 id: "datamigration.projects.locations.conversionWorkspaces.describeDatabaseEntities",
12138 http_method: hyper::Method::GET,
12139 });
12140
12141 for &field in [
12142 "alt",
12143 "conversionWorkspace",
12144 "view",
12145 "uncommitted",
12146 "tree",
12147 "pageToken",
12148 "pageSize",
12149 "filter",
12150 "commitId",
12151 ]
12152 .iter()
12153 {
12154 if self._additional_params.contains_key(field) {
12155 dlg.finished(false);
12156 return Err(common::Error::FieldClash(field));
12157 }
12158 }
12159
12160 let mut params = Params::with_capacity(10 + self._additional_params.len());
12161 params.push("conversionWorkspace", self._conversion_workspace);
12162 if let Some(value) = self._view.as_ref() {
12163 params.push("view", value);
12164 }
12165 if let Some(value) = self._uncommitted.as_ref() {
12166 params.push("uncommitted", value.to_string());
12167 }
12168 if let Some(value) = self._tree.as_ref() {
12169 params.push("tree", value);
12170 }
12171 if let Some(value) = self._page_token.as_ref() {
12172 params.push("pageToken", value);
12173 }
12174 if let Some(value) = self._page_size.as_ref() {
12175 params.push("pageSize", value.to_string());
12176 }
12177 if let Some(value) = self._filter.as_ref() {
12178 params.push("filter", value);
12179 }
12180 if let Some(value) = self._commit_id.as_ref() {
12181 params.push("commitId", value);
12182 }
12183
12184 params.extend(self._additional_params.iter());
12185
12186 params.push("alt", "json");
12187 let mut url =
12188 self.hub._base_url.clone() + "v1/{+conversionWorkspace}:describeDatabaseEntities";
12189 if self._scopes.is_empty() {
12190 self._scopes
12191 .insert(Scope::CloudPlatform.as_ref().to_string());
12192 }
12193
12194 #[allow(clippy::single_element_loop)]
12195 for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
12196 url = params.uri_replacement(url, param_name, find_this, true);
12197 }
12198 {
12199 let to_remove = ["conversionWorkspace"];
12200 params.remove_params(&to_remove);
12201 }
12202
12203 let url = params.parse_with_url(&url);
12204
12205 loop {
12206 let token = match self
12207 .hub
12208 .auth
12209 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12210 .await
12211 {
12212 Ok(token) => token,
12213 Err(e) => match dlg.token(e) {
12214 Ok(token) => token,
12215 Err(e) => {
12216 dlg.finished(false);
12217 return Err(common::Error::MissingToken(e));
12218 }
12219 },
12220 };
12221 let mut req_result = {
12222 let client = &self.hub.client;
12223 dlg.pre_request();
12224 let mut req_builder = hyper::Request::builder()
12225 .method(hyper::Method::GET)
12226 .uri(url.as_str())
12227 .header(USER_AGENT, self.hub._user_agent.clone());
12228
12229 if let Some(token) = token.as_ref() {
12230 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12231 }
12232
12233 let request = req_builder
12234 .header(CONTENT_LENGTH, 0_u64)
12235 .body(common::to_body::<String>(None));
12236
12237 client.request(request.unwrap()).await
12238 };
12239
12240 match req_result {
12241 Err(err) => {
12242 if let common::Retry::After(d) = dlg.http_error(&err) {
12243 sleep(d).await;
12244 continue;
12245 }
12246 dlg.finished(false);
12247 return Err(common::Error::HttpError(err));
12248 }
12249 Ok(res) => {
12250 let (mut parts, body) = res.into_parts();
12251 let mut body = common::Body::new(body);
12252 if !parts.status.is_success() {
12253 let bytes = common::to_bytes(body).await.unwrap_or_default();
12254 let error = serde_json::from_str(&common::to_string(&bytes));
12255 let response = common::to_response(parts, bytes.into());
12256
12257 if let common::Retry::After(d) =
12258 dlg.http_failure(&response, error.as_ref().ok())
12259 {
12260 sleep(d).await;
12261 continue;
12262 }
12263
12264 dlg.finished(false);
12265
12266 return Err(match error {
12267 Ok(value) => common::Error::BadRequest(value),
12268 _ => common::Error::Failure(response),
12269 });
12270 }
12271 let response = {
12272 let bytes = common::to_bytes(body).await.unwrap_or_default();
12273 let encoded = common::to_string(&bytes);
12274 match serde_json::from_str(&encoded) {
12275 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12276 Err(error) => {
12277 dlg.response_json_decode_error(&encoded, &error);
12278 return Err(common::Error::JsonDecodeError(
12279 encoded.to_string(),
12280 error,
12281 ));
12282 }
12283 }
12284 };
12285
12286 dlg.finished(true);
12287 return Ok(response);
12288 }
12289 }
12290 }
12291 }
12292
12293 /// 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}.
12294 ///
12295 /// Sets the *conversion workspace* path property to the given value.
12296 ///
12297 /// Even though the property as already been set when instantiating this call,
12298 /// we provide this method for API completeness.
12299 pub fn conversion_workspace(
12300 mut self,
12301 new_value: &str,
12302 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12303 self._conversion_workspace = new_value.to_string();
12304 self
12305 }
12306 /// Optional. Results view based on AIP-157
12307 ///
12308 /// Sets the *view* query property to the given value.
12309 pub fn view(
12310 mut self,
12311 new_value: &str,
12312 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12313 self._view = Some(new_value.to_string());
12314 self
12315 }
12316 /// 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.
12317 ///
12318 /// Sets the *uncommitted* query property to the given value.
12319 pub fn uncommitted(
12320 mut self,
12321 new_value: bool,
12322 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12323 self._uncommitted = Some(new_value);
12324 self
12325 }
12326 /// Required. The tree to fetch.
12327 ///
12328 /// Sets the *tree* query property to the given value.
12329 pub fn tree(
12330 mut self,
12331 new_value: &str,
12332 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12333 self._tree = Some(new_value.to_string());
12334 self
12335 }
12336 /// 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.
12337 ///
12338 /// Sets the *page token* query property to the given value.
12339 pub fn page_token(
12340 mut self,
12341 new_value: &str,
12342 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12343 self._page_token = Some(new_value.to_string());
12344 self
12345 }
12346 /// Optional. The maximum number of entities to return. The service may return fewer entities than the value specifies.
12347 ///
12348 /// Sets the *page size* query property to the given value.
12349 pub fn page_size(
12350 mut self,
12351 new_value: i32,
12352 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12353 self._page_size = Some(new_value);
12354 self
12355 }
12356 /// Optional. Filter the returned entities based on AIP-160 standard.
12357 ///
12358 /// Sets the *filter* query property to the given value.
12359 pub fn filter(
12360 mut self,
12361 new_value: &str,
12362 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12363 self._filter = Some(new_value.to_string());
12364 self
12365 }
12366 /// Optional. Request a specific commit ID. If not specified, the entities from the latest commit are returned.
12367 ///
12368 /// Sets the *commit id* query property to the given value.
12369 pub fn commit_id(
12370 mut self,
12371 new_value: &str,
12372 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12373 self._commit_id = Some(new_value.to_string());
12374 self
12375 }
12376 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12377 /// while executing the actual API request.
12378 ///
12379 /// ````text
12380 /// It should be used to handle progress information, and to implement a certain level of resilience.
12381 /// ````
12382 ///
12383 /// Sets the *delegate* property to the given value.
12384 pub fn delegate(
12385 mut self,
12386 new_value: &'a mut dyn common::Delegate,
12387 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12388 self._delegate = Some(new_value);
12389 self
12390 }
12391
12392 /// Set any additional parameter of the query string used in the request.
12393 /// It should be used to set parameters which are not yet available through their own
12394 /// setters.
12395 ///
12396 /// Please note that this method must not be used to set any of the known parameters
12397 /// which have their own setter method. If done anyway, the request will fail.
12398 ///
12399 /// # Additional Parameters
12400 ///
12401 /// * *$.xgafv* (query-string) - V1 error format.
12402 /// * *access_token* (query-string) - OAuth access token.
12403 /// * *alt* (query-string) - Data format for response.
12404 /// * *callback* (query-string) - JSONP
12405 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12406 /// * *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.
12407 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12408 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12409 /// * *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.
12410 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12411 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12412 pub fn param<T>(
12413 mut self,
12414 name: T,
12415 value: T,
12416 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12417 where
12418 T: AsRef<str>,
12419 {
12420 self._additional_params
12421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12422 self
12423 }
12424
12425 /// Identifies the authorization scope for the method you are building.
12426 ///
12427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12428 /// [`Scope::CloudPlatform`].
12429 ///
12430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12431 /// tokens for more than one scope.
12432 ///
12433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12435 /// sufficient, a read-write scope will do as well.
12436 pub fn add_scope<St>(
12437 mut self,
12438 scope: St,
12439 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12440 where
12441 St: AsRef<str>,
12442 {
12443 self._scopes.insert(String::from(scope.as_ref()));
12444 self
12445 }
12446 /// Identifies the authorization scope(s) for the method you are building.
12447 ///
12448 /// See [`Self::add_scope()`] for details.
12449 pub fn add_scopes<I, St>(
12450 mut self,
12451 scopes: I,
12452 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C>
12453 where
12454 I: IntoIterator<Item = St>,
12455 St: AsRef<str>,
12456 {
12457 self._scopes
12458 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12459 self
12460 }
12461
12462 /// Removes all scopes, and no default scope will be used either.
12463 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12464 /// for details).
12465 pub fn clear_scopes(
12466 mut self,
12467 ) -> ProjectLocationConversionWorkspaceDescribeDatabaseEntityCall<'a, C> {
12468 self._scopes.clear();
12469 self
12470 }
12471}
12472
12473/// Gets details of a single conversion workspace.
12474///
12475/// A builder for the *locations.conversionWorkspaces.get* method supported by a *project* resource.
12476/// It is not used directly, but through a [`ProjectMethods`] instance.
12477///
12478/// # Example
12479///
12480/// Instantiate a resource method builder
12481///
12482/// ```test_harness,no_run
12483/// # extern crate hyper;
12484/// # extern crate hyper_rustls;
12485/// # extern crate google_datamigration1 as datamigration1;
12486/// # async fn dox() {
12487/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12488///
12489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12491/// # .with_native_roots()
12492/// # .unwrap()
12493/// # .https_only()
12494/// # .enable_http2()
12495/// # .build();
12496///
12497/// # let executor = hyper_util::rt::TokioExecutor::new();
12498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12499/// # secret,
12500/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12501/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12502/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12503/// # ),
12504/// # ).build().await.unwrap();
12505///
12506/// # let client = hyper_util::client::legacy::Client::builder(
12507/// # hyper_util::rt::TokioExecutor::new()
12508/// # )
12509/// # .build(
12510/// # hyper_rustls::HttpsConnectorBuilder::new()
12511/// # .with_native_roots()
12512/// # .unwrap()
12513/// # .https_or_http()
12514/// # .enable_http2()
12515/// # .build()
12516/// # );
12517/// # let mut hub = DatabaseMigrationService::new(client, auth);
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_get("name")
12522/// .doit().await;
12523/// # }
12524/// ```
12525pub struct ProjectLocationConversionWorkspaceGetCall<'a, C>
12526where
12527 C: 'a,
12528{
12529 hub: &'a DatabaseMigrationService<C>,
12530 _name: String,
12531 _delegate: Option<&'a mut dyn common::Delegate>,
12532 _additional_params: HashMap<String, String>,
12533 _scopes: BTreeSet<String>,
12534}
12535
12536impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceGetCall<'a, C> {}
12537
12538impl<'a, C> ProjectLocationConversionWorkspaceGetCall<'a, C>
12539where
12540 C: common::Connector,
12541{
12542 /// Perform the operation you have build so far.
12543 pub async fn doit(mut self) -> common::Result<(common::Response, ConversionWorkspace)> {
12544 use std::borrow::Cow;
12545 use std::io::{Read, Seek};
12546
12547 use common::{url::Params, ToParts};
12548 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12549
12550 let mut dd = common::DefaultDelegate;
12551 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12552 dlg.begin(common::MethodInfo {
12553 id: "datamigration.projects.locations.conversionWorkspaces.get",
12554 http_method: hyper::Method::GET,
12555 });
12556
12557 for &field in ["alt", "name"].iter() {
12558 if self._additional_params.contains_key(field) {
12559 dlg.finished(false);
12560 return Err(common::Error::FieldClash(field));
12561 }
12562 }
12563
12564 let mut params = Params::with_capacity(3 + self._additional_params.len());
12565 params.push("name", self._name);
12566
12567 params.extend(self._additional_params.iter());
12568
12569 params.push("alt", "json");
12570 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12571 if self._scopes.is_empty() {
12572 self._scopes
12573 .insert(Scope::CloudPlatform.as_ref().to_string());
12574 }
12575
12576 #[allow(clippy::single_element_loop)]
12577 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12578 url = params.uri_replacement(url, param_name, find_this, true);
12579 }
12580 {
12581 let to_remove = ["name"];
12582 params.remove_params(&to_remove);
12583 }
12584
12585 let url = params.parse_with_url(&url);
12586
12587 loop {
12588 let token = match self
12589 .hub
12590 .auth
12591 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12592 .await
12593 {
12594 Ok(token) => token,
12595 Err(e) => match dlg.token(e) {
12596 Ok(token) => token,
12597 Err(e) => {
12598 dlg.finished(false);
12599 return Err(common::Error::MissingToken(e));
12600 }
12601 },
12602 };
12603 let mut req_result = {
12604 let client = &self.hub.client;
12605 dlg.pre_request();
12606 let mut req_builder = hyper::Request::builder()
12607 .method(hyper::Method::GET)
12608 .uri(url.as_str())
12609 .header(USER_AGENT, self.hub._user_agent.clone());
12610
12611 if let Some(token) = token.as_ref() {
12612 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12613 }
12614
12615 let request = req_builder
12616 .header(CONTENT_LENGTH, 0_u64)
12617 .body(common::to_body::<String>(None));
12618
12619 client.request(request.unwrap()).await
12620 };
12621
12622 match req_result {
12623 Err(err) => {
12624 if let common::Retry::After(d) = dlg.http_error(&err) {
12625 sleep(d).await;
12626 continue;
12627 }
12628 dlg.finished(false);
12629 return Err(common::Error::HttpError(err));
12630 }
12631 Ok(res) => {
12632 let (mut parts, body) = res.into_parts();
12633 let mut body = common::Body::new(body);
12634 if !parts.status.is_success() {
12635 let bytes = common::to_bytes(body).await.unwrap_or_default();
12636 let error = serde_json::from_str(&common::to_string(&bytes));
12637 let response = common::to_response(parts, bytes.into());
12638
12639 if let common::Retry::After(d) =
12640 dlg.http_failure(&response, error.as_ref().ok())
12641 {
12642 sleep(d).await;
12643 continue;
12644 }
12645
12646 dlg.finished(false);
12647
12648 return Err(match error {
12649 Ok(value) => common::Error::BadRequest(value),
12650 _ => common::Error::Failure(response),
12651 });
12652 }
12653 let response = {
12654 let bytes = common::to_bytes(body).await.unwrap_or_default();
12655 let encoded = common::to_string(&bytes);
12656 match serde_json::from_str(&encoded) {
12657 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12658 Err(error) => {
12659 dlg.response_json_decode_error(&encoded, &error);
12660 return Err(common::Error::JsonDecodeError(
12661 encoded.to_string(),
12662 error,
12663 ));
12664 }
12665 }
12666 };
12667
12668 dlg.finished(true);
12669 return Ok(response);
12670 }
12671 }
12672 }
12673 }
12674
12675 /// Required. Name of the conversion workspace resource to get.
12676 ///
12677 /// Sets the *name* path property to the given value.
12678 ///
12679 /// Even though the property as already been set when instantiating this call,
12680 /// we provide this method for API completeness.
12681 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
12682 self._name = new_value.to_string();
12683 self
12684 }
12685 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12686 /// while executing the actual API request.
12687 ///
12688 /// ````text
12689 /// It should be used to handle progress information, and to implement a certain level of resilience.
12690 /// ````
12691 ///
12692 /// Sets the *delegate* property to the given value.
12693 pub fn delegate(
12694 mut self,
12695 new_value: &'a mut dyn common::Delegate,
12696 ) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
12697 self._delegate = Some(new_value);
12698 self
12699 }
12700
12701 /// Set any additional parameter of the query string used in the request.
12702 /// It should be used to set parameters which are not yet available through their own
12703 /// setters.
12704 ///
12705 /// Please note that this method must not be used to set any of the known parameters
12706 /// which have their own setter method. If done anyway, the request will fail.
12707 ///
12708 /// # Additional Parameters
12709 ///
12710 /// * *$.xgafv* (query-string) - V1 error format.
12711 /// * *access_token* (query-string) - OAuth access token.
12712 /// * *alt* (query-string) - Data format for response.
12713 /// * *callback* (query-string) - JSONP
12714 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12715 /// * *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.
12716 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12717 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12718 /// * *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.
12719 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12720 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12721 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
12722 where
12723 T: AsRef<str>,
12724 {
12725 self._additional_params
12726 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12727 self
12728 }
12729
12730 /// Identifies the authorization scope for the method you are building.
12731 ///
12732 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12733 /// [`Scope::CloudPlatform`].
12734 ///
12735 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12736 /// tokens for more than one scope.
12737 ///
12738 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12739 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12740 /// sufficient, a read-write scope will do as well.
12741 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
12742 where
12743 St: AsRef<str>,
12744 {
12745 self._scopes.insert(String::from(scope.as_ref()));
12746 self
12747 }
12748 /// Identifies the authorization scope(s) for the method you are building.
12749 ///
12750 /// See [`Self::add_scope()`] for details.
12751 pub fn add_scopes<I, St>(
12752 mut self,
12753 scopes: I,
12754 ) -> ProjectLocationConversionWorkspaceGetCall<'a, C>
12755 where
12756 I: IntoIterator<Item = St>,
12757 St: AsRef<str>,
12758 {
12759 self._scopes
12760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12761 self
12762 }
12763
12764 /// Removes all scopes, and no default scope will be used either.
12765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12766 /// for details).
12767 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceGetCall<'a, C> {
12768 self._scopes.clear();
12769 self
12770 }
12771}
12772
12773/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
12774///
12775/// A builder for the *locations.conversionWorkspaces.getIamPolicy* method supported by a *project* resource.
12776/// It is not used directly, but through a [`ProjectMethods`] instance.
12777///
12778/// # Example
12779///
12780/// Instantiate a resource method builder
12781///
12782/// ```test_harness,no_run
12783/// # extern crate hyper;
12784/// # extern crate hyper_rustls;
12785/// # extern crate google_datamigration1 as datamigration1;
12786/// # async fn dox() {
12787/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12788///
12789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12791/// # .with_native_roots()
12792/// # .unwrap()
12793/// # .https_only()
12794/// # .enable_http2()
12795/// # .build();
12796///
12797/// # let executor = hyper_util::rt::TokioExecutor::new();
12798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12799/// # secret,
12800/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12801/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12802/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12803/// # ),
12804/// # ).build().await.unwrap();
12805///
12806/// # let client = hyper_util::client::legacy::Client::builder(
12807/// # hyper_util::rt::TokioExecutor::new()
12808/// # )
12809/// # .build(
12810/// # hyper_rustls::HttpsConnectorBuilder::new()
12811/// # .with_native_roots()
12812/// # .unwrap()
12813/// # .https_or_http()
12814/// # .enable_http2()
12815/// # .build()
12816/// # );
12817/// # let mut hub = DatabaseMigrationService::new(client, auth);
12818/// // You can configure optional parameters by calling the respective setters at will, and
12819/// // execute the final call using `doit()`.
12820/// // Values shown here are possibly random and not representative !
12821/// let result = hub.projects().locations_conversion_workspaces_get_iam_policy("resource")
12822/// .options_requested_policy_version(-2)
12823/// .doit().await;
12824/// # }
12825/// ```
12826pub struct ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
12827where
12828 C: 'a,
12829{
12830 hub: &'a DatabaseMigrationService<C>,
12831 _resource: String,
12832 _options_requested_policy_version: Option<i32>,
12833 _delegate: Option<&'a mut dyn common::Delegate>,
12834 _additional_params: HashMap<String, String>,
12835 _scopes: BTreeSet<String>,
12836}
12837
12838impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {}
12839
12840impl<'a, C> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
12841where
12842 C: common::Connector,
12843{
12844 /// Perform the operation you have build so far.
12845 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12846 use std::borrow::Cow;
12847 use std::io::{Read, Seek};
12848
12849 use common::{url::Params, ToParts};
12850 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12851
12852 let mut dd = common::DefaultDelegate;
12853 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12854 dlg.begin(common::MethodInfo {
12855 id: "datamigration.projects.locations.conversionWorkspaces.getIamPolicy",
12856 http_method: hyper::Method::GET,
12857 });
12858
12859 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
12860 if self._additional_params.contains_key(field) {
12861 dlg.finished(false);
12862 return Err(common::Error::FieldClash(field));
12863 }
12864 }
12865
12866 let mut params = Params::with_capacity(4 + self._additional_params.len());
12867 params.push("resource", self._resource);
12868 if let Some(value) = self._options_requested_policy_version.as_ref() {
12869 params.push("options.requestedPolicyVersion", value.to_string());
12870 }
12871
12872 params.extend(self._additional_params.iter());
12873
12874 params.push("alt", "json");
12875 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
12876 if self._scopes.is_empty() {
12877 self._scopes
12878 .insert(Scope::CloudPlatform.as_ref().to_string());
12879 }
12880
12881 #[allow(clippy::single_element_loop)]
12882 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12883 url = params.uri_replacement(url, param_name, find_this, true);
12884 }
12885 {
12886 let to_remove = ["resource"];
12887 params.remove_params(&to_remove);
12888 }
12889
12890 let url = params.parse_with_url(&url);
12891
12892 loop {
12893 let token = match self
12894 .hub
12895 .auth
12896 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12897 .await
12898 {
12899 Ok(token) => token,
12900 Err(e) => match dlg.token(e) {
12901 Ok(token) => token,
12902 Err(e) => {
12903 dlg.finished(false);
12904 return Err(common::Error::MissingToken(e));
12905 }
12906 },
12907 };
12908 let mut req_result = {
12909 let client = &self.hub.client;
12910 dlg.pre_request();
12911 let mut req_builder = hyper::Request::builder()
12912 .method(hyper::Method::GET)
12913 .uri(url.as_str())
12914 .header(USER_AGENT, self.hub._user_agent.clone());
12915
12916 if let Some(token) = token.as_ref() {
12917 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12918 }
12919
12920 let request = req_builder
12921 .header(CONTENT_LENGTH, 0_u64)
12922 .body(common::to_body::<String>(None));
12923
12924 client.request(request.unwrap()).await
12925 };
12926
12927 match req_result {
12928 Err(err) => {
12929 if let common::Retry::After(d) = dlg.http_error(&err) {
12930 sleep(d).await;
12931 continue;
12932 }
12933 dlg.finished(false);
12934 return Err(common::Error::HttpError(err));
12935 }
12936 Ok(res) => {
12937 let (mut parts, body) = res.into_parts();
12938 let mut body = common::Body::new(body);
12939 if !parts.status.is_success() {
12940 let bytes = common::to_bytes(body).await.unwrap_or_default();
12941 let error = serde_json::from_str(&common::to_string(&bytes));
12942 let response = common::to_response(parts, bytes.into());
12943
12944 if let common::Retry::After(d) =
12945 dlg.http_failure(&response, error.as_ref().ok())
12946 {
12947 sleep(d).await;
12948 continue;
12949 }
12950
12951 dlg.finished(false);
12952
12953 return Err(match error {
12954 Ok(value) => common::Error::BadRequest(value),
12955 _ => common::Error::Failure(response),
12956 });
12957 }
12958 let response = {
12959 let bytes = common::to_bytes(body).await.unwrap_or_default();
12960 let encoded = common::to_string(&bytes);
12961 match serde_json::from_str(&encoded) {
12962 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12963 Err(error) => {
12964 dlg.response_json_decode_error(&encoded, &error);
12965 return Err(common::Error::JsonDecodeError(
12966 encoded.to_string(),
12967 error,
12968 ));
12969 }
12970 }
12971 };
12972
12973 dlg.finished(true);
12974 return Ok(response);
12975 }
12976 }
12977 }
12978 }
12979
12980 /// 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.
12981 ///
12982 /// Sets the *resource* path property to the given value.
12983 ///
12984 /// Even though the property as already been set when instantiating this call,
12985 /// we provide this method for API completeness.
12986 pub fn resource(
12987 mut self,
12988 new_value: &str,
12989 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
12990 self._resource = new_value.to_string();
12991 self
12992 }
12993 /// 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).
12994 ///
12995 /// Sets the *options.requested policy version* query property to the given value.
12996 pub fn options_requested_policy_version(
12997 mut self,
12998 new_value: i32,
12999 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
13000 self._options_requested_policy_version = Some(new_value);
13001 self
13002 }
13003 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13004 /// while executing the actual API request.
13005 ///
13006 /// ````text
13007 /// It should be used to handle progress information, and to implement a certain level of resilience.
13008 /// ````
13009 ///
13010 /// Sets the *delegate* property to the given value.
13011 pub fn delegate(
13012 mut self,
13013 new_value: &'a mut dyn common::Delegate,
13014 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
13015 self._delegate = Some(new_value);
13016 self
13017 }
13018
13019 /// Set any additional parameter of the query string used in the request.
13020 /// It should be used to set parameters which are not yet available through their own
13021 /// setters.
13022 ///
13023 /// Please note that this method must not be used to set any of the known parameters
13024 /// which have their own setter method. If done anyway, the request will fail.
13025 ///
13026 /// # Additional Parameters
13027 ///
13028 /// * *$.xgafv* (query-string) - V1 error format.
13029 /// * *access_token* (query-string) - OAuth access token.
13030 /// * *alt* (query-string) - Data format for response.
13031 /// * *callback* (query-string) - JSONP
13032 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13033 /// * *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.
13034 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13035 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13036 /// * *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.
13037 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13038 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13039 pub fn param<T>(
13040 mut self,
13041 name: T,
13042 value: T,
13043 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
13044 where
13045 T: AsRef<str>,
13046 {
13047 self._additional_params
13048 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13049 self
13050 }
13051
13052 /// Identifies the authorization scope for the method you are building.
13053 ///
13054 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13055 /// [`Scope::CloudPlatform`].
13056 ///
13057 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13058 /// tokens for more than one scope.
13059 ///
13060 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13061 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13062 /// sufficient, a read-write scope will do as well.
13063 pub fn add_scope<St>(
13064 mut self,
13065 scope: St,
13066 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
13067 where
13068 St: AsRef<str>,
13069 {
13070 self._scopes.insert(String::from(scope.as_ref()));
13071 self
13072 }
13073 /// Identifies the authorization scope(s) for the method you are building.
13074 ///
13075 /// See [`Self::add_scope()`] for details.
13076 pub fn add_scopes<I, St>(
13077 mut self,
13078 scopes: I,
13079 ) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C>
13080 where
13081 I: IntoIterator<Item = St>,
13082 St: AsRef<str>,
13083 {
13084 self._scopes
13085 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13086 self
13087 }
13088
13089 /// Removes all scopes, and no default scope will be used either.
13090 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13091 /// for details).
13092 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceGetIamPolicyCall<'a, C> {
13093 self._scopes.clear();
13094 self
13095 }
13096}
13097
13098/// Lists conversion workspaces in a given project and location.
13099///
13100/// A builder for the *locations.conversionWorkspaces.list* method supported by a *project* resource.
13101/// It is not used directly, but through a [`ProjectMethods`] instance.
13102///
13103/// # Example
13104///
13105/// Instantiate a resource method builder
13106///
13107/// ```test_harness,no_run
13108/// # extern crate hyper;
13109/// # extern crate hyper_rustls;
13110/// # extern crate google_datamigration1 as datamigration1;
13111/// # async fn dox() {
13112/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13113///
13114/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13115/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13116/// # .with_native_roots()
13117/// # .unwrap()
13118/// # .https_only()
13119/// # .enable_http2()
13120/// # .build();
13121///
13122/// # let executor = hyper_util::rt::TokioExecutor::new();
13123/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13124/// # secret,
13125/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13126/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13127/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13128/// # ),
13129/// # ).build().await.unwrap();
13130///
13131/// # let client = hyper_util::client::legacy::Client::builder(
13132/// # hyper_util::rt::TokioExecutor::new()
13133/// # )
13134/// # .build(
13135/// # hyper_rustls::HttpsConnectorBuilder::new()
13136/// # .with_native_roots()
13137/// # .unwrap()
13138/// # .https_or_http()
13139/// # .enable_http2()
13140/// # .build()
13141/// # );
13142/// # let mut hub = DatabaseMigrationService::new(client, auth);
13143/// // You can configure optional parameters by calling the respective setters at will, and
13144/// // execute the final call using `doit()`.
13145/// // Values shown here are possibly random and not representative !
13146/// let result = hub.projects().locations_conversion_workspaces_list("parent")
13147/// .page_token("takimata")
13148/// .page_size(-19)
13149/// .filter("gubergren")
13150/// .doit().await;
13151/// # }
13152/// ```
13153pub struct ProjectLocationConversionWorkspaceListCall<'a, C>
13154where
13155 C: 'a,
13156{
13157 hub: &'a DatabaseMigrationService<C>,
13158 _parent: String,
13159 _page_token: Option<String>,
13160 _page_size: Option<i32>,
13161 _filter: Option<String>,
13162 _delegate: Option<&'a mut dyn common::Delegate>,
13163 _additional_params: HashMap<String, String>,
13164 _scopes: BTreeSet<String>,
13165}
13166
13167impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceListCall<'a, C> {}
13168
13169impl<'a, C> ProjectLocationConversionWorkspaceListCall<'a, C>
13170where
13171 C: common::Connector,
13172{
13173 /// Perform the operation you have build so far.
13174 pub async fn doit(
13175 mut self,
13176 ) -> common::Result<(common::Response, ListConversionWorkspacesResponse)> {
13177 use std::borrow::Cow;
13178 use std::io::{Read, Seek};
13179
13180 use common::{url::Params, ToParts};
13181 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13182
13183 let mut dd = common::DefaultDelegate;
13184 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13185 dlg.begin(common::MethodInfo {
13186 id: "datamigration.projects.locations.conversionWorkspaces.list",
13187 http_method: hyper::Method::GET,
13188 });
13189
13190 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
13191 if self._additional_params.contains_key(field) {
13192 dlg.finished(false);
13193 return Err(common::Error::FieldClash(field));
13194 }
13195 }
13196
13197 let mut params = Params::with_capacity(6 + self._additional_params.len());
13198 params.push("parent", self._parent);
13199 if let Some(value) = self._page_token.as_ref() {
13200 params.push("pageToken", value);
13201 }
13202 if let Some(value) = self._page_size.as_ref() {
13203 params.push("pageSize", value.to_string());
13204 }
13205 if let Some(value) = self._filter.as_ref() {
13206 params.push("filter", value);
13207 }
13208
13209 params.extend(self._additional_params.iter());
13210
13211 params.push("alt", "json");
13212 let mut url = self.hub._base_url.clone() + "v1/{+parent}/conversionWorkspaces";
13213 if self._scopes.is_empty() {
13214 self._scopes
13215 .insert(Scope::CloudPlatform.as_ref().to_string());
13216 }
13217
13218 #[allow(clippy::single_element_loop)]
13219 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13220 url = params.uri_replacement(url, param_name, find_this, true);
13221 }
13222 {
13223 let to_remove = ["parent"];
13224 params.remove_params(&to_remove);
13225 }
13226
13227 let url = params.parse_with_url(&url);
13228
13229 loop {
13230 let token = match self
13231 .hub
13232 .auth
13233 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13234 .await
13235 {
13236 Ok(token) => token,
13237 Err(e) => match dlg.token(e) {
13238 Ok(token) => token,
13239 Err(e) => {
13240 dlg.finished(false);
13241 return Err(common::Error::MissingToken(e));
13242 }
13243 },
13244 };
13245 let mut req_result = {
13246 let client = &self.hub.client;
13247 dlg.pre_request();
13248 let mut req_builder = hyper::Request::builder()
13249 .method(hyper::Method::GET)
13250 .uri(url.as_str())
13251 .header(USER_AGENT, self.hub._user_agent.clone());
13252
13253 if let Some(token) = token.as_ref() {
13254 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13255 }
13256
13257 let request = req_builder
13258 .header(CONTENT_LENGTH, 0_u64)
13259 .body(common::to_body::<String>(None));
13260
13261 client.request(request.unwrap()).await
13262 };
13263
13264 match req_result {
13265 Err(err) => {
13266 if let common::Retry::After(d) = dlg.http_error(&err) {
13267 sleep(d).await;
13268 continue;
13269 }
13270 dlg.finished(false);
13271 return Err(common::Error::HttpError(err));
13272 }
13273 Ok(res) => {
13274 let (mut parts, body) = res.into_parts();
13275 let mut body = common::Body::new(body);
13276 if !parts.status.is_success() {
13277 let bytes = common::to_bytes(body).await.unwrap_or_default();
13278 let error = serde_json::from_str(&common::to_string(&bytes));
13279 let response = common::to_response(parts, bytes.into());
13280
13281 if let common::Retry::After(d) =
13282 dlg.http_failure(&response, error.as_ref().ok())
13283 {
13284 sleep(d).await;
13285 continue;
13286 }
13287
13288 dlg.finished(false);
13289
13290 return Err(match error {
13291 Ok(value) => common::Error::BadRequest(value),
13292 _ => common::Error::Failure(response),
13293 });
13294 }
13295 let response = {
13296 let bytes = common::to_bytes(body).await.unwrap_or_default();
13297 let encoded = common::to_string(&bytes);
13298 match serde_json::from_str(&encoded) {
13299 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13300 Err(error) => {
13301 dlg.response_json_decode_error(&encoded, &error);
13302 return Err(common::Error::JsonDecodeError(
13303 encoded.to_string(),
13304 error,
13305 ));
13306 }
13307 }
13308 };
13309
13310 dlg.finished(true);
13311 return Ok(response);
13312 }
13313 }
13314 }
13315 }
13316
13317 /// Required. The parent which owns this collection of conversion workspaces.
13318 ///
13319 /// Sets the *parent* path property to the given value.
13320 ///
13321 /// Even though the property as already been set when instantiating this call,
13322 /// we provide this method for API completeness.
13323 pub fn parent(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13324 self._parent = new_value.to_string();
13325 self
13326 }
13327 /// 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.
13328 ///
13329 /// Sets the *page token* query property to the given value.
13330 pub fn page_token(
13331 mut self,
13332 new_value: &str,
13333 ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13334 self._page_token = Some(new_value.to_string());
13335 self
13336 }
13337 /// The maximum number of conversion workspaces to return. The service may return fewer than this value. If unspecified, at most 50 sets are returned.
13338 ///
13339 /// Sets the *page size* query property to the given value.
13340 pub fn page_size(
13341 mut self,
13342 new_value: i32,
13343 ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13344 self._page_size = Some(new_value);
13345 self
13346 }
13347 /// 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.
13348 ///
13349 /// Sets the *filter* query property to the given value.
13350 pub fn filter(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13351 self._filter = Some(new_value.to_string());
13352 self
13353 }
13354 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13355 /// while executing the actual API request.
13356 ///
13357 /// ````text
13358 /// It should be used to handle progress information, and to implement a certain level of resilience.
13359 /// ````
13360 ///
13361 /// Sets the *delegate* property to the given value.
13362 pub fn delegate(
13363 mut self,
13364 new_value: &'a mut dyn common::Delegate,
13365 ) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13366 self._delegate = Some(new_value);
13367 self
13368 }
13369
13370 /// Set any additional parameter of the query string used in the request.
13371 /// It should be used to set parameters which are not yet available through their own
13372 /// setters.
13373 ///
13374 /// Please note that this method must not be used to set any of the known parameters
13375 /// which have their own setter method. If done anyway, the request will fail.
13376 ///
13377 /// # Additional Parameters
13378 ///
13379 /// * *$.xgafv* (query-string) - V1 error format.
13380 /// * *access_token* (query-string) - OAuth access token.
13381 /// * *alt* (query-string) - Data format for response.
13382 /// * *callback* (query-string) - JSONP
13383 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13384 /// * *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.
13385 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13386 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13387 /// * *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.
13388 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13389 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13390 pub fn param<T>(
13391 mut self,
13392 name: T,
13393 value: T,
13394 ) -> ProjectLocationConversionWorkspaceListCall<'a, C>
13395 where
13396 T: AsRef<str>,
13397 {
13398 self._additional_params
13399 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13400 self
13401 }
13402
13403 /// Identifies the authorization scope for the method you are building.
13404 ///
13405 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13406 /// [`Scope::CloudPlatform`].
13407 ///
13408 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13409 /// tokens for more than one scope.
13410 ///
13411 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13412 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13413 /// sufficient, a read-write scope will do as well.
13414 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceListCall<'a, C>
13415 where
13416 St: AsRef<str>,
13417 {
13418 self._scopes.insert(String::from(scope.as_ref()));
13419 self
13420 }
13421 /// Identifies the authorization scope(s) for the method you are building.
13422 ///
13423 /// See [`Self::add_scope()`] for details.
13424 pub fn add_scopes<I, St>(
13425 mut self,
13426 scopes: I,
13427 ) -> ProjectLocationConversionWorkspaceListCall<'a, C>
13428 where
13429 I: IntoIterator<Item = St>,
13430 St: AsRef<str>,
13431 {
13432 self._scopes
13433 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13434 self
13435 }
13436
13437 /// Removes all scopes, and no default scope will be used either.
13438 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13439 /// for details).
13440 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceListCall<'a, C> {
13441 self._scopes.clear();
13442 self
13443 }
13444}
13445
13446/// Updates the parameters of a single conversion workspace.
13447///
13448/// A builder for the *locations.conversionWorkspaces.patch* method supported by a *project* resource.
13449/// It is not used directly, but through a [`ProjectMethods`] instance.
13450///
13451/// # Example
13452///
13453/// Instantiate a resource method builder
13454///
13455/// ```test_harness,no_run
13456/// # extern crate hyper;
13457/// # extern crate hyper_rustls;
13458/// # extern crate google_datamigration1 as datamigration1;
13459/// use datamigration1::api::ConversionWorkspace;
13460/// # async fn dox() {
13461/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13462///
13463/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13464/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13465/// # .with_native_roots()
13466/// # .unwrap()
13467/// # .https_only()
13468/// # .enable_http2()
13469/// # .build();
13470///
13471/// # let executor = hyper_util::rt::TokioExecutor::new();
13472/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13473/// # secret,
13474/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13475/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13476/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13477/// # ),
13478/// # ).build().await.unwrap();
13479///
13480/// # let client = hyper_util::client::legacy::Client::builder(
13481/// # hyper_util::rt::TokioExecutor::new()
13482/// # )
13483/// # .build(
13484/// # hyper_rustls::HttpsConnectorBuilder::new()
13485/// # .with_native_roots()
13486/// # .unwrap()
13487/// # .https_or_http()
13488/// # .enable_http2()
13489/// # .build()
13490/// # );
13491/// # let mut hub = DatabaseMigrationService::new(client, auth);
13492/// // As the method needs a request, you would usually fill it with the desired information
13493/// // into the respective structure. Some of the parts shown here might not be applicable !
13494/// // Values shown here are possibly random and not representative !
13495/// let mut req = ConversionWorkspace::default();
13496///
13497/// // You can configure optional parameters by calling the respective setters at will, and
13498/// // execute the final call using `doit()`.
13499/// // Values shown here are possibly random and not representative !
13500/// let result = hub.projects().locations_conversion_workspaces_patch(req, "name")
13501/// .update_mask(FieldMask::new::<&str>(&[]))
13502/// .request_id("accusam")
13503/// .doit().await;
13504/// # }
13505/// ```
13506pub struct ProjectLocationConversionWorkspacePatchCall<'a, C>
13507where
13508 C: 'a,
13509{
13510 hub: &'a DatabaseMigrationService<C>,
13511 _request: ConversionWorkspace,
13512 _name: String,
13513 _update_mask: Option<common::FieldMask>,
13514 _request_id: Option<String>,
13515 _delegate: Option<&'a mut dyn common::Delegate>,
13516 _additional_params: HashMap<String, String>,
13517 _scopes: BTreeSet<String>,
13518}
13519
13520impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspacePatchCall<'a, C> {}
13521
13522impl<'a, C> ProjectLocationConversionWorkspacePatchCall<'a, C>
13523where
13524 C: common::Connector,
13525{
13526 /// Perform the operation you have build so far.
13527 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13528 use std::borrow::Cow;
13529 use std::io::{Read, Seek};
13530
13531 use common::{url::Params, ToParts};
13532 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13533
13534 let mut dd = common::DefaultDelegate;
13535 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13536 dlg.begin(common::MethodInfo {
13537 id: "datamigration.projects.locations.conversionWorkspaces.patch",
13538 http_method: hyper::Method::PATCH,
13539 });
13540
13541 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
13542 if self._additional_params.contains_key(field) {
13543 dlg.finished(false);
13544 return Err(common::Error::FieldClash(field));
13545 }
13546 }
13547
13548 let mut params = Params::with_capacity(6 + self._additional_params.len());
13549 params.push("name", self._name);
13550 if let Some(value) = self._update_mask.as_ref() {
13551 params.push("updateMask", value.to_string());
13552 }
13553 if let Some(value) = self._request_id.as_ref() {
13554 params.push("requestId", value);
13555 }
13556
13557 params.extend(self._additional_params.iter());
13558
13559 params.push("alt", "json");
13560 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13561 if self._scopes.is_empty() {
13562 self._scopes
13563 .insert(Scope::CloudPlatform.as_ref().to_string());
13564 }
13565
13566 #[allow(clippy::single_element_loop)]
13567 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13568 url = params.uri_replacement(url, param_name, find_this, true);
13569 }
13570 {
13571 let to_remove = ["name"];
13572 params.remove_params(&to_remove);
13573 }
13574
13575 let url = params.parse_with_url(&url);
13576
13577 let mut json_mime_type = mime::APPLICATION_JSON;
13578 let mut request_value_reader = {
13579 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13580 common::remove_json_null_values(&mut value);
13581 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13582 serde_json::to_writer(&mut dst, &value).unwrap();
13583 dst
13584 };
13585 let request_size = request_value_reader
13586 .seek(std::io::SeekFrom::End(0))
13587 .unwrap();
13588 request_value_reader
13589 .seek(std::io::SeekFrom::Start(0))
13590 .unwrap();
13591
13592 loop {
13593 let token = match self
13594 .hub
13595 .auth
13596 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13597 .await
13598 {
13599 Ok(token) => token,
13600 Err(e) => match dlg.token(e) {
13601 Ok(token) => token,
13602 Err(e) => {
13603 dlg.finished(false);
13604 return Err(common::Error::MissingToken(e));
13605 }
13606 },
13607 };
13608 request_value_reader
13609 .seek(std::io::SeekFrom::Start(0))
13610 .unwrap();
13611 let mut req_result = {
13612 let client = &self.hub.client;
13613 dlg.pre_request();
13614 let mut req_builder = hyper::Request::builder()
13615 .method(hyper::Method::PATCH)
13616 .uri(url.as_str())
13617 .header(USER_AGENT, self.hub._user_agent.clone());
13618
13619 if let Some(token) = token.as_ref() {
13620 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13621 }
13622
13623 let request = req_builder
13624 .header(CONTENT_TYPE, json_mime_type.to_string())
13625 .header(CONTENT_LENGTH, request_size as u64)
13626 .body(common::to_body(
13627 request_value_reader.get_ref().clone().into(),
13628 ));
13629
13630 client.request(request.unwrap()).await
13631 };
13632
13633 match req_result {
13634 Err(err) => {
13635 if let common::Retry::After(d) = dlg.http_error(&err) {
13636 sleep(d).await;
13637 continue;
13638 }
13639 dlg.finished(false);
13640 return Err(common::Error::HttpError(err));
13641 }
13642 Ok(res) => {
13643 let (mut parts, body) = res.into_parts();
13644 let mut body = common::Body::new(body);
13645 if !parts.status.is_success() {
13646 let bytes = common::to_bytes(body).await.unwrap_or_default();
13647 let error = serde_json::from_str(&common::to_string(&bytes));
13648 let response = common::to_response(parts, bytes.into());
13649
13650 if let common::Retry::After(d) =
13651 dlg.http_failure(&response, error.as_ref().ok())
13652 {
13653 sleep(d).await;
13654 continue;
13655 }
13656
13657 dlg.finished(false);
13658
13659 return Err(match error {
13660 Ok(value) => common::Error::BadRequest(value),
13661 _ => common::Error::Failure(response),
13662 });
13663 }
13664 let response = {
13665 let bytes = common::to_bytes(body).await.unwrap_or_default();
13666 let encoded = common::to_string(&bytes);
13667 match serde_json::from_str(&encoded) {
13668 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13669 Err(error) => {
13670 dlg.response_json_decode_error(&encoded, &error);
13671 return Err(common::Error::JsonDecodeError(
13672 encoded.to_string(),
13673 error,
13674 ));
13675 }
13676 }
13677 };
13678
13679 dlg.finished(true);
13680 return Ok(response);
13681 }
13682 }
13683 }
13684 }
13685
13686 ///
13687 /// Sets the *request* property to the given value.
13688 ///
13689 /// Even though the property as already been set when instantiating this call,
13690 /// we provide this method for API completeness.
13691 pub fn request(
13692 mut self,
13693 new_value: ConversionWorkspace,
13694 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13695 self._request = new_value;
13696 self
13697 }
13698 /// Full name of the workspace resource, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
13699 ///
13700 /// Sets the *name* path property to the given value.
13701 ///
13702 /// Even though the property as already been set when instantiating this call,
13703 /// we provide this method for API completeness.
13704 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13705 self._name = new_value.to_string();
13706 self
13707 }
13708 /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
13709 ///
13710 /// Sets the *update mask* query property to the given value.
13711 pub fn update_mask(
13712 mut self,
13713 new_value: common::FieldMask,
13714 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13715 self._update_mask = Some(new_value);
13716 self
13717 }
13718 /// 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.
13719 ///
13720 /// Sets the *request id* query property to the given value.
13721 pub fn request_id(
13722 mut self,
13723 new_value: &str,
13724 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13725 self._request_id = Some(new_value.to_string());
13726 self
13727 }
13728 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13729 /// while executing the actual API request.
13730 ///
13731 /// ````text
13732 /// It should be used to handle progress information, and to implement a certain level of resilience.
13733 /// ````
13734 ///
13735 /// Sets the *delegate* property to the given value.
13736 pub fn delegate(
13737 mut self,
13738 new_value: &'a mut dyn common::Delegate,
13739 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13740 self._delegate = Some(new_value);
13741 self
13742 }
13743
13744 /// Set any additional parameter of the query string used in the request.
13745 /// It should be used to set parameters which are not yet available through their own
13746 /// setters.
13747 ///
13748 /// Please note that this method must not be used to set any of the known parameters
13749 /// which have their own setter method. If done anyway, the request will fail.
13750 ///
13751 /// # Additional Parameters
13752 ///
13753 /// * *$.xgafv* (query-string) - V1 error format.
13754 /// * *access_token* (query-string) - OAuth access token.
13755 /// * *alt* (query-string) - Data format for response.
13756 /// * *callback* (query-string) - JSONP
13757 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13758 /// * *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.
13759 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13760 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13761 /// * *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.
13762 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13763 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13764 pub fn param<T>(
13765 mut self,
13766 name: T,
13767 value: T,
13768 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
13769 where
13770 T: AsRef<str>,
13771 {
13772 self._additional_params
13773 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13774 self
13775 }
13776
13777 /// Identifies the authorization scope for the method you are building.
13778 ///
13779 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13780 /// [`Scope::CloudPlatform`].
13781 ///
13782 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13783 /// tokens for more than one scope.
13784 ///
13785 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13786 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13787 /// sufficient, a read-write scope will do as well.
13788 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
13789 where
13790 St: AsRef<str>,
13791 {
13792 self._scopes.insert(String::from(scope.as_ref()));
13793 self
13794 }
13795 /// Identifies the authorization scope(s) for the method you are building.
13796 ///
13797 /// See [`Self::add_scope()`] for details.
13798 pub fn add_scopes<I, St>(
13799 mut self,
13800 scopes: I,
13801 ) -> ProjectLocationConversionWorkspacePatchCall<'a, C>
13802 where
13803 I: IntoIterator<Item = St>,
13804 St: AsRef<str>,
13805 {
13806 self._scopes
13807 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13808 self
13809 }
13810
13811 /// Removes all scopes, and no default scope will be used either.
13812 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13813 /// for details).
13814 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspacePatchCall<'a, C> {
13815 self._scopes.clear();
13816 self
13817 }
13818}
13819
13820/// Rolls back a conversion workspace to the last committed snapshot.
13821///
13822/// A builder for the *locations.conversionWorkspaces.rollback* method supported by a *project* resource.
13823/// It is not used directly, but through a [`ProjectMethods`] instance.
13824///
13825/// # Example
13826///
13827/// Instantiate a resource method builder
13828///
13829/// ```test_harness,no_run
13830/// # extern crate hyper;
13831/// # extern crate hyper_rustls;
13832/// # extern crate google_datamigration1 as datamigration1;
13833/// use datamigration1::api::RollbackConversionWorkspaceRequest;
13834/// # async fn dox() {
13835/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13836///
13837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13838/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13839/// # .with_native_roots()
13840/// # .unwrap()
13841/// # .https_only()
13842/// # .enable_http2()
13843/// # .build();
13844///
13845/// # let executor = hyper_util::rt::TokioExecutor::new();
13846/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13847/// # secret,
13848/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13849/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13850/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13851/// # ),
13852/// # ).build().await.unwrap();
13853///
13854/// # let client = hyper_util::client::legacy::Client::builder(
13855/// # hyper_util::rt::TokioExecutor::new()
13856/// # )
13857/// # .build(
13858/// # hyper_rustls::HttpsConnectorBuilder::new()
13859/// # .with_native_roots()
13860/// # .unwrap()
13861/// # .https_or_http()
13862/// # .enable_http2()
13863/// # .build()
13864/// # );
13865/// # let mut hub = DatabaseMigrationService::new(client, auth);
13866/// // As the method needs a request, you would usually fill it with the desired information
13867/// // into the respective structure. Some of the parts shown here might not be applicable !
13868/// // Values shown here are possibly random and not representative !
13869/// let mut req = RollbackConversionWorkspaceRequest::default();
13870///
13871/// // You can configure optional parameters by calling the respective setters at will, and
13872/// // execute the final call using `doit()`.
13873/// // Values shown here are possibly random and not representative !
13874/// let result = hub.projects().locations_conversion_workspaces_rollback(req, "name")
13875/// .doit().await;
13876/// # }
13877/// ```
13878pub struct ProjectLocationConversionWorkspaceRollbackCall<'a, C>
13879where
13880 C: 'a,
13881{
13882 hub: &'a DatabaseMigrationService<C>,
13883 _request: RollbackConversionWorkspaceRequest,
13884 _name: String,
13885 _delegate: Option<&'a mut dyn common::Delegate>,
13886 _additional_params: HashMap<String, String>,
13887 _scopes: BTreeSet<String>,
13888}
13889
13890impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceRollbackCall<'a, C> {}
13891
13892impl<'a, C> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
13893where
13894 C: common::Connector,
13895{
13896 /// Perform the operation you have build so far.
13897 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13898 use std::borrow::Cow;
13899 use std::io::{Read, Seek};
13900
13901 use common::{url::Params, ToParts};
13902 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13903
13904 let mut dd = common::DefaultDelegate;
13905 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13906 dlg.begin(common::MethodInfo {
13907 id: "datamigration.projects.locations.conversionWorkspaces.rollback",
13908 http_method: hyper::Method::POST,
13909 });
13910
13911 for &field in ["alt", "name"].iter() {
13912 if self._additional_params.contains_key(field) {
13913 dlg.finished(false);
13914 return Err(common::Error::FieldClash(field));
13915 }
13916 }
13917
13918 let mut params = Params::with_capacity(4 + self._additional_params.len());
13919 params.push("name", self._name);
13920
13921 params.extend(self._additional_params.iter());
13922
13923 params.push("alt", "json");
13924 let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
13925 if self._scopes.is_empty() {
13926 self._scopes
13927 .insert(Scope::CloudPlatform.as_ref().to_string());
13928 }
13929
13930 #[allow(clippy::single_element_loop)]
13931 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13932 url = params.uri_replacement(url, param_name, find_this, true);
13933 }
13934 {
13935 let to_remove = ["name"];
13936 params.remove_params(&to_remove);
13937 }
13938
13939 let url = params.parse_with_url(&url);
13940
13941 let mut json_mime_type = mime::APPLICATION_JSON;
13942 let mut request_value_reader = {
13943 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13944 common::remove_json_null_values(&mut value);
13945 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13946 serde_json::to_writer(&mut dst, &value).unwrap();
13947 dst
13948 };
13949 let request_size = request_value_reader
13950 .seek(std::io::SeekFrom::End(0))
13951 .unwrap();
13952 request_value_reader
13953 .seek(std::io::SeekFrom::Start(0))
13954 .unwrap();
13955
13956 loop {
13957 let token = match self
13958 .hub
13959 .auth
13960 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13961 .await
13962 {
13963 Ok(token) => token,
13964 Err(e) => match dlg.token(e) {
13965 Ok(token) => token,
13966 Err(e) => {
13967 dlg.finished(false);
13968 return Err(common::Error::MissingToken(e));
13969 }
13970 },
13971 };
13972 request_value_reader
13973 .seek(std::io::SeekFrom::Start(0))
13974 .unwrap();
13975 let mut req_result = {
13976 let client = &self.hub.client;
13977 dlg.pre_request();
13978 let mut req_builder = hyper::Request::builder()
13979 .method(hyper::Method::POST)
13980 .uri(url.as_str())
13981 .header(USER_AGENT, self.hub._user_agent.clone());
13982
13983 if let Some(token) = token.as_ref() {
13984 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13985 }
13986
13987 let request = req_builder
13988 .header(CONTENT_TYPE, json_mime_type.to_string())
13989 .header(CONTENT_LENGTH, request_size as u64)
13990 .body(common::to_body(
13991 request_value_reader.get_ref().clone().into(),
13992 ));
13993
13994 client.request(request.unwrap()).await
13995 };
13996
13997 match req_result {
13998 Err(err) => {
13999 if let common::Retry::After(d) = dlg.http_error(&err) {
14000 sleep(d).await;
14001 continue;
14002 }
14003 dlg.finished(false);
14004 return Err(common::Error::HttpError(err));
14005 }
14006 Ok(res) => {
14007 let (mut parts, body) = res.into_parts();
14008 let mut body = common::Body::new(body);
14009 if !parts.status.is_success() {
14010 let bytes = common::to_bytes(body).await.unwrap_or_default();
14011 let error = serde_json::from_str(&common::to_string(&bytes));
14012 let response = common::to_response(parts, bytes.into());
14013
14014 if let common::Retry::After(d) =
14015 dlg.http_failure(&response, error.as_ref().ok())
14016 {
14017 sleep(d).await;
14018 continue;
14019 }
14020
14021 dlg.finished(false);
14022
14023 return Err(match error {
14024 Ok(value) => common::Error::BadRequest(value),
14025 _ => common::Error::Failure(response),
14026 });
14027 }
14028 let response = {
14029 let bytes = common::to_bytes(body).await.unwrap_or_default();
14030 let encoded = common::to_string(&bytes);
14031 match serde_json::from_str(&encoded) {
14032 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14033 Err(error) => {
14034 dlg.response_json_decode_error(&encoded, &error);
14035 return Err(common::Error::JsonDecodeError(
14036 encoded.to_string(),
14037 error,
14038 ));
14039 }
14040 }
14041 };
14042
14043 dlg.finished(true);
14044 return Ok(response);
14045 }
14046 }
14047 }
14048 }
14049
14050 ///
14051 /// Sets the *request* property to the given value.
14052 ///
14053 /// Even though the property as already been set when instantiating this call,
14054 /// we provide this method for API completeness.
14055 pub fn request(
14056 mut self,
14057 new_value: RollbackConversionWorkspaceRequest,
14058 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
14059 self._request = new_value;
14060 self
14061 }
14062 /// Required. Name of the conversion workspace resource to roll back to.
14063 ///
14064 /// Sets the *name* path property to the given value.
14065 ///
14066 /// Even though the property as already been set when instantiating this call,
14067 /// we provide this method for API completeness.
14068 pub fn name(
14069 mut self,
14070 new_value: &str,
14071 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
14072 self._name = new_value.to_string();
14073 self
14074 }
14075 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14076 /// while executing the actual API request.
14077 ///
14078 /// ````text
14079 /// It should be used to handle progress information, and to implement a certain level of resilience.
14080 /// ````
14081 ///
14082 /// Sets the *delegate* property to the given value.
14083 pub fn delegate(
14084 mut self,
14085 new_value: &'a mut dyn common::Delegate,
14086 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
14087 self._delegate = Some(new_value);
14088 self
14089 }
14090
14091 /// Set any additional parameter of the query string used in the request.
14092 /// It should be used to set parameters which are not yet available through their own
14093 /// setters.
14094 ///
14095 /// Please note that this method must not be used to set any of the known parameters
14096 /// which have their own setter method. If done anyway, the request will fail.
14097 ///
14098 /// # Additional Parameters
14099 ///
14100 /// * *$.xgafv* (query-string) - V1 error format.
14101 /// * *access_token* (query-string) - OAuth access token.
14102 /// * *alt* (query-string) - Data format for response.
14103 /// * *callback* (query-string) - JSONP
14104 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14105 /// * *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.
14106 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14107 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14108 /// * *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.
14109 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14110 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14111 pub fn param<T>(
14112 mut self,
14113 name: T,
14114 value: T,
14115 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
14116 where
14117 T: AsRef<str>,
14118 {
14119 self._additional_params
14120 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14121 self
14122 }
14123
14124 /// Identifies the authorization scope for the method you are building.
14125 ///
14126 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14127 /// [`Scope::CloudPlatform`].
14128 ///
14129 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14130 /// tokens for more than one scope.
14131 ///
14132 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14133 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14134 /// sufficient, a read-write scope will do as well.
14135 pub fn add_scope<St>(
14136 mut self,
14137 scope: St,
14138 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
14139 where
14140 St: AsRef<str>,
14141 {
14142 self._scopes.insert(String::from(scope.as_ref()));
14143 self
14144 }
14145 /// Identifies the authorization scope(s) for the method you are building.
14146 ///
14147 /// See [`Self::add_scope()`] for details.
14148 pub fn add_scopes<I, St>(
14149 mut self,
14150 scopes: I,
14151 ) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C>
14152 where
14153 I: IntoIterator<Item = St>,
14154 St: AsRef<str>,
14155 {
14156 self._scopes
14157 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14158 self
14159 }
14160
14161 /// Removes all scopes, and no default scope will be used either.
14162 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14163 /// for details).
14164 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceRollbackCall<'a, C> {
14165 self._scopes.clear();
14166 self
14167 }
14168}
14169
14170/// 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.
14171///
14172/// A builder for the *locations.conversionWorkspaces.searchBackgroundJobs* method supported by a *project* resource.
14173/// It is not used directly, but through a [`ProjectMethods`] instance.
14174///
14175/// # Example
14176///
14177/// Instantiate a resource method builder
14178///
14179/// ```test_harness,no_run
14180/// # extern crate hyper;
14181/// # extern crate hyper_rustls;
14182/// # extern crate google_datamigration1 as datamigration1;
14183/// # async fn dox() {
14184/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14185///
14186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14188/// # .with_native_roots()
14189/// # .unwrap()
14190/// # .https_only()
14191/// # .enable_http2()
14192/// # .build();
14193///
14194/// # let executor = hyper_util::rt::TokioExecutor::new();
14195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14196/// # secret,
14197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14200/// # ),
14201/// # ).build().await.unwrap();
14202///
14203/// # let client = hyper_util::client::legacy::Client::builder(
14204/// # hyper_util::rt::TokioExecutor::new()
14205/// # )
14206/// # .build(
14207/// # hyper_rustls::HttpsConnectorBuilder::new()
14208/// # .with_native_roots()
14209/// # .unwrap()
14210/// # .https_or_http()
14211/// # .enable_http2()
14212/// # .build()
14213/// # );
14214/// # let mut hub = DatabaseMigrationService::new(client, auth);
14215/// // You can configure optional parameters by calling the respective setters at will, and
14216/// // execute the final call using `doit()`.
14217/// // Values shown here are possibly random and not representative !
14218/// let result = hub.projects().locations_conversion_workspaces_search_background_jobs("conversionWorkspace")
14219/// .return_most_recent_per_job_type(false)
14220/// .max_size(-2)
14221/// .completed_until_time(chrono::Utc::now())
14222/// .doit().await;
14223/// # }
14224/// ```
14225pub struct ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14226where
14227 C: 'a,
14228{
14229 hub: &'a DatabaseMigrationService<C>,
14230 _conversion_workspace: String,
14231 _return_most_recent_per_job_type: Option<bool>,
14232 _max_size: Option<i32>,
14233 _completed_until_time: Option<chrono::DateTime<chrono::offset::Utc>>,
14234 _delegate: Option<&'a mut dyn common::Delegate>,
14235 _additional_params: HashMap<String, String>,
14236 _scopes: BTreeSet<String>,
14237}
14238
14239impl<'a, C> common::CallBuilder
14240 for ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14241{
14242}
14243
14244impl<'a, C> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14245where
14246 C: common::Connector,
14247{
14248 /// Perform the operation you have build so far.
14249 pub async fn doit(
14250 mut self,
14251 ) -> common::Result<(common::Response, SearchBackgroundJobsResponse)> {
14252 use std::borrow::Cow;
14253 use std::io::{Read, Seek};
14254
14255 use common::{url::Params, ToParts};
14256 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14257
14258 let mut dd = common::DefaultDelegate;
14259 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14260 dlg.begin(common::MethodInfo {
14261 id: "datamigration.projects.locations.conversionWorkspaces.searchBackgroundJobs",
14262 http_method: hyper::Method::GET,
14263 });
14264
14265 for &field in [
14266 "alt",
14267 "conversionWorkspace",
14268 "returnMostRecentPerJobType",
14269 "maxSize",
14270 "completedUntilTime",
14271 ]
14272 .iter()
14273 {
14274 if self._additional_params.contains_key(field) {
14275 dlg.finished(false);
14276 return Err(common::Error::FieldClash(field));
14277 }
14278 }
14279
14280 let mut params = Params::with_capacity(6 + self._additional_params.len());
14281 params.push("conversionWorkspace", self._conversion_workspace);
14282 if let Some(value) = self._return_most_recent_per_job_type.as_ref() {
14283 params.push("returnMostRecentPerJobType", value.to_string());
14284 }
14285 if let Some(value) = self._max_size.as_ref() {
14286 params.push("maxSize", value.to_string());
14287 }
14288 if let Some(value) = self._completed_until_time.as_ref() {
14289 params.push(
14290 "completedUntilTime",
14291 common::serde::datetime_to_string(&value),
14292 );
14293 }
14294
14295 params.extend(self._additional_params.iter());
14296
14297 params.push("alt", "json");
14298 let mut url = self.hub._base_url.clone() + "v1/{+conversionWorkspace}:searchBackgroundJobs";
14299 if self._scopes.is_empty() {
14300 self._scopes
14301 .insert(Scope::CloudPlatform.as_ref().to_string());
14302 }
14303
14304 #[allow(clippy::single_element_loop)]
14305 for &(find_this, param_name) in [("{+conversionWorkspace}", "conversionWorkspace")].iter() {
14306 url = params.uri_replacement(url, param_name, find_this, true);
14307 }
14308 {
14309 let to_remove = ["conversionWorkspace"];
14310 params.remove_params(&to_remove);
14311 }
14312
14313 let url = params.parse_with_url(&url);
14314
14315 loop {
14316 let token = match self
14317 .hub
14318 .auth
14319 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14320 .await
14321 {
14322 Ok(token) => token,
14323 Err(e) => match dlg.token(e) {
14324 Ok(token) => token,
14325 Err(e) => {
14326 dlg.finished(false);
14327 return Err(common::Error::MissingToken(e));
14328 }
14329 },
14330 };
14331 let mut req_result = {
14332 let client = &self.hub.client;
14333 dlg.pre_request();
14334 let mut req_builder = hyper::Request::builder()
14335 .method(hyper::Method::GET)
14336 .uri(url.as_str())
14337 .header(USER_AGENT, self.hub._user_agent.clone());
14338
14339 if let Some(token) = token.as_ref() {
14340 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14341 }
14342
14343 let request = req_builder
14344 .header(CONTENT_LENGTH, 0_u64)
14345 .body(common::to_body::<String>(None));
14346
14347 client.request(request.unwrap()).await
14348 };
14349
14350 match req_result {
14351 Err(err) => {
14352 if let common::Retry::After(d) = dlg.http_error(&err) {
14353 sleep(d).await;
14354 continue;
14355 }
14356 dlg.finished(false);
14357 return Err(common::Error::HttpError(err));
14358 }
14359 Ok(res) => {
14360 let (mut parts, body) = res.into_parts();
14361 let mut body = common::Body::new(body);
14362 if !parts.status.is_success() {
14363 let bytes = common::to_bytes(body).await.unwrap_or_default();
14364 let error = serde_json::from_str(&common::to_string(&bytes));
14365 let response = common::to_response(parts, bytes.into());
14366
14367 if let common::Retry::After(d) =
14368 dlg.http_failure(&response, error.as_ref().ok())
14369 {
14370 sleep(d).await;
14371 continue;
14372 }
14373
14374 dlg.finished(false);
14375
14376 return Err(match error {
14377 Ok(value) => common::Error::BadRequest(value),
14378 _ => common::Error::Failure(response),
14379 });
14380 }
14381 let response = {
14382 let bytes = common::to_bytes(body).await.unwrap_or_default();
14383 let encoded = common::to_string(&bytes);
14384 match serde_json::from_str(&encoded) {
14385 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14386 Err(error) => {
14387 dlg.response_json_decode_error(&encoded, &error);
14388 return Err(common::Error::JsonDecodeError(
14389 encoded.to_string(),
14390 error,
14391 ));
14392 }
14393 }
14394 };
14395
14396 dlg.finished(true);
14397 return Ok(response);
14398 }
14399 }
14400 }
14401 }
14402
14403 /// Required. Name of the conversion workspace resource whose jobs are listed, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
14404 ///
14405 /// Sets the *conversion workspace* path property to the given value.
14406 ///
14407 /// Even though the property as already been set when instantiating this call,
14408 /// we provide this method for API completeness.
14409 pub fn conversion_workspace(
14410 mut self,
14411 new_value: &str,
14412 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14413 self._conversion_workspace = new_value.to_string();
14414 self
14415 }
14416 /// Optional. Whether or not to return just the most recent job per job type,
14417 ///
14418 /// Sets the *return most recent per job type* query property to the given value.
14419 pub fn return_most_recent_per_job_type(
14420 mut self,
14421 new_value: bool,
14422 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14423 self._return_most_recent_per_job_type = Some(new_value);
14424 self
14425 }
14426 /// 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.
14427 ///
14428 /// Sets the *max size* query property to the given value.
14429 pub fn max_size(
14430 mut self,
14431 new_value: i32,
14432 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14433 self._max_size = Some(new_value);
14434 self
14435 }
14436 /// Optional. If provided, only returns jobs that completed until (not including) the given timestamp.
14437 ///
14438 /// Sets the *completed until time* query property to the given value.
14439 pub fn completed_until_time(
14440 mut self,
14441 new_value: chrono::DateTime<chrono::offset::Utc>,
14442 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14443 self._completed_until_time = Some(new_value);
14444 self
14445 }
14446 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14447 /// while executing the actual API request.
14448 ///
14449 /// ````text
14450 /// It should be used to handle progress information, and to implement a certain level of resilience.
14451 /// ````
14452 ///
14453 /// Sets the *delegate* property to the given value.
14454 pub fn delegate(
14455 mut self,
14456 new_value: &'a mut dyn common::Delegate,
14457 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14458 self._delegate = Some(new_value);
14459 self
14460 }
14461
14462 /// Set any additional parameter of the query string used in the request.
14463 /// It should be used to set parameters which are not yet available through their own
14464 /// setters.
14465 ///
14466 /// Please note that this method must not be used to set any of the known parameters
14467 /// which have their own setter method. If done anyway, the request will fail.
14468 ///
14469 /// # Additional Parameters
14470 ///
14471 /// * *$.xgafv* (query-string) - V1 error format.
14472 /// * *access_token* (query-string) - OAuth access token.
14473 /// * *alt* (query-string) - Data format for response.
14474 /// * *callback* (query-string) - JSONP
14475 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14476 /// * *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.
14477 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14478 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14479 /// * *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.
14480 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14481 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14482 pub fn param<T>(
14483 mut self,
14484 name: T,
14485 value: T,
14486 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14487 where
14488 T: AsRef<str>,
14489 {
14490 self._additional_params
14491 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14492 self
14493 }
14494
14495 /// Identifies the authorization scope for the method you are building.
14496 ///
14497 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14498 /// [`Scope::CloudPlatform`].
14499 ///
14500 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14501 /// tokens for more than one scope.
14502 ///
14503 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14504 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14505 /// sufficient, a read-write scope will do as well.
14506 pub fn add_scope<St>(
14507 mut self,
14508 scope: St,
14509 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14510 where
14511 St: AsRef<str>,
14512 {
14513 self._scopes.insert(String::from(scope.as_ref()));
14514 self
14515 }
14516 /// Identifies the authorization scope(s) for the method you are building.
14517 ///
14518 /// See [`Self::add_scope()`] for details.
14519 pub fn add_scopes<I, St>(
14520 mut self,
14521 scopes: I,
14522 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C>
14523 where
14524 I: IntoIterator<Item = St>,
14525 St: AsRef<str>,
14526 {
14527 self._scopes
14528 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14529 self
14530 }
14531
14532 /// Removes all scopes, and no default scope will be used either.
14533 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14534 /// for details).
14535 pub fn clear_scopes(
14536 mut self,
14537 ) -> ProjectLocationConversionWorkspaceSearchBackgroundJobCall<'a, C> {
14538 self._scopes.clear();
14539 self
14540 }
14541}
14542
14543/// Imports a snapshot of the source database into the conversion workspace.
14544///
14545/// A builder for the *locations.conversionWorkspaces.seed* method supported by a *project* resource.
14546/// It is not used directly, but through a [`ProjectMethods`] instance.
14547///
14548/// # Example
14549///
14550/// Instantiate a resource method builder
14551///
14552/// ```test_harness,no_run
14553/// # extern crate hyper;
14554/// # extern crate hyper_rustls;
14555/// # extern crate google_datamigration1 as datamigration1;
14556/// use datamigration1::api::SeedConversionWorkspaceRequest;
14557/// # async fn dox() {
14558/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14559///
14560/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14561/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14562/// # .with_native_roots()
14563/// # .unwrap()
14564/// # .https_only()
14565/// # .enable_http2()
14566/// # .build();
14567///
14568/// # let executor = hyper_util::rt::TokioExecutor::new();
14569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14570/// # secret,
14571/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14572/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14573/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14574/// # ),
14575/// # ).build().await.unwrap();
14576///
14577/// # let client = hyper_util::client::legacy::Client::builder(
14578/// # hyper_util::rt::TokioExecutor::new()
14579/// # )
14580/// # .build(
14581/// # hyper_rustls::HttpsConnectorBuilder::new()
14582/// # .with_native_roots()
14583/// # .unwrap()
14584/// # .https_or_http()
14585/// # .enable_http2()
14586/// # .build()
14587/// # );
14588/// # let mut hub = DatabaseMigrationService::new(client, auth);
14589/// // As the method needs a request, you would usually fill it with the desired information
14590/// // into the respective structure. Some of the parts shown here might not be applicable !
14591/// // Values shown here are possibly random and not representative !
14592/// let mut req = SeedConversionWorkspaceRequest::default();
14593///
14594/// // You can configure optional parameters by calling the respective setters at will, and
14595/// // execute the final call using `doit()`.
14596/// // Values shown here are possibly random and not representative !
14597/// let result = hub.projects().locations_conversion_workspaces_seed(req, "name")
14598/// .doit().await;
14599/// # }
14600/// ```
14601pub struct ProjectLocationConversionWorkspaceSeedCall<'a, C>
14602where
14603 C: 'a,
14604{
14605 hub: &'a DatabaseMigrationService<C>,
14606 _request: SeedConversionWorkspaceRequest,
14607 _name: String,
14608 _delegate: Option<&'a mut dyn common::Delegate>,
14609 _additional_params: HashMap<String, String>,
14610 _scopes: BTreeSet<String>,
14611}
14612
14613impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceSeedCall<'a, C> {}
14614
14615impl<'a, C> ProjectLocationConversionWorkspaceSeedCall<'a, C>
14616where
14617 C: common::Connector,
14618{
14619 /// Perform the operation you have build so far.
14620 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14621 use std::borrow::Cow;
14622 use std::io::{Read, Seek};
14623
14624 use common::{url::Params, ToParts};
14625 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14626
14627 let mut dd = common::DefaultDelegate;
14628 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14629 dlg.begin(common::MethodInfo {
14630 id: "datamigration.projects.locations.conversionWorkspaces.seed",
14631 http_method: hyper::Method::POST,
14632 });
14633
14634 for &field in ["alt", "name"].iter() {
14635 if self._additional_params.contains_key(field) {
14636 dlg.finished(false);
14637 return Err(common::Error::FieldClash(field));
14638 }
14639 }
14640
14641 let mut params = Params::with_capacity(4 + self._additional_params.len());
14642 params.push("name", self._name);
14643
14644 params.extend(self._additional_params.iter());
14645
14646 params.push("alt", "json");
14647 let mut url = self.hub._base_url.clone() + "v1/{+name}:seed";
14648 if self._scopes.is_empty() {
14649 self._scopes
14650 .insert(Scope::CloudPlatform.as_ref().to_string());
14651 }
14652
14653 #[allow(clippy::single_element_loop)]
14654 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14655 url = params.uri_replacement(url, param_name, find_this, true);
14656 }
14657 {
14658 let to_remove = ["name"];
14659 params.remove_params(&to_remove);
14660 }
14661
14662 let url = params.parse_with_url(&url);
14663
14664 let mut json_mime_type = mime::APPLICATION_JSON;
14665 let mut request_value_reader = {
14666 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14667 common::remove_json_null_values(&mut value);
14668 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14669 serde_json::to_writer(&mut dst, &value).unwrap();
14670 dst
14671 };
14672 let request_size = request_value_reader
14673 .seek(std::io::SeekFrom::End(0))
14674 .unwrap();
14675 request_value_reader
14676 .seek(std::io::SeekFrom::Start(0))
14677 .unwrap();
14678
14679 loop {
14680 let token = match self
14681 .hub
14682 .auth
14683 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14684 .await
14685 {
14686 Ok(token) => token,
14687 Err(e) => match dlg.token(e) {
14688 Ok(token) => token,
14689 Err(e) => {
14690 dlg.finished(false);
14691 return Err(common::Error::MissingToken(e));
14692 }
14693 },
14694 };
14695 request_value_reader
14696 .seek(std::io::SeekFrom::Start(0))
14697 .unwrap();
14698 let mut req_result = {
14699 let client = &self.hub.client;
14700 dlg.pre_request();
14701 let mut req_builder = hyper::Request::builder()
14702 .method(hyper::Method::POST)
14703 .uri(url.as_str())
14704 .header(USER_AGENT, self.hub._user_agent.clone());
14705
14706 if let Some(token) = token.as_ref() {
14707 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14708 }
14709
14710 let request = req_builder
14711 .header(CONTENT_TYPE, json_mime_type.to_string())
14712 .header(CONTENT_LENGTH, request_size as u64)
14713 .body(common::to_body(
14714 request_value_reader.get_ref().clone().into(),
14715 ));
14716
14717 client.request(request.unwrap()).await
14718 };
14719
14720 match req_result {
14721 Err(err) => {
14722 if let common::Retry::After(d) = dlg.http_error(&err) {
14723 sleep(d).await;
14724 continue;
14725 }
14726 dlg.finished(false);
14727 return Err(common::Error::HttpError(err));
14728 }
14729 Ok(res) => {
14730 let (mut parts, body) = res.into_parts();
14731 let mut body = common::Body::new(body);
14732 if !parts.status.is_success() {
14733 let bytes = common::to_bytes(body).await.unwrap_or_default();
14734 let error = serde_json::from_str(&common::to_string(&bytes));
14735 let response = common::to_response(parts, bytes.into());
14736
14737 if let common::Retry::After(d) =
14738 dlg.http_failure(&response, error.as_ref().ok())
14739 {
14740 sleep(d).await;
14741 continue;
14742 }
14743
14744 dlg.finished(false);
14745
14746 return Err(match error {
14747 Ok(value) => common::Error::BadRequest(value),
14748 _ => common::Error::Failure(response),
14749 });
14750 }
14751 let response = {
14752 let bytes = common::to_bytes(body).await.unwrap_or_default();
14753 let encoded = common::to_string(&bytes);
14754 match serde_json::from_str(&encoded) {
14755 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14756 Err(error) => {
14757 dlg.response_json_decode_error(&encoded, &error);
14758 return Err(common::Error::JsonDecodeError(
14759 encoded.to_string(),
14760 error,
14761 ));
14762 }
14763 }
14764 };
14765
14766 dlg.finished(true);
14767 return Ok(response);
14768 }
14769 }
14770 }
14771 }
14772
14773 ///
14774 /// Sets the *request* property to the given value.
14775 ///
14776 /// Even though the property as already been set when instantiating this call,
14777 /// we provide this method for API completeness.
14778 pub fn request(
14779 mut self,
14780 new_value: SeedConversionWorkspaceRequest,
14781 ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
14782 self._request = new_value;
14783 self
14784 }
14785 /// Name of the conversion workspace resource to seed with new database structure, in the form of: projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
14786 ///
14787 /// Sets the *name* path property to the given value.
14788 ///
14789 /// Even though the property as already been set when instantiating this call,
14790 /// we provide this method for API completeness.
14791 pub fn name(mut self, new_value: &str) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
14792 self._name = new_value.to_string();
14793 self
14794 }
14795 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14796 /// while executing the actual API request.
14797 ///
14798 /// ````text
14799 /// It should be used to handle progress information, and to implement a certain level of resilience.
14800 /// ````
14801 ///
14802 /// Sets the *delegate* property to the given value.
14803 pub fn delegate(
14804 mut self,
14805 new_value: &'a mut dyn common::Delegate,
14806 ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
14807 self._delegate = Some(new_value);
14808 self
14809 }
14810
14811 /// Set any additional parameter of the query string used in the request.
14812 /// It should be used to set parameters which are not yet available through their own
14813 /// setters.
14814 ///
14815 /// Please note that this method must not be used to set any of the known parameters
14816 /// which have their own setter method. If done anyway, the request will fail.
14817 ///
14818 /// # Additional Parameters
14819 ///
14820 /// * *$.xgafv* (query-string) - V1 error format.
14821 /// * *access_token* (query-string) - OAuth access token.
14822 /// * *alt* (query-string) - Data format for response.
14823 /// * *callback* (query-string) - JSONP
14824 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14825 /// * *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.
14826 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14827 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14828 /// * *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.
14829 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14830 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14831 pub fn param<T>(
14832 mut self,
14833 name: T,
14834 value: T,
14835 ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
14836 where
14837 T: AsRef<str>,
14838 {
14839 self._additional_params
14840 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14841 self
14842 }
14843
14844 /// Identifies the authorization scope for the method you are building.
14845 ///
14846 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14847 /// [`Scope::CloudPlatform`].
14848 ///
14849 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14850 /// tokens for more than one scope.
14851 ///
14852 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14853 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14854 /// sufficient, a read-write scope will do as well.
14855 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
14856 where
14857 St: AsRef<str>,
14858 {
14859 self._scopes.insert(String::from(scope.as_ref()));
14860 self
14861 }
14862 /// Identifies the authorization scope(s) for the method you are building.
14863 ///
14864 /// See [`Self::add_scope()`] for details.
14865 pub fn add_scopes<I, St>(
14866 mut self,
14867 scopes: I,
14868 ) -> ProjectLocationConversionWorkspaceSeedCall<'a, C>
14869 where
14870 I: IntoIterator<Item = St>,
14871 St: AsRef<str>,
14872 {
14873 self._scopes
14874 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14875 self
14876 }
14877
14878 /// Removes all scopes, and no default scope will be used either.
14879 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14880 /// for details).
14881 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceSeedCall<'a, C> {
14882 self._scopes.clear();
14883 self
14884 }
14885}
14886
14887/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
14888///
14889/// A builder for the *locations.conversionWorkspaces.setIamPolicy* method supported by a *project* resource.
14890/// It is not used directly, but through a [`ProjectMethods`] instance.
14891///
14892/// # Example
14893///
14894/// Instantiate a resource method builder
14895///
14896/// ```test_harness,no_run
14897/// # extern crate hyper;
14898/// # extern crate hyper_rustls;
14899/// # extern crate google_datamigration1 as datamigration1;
14900/// use datamigration1::api::SetIamPolicyRequest;
14901/// # async fn dox() {
14902/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14903///
14904/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14905/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14906/// # .with_native_roots()
14907/// # .unwrap()
14908/// # .https_only()
14909/// # .enable_http2()
14910/// # .build();
14911///
14912/// # let executor = hyper_util::rt::TokioExecutor::new();
14913/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14914/// # secret,
14915/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14916/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14917/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14918/// # ),
14919/// # ).build().await.unwrap();
14920///
14921/// # let client = hyper_util::client::legacy::Client::builder(
14922/// # hyper_util::rt::TokioExecutor::new()
14923/// # )
14924/// # .build(
14925/// # hyper_rustls::HttpsConnectorBuilder::new()
14926/// # .with_native_roots()
14927/// # .unwrap()
14928/// # .https_or_http()
14929/// # .enable_http2()
14930/// # .build()
14931/// # );
14932/// # let mut hub = DatabaseMigrationService::new(client, auth);
14933/// // As the method needs a request, you would usually fill it with the desired information
14934/// // into the respective structure. Some of the parts shown here might not be applicable !
14935/// // Values shown here are possibly random and not representative !
14936/// let mut req = SetIamPolicyRequest::default();
14937///
14938/// // You can configure optional parameters by calling the respective setters at will, and
14939/// // execute the final call using `doit()`.
14940/// // Values shown here are possibly random and not representative !
14941/// let result = hub.projects().locations_conversion_workspaces_set_iam_policy(req, "resource")
14942/// .doit().await;
14943/// # }
14944/// ```
14945pub struct ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
14946where
14947 C: 'a,
14948{
14949 hub: &'a DatabaseMigrationService<C>,
14950 _request: SetIamPolicyRequest,
14951 _resource: String,
14952 _delegate: Option<&'a mut dyn common::Delegate>,
14953 _additional_params: HashMap<String, String>,
14954 _scopes: BTreeSet<String>,
14955}
14956
14957impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {}
14958
14959impl<'a, C> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
14960where
14961 C: common::Connector,
14962{
14963 /// Perform the operation you have build so far.
14964 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14965 use std::borrow::Cow;
14966 use std::io::{Read, Seek};
14967
14968 use common::{url::Params, ToParts};
14969 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14970
14971 let mut dd = common::DefaultDelegate;
14972 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14973 dlg.begin(common::MethodInfo {
14974 id: "datamigration.projects.locations.conversionWorkspaces.setIamPolicy",
14975 http_method: hyper::Method::POST,
14976 });
14977
14978 for &field in ["alt", "resource"].iter() {
14979 if self._additional_params.contains_key(field) {
14980 dlg.finished(false);
14981 return Err(common::Error::FieldClash(field));
14982 }
14983 }
14984
14985 let mut params = Params::with_capacity(4 + self._additional_params.len());
14986 params.push("resource", self._resource);
14987
14988 params.extend(self._additional_params.iter());
14989
14990 params.push("alt", "json");
14991 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
14992 if self._scopes.is_empty() {
14993 self._scopes
14994 .insert(Scope::CloudPlatform.as_ref().to_string());
14995 }
14996
14997 #[allow(clippy::single_element_loop)]
14998 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14999 url = params.uri_replacement(url, param_name, find_this, true);
15000 }
15001 {
15002 let to_remove = ["resource"];
15003 params.remove_params(&to_remove);
15004 }
15005
15006 let url = params.parse_with_url(&url);
15007
15008 let mut json_mime_type = mime::APPLICATION_JSON;
15009 let mut request_value_reader = {
15010 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15011 common::remove_json_null_values(&mut value);
15012 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15013 serde_json::to_writer(&mut dst, &value).unwrap();
15014 dst
15015 };
15016 let request_size = request_value_reader
15017 .seek(std::io::SeekFrom::End(0))
15018 .unwrap();
15019 request_value_reader
15020 .seek(std::io::SeekFrom::Start(0))
15021 .unwrap();
15022
15023 loop {
15024 let token = match self
15025 .hub
15026 .auth
15027 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15028 .await
15029 {
15030 Ok(token) => token,
15031 Err(e) => match dlg.token(e) {
15032 Ok(token) => token,
15033 Err(e) => {
15034 dlg.finished(false);
15035 return Err(common::Error::MissingToken(e));
15036 }
15037 },
15038 };
15039 request_value_reader
15040 .seek(std::io::SeekFrom::Start(0))
15041 .unwrap();
15042 let mut req_result = {
15043 let client = &self.hub.client;
15044 dlg.pre_request();
15045 let mut req_builder = hyper::Request::builder()
15046 .method(hyper::Method::POST)
15047 .uri(url.as_str())
15048 .header(USER_AGENT, self.hub._user_agent.clone());
15049
15050 if let Some(token) = token.as_ref() {
15051 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15052 }
15053
15054 let request = req_builder
15055 .header(CONTENT_TYPE, json_mime_type.to_string())
15056 .header(CONTENT_LENGTH, request_size as u64)
15057 .body(common::to_body(
15058 request_value_reader.get_ref().clone().into(),
15059 ));
15060
15061 client.request(request.unwrap()).await
15062 };
15063
15064 match req_result {
15065 Err(err) => {
15066 if let common::Retry::After(d) = dlg.http_error(&err) {
15067 sleep(d).await;
15068 continue;
15069 }
15070 dlg.finished(false);
15071 return Err(common::Error::HttpError(err));
15072 }
15073 Ok(res) => {
15074 let (mut parts, body) = res.into_parts();
15075 let mut body = common::Body::new(body);
15076 if !parts.status.is_success() {
15077 let bytes = common::to_bytes(body).await.unwrap_or_default();
15078 let error = serde_json::from_str(&common::to_string(&bytes));
15079 let response = common::to_response(parts, bytes.into());
15080
15081 if let common::Retry::After(d) =
15082 dlg.http_failure(&response, error.as_ref().ok())
15083 {
15084 sleep(d).await;
15085 continue;
15086 }
15087
15088 dlg.finished(false);
15089
15090 return Err(match error {
15091 Ok(value) => common::Error::BadRequest(value),
15092 _ => common::Error::Failure(response),
15093 });
15094 }
15095 let response = {
15096 let bytes = common::to_bytes(body).await.unwrap_or_default();
15097 let encoded = common::to_string(&bytes);
15098 match serde_json::from_str(&encoded) {
15099 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15100 Err(error) => {
15101 dlg.response_json_decode_error(&encoded, &error);
15102 return Err(common::Error::JsonDecodeError(
15103 encoded.to_string(),
15104 error,
15105 ));
15106 }
15107 }
15108 };
15109
15110 dlg.finished(true);
15111 return Ok(response);
15112 }
15113 }
15114 }
15115 }
15116
15117 ///
15118 /// Sets the *request* property to the given value.
15119 ///
15120 /// Even though the property as already been set when instantiating this call,
15121 /// we provide this method for API completeness.
15122 pub fn request(
15123 mut self,
15124 new_value: SetIamPolicyRequest,
15125 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
15126 self._request = new_value;
15127 self
15128 }
15129 /// 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.
15130 ///
15131 /// Sets the *resource* path property to the given value.
15132 ///
15133 /// Even though the property as already been set when instantiating this call,
15134 /// we provide this method for API completeness.
15135 pub fn resource(
15136 mut self,
15137 new_value: &str,
15138 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
15139 self._resource = new_value.to_string();
15140 self
15141 }
15142 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15143 /// while executing the actual API request.
15144 ///
15145 /// ````text
15146 /// It should be used to handle progress information, and to implement a certain level of resilience.
15147 /// ````
15148 ///
15149 /// Sets the *delegate* property to the given value.
15150 pub fn delegate(
15151 mut self,
15152 new_value: &'a mut dyn common::Delegate,
15153 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
15154 self._delegate = Some(new_value);
15155 self
15156 }
15157
15158 /// Set any additional parameter of the query string used in the request.
15159 /// It should be used to set parameters which are not yet available through their own
15160 /// setters.
15161 ///
15162 /// Please note that this method must not be used to set any of the known parameters
15163 /// which have their own setter method. If done anyway, the request will fail.
15164 ///
15165 /// # Additional Parameters
15166 ///
15167 /// * *$.xgafv* (query-string) - V1 error format.
15168 /// * *access_token* (query-string) - OAuth access token.
15169 /// * *alt* (query-string) - Data format for response.
15170 /// * *callback* (query-string) - JSONP
15171 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15172 /// * *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.
15173 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15174 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15175 /// * *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.
15176 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15177 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15178 pub fn param<T>(
15179 mut self,
15180 name: T,
15181 value: T,
15182 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
15183 where
15184 T: AsRef<str>,
15185 {
15186 self._additional_params
15187 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15188 self
15189 }
15190
15191 /// Identifies the authorization scope for the method you are building.
15192 ///
15193 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15194 /// [`Scope::CloudPlatform`].
15195 ///
15196 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15197 /// tokens for more than one scope.
15198 ///
15199 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15200 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15201 /// sufficient, a read-write scope will do as well.
15202 pub fn add_scope<St>(
15203 mut self,
15204 scope: St,
15205 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
15206 where
15207 St: AsRef<str>,
15208 {
15209 self._scopes.insert(String::from(scope.as_ref()));
15210 self
15211 }
15212 /// Identifies the authorization scope(s) for the method you are building.
15213 ///
15214 /// See [`Self::add_scope()`] for details.
15215 pub fn add_scopes<I, St>(
15216 mut self,
15217 scopes: I,
15218 ) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C>
15219 where
15220 I: IntoIterator<Item = St>,
15221 St: AsRef<str>,
15222 {
15223 self._scopes
15224 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15225 self
15226 }
15227
15228 /// Removes all scopes, and no default scope will be used either.
15229 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15230 /// for details).
15231 pub fn clear_scopes(mut self) -> ProjectLocationConversionWorkspaceSetIamPolicyCall<'a, C> {
15232 self._scopes.clear();
15233 self
15234 }
15235}
15236
15237/// 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.
15238///
15239/// A builder for the *locations.conversionWorkspaces.testIamPermissions* method supported by a *project* resource.
15240/// It is not used directly, but through a [`ProjectMethods`] instance.
15241///
15242/// # Example
15243///
15244/// Instantiate a resource method builder
15245///
15246/// ```test_harness,no_run
15247/// # extern crate hyper;
15248/// # extern crate hyper_rustls;
15249/// # extern crate google_datamigration1 as datamigration1;
15250/// use datamigration1::api::TestIamPermissionsRequest;
15251/// # async fn dox() {
15252/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15253///
15254/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15255/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15256/// # .with_native_roots()
15257/// # .unwrap()
15258/// # .https_only()
15259/// # .enable_http2()
15260/// # .build();
15261///
15262/// # let executor = hyper_util::rt::TokioExecutor::new();
15263/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15264/// # secret,
15265/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15266/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15267/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15268/// # ),
15269/// # ).build().await.unwrap();
15270///
15271/// # let client = hyper_util::client::legacy::Client::builder(
15272/// # hyper_util::rt::TokioExecutor::new()
15273/// # )
15274/// # .build(
15275/// # hyper_rustls::HttpsConnectorBuilder::new()
15276/// # .with_native_roots()
15277/// # .unwrap()
15278/// # .https_or_http()
15279/// # .enable_http2()
15280/// # .build()
15281/// # );
15282/// # let mut hub = DatabaseMigrationService::new(client, auth);
15283/// // As the method needs a request, you would usually fill it with the desired information
15284/// // into the respective structure. Some of the parts shown here might not be applicable !
15285/// // Values shown here are possibly random and not representative !
15286/// let mut req = TestIamPermissionsRequest::default();
15287///
15288/// // You can configure optional parameters by calling the respective setters at will, and
15289/// // execute the final call using `doit()`.
15290/// // Values shown here are possibly random and not representative !
15291/// let result = hub.projects().locations_conversion_workspaces_test_iam_permissions(req, "resource")
15292/// .doit().await;
15293/// # }
15294/// ```
15295pub struct ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
15296where
15297 C: 'a,
15298{
15299 hub: &'a DatabaseMigrationService<C>,
15300 _request: TestIamPermissionsRequest,
15301 _resource: String,
15302 _delegate: Option<&'a mut dyn common::Delegate>,
15303 _additional_params: HashMap<String, String>,
15304 _scopes: BTreeSet<String>,
15305}
15306
15307impl<'a, C> common::CallBuilder for ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {}
15308
15309impl<'a, C> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
15310where
15311 C: common::Connector,
15312{
15313 /// Perform the operation you have build so far.
15314 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
15315 use std::borrow::Cow;
15316 use std::io::{Read, Seek};
15317
15318 use common::{url::Params, ToParts};
15319 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15320
15321 let mut dd = common::DefaultDelegate;
15322 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15323 dlg.begin(common::MethodInfo {
15324 id: "datamigration.projects.locations.conversionWorkspaces.testIamPermissions",
15325 http_method: hyper::Method::POST,
15326 });
15327
15328 for &field in ["alt", "resource"].iter() {
15329 if self._additional_params.contains_key(field) {
15330 dlg.finished(false);
15331 return Err(common::Error::FieldClash(field));
15332 }
15333 }
15334
15335 let mut params = Params::with_capacity(4 + self._additional_params.len());
15336 params.push("resource", self._resource);
15337
15338 params.extend(self._additional_params.iter());
15339
15340 params.push("alt", "json");
15341 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
15342 if self._scopes.is_empty() {
15343 self._scopes
15344 .insert(Scope::CloudPlatform.as_ref().to_string());
15345 }
15346
15347 #[allow(clippy::single_element_loop)]
15348 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15349 url = params.uri_replacement(url, param_name, find_this, true);
15350 }
15351 {
15352 let to_remove = ["resource"];
15353 params.remove_params(&to_remove);
15354 }
15355
15356 let url = params.parse_with_url(&url);
15357
15358 let mut json_mime_type = mime::APPLICATION_JSON;
15359 let mut request_value_reader = {
15360 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15361 common::remove_json_null_values(&mut value);
15362 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15363 serde_json::to_writer(&mut dst, &value).unwrap();
15364 dst
15365 };
15366 let request_size = request_value_reader
15367 .seek(std::io::SeekFrom::End(0))
15368 .unwrap();
15369 request_value_reader
15370 .seek(std::io::SeekFrom::Start(0))
15371 .unwrap();
15372
15373 loop {
15374 let token = match self
15375 .hub
15376 .auth
15377 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15378 .await
15379 {
15380 Ok(token) => token,
15381 Err(e) => match dlg.token(e) {
15382 Ok(token) => token,
15383 Err(e) => {
15384 dlg.finished(false);
15385 return Err(common::Error::MissingToken(e));
15386 }
15387 },
15388 };
15389 request_value_reader
15390 .seek(std::io::SeekFrom::Start(0))
15391 .unwrap();
15392 let mut req_result = {
15393 let client = &self.hub.client;
15394 dlg.pre_request();
15395 let mut req_builder = hyper::Request::builder()
15396 .method(hyper::Method::POST)
15397 .uri(url.as_str())
15398 .header(USER_AGENT, self.hub._user_agent.clone());
15399
15400 if let Some(token) = token.as_ref() {
15401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15402 }
15403
15404 let request = req_builder
15405 .header(CONTENT_TYPE, json_mime_type.to_string())
15406 .header(CONTENT_LENGTH, request_size as u64)
15407 .body(common::to_body(
15408 request_value_reader.get_ref().clone().into(),
15409 ));
15410
15411 client.request(request.unwrap()).await
15412 };
15413
15414 match req_result {
15415 Err(err) => {
15416 if let common::Retry::After(d) = dlg.http_error(&err) {
15417 sleep(d).await;
15418 continue;
15419 }
15420 dlg.finished(false);
15421 return Err(common::Error::HttpError(err));
15422 }
15423 Ok(res) => {
15424 let (mut parts, body) = res.into_parts();
15425 let mut body = common::Body::new(body);
15426 if !parts.status.is_success() {
15427 let bytes = common::to_bytes(body).await.unwrap_or_default();
15428 let error = serde_json::from_str(&common::to_string(&bytes));
15429 let response = common::to_response(parts, bytes.into());
15430
15431 if let common::Retry::After(d) =
15432 dlg.http_failure(&response, error.as_ref().ok())
15433 {
15434 sleep(d).await;
15435 continue;
15436 }
15437
15438 dlg.finished(false);
15439
15440 return Err(match error {
15441 Ok(value) => common::Error::BadRequest(value),
15442 _ => common::Error::Failure(response),
15443 });
15444 }
15445 let response = {
15446 let bytes = common::to_bytes(body).await.unwrap_or_default();
15447 let encoded = common::to_string(&bytes);
15448 match serde_json::from_str(&encoded) {
15449 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15450 Err(error) => {
15451 dlg.response_json_decode_error(&encoded, &error);
15452 return Err(common::Error::JsonDecodeError(
15453 encoded.to_string(),
15454 error,
15455 ));
15456 }
15457 }
15458 };
15459
15460 dlg.finished(true);
15461 return Ok(response);
15462 }
15463 }
15464 }
15465 }
15466
15467 ///
15468 /// Sets the *request* property to the given value.
15469 ///
15470 /// Even though the property as already been set when instantiating this call,
15471 /// we provide this method for API completeness.
15472 pub fn request(
15473 mut self,
15474 new_value: TestIamPermissionsRequest,
15475 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
15476 self._request = new_value;
15477 self
15478 }
15479 /// 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.
15480 ///
15481 /// Sets the *resource* path property to the given value.
15482 ///
15483 /// Even though the property as already been set when instantiating this call,
15484 /// we provide this method for API completeness.
15485 pub fn resource(
15486 mut self,
15487 new_value: &str,
15488 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
15489 self._resource = new_value.to_string();
15490 self
15491 }
15492 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15493 /// while executing the actual API request.
15494 ///
15495 /// ````text
15496 /// It should be used to handle progress information, and to implement a certain level of resilience.
15497 /// ````
15498 ///
15499 /// Sets the *delegate* property to the given value.
15500 pub fn delegate(
15501 mut self,
15502 new_value: &'a mut dyn common::Delegate,
15503 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
15504 self._delegate = Some(new_value);
15505 self
15506 }
15507
15508 /// Set any additional parameter of the query string used in the request.
15509 /// It should be used to set parameters which are not yet available through their own
15510 /// setters.
15511 ///
15512 /// Please note that this method must not be used to set any of the known parameters
15513 /// which have their own setter method. If done anyway, the request will fail.
15514 ///
15515 /// # Additional Parameters
15516 ///
15517 /// * *$.xgafv* (query-string) - V1 error format.
15518 /// * *access_token* (query-string) - OAuth access token.
15519 /// * *alt* (query-string) - Data format for response.
15520 /// * *callback* (query-string) - JSONP
15521 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15522 /// * *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.
15523 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15524 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15525 /// * *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.
15526 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15527 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15528 pub fn param<T>(
15529 mut self,
15530 name: T,
15531 value: T,
15532 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
15533 where
15534 T: AsRef<str>,
15535 {
15536 self._additional_params
15537 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15538 self
15539 }
15540
15541 /// Identifies the authorization scope for the method you are building.
15542 ///
15543 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15544 /// [`Scope::CloudPlatform`].
15545 ///
15546 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15547 /// tokens for more than one scope.
15548 ///
15549 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15550 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15551 /// sufficient, a read-write scope will do as well.
15552 pub fn add_scope<St>(
15553 mut self,
15554 scope: St,
15555 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
15556 where
15557 St: AsRef<str>,
15558 {
15559 self._scopes.insert(String::from(scope.as_ref()));
15560 self
15561 }
15562 /// Identifies the authorization scope(s) for the method you are building.
15563 ///
15564 /// See [`Self::add_scope()`] for details.
15565 pub fn add_scopes<I, St>(
15566 mut self,
15567 scopes: I,
15568 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C>
15569 where
15570 I: IntoIterator<Item = St>,
15571 St: AsRef<str>,
15572 {
15573 self._scopes
15574 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15575 self
15576 }
15577
15578 /// Removes all scopes, and no default scope will be used either.
15579 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15580 /// for details).
15581 pub fn clear_scopes(
15582 mut self,
15583 ) -> ProjectLocationConversionWorkspaceTestIamPermissionCall<'a, C> {
15584 self._scopes.clear();
15585 self
15586 }
15587}
15588
15589/// Use this method to get details about a migration job object.
15590///
15591/// A builder for the *locations.migrationJobs.objects.get* method supported by a *project* resource.
15592/// It is not used directly, but through a [`ProjectMethods`] instance.
15593///
15594/// # Example
15595///
15596/// Instantiate a resource method builder
15597///
15598/// ```test_harness,no_run
15599/// # extern crate hyper;
15600/// # extern crate hyper_rustls;
15601/// # extern crate google_datamigration1 as datamigration1;
15602/// # async fn dox() {
15603/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15604///
15605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15606/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15607/// # .with_native_roots()
15608/// # .unwrap()
15609/// # .https_only()
15610/// # .enable_http2()
15611/// # .build();
15612///
15613/// # let executor = hyper_util::rt::TokioExecutor::new();
15614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15615/// # secret,
15616/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15617/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15618/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15619/// # ),
15620/// # ).build().await.unwrap();
15621///
15622/// # let client = hyper_util::client::legacy::Client::builder(
15623/// # hyper_util::rt::TokioExecutor::new()
15624/// # )
15625/// # .build(
15626/// # hyper_rustls::HttpsConnectorBuilder::new()
15627/// # .with_native_roots()
15628/// # .unwrap()
15629/// # .https_or_http()
15630/// # .enable_http2()
15631/// # .build()
15632/// # );
15633/// # let mut hub = DatabaseMigrationService::new(client, auth);
15634/// // You can configure optional parameters by calling the respective setters at will, and
15635/// // execute the final call using `doit()`.
15636/// // Values shown here are possibly random and not representative !
15637/// let result = hub.projects().locations_migration_jobs_objects_get("name")
15638/// .doit().await;
15639/// # }
15640/// ```
15641pub struct ProjectLocationMigrationJobObjectGetCall<'a, C>
15642where
15643 C: 'a,
15644{
15645 hub: &'a DatabaseMigrationService<C>,
15646 _name: String,
15647 _delegate: Option<&'a mut dyn common::Delegate>,
15648 _additional_params: HashMap<String, String>,
15649 _scopes: BTreeSet<String>,
15650}
15651
15652impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectGetCall<'a, C> {}
15653
15654impl<'a, C> ProjectLocationMigrationJobObjectGetCall<'a, C>
15655where
15656 C: common::Connector,
15657{
15658 /// Perform the operation you have build so far.
15659 pub async fn doit(mut self) -> common::Result<(common::Response, MigrationJobObject)> {
15660 use std::borrow::Cow;
15661 use std::io::{Read, Seek};
15662
15663 use common::{url::Params, ToParts};
15664 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15665
15666 let mut dd = common::DefaultDelegate;
15667 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15668 dlg.begin(common::MethodInfo {
15669 id: "datamigration.projects.locations.migrationJobs.objects.get",
15670 http_method: hyper::Method::GET,
15671 });
15672
15673 for &field in ["alt", "name"].iter() {
15674 if self._additional_params.contains_key(field) {
15675 dlg.finished(false);
15676 return Err(common::Error::FieldClash(field));
15677 }
15678 }
15679
15680 let mut params = Params::with_capacity(3 + self._additional_params.len());
15681 params.push("name", self._name);
15682
15683 params.extend(self._additional_params.iter());
15684
15685 params.push("alt", "json");
15686 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15687 if self._scopes.is_empty() {
15688 self._scopes
15689 .insert(Scope::CloudPlatform.as_ref().to_string());
15690 }
15691
15692 #[allow(clippy::single_element_loop)]
15693 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15694 url = params.uri_replacement(url, param_name, find_this, true);
15695 }
15696 {
15697 let to_remove = ["name"];
15698 params.remove_params(&to_remove);
15699 }
15700
15701 let url = params.parse_with_url(&url);
15702
15703 loop {
15704 let token = match self
15705 .hub
15706 .auth
15707 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15708 .await
15709 {
15710 Ok(token) => token,
15711 Err(e) => match dlg.token(e) {
15712 Ok(token) => token,
15713 Err(e) => {
15714 dlg.finished(false);
15715 return Err(common::Error::MissingToken(e));
15716 }
15717 },
15718 };
15719 let mut req_result = {
15720 let client = &self.hub.client;
15721 dlg.pre_request();
15722 let mut req_builder = hyper::Request::builder()
15723 .method(hyper::Method::GET)
15724 .uri(url.as_str())
15725 .header(USER_AGENT, self.hub._user_agent.clone());
15726
15727 if let Some(token) = token.as_ref() {
15728 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15729 }
15730
15731 let request = req_builder
15732 .header(CONTENT_LENGTH, 0_u64)
15733 .body(common::to_body::<String>(None));
15734
15735 client.request(request.unwrap()).await
15736 };
15737
15738 match req_result {
15739 Err(err) => {
15740 if let common::Retry::After(d) = dlg.http_error(&err) {
15741 sleep(d).await;
15742 continue;
15743 }
15744 dlg.finished(false);
15745 return Err(common::Error::HttpError(err));
15746 }
15747 Ok(res) => {
15748 let (mut parts, body) = res.into_parts();
15749 let mut body = common::Body::new(body);
15750 if !parts.status.is_success() {
15751 let bytes = common::to_bytes(body).await.unwrap_or_default();
15752 let error = serde_json::from_str(&common::to_string(&bytes));
15753 let response = common::to_response(parts, bytes.into());
15754
15755 if let common::Retry::After(d) =
15756 dlg.http_failure(&response, error.as_ref().ok())
15757 {
15758 sleep(d).await;
15759 continue;
15760 }
15761
15762 dlg.finished(false);
15763
15764 return Err(match error {
15765 Ok(value) => common::Error::BadRequest(value),
15766 _ => common::Error::Failure(response),
15767 });
15768 }
15769 let response = {
15770 let bytes = common::to_bytes(body).await.unwrap_or_default();
15771 let encoded = common::to_string(&bytes);
15772 match serde_json::from_str(&encoded) {
15773 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15774 Err(error) => {
15775 dlg.response_json_decode_error(&encoded, &error);
15776 return Err(common::Error::JsonDecodeError(
15777 encoded.to_string(),
15778 error,
15779 ));
15780 }
15781 }
15782 };
15783
15784 dlg.finished(true);
15785 return Ok(response);
15786 }
15787 }
15788 }
15789 }
15790
15791 /// Required. The name of the migration job object resource to get.
15792 ///
15793 /// Sets the *name* path property to the given value.
15794 ///
15795 /// Even though the property as already been set when instantiating this call,
15796 /// we provide this method for API completeness.
15797 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobObjectGetCall<'a, C> {
15798 self._name = 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 ) -> ProjectLocationMigrationJobObjectGetCall<'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>(mut self, name: T, value: T) -> ProjectLocationMigrationJobObjectGetCall<'a, C>
15838 where
15839 T: AsRef<str>,
15840 {
15841 self._additional_params
15842 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15843 self
15844 }
15845
15846 /// Identifies the authorization scope for the method you are building.
15847 ///
15848 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15849 /// [`Scope::CloudPlatform`].
15850 ///
15851 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15852 /// tokens for more than one scope.
15853 ///
15854 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15855 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15856 /// sufficient, a read-write scope will do as well.
15857 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobObjectGetCall<'a, C>
15858 where
15859 St: AsRef<str>,
15860 {
15861 self._scopes.insert(String::from(scope.as_ref()));
15862 self
15863 }
15864 /// Identifies the authorization scope(s) for the method you are building.
15865 ///
15866 /// See [`Self::add_scope()`] for details.
15867 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobObjectGetCall<'a, C>
15868 where
15869 I: IntoIterator<Item = St>,
15870 St: AsRef<str>,
15871 {
15872 self._scopes
15873 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15874 self
15875 }
15876
15877 /// Removes all scopes, and no default scope will be used either.
15878 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15879 /// for details).
15880 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectGetCall<'a, C> {
15881 self._scopes.clear();
15882 self
15883 }
15884}
15885
15886/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
15887///
15888/// A builder for the *locations.migrationJobs.objects.getIamPolicy* method supported by a *project* resource.
15889/// It is not used directly, but through a [`ProjectMethods`] instance.
15890///
15891/// # Example
15892///
15893/// Instantiate a resource method builder
15894///
15895/// ```test_harness,no_run
15896/// # extern crate hyper;
15897/// # extern crate hyper_rustls;
15898/// # extern crate google_datamigration1 as datamigration1;
15899/// # async fn dox() {
15900/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15901///
15902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15904/// # .with_native_roots()
15905/// # .unwrap()
15906/// # .https_only()
15907/// # .enable_http2()
15908/// # .build();
15909///
15910/// # let executor = hyper_util::rt::TokioExecutor::new();
15911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15912/// # secret,
15913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15916/// # ),
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_http2()
15928/// # .build()
15929/// # );
15930/// # let mut hub = DatabaseMigrationService::new(client, auth);
15931/// // You can configure optional parameters by calling the respective setters at will, and
15932/// // execute the final call using `doit()`.
15933/// // Values shown here are possibly random and not representative !
15934/// let result = hub.projects().locations_migration_jobs_objects_get_iam_policy("resource")
15935/// .options_requested_policy_version(-7)
15936/// .doit().await;
15937/// # }
15938/// ```
15939pub struct ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C>
15940where
15941 C: 'a,
15942{
15943 hub: &'a DatabaseMigrationService<C>,
15944 _resource: String,
15945 _options_requested_policy_version: Option<i32>,
15946 _delegate: Option<&'a mut dyn common::Delegate>,
15947 _additional_params: HashMap<String, String>,
15948 _scopes: BTreeSet<String>,
15949}
15950
15951impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {}
15952
15953impl<'a, C> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C>
15954where
15955 C: common::Connector,
15956{
15957 /// Perform the operation you have build so far.
15958 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15959 use std::borrow::Cow;
15960 use std::io::{Read, Seek};
15961
15962 use common::{url::Params, ToParts};
15963 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15964
15965 let mut dd = common::DefaultDelegate;
15966 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15967 dlg.begin(common::MethodInfo {
15968 id: "datamigration.projects.locations.migrationJobs.objects.getIamPolicy",
15969 http_method: hyper::Method::GET,
15970 });
15971
15972 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
15973 if self._additional_params.contains_key(field) {
15974 dlg.finished(false);
15975 return Err(common::Error::FieldClash(field));
15976 }
15977 }
15978
15979 let mut params = Params::with_capacity(4 + self._additional_params.len());
15980 params.push("resource", self._resource);
15981 if let Some(value) = self._options_requested_policy_version.as_ref() {
15982 params.push("options.requestedPolicyVersion", value.to_string());
15983 }
15984
15985 params.extend(self._additional_params.iter());
15986
15987 params.push("alt", "json");
15988 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
15989 if self._scopes.is_empty() {
15990 self._scopes
15991 .insert(Scope::CloudPlatform.as_ref().to_string());
15992 }
15993
15994 #[allow(clippy::single_element_loop)]
15995 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15996 url = params.uri_replacement(url, param_name, find_this, true);
15997 }
15998 {
15999 let to_remove = ["resource"];
16000 params.remove_params(&to_remove);
16001 }
16002
16003 let url = params.parse_with_url(&url);
16004
16005 loop {
16006 let token = match self
16007 .hub
16008 .auth
16009 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16010 .await
16011 {
16012 Ok(token) => token,
16013 Err(e) => match dlg.token(e) {
16014 Ok(token) => token,
16015 Err(e) => {
16016 dlg.finished(false);
16017 return Err(common::Error::MissingToken(e));
16018 }
16019 },
16020 };
16021 let mut req_result = {
16022 let client = &self.hub.client;
16023 dlg.pre_request();
16024 let mut req_builder = hyper::Request::builder()
16025 .method(hyper::Method::GET)
16026 .uri(url.as_str())
16027 .header(USER_AGENT, self.hub._user_agent.clone());
16028
16029 if let Some(token) = token.as_ref() {
16030 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16031 }
16032
16033 let request = req_builder
16034 .header(CONTENT_LENGTH, 0_u64)
16035 .body(common::to_body::<String>(None));
16036
16037 client.request(request.unwrap()).await
16038 };
16039
16040 match req_result {
16041 Err(err) => {
16042 if let common::Retry::After(d) = dlg.http_error(&err) {
16043 sleep(d).await;
16044 continue;
16045 }
16046 dlg.finished(false);
16047 return Err(common::Error::HttpError(err));
16048 }
16049 Ok(res) => {
16050 let (mut parts, body) = res.into_parts();
16051 let mut body = common::Body::new(body);
16052 if !parts.status.is_success() {
16053 let bytes = common::to_bytes(body).await.unwrap_or_default();
16054 let error = serde_json::from_str(&common::to_string(&bytes));
16055 let response = common::to_response(parts, bytes.into());
16056
16057 if let common::Retry::After(d) =
16058 dlg.http_failure(&response, error.as_ref().ok())
16059 {
16060 sleep(d).await;
16061 continue;
16062 }
16063
16064 dlg.finished(false);
16065
16066 return Err(match error {
16067 Ok(value) => common::Error::BadRequest(value),
16068 _ => common::Error::Failure(response),
16069 });
16070 }
16071 let response = {
16072 let bytes = common::to_bytes(body).await.unwrap_or_default();
16073 let encoded = common::to_string(&bytes);
16074 match serde_json::from_str(&encoded) {
16075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16076 Err(error) => {
16077 dlg.response_json_decode_error(&encoded, &error);
16078 return Err(common::Error::JsonDecodeError(
16079 encoded.to_string(),
16080 error,
16081 ));
16082 }
16083 }
16084 };
16085
16086 dlg.finished(true);
16087 return Ok(response);
16088 }
16089 }
16090 }
16091 }
16092
16093 /// 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.
16094 ///
16095 /// Sets the *resource* path property to the given value.
16096 ///
16097 /// Even though the property as already been set when instantiating this call,
16098 /// we provide this method for API completeness.
16099 pub fn resource(
16100 mut self,
16101 new_value: &str,
16102 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {
16103 self._resource = new_value.to_string();
16104 self
16105 }
16106 /// 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).
16107 ///
16108 /// Sets the *options.requested policy version* query property to the given value.
16109 pub fn options_requested_policy_version(
16110 mut self,
16111 new_value: i32,
16112 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {
16113 self._options_requested_policy_version = Some(new_value);
16114 self
16115 }
16116 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16117 /// while executing the actual API request.
16118 ///
16119 /// ````text
16120 /// It should be used to handle progress information, and to implement a certain level of resilience.
16121 /// ````
16122 ///
16123 /// Sets the *delegate* property to the given value.
16124 pub fn delegate(
16125 mut self,
16126 new_value: &'a mut dyn common::Delegate,
16127 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {
16128 self._delegate = Some(new_value);
16129 self
16130 }
16131
16132 /// Set any additional parameter of the query string used in the request.
16133 /// It should be used to set parameters which are not yet available through their own
16134 /// setters.
16135 ///
16136 /// Please note that this method must not be used to set any of the known parameters
16137 /// which have their own setter method. If done anyway, the request will fail.
16138 ///
16139 /// # Additional Parameters
16140 ///
16141 /// * *$.xgafv* (query-string) - V1 error format.
16142 /// * *access_token* (query-string) - OAuth access token.
16143 /// * *alt* (query-string) - Data format for response.
16144 /// * *callback* (query-string) - JSONP
16145 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16146 /// * *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.
16147 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16148 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16149 /// * *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.
16150 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16151 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16152 pub fn param<T>(
16153 mut self,
16154 name: T,
16155 value: T,
16156 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C>
16157 where
16158 T: AsRef<str>,
16159 {
16160 self._additional_params
16161 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16162 self
16163 }
16164
16165 /// Identifies the authorization scope for the method you are building.
16166 ///
16167 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16168 /// [`Scope::CloudPlatform`].
16169 ///
16170 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16171 /// tokens for more than one scope.
16172 ///
16173 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16174 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16175 /// sufficient, a read-write scope will do as well.
16176 pub fn add_scope<St>(
16177 mut self,
16178 scope: St,
16179 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C>
16180 where
16181 St: AsRef<str>,
16182 {
16183 self._scopes.insert(String::from(scope.as_ref()));
16184 self
16185 }
16186 /// Identifies the authorization scope(s) for the method you are building.
16187 ///
16188 /// See [`Self::add_scope()`] for details.
16189 pub fn add_scopes<I, St>(
16190 mut self,
16191 scopes: I,
16192 ) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C>
16193 where
16194 I: IntoIterator<Item = St>,
16195 St: AsRef<str>,
16196 {
16197 self._scopes
16198 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16199 self
16200 }
16201
16202 /// Removes all scopes, and no default scope will be used either.
16203 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16204 /// for details).
16205 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectGetIamPolicyCall<'a, C> {
16206 self._scopes.clear();
16207 self
16208 }
16209}
16210
16211/// Use this method to list the objects of a specific migration job.
16212///
16213/// A builder for the *locations.migrationJobs.objects.list* method supported by a *project* resource.
16214/// It is not used directly, but through a [`ProjectMethods`] instance.
16215///
16216/// # Example
16217///
16218/// Instantiate a resource method builder
16219///
16220/// ```test_harness,no_run
16221/// # extern crate hyper;
16222/// # extern crate hyper_rustls;
16223/// # extern crate google_datamigration1 as datamigration1;
16224/// # async fn dox() {
16225/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16226///
16227/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16228/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16229/// # .with_native_roots()
16230/// # .unwrap()
16231/// # .https_only()
16232/// # .enable_http2()
16233/// # .build();
16234///
16235/// # let executor = hyper_util::rt::TokioExecutor::new();
16236/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16237/// # secret,
16238/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16239/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16240/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16241/// # ),
16242/// # ).build().await.unwrap();
16243///
16244/// # let client = hyper_util::client::legacy::Client::builder(
16245/// # hyper_util::rt::TokioExecutor::new()
16246/// # )
16247/// # .build(
16248/// # hyper_rustls::HttpsConnectorBuilder::new()
16249/// # .with_native_roots()
16250/// # .unwrap()
16251/// # .https_or_http()
16252/// # .enable_http2()
16253/// # .build()
16254/// # );
16255/// # let mut hub = DatabaseMigrationService::new(client, auth);
16256/// // You can configure optional parameters by calling the respective setters at will, and
16257/// // execute the final call using `doit()`.
16258/// // Values shown here are possibly random and not representative !
16259/// let result = hub.projects().locations_migration_jobs_objects_list("parent")
16260/// .page_token("sed")
16261/// .page_size(-98)
16262/// .doit().await;
16263/// # }
16264/// ```
16265pub struct ProjectLocationMigrationJobObjectListCall<'a, C>
16266where
16267 C: 'a,
16268{
16269 hub: &'a DatabaseMigrationService<C>,
16270 _parent: String,
16271 _page_token: Option<String>,
16272 _page_size: Option<i32>,
16273 _delegate: Option<&'a mut dyn common::Delegate>,
16274 _additional_params: HashMap<String, String>,
16275 _scopes: BTreeSet<String>,
16276}
16277
16278impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectListCall<'a, C> {}
16279
16280impl<'a, C> ProjectLocationMigrationJobObjectListCall<'a, C>
16281where
16282 C: common::Connector,
16283{
16284 /// Perform the operation you have build so far.
16285 pub async fn doit(
16286 mut self,
16287 ) -> common::Result<(common::Response, ListMigrationJobObjectsResponse)> {
16288 use std::borrow::Cow;
16289 use std::io::{Read, Seek};
16290
16291 use common::{url::Params, ToParts};
16292 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16293
16294 let mut dd = common::DefaultDelegate;
16295 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16296 dlg.begin(common::MethodInfo {
16297 id: "datamigration.projects.locations.migrationJobs.objects.list",
16298 http_method: hyper::Method::GET,
16299 });
16300
16301 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16302 if self._additional_params.contains_key(field) {
16303 dlg.finished(false);
16304 return Err(common::Error::FieldClash(field));
16305 }
16306 }
16307
16308 let mut params = Params::with_capacity(5 + self._additional_params.len());
16309 params.push("parent", self._parent);
16310 if let Some(value) = self._page_token.as_ref() {
16311 params.push("pageToken", value);
16312 }
16313 if let Some(value) = self._page_size.as_ref() {
16314 params.push("pageSize", value.to_string());
16315 }
16316
16317 params.extend(self._additional_params.iter());
16318
16319 params.push("alt", "json");
16320 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects";
16321 if self._scopes.is_empty() {
16322 self._scopes
16323 .insert(Scope::CloudPlatform.as_ref().to_string());
16324 }
16325
16326 #[allow(clippy::single_element_loop)]
16327 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16328 url = params.uri_replacement(url, param_name, find_this, true);
16329 }
16330 {
16331 let to_remove = ["parent"];
16332 params.remove_params(&to_remove);
16333 }
16334
16335 let url = params.parse_with_url(&url);
16336
16337 loop {
16338 let token = match self
16339 .hub
16340 .auth
16341 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16342 .await
16343 {
16344 Ok(token) => token,
16345 Err(e) => match dlg.token(e) {
16346 Ok(token) => token,
16347 Err(e) => {
16348 dlg.finished(false);
16349 return Err(common::Error::MissingToken(e));
16350 }
16351 },
16352 };
16353 let mut req_result = {
16354 let client = &self.hub.client;
16355 dlg.pre_request();
16356 let mut req_builder = hyper::Request::builder()
16357 .method(hyper::Method::GET)
16358 .uri(url.as_str())
16359 .header(USER_AGENT, self.hub._user_agent.clone());
16360
16361 if let Some(token) = token.as_ref() {
16362 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16363 }
16364
16365 let request = req_builder
16366 .header(CONTENT_LENGTH, 0_u64)
16367 .body(common::to_body::<String>(None));
16368
16369 client.request(request.unwrap()).await
16370 };
16371
16372 match req_result {
16373 Err(err) => {
16374 if let common::Retry::After(d) = dlg.http_error(&err) {
16375 sleep(d).await;
16376 continue;
16377 }
16378 dlg.finished(false);
16379 return Err(common::Error::HttpError(err));
16380 }
16381 Ok(res) => {
16382 let (mut parts, body) = res.into_parts();
16383 let mut body = common::Body::new(body);
16384 if !parts.status.is_success() {
16385 let bytes = common::to_bytes(body).await.unwrap_or_default();
16386 let error = serde_json::from_str(&common::to_string(&bytes));
16387 let response = common::to_response(parts, bytes.into());
16388
16389 if let common::Retry::After(d) =
16390 dlg.http_failure(&response, error.as_ref().ok())
16391 {
16392 sleep(d).await;
16393 continue;
16394 }
16395
16396 dlg.finished(false);
16397
16398 return Err(match error {
16399 Ok(value) => common::Error::BadRequest(value),
16400 _ => common::Error::Failure(response),
16401 });
16402 }
16403 let response = {
16404 let bytes = common::to_bytes(body).await.unwrap_or_default();
16405 let encoded = common::to_string(&bytes);
16406 match serde_json::from_str(&encoded) {
16407 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16408 Err(error) => {
16409 dlg.response_json_decode_error(&encoded, &error);
16410 return Err(common::Error::JsonDecodeError(
16411 encoded.to_string(),
16412 error,
16413 ));
16414 }
16415 }
16416 };
16417
16418 dlg.finished(true);
16419 return Ok(response);
16420 }
16421 }
16422 }
16423 }
16424
16425 /// Required. The parent migration job that owns the collection of objects.
16426 ///
16427 /// Sets the *parent* path property to the given value.
16428 ///
16429 /// Even though the property as already been set when instantiating this call,
16430 /// we provide this method for API completeness.
16431 pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
16432 self._parent = new_value.to_string();
16433 self
16434 }
16435 /// Page token received from a previous `ListMigrationJObObjectsRequest` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListMigrationJobObjectsRequest` must match the call that provided the page token.
16436 ///
16437 /// Sets the *page token* query property to the given value.
16438 pub fn page_token(
16439 mut self,
16440 new_value: &str,
16441 ) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
16442 self._page_token = Some(new_value.to_string());
16443 self
16444 }
16445 /// Maximum number of objects to return. Default is 50. The maximum value is 1000; values above 1000 will be coerced to 1000.
16446 ///
16447 /// Sets the *page size* query property to the given value.
16448 pub fn page_size(mut self, new_value: i32) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
16449 self._page_size = Some(new_value);
16450 self
16451 }
16452 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16453 /// while executing the actual API request.
16454 ///
16455 /// ````text
16456 /// It should be used to handle progress information, and to implement a certain level of resilience.
16457 /// ````
16458 ///
16459 /// Sets the *delegate* property to the given value.
16460 pub fn delegate(
16461 mut self,
16462 new_value: &'a mut dyn common::Delegate,
16463 ) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
16464 self._delegate = Some(new_value);
16465 self
16466 }
16467
16468 /// Set any additional parameter of the query string used in the request.
16469 /// It should be used to set parameters which are not yet available through their own
16470 /// setters.
16471 ///
16472 /// Please note that this method must not be used to set any of the known parameters
16473 /// which have their own setter method. If done anyway, the request will fail.
16474 ///
16475 /// # Additional Parameters
16476 ///
16477 /// * *$.xgafv* (query-string) - V1 error format.
16478 /// * *access_token* (query-string) - OAuth access token.
16479 /// * *alt* (query-string) - Data format for response.
16480 /// * *callback* (query-string) - JSONP
16481 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16482 /// * *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.
16483 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16484 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16485 /// * *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.
16486 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16487 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16488 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobObjectListCall<'a, C>
16489 where
16490 T: AsRef<str>,
16491 {
16492 self._additional_params
16493 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16494 self
16495 }
16496
16497 /// Identifies the authorization scope for the method you are building.
16498 ///
16499 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16500 /// [`Scope::CloudPlatform`].
16501 ///
16502 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16503 /// tokens for more than one scope.
16504 ///
16505 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16506 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16507 /// sufficient, a read-write scope will do as well.
16508 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobObjectListCall<'a, C>
16509 where
16510 St: AsRef<str>,
16511 {
16512 self._scopes.insert(String::from(scope.as_ref()));
16513 self
16514 }
16515 /// Identifies the authorization scope(s) for the method you are building.
16516 ///
16517 /// See [`Self::add_scope()`] for details.
16518 pub fn add_scopes<I, St>(
16519 mut self,
16520 scopes: I,
16521 ) -> ProjectLocationMigrationJobObjectListCall<'a, C>
16522 where
16523 I: IntoIterator<Item = St>,
16524 St: AsRef<str>,
16525 {
16526 self._scopes
16527 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16528 self
16529 }
16530
16531 /// Removes all scopes, and no default scope will be used either.
16532 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16533 /// for details).
16534 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectListCall<'a, C> {
16535 self._scopes.clear();
16536 self
16537 }
16538}
16539
16540/// Use this method to look up a migration job object by its source object identifier.
16541///
16542/// A builder for the *locations.migrationJobs.objects.lookup* method supported by a *project* resource.
16543/// It is not used directly, but through a [`ProjectMethods`] instance.
16544///
16545/// # Example
16546///
16547/// Instantiate a resource method builder
16548///
16549/// ```test_harness,no_run
16550/// # extern crate hyper;
16551/// # extern crate hyper_rustls;
16552/// # extern crate google_datamigration1 as datamigration1;
16553/// use datamigration1::api::LookupMigrationJobObjectRequest;
16554/// # async fn dox() {
16555/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16556///
16557/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16558/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16559/// # .with_native_roots()
16560/// # .unwrap()
16561/// # .https_only()
16562/// # .enable_http2()
16563/// # .build();
16564///
16565/// # let executor = hyper_util::rt::TokioExecutor::new();
16566/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16567/// # secret,
16568/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16569/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16570/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16571/// # ),
16572/// # ).build().await.unwrap();
16573///
16574/// # let client = hyper_util::client::legacy::Client::builder(
16575/// # hyper_util::rt::TokioExecutor::new()
16576/// # )
16577/// # .build(
16578/// # hyper_rustls::HttpsConnectorBuilder::new()
16579/// # .with_native_roots()
16580/// # .unwrap()
16581/// # .https_or_http()
16582/// # .enable_http2()
16583/// # .build()
16584/// # );
16585/// # let mut hub = DatabaseMigrationService::new(client, auth);
16586/// // As the method needs a request, you would usually fill it with the desired information
16587/// // into the respective structure. Some of the parts shown here might not be applicable !
16588/// // Values shown here are possibly random and not representative !
16589/// let mut req = LookupMigrationJobObjectRequest::default();
16590///
16591/// // You can configure optional parameters by calling the respective setters at will, and
16592/// // execute the final call using `doit()`.
16593/// // Values shown here are possibly random and not representative !
16594/// let result = hub.projects().locations_migration_jobs_objects_lookup(req, "parent")
16595/// .doit().await;
16596/// # }
16597/// ```
16598pub struct ProjectLocationMigrationJobObjectLookupCall<'a, C>
16599where
16600 C: 'a,
16601{
16602 hub: &'a DatabaseMigrationService<C>,
16603 _request: LookupMigrationJobObjectRequest,
16604 _parent: String,
16605 _delegate: Option<&'a mut dyn common::Delegate>,
16606 _additional_params: HashMap<String, String>,
16607 _scopes: BTreeSet<String>,
16608}
16609
16610impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectLookupCall<'a, C> {}
16611
16612impl<'a, C> ProjectLocationMigrationJobObjectLookupCall<'a, C>
16613where
16614 C: common::Connector,
16615{
16616 /// Perform the operation you have build so far.
16617 pub async fn doit(mut self) -> common::Result<(common::Response, MigrationJobObject)> {
16618 use std::borrow::Cow;
16619 use std::io::{Read, Seek};
16620
16621 use common::{url::Params, ToParts};
16622 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16623
16624 let mut dd = common::DefaultDelegate;
16625 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16626 dlg.begin(common::MethodInfo {
16627 id: "datamigration.projects.locations.migrationJobs.objects.lookup",
16628 http_method: hyper::Method::POST,
16629 });
16630
16631 for &field in ["alt", "parent"].iter() {
16632 if self._additional_params.contains_key(field) {
16633 dlg.finished(false);
16634 return Err(common::Error::FieldClash(field));
16635 }
16636 }
16637
16638 let mut params = Params::with_capacity(4 + self._additional_params.len());
16639 params.push("parent", self._parent);
16640
16641 params.extend(self._additional_params.iter());
16642
16643 params.push("alt", "json");
16644 let mut url = self.hub._base_url.clone() + "v1/{+parent}/objects:lookup";
16645 if self._scopes.is_empty() {
16646 self._scopes
16647 .insert(Scope::CloudPlatform.as_ref().to_string());
16648 }
16649
16650 #[allow(clippy::single_element_loop)]
16651 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16652 url = params.uri_replacement(url, param_name, find_this, true);
16653 }
16654 {
16655 let to_remove = ["parent"];
16656 params.remove_params(&to_remove);
16657 }
16658
16659 let url = params.parse_with_url(&url);
16660
16661 let mut json_mime_type = mime::APPLICATION_JSON;
16662 let mut request_value_reader = {
16663 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16664 common::remove_json_null_values(&mut value);
16665 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16666 serde_json::to_writer(&mut dst, &value).unwrap();
16667 dst
16668 };
16669 let request_size = request_value_reader
16670 .seek(std::io::SeekFrom::End(0))
16671 .unwrap();
16672 request_value_reader
16673 .seek(std::io::SeekFrom::Start(0))
16674 .unwrap();
16675
16676 loop {
16677 let token = match self
16678 .hub
16679 .auth
16680 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16681 .await
16682 {
16683 Ok(token) => token,
16684 Err(e) => match dlg.token(e) {
16685 Ok(token) => token,
16686 Err(e) => {
16687 dlg.finished(false);
16688 return Err(common::Error::MissingToken(e));
16689 }
16690 },
16691 };
16692 request_value_reader
16693 .seek(std::io::SeekFrom::Start(0))
16694 .unwrap();
16695 let mut req_result = {
16696 let client = &self.hub.client;
16697 dlg.pre_request();
16698 let mut req_builder = hyper::Request::builder()
16699 .method(hyper::Method::POST)
16700 .uri(url.as_str())
16701 .header(USER_AGENT, self.hub._user_agent.clone());
16702
16703 if let Some(token) = token.as_ref() {
16704 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16705 }
16706
16707 let request = req_builder
16708 .header(CONTENT_TYPE, json_mime_type.to_string())
16709 .header(CONTENT_LENGTH, request_size as u64)
16710 .body(common::to_body(
16711 request_value_reader.get_ref().clone().into(),
16712 ));
16713
16714 client.request(request.unwrap()).await
16715 };
16716
16717 match req_result {
16718 Err(err) => {
16719 if let common::Retry::After(d) = dlg.http_error(&err) {
16720 sleep(d).await;
16721 continue;
16722 }
16723 dlg.finished(false);
16724 return Err(common::Error::HttpError(err));
16725 }
16726 Ok(res) => {
16727 let (mut parts, body) = res.into_parts();
16728 let mut body = common::Body::new(body);
16729 if !parts.status.is_success() {
16730 let bytes = common::to_bytes(body).await.unwrap_or_default();
16731 let error = serde_json::from_str(&common::to_string(&bytes));
16732 let response = common::to_response(parts, bytes.into());
16733
16734 if let common::Retry::After(d) =
16735 dlg.http_failure(&response, error.as_ref().ok())
16736 {
16737 sleep(d).await;
16738 continue;
16739 }
16740
16741 dlg.finished(false);
16742
16743 return Err(match error {
16744 Ok(value) => common::Error::BadRequest(value),
16745 _ => common::Error::Failure(response),
16746 });
16747 }
16748 let response = {
16749 let bytes = common::to_bytes(body).await.unwrap_or_default();
16750 let encoded = common::to_string(&bytes);
16751 match serde_json::from_str(&encoded) {
16752 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16753 Err(error) => {
16754 dlg.response_json_decode_error(&encoded, &error);
16755 return Err(common::Error::JsonDecodeError(
16756 encoded.to_string(),
16757 error,
16758 ));
16759 }
16760 }
16761 };
16762
16763 dlg.finished(true);
16764 return Ok(response);
16765 }
16766 }
16767 }
16768 }
16769
16770 ///
16771 /// Sets the *request* property to the given value.
16772 ///
16773 /// Even though the property as already been set when instantiating this call,
16774 /// we provide this method for API completeness.
16775 pub fn request(
16776 mut self,
16777 new_value: LookupMigrationJobObjectRequest,
16778 ) -> ProjectLocationMigrationJobObjectLookupCall<'a, C> {
16779 self._request = new_value;
16780 self
16781 }
16782 /// Required. The parent migration job that owns the collection of objects.
16783 ///
16784 /// Sets the *parent* path property to the given value.
16785 ///
16786 /// Even though the property as already been set when instantiating this call,
16787 /// we provide this method for API completeness.
16788 pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobObjectLookupCall<'a, C> {
16789 self._parent = new_value.to_string();
16790 self
16791 }
16792 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16793 /// while executing the actual API request.
16794 ///
16795 /// ````text
16796 /// It should be used to handle progress information, and to implement a certain level of resilience.
16797 /// ````
16798 ///
16799 /// Sets the *delegate* property to the given value.
16800 pub fn delegate(
16801 mut self,
16802 new_value: &'a mut dyn common::Delegate,
16803 ) -> ProjectLocationMigrationJobObjectLookupCall<'a, C> {
16804 self._delegate = Some(new_value);
16805 self
16806 }
16807
16808 /// Set any additional parameter of the query string used in the request.
16809 /// It should be used to set parameters which are not yet available through their own
16810 /// setters.
16811 ///
16812 /// Please note that this method must not be used to set any of the known parameters
16813 /// which have their own setter method. If done anyway, the request will fail.
16814 ///
16815 /// # Additional Parameters
16816 ///
16817 /// * *$.xgafv* (query-string) - V1 error format.
16818 /// * *access_token* (query-string) - OAuth access token.
16819 /// * *alt* (query-string) - Data format for response.
16820 /// * *callback* (query-string) - JSONP
16821 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16822 /// * *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.
16823 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16824 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16825 /// * *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.
16826 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16827 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16828 pub fn param<T>(
16829 mut self,
16830 name: T,
16831 value: T,
16832 ) -> ProjectLocationMigrationJobObjectLookupCall<'a, C>
16833 where
16834 T: AsRef<str>,
16835 {
16836 self._additional_params
16837 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16838 self
16839 }
16840
16841 /// Identifies the authorization scope for the method you are building.
16842 ///
16843 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16844 /// [`Scope::CloudPlatform`].
16845 ///
16846 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16847 /// tokens for more than one scope.
16848 ///
16849 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16850 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16851 /// sufficient, a read-write scope will do as well.
16852 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobObjectLookupCall<'a, C>
16853 where
16854 St: AsRef<str>,
16855 {
16856 self._scopes.insert(String::from(scope.as_ref()));
16857 self
16858 }
16859 /// Identifies the authorization scope(s) for the method you are building.
16860 ///
16861 /// See [`Self::add_scope()`] for details.
16862 pub fn add_scopes<I, St>(
16863 mut self,
16864 scopes: I,
16865 ) -> ProjectLocationMigrationJobObjectLookupCall<'a, C>
16866 where
16867 I: IntoIterator<Item = St>,
16868 St: AsRef<str>,
16869 {
16870 self._scopes
16871 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16872 self
16873 }
16874
16875 /// Removes all scopes, and no default scope will be used either.
16876 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16877 /// for details).
16878 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectLookupCall<'a, C> {
16879 self._scopes.clear();
16880 self
16881 }
16882}
16883
16884/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
16885///
16886/// A builder for the *locations.migrationJobs.objects.setIamPolicy* method supported by a *project* resource.
16887/// It is not used directly, but through a [`ProjectMethods`] instance.
16888///
16889/// # Example
16890///
16891/// Instantiate a resource method builder
16892///
16893/// ```test_harness,no_run
16894/// # extern crate hyper;
16895/// # extern crate hyper_rustls;
16896/// # extern crate google_datamigration1 as datamigration1;
16897/// use datamigration1::api::SetIamPolicyRequest;
16898/// # async fn dox() {
16899/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16900///
16901/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16902/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16903/// # .with_native_roots()
16904/// # .unwrap()
16905/// # .https_only()
16906/// # .enable_http2()
16907/// # .build();
16908///
16909/// # let executor = hyper_util::rt::TokioExecutor::new();
16910/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16911/// # secret,
16912/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16913/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16914/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16915/// # ),
16916/// # ).build().await.unwrap();
16917///
16918/// # let client = hyper_util::client::legacy::Client::builder(
16919/// # hyper_util::rt::TokioExecutor::new()
16920/// # )
16921/// # .build(
16922/// # hyper_rustls::HttpsConnectorBuilder::new()
16923/// # .with_native_roots()
16924/// # .unwrap()
16925/// # .https_or_http()
16926/// # .enable_http2()
16927/// # .build()
16928/// # );
16929/// # let mut hub = DatabaseMigrationService::new(client, auth);
16930/// // As the method needs a request, you would usually fill it with the desired information
16931/// // into the respective structure. Some of the parts shown here might not be applicable !
16932/// // Values shown here are possibly random and not representative !
16933/// let mut req = SetIamPolicyRequest::default();
16934///
16935/// // You can configure optional parameters by calling the respective setters at will, and
16936/// // execute the final call using `doit()`.
16937/// // Values shown here are possibly random and not representative !
16938/// let result = hub.projects().locations_migration_jobs_objects_set_iam_policy(req, "resource")
16939/// .doit().await;
16940/// # }
16941/// ```
16942pub struct ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C>
16943where
16944 C: 'a,
16945{
16946 hub: &'a DatabaseMigrationService<C>,
16947 _request: SetIamPolicyRequest,
16948 _resource: String,
16949 _delegate: Option<&'a mut dyn common::Delegate>,
16950 _additional_params: HashMap<String, String>,
16951 _scopes: BTreeSet<String>,
16952}
16953
16954impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {}
16955
16956impl<'a, C> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C>
16957where
16958 C: common::Connector,
16959{
16960 /// Perform the operation you have build so far.
16961 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
16962 use std::borrow::Cow;
16963 use std::io::{Read, Seek};
16964
16965 use common::{url::Params, ToParts};
16966 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16967
16968 let mut dd = common::DefaultDelegate;
16969 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16970 dlg.begin(common::MethodInfo {
16971 id: "datamigration.projects.locations.migrationJobs.objects.setIamPolicy",
16972 http_method: hyper::Method::POST,
16973 });
16974
16975 for &field in ["alt", "resource"].iter() {
16976 if self._additional_params.contains_key(field) {
16977 dlg.finished(false);
16978 return Err(common::Error::FieldClash(field));
16979 }
16980 }
16981
16982 let mut params = Params::with_capacity(4 + self._additional_params.len());
16983 params.push("resource", self._resource);
16984
16985 params.extend(self._additional_params.iter());
16986
16987 params.push("alt", "json");
16988 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
16989 if self._scopes.is_empty() {
16990 self._scopes
16991 .insert(Scope::CloudPlatform.as_ref().to_string());
16992 }
16993
16994 #[allow(clippy::single_element_loop)]
16995 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
16996 url = params.uri_replacement(url, param_name, find_this, true);
16997 }
16998 {
16999 let to_remove = ["resource"];
17000 params.remove_params(&to_remove);
17001 }
17002
17003 let url = params.parse_with_url(&url);
17004
17005 let mut json_mime_type = mime::APPLICATION_JSON;
17006 let mut request_value_reader = {
17007 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17008 common::remove_json_null_values(&mut value);
17009 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17010 serde_json::to_writer(&mut dst, &value).unwrap();
17011 dst
17012 };
17013 let request_size = request_value_reader
17014 .seek(std::io::SeekFrom::End(0))
17015 .unwrap();
17016 request_value_reader
17017 .seek(std::io::SeekFrom::Start(0))
17018 .unwrap();
17019
17020 loop {
17021 let token = match self
17022 .hub
17023 .auth
17024 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17025 .await
17026 {
17027 Ok(token) => token,
17028 Err(e) => match dlg.token(e) {
17029 Ok(token) => token,
17030 Err(e) => {
17031 dlg.finished(false);
17032 return Err(common::Error::MissingToken(e));
17033 }
17034 },
17035 };
17036 request_value_reader
17037 .seek(std::io::SeekFrom::Start(0))
17038 .unwrap();
17039 let mut req_result = {
17040 let client = &self.hub.client;
17041 dlg.pre_request();
17042 let mut req_builder = hyper::Request::builder()
17043 .method(hyper::Method::POST)
17044 .uri(url.as_str())
17045 .header(USER_AGENT, self.hub._user_agent.clone());
17046
17047 if let Some(token) = token.as_ref() {
17048 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17049 }
17050
17051 let request = req_builder
17052 .header(CONTENT_TYPE, json_mime_type.to_string())
17053 .header(CONTENT_LENGTH, request_size as u64)
17054 .body(common::to_body(
17055 request_value_reader.get_ref().clone().into(),
17056 ));
17057
17058 client.request(request.unwrap()).await
17059 };
17060
17061 match req_result {
17062 Err(err) => {
17063 if let common::Retry::After(d) = dlg.http_error(&err) {
17064 sleep(d).await;
17065 continue;
17066 }
17067 dlg.finished(false);
17068 return Err(common::Error::HttpError(err));
17069 }
17070 Ok(res) => {
17071 let (mut parts, body) = res.into_parts();
17072 let mut body = common::Body::new(body);
17073 if !parts.status.is_success() {
17074 let bytes = common::to_bytes(body).await.unwrap_or_default();
17075 let error = serde_json::from_str(&common::to_string(&bytes));
17076 let response = common::to_response(parts, bytes.into());
17077
17078 if let common::Retry::After(d) =
17079 dlg.http_failure(&response, error.as_ref().ok())
17080 {
17081 sleep(d).await;
17082 continue;
17083 }
17084
17085 dlg.finished(false);
17086
17087 return Err(match error {
17088 Ok(value) => common::Error::BadRequest(value),
17089 _ => common::Error::Failure(response),
17090 });
17091 }
17092 let response = {
17093 let bytes = common::to_bytes(body).await.unwrap_or_default();
17094 let encoded = common::to_string(&bytes);
17095 match serde_json::from_str(&encoded) {
17096 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17097 Err(error) => {
17098 dlg.response_json_decode_error(&encoded, &error);
17099 return Err(common::Error::JsonDecodeError(
17100 encoded.to_string(),
17101 error,
17102 ));
17103 }
17104 }
17105 };
17106
17107 dlg.finished(true);
17108 return Ok(response);
17109 }
17110 }
17111 }
17112 }
17113
17114 ///
17115 /// Sets the *request* property to the given value.
17116 ///
17117 /// Even though the property as already been set when instantiating this call,
17118 /// we provide this method for API completeness.
17119 pub fn request(
17120 mut self,
17121 new_value: SetIamPolicyRequest,
17122 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {
17123 self._request = new_value;
17124 self
17125 }
17126 /// 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.
17127 ///
17128 /// Sets the *resource* path property to the given value.
17129 ///
17130 /// Even though the property as already been set when instantiating this call,
17131 /// we provide this method for API completeness.
17132 pub fn resource(
17133 mut self,
17134 new_value: &str,
17135 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {
17136 self._resource = new_value.to_string();
17137 self
17138 }
17139 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17140 /// while executing the actual API request.
17141 ///
17142 /// ````text
17143 /// It should be used to handle progress information, and to implement a certain level of resilience.
17144 /// ````
17145 ///
17146 /// Sets the *delegate* property to the given value.
17147 pub fn delegate(
17148 mut self,
17149 new_value: &'a mut dyn common::Delegate,
17150 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {
17151 self._delegate = Some(new_value);
17152 self
17153 }
17154
17155 /// Set any additional parameter of the query string used in the request.
17156 /// It should be used to set parameters which are not yet available through their own
17157 /// setters.
17158 ///
17159 /// Please note that this method must not be used to set any of the known parameters
17160 /// which have their own setter method. If done anyway, the request will fail.
17161 ///
17162 /// # Additional Parameters
17163 ///
17164 /// * *$.xgafv* (query-string) - V1 error format.
17165 /// * *access_token* (query-string) - OAuth access token.
17166 /// * *alt* (query-string) - Data format for response.
17167 /// * *callback* (query-string) - JSONP
17168 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17169 /// * *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.
17170 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17171 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17172 /// * *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.
17173 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17174 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17175 pub fn param<T>(
17176 mut self,
17177 name: T,
17178 value: T,
17179 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C>
17180 where
17181 T: AsRef<str>,
17182 {
17183 self._additional_params
17184 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17185 self
17186 }
17187
17188 /// Identifies the authorization scope for the method you are building.
17189 ///
17190 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17191 /// [`Scope::CloudPlatform`].
17192 ///
17193 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17194 /// tokens for more than one scope.
17195 ///
17196 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17197 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17198 /// sufficient, a read-write scope will do as well.
17199 pub fn add_scope<St>(
17200 mut self,
17201 scope: St,
17202 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C>
17203 where
17204 St: AsRef<str>,
17205 {
17206 self._scopes.insert(String::from(scope.as_ref()));
17207 self
17208 }
17209 /// Identifies the authorization scope(s) for the method you are building.
17210 ///
17211 /// See [`Self::add_scope()`] for details.
17212 pub fn add_scopes<I, St>(
17213 mut self,
17214 scopes: I,
17215 ) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C>
17216 where
17217 I: IntoIterator<Item = St>,
17218 St: AsRef<str>,
17219 {
17220 self._scopes
17221 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17222 self
17223 }
17224
17225 /// Removes all scopes, and no default scope will be used either.
17226 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17227 /// for details).
17228 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectSetIamPolicyCall<'a, C> {
17229 self._scopes.clear();
17230 self
17231 }
17232}
17233
17234/// 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.
17235///
17236/// A builder for the *locations.migrationJobs.objects.testIamPermissions* method supported by a *project* resource.
17237/// It is not used directly, but through a [`ProjectMethods`] instance.
17238///
17239/// # Example
17240///
17241/// Instantiate a resource method builder
17242///
17243/// ```test_harness,no_run
17244/// # extern crate hyper;
17245/// # extern crate hyper_rustls;
17246/// # extern crate google_datamigration1 as datamigration1;
17247/// use datamigration1::api::TestIamPermissionsRequest;
17248/// # async fn dox() {
17249/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17250///
17251/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17252/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17253/// # .with_native_roots()
17254/// # .unwrap()
17255/// # .https_only()
17256/// # .enable_http2()
17257/// # .build();
17258///
17259/// # let executor = hyper_util::rt::TokioExecutor::new();
17260/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17261/// # secret,
17262/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17263/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17264/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17265/// # ),
17266/// # ).build().await.unwrap();
17267///
17268/// # let client = hyper_util::client::legacy::Client::builder(
17269/// # hyper_util::rt::TokioExecutor::new()
17270/// # )
17271/// # .build(
17272/// # hyper_rustls::HttpsConnectorBuilder::new()
17273/// # .with_native_roots()
17274/// # .unwrap()
17275/// # .https_or_http()
17276/// # .enable_http2()
17277/// # .build()
17278/// # );
17279/// # let mut hub = DatabaseMigrationService::new(client, auth);
17280/// // As the method needs a request, you would usually fill it with the desired information
17281/// // into the respective structure. Some of the parts shown here might not be applicable !
17282/// // Values shown here are possibly random and not representative !
17283/// let mut req = TestIamPermissionsRequest::default();
17284///
17285/// // You can configure optional parameters by calling the respective setters at will, and
17286/// // execute the final call using `doit()`.
17287/// // Values shown here are possibly random and not representative !
17288/// let result = hub.projects().locations_migration_jobs_objects_test_iam_permissions(req, "resource")
17289/// .doit().await;
17290/// # }
17291/// ```
17292pub struct ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C>
17293where
17294 C: 'a,
17295{
17296 hub: &'a DatabaseMigrationService<C>,
17297 _request: TestIamPermissionsRequest,
17298 _resource: String,
17299 _delegate: Option<&'a mut dyn common::Delegate>,
17300 _additional_params: HashMap<String, String>,
17301 _scopes: BTreeSet<String>,
17302}
17303
17304impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {}
17305
17306impl<'a, C> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C>
17307where
17308 C: common::Connector,
17309{
17310 /// Perform the operation you have build so far.
17311 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17312 use std::borrow::Cow;
17313 use std::io::{Read, Seek};
17314
17315 use common::{url::Params, ToParts};
17316 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17317
17318 let mut dd = common::DefaultDelegate;
17319 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17320 dlg.begin(common::MethodInfo {
17321 id: "datamigration.projects.locations.migrationJobs.objects.testIamPermissions",
17322 http_method: hyper::Method::POST,
17323 });
17324
17325 for &field in ["alt", "resource"].iter() {
17326 if self._additional_params.contains_key(field) {
17327 dlg.finished(false);
17328 return Err(common::Error::FieldClash(field));
17329 }
17330 }
17331
17332 let mut params = Params::with_capacity(4 + self._additional_params.len());
17333 params.push("resource", self._resource);
17334
17335 params.extend(self._additional_params.iter());
17336
17337 params.push("alt", "json");
17338 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
17339 if self._scopes.is_empty() {
17340 self._scopes
17341 .insert(Scope::CloudPlatform.as_ref().to_string());
17342 }
17343
17344 #[allow(clippy::single_element_loop)]
17345 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17346 url = params.uri_replacement(url, param_name, find_this, true);
17347 }
17348 {
17349 let to_remove = ["resource"];
17350 params.remove_params(&to_remove);
17351 }
17352
17353 let url = params.parse_with_url(&url);
17354
17355 let mut json_mime_type = mime::APPLICATION_JSON;
17356 let mut request_value_reader = {
17357 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17358 common::remove_json_null_values(&mut value);
17359 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17360 serde_json::to_writer(&mut dst, &value).unwrap();
17361 dst
17362 };
17363 let request_size = request_value_reader
17364 .seek(std::io::SeekFrom::End(0))
17365 .unwrap();
17366 request_value_reader
17367 .seek(std::io::SeekFrom::Start(0))
17368 .unwrap();
17369
17370 loop {
17371 let token = match self
17372 .hub
17373 .auth
17374 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17375 .await
17376 {
17377 Ok(token) => token,
17378 Err(e) => match dlg.token(e) {
17379 Ok(token) => token,
17380 Err(e) => {
17381 dlg.finished(false);
17382 return Err(common::Error::MissingToken(e));
17383 }
17384 },
17385 };
17386 request_value_reader
17387 .seek(std::io::SeekFrom::Start(0))
17388 .unwrap();
17389 let mut req_result = {
17390 let client = &self.hub.client;
17391 dlg.pre_request();
17392 let mut req_builder = hyper::Request::builder()
17393 .method(hyper::Method::POST)
17394 .uri(url.as_str())
17395 .header(USER_AGENT, self.hub._user_agent.clone());
17396
17397 if let Some(token) = token.as_ref() {
17398 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17399 }
17400
17401 let request = req_builder
17402 .header(CONTENT_TYPE, json_mime_type.to_string())
17403 .header(CONTENT_LENGTH, request_size as u64)
17404 .body(common::to_body(
17405 request_value_reader.get_ref().clone().into(),
17406 ));
17407
17408 client.request(request.unwrap()).await
17409 };
17410
17411 match req_result {
17412 Err(err) => {
17413 if let common::Retry::After(d) = dlg.http_error(&err) {
17414 sleep(d).await;
17415 continue;
17416 }
17417 dlg.finished(false);
17418 return Err(common::Error::HttpError(err));
17419 }
17420 Ok(res) => {
17421 let (mut parts, body) = res.into_parts();
17422 let mut body = common::Body::new(body);
17423 if !parts.status.is_success() {
17424 let bytes = common::to_bytes(body).await.unwrap_or_default();
17425 let error = serde_json::from_str(&common::to_string(&bytes));
17426 let response = common::to_response(parts, bytes.into());
17427
17428 if let common::Retry::After(d) =
17429 dlg.http_failure(&response, error.as_ref().ok())
17430 {
17431 sleep(d).await;
17432 continue;
17433 }
17434
17435 dlg.finished(false);
17436
17437 return Err(match error {
17438 Ok(value) => common::Error::BadRequest(value),
17439 _ => common::Error::Failure(response),
17440 });
17441 }
17442 let response = {
17443 let bytes = common::to_bytes(body).await.unwrap_or_default();
17444 let encoded = common::to_string(&bytes);
17445 match serde_json::from_str(&encoded) {
17446 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17447 Err(error) => {
17448 dlg.response_json_decode_error(&encoded, &error);
17449 return Err(common::Error::JsonDecodeError(
17450 encoded.to_string(),
17451 error,
17452 ));
17453 }
17454 }
17455 };
17456
17457 dlg.finished(true);
17458 return Ok(response);
17459 }
17460 }
17461 }
17462 }
17463
17464 ///
17465 /// Sets the *request* property to the given value.
17466 ///
17467 /// Even though the property as already been set when instantiating this call,
17468 /// we provide this method for API completeness.
17469 pub fn request(
17470 mut self,
17471 new_value: TestIamPermissionsRequest,
17472 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {
17473 self._request = new_value;
17474 self
17475 }
17476 /// 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.
17477 ///
17478 /// Sets the *resource* path property to the given value.
17479 ///
17480 /// Even though the property as already been set when instantiating this call,
17481 /// we provide this method for API completeness.
17482 pub fn resource(
17483 mut self,
17484 new_value: &str,
17485 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {
17486 self._resource = new_value.to_string();
17487 self
17488 }
17489 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17490 /// while executing the actual API request.
17491 ///
17492 /// ````text
17493 /// It should be used to handle progress information, and to implement a certain level of resilience.
17494 /// ````
17495 ///
17496 /// Sets the *delegate* property to the given value.
17497 pub fn delegate(
17498 mut self,
17499 new_value: &'a mut dyn common::Delegate,
17500 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {
17501 self._delegate = Some(new_value);
17502 self
17503 }
17504
17505 /// Set any additional parameter of the query string used in the request.
17506 /// It should be used to set parameters which are not yet available through their own
17507 /// setters.
17508 ///
17509 /// Please note that this method must not be used to set any of the known parameters
17510 /// which have their own setter method. If done anyway, the request will fail.
17511 ///
17512 /// # Additional Parameters
17513 ///
17514 /// * *$.xgafv* (query-string) - V1 error format.
17515 /// * *access_token* (query-string) - OAuth access token.
17516 /// * *alt* (query-string) - Data format for response.
17517 /// * *callback* (query-string) - JSONP
17518 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17519 /// * *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.
17520 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17521 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17522 /// * *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.
17523 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17524 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17525 pub fn param<T>(
17526 mut self,
17527 name: T,
17528 value: T,
17529 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C>
17530 where
17531 T: AsRef<str>,
17532 {
17533 self._additional_params
17534 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17535 self
17536 }
17537
17538 /// Identifies the authorization scope for the method you are building.
17539 ///
17540 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17541 /// [`Scope::CloudPlatform`].
17542 ///
17543 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17544 /// tokens for more than one scope.
17545 ///
17546 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17547 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17548 /// sufficient, a read-write scope will do as well.
17549 pub fn add_scope<St>(
17550 mut self,
17551 scope: St,
17552 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C>
17553 where
17554 St: AsRef<str>,
17555 {
17556 self._scopes.insert(String::from(scope.as_ref()));
17557 self
17558 }
17559 /// Identifies the authorization scope(s) for the method you are building.
17560 ///
17561 /// See [`Self::add_scope()`] for details.
17562 pub fn add_scopes<I, St>(
17563 mut self,
17564 scopes: I,
17565 ) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C>
17566 where
17567 I: IntoIterator<Item = St>,
17568 St: AsRef<str>,
17569 {
17570 self._scopes
17571 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17572 self
17573 }
17574
17575 /// Removes all scopes, and no default scope will be used either.
17576 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17577 /// for details).
17578 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobObjectTestIamPermissionCall<'a, C> {
17579 self._scopes.clear();
17580 self
17581 }
17582}
17583
17584/// Creates a new migration job in a given project and location.
17585///
17586/// A builder for the *locations.migrationJobs.create* method supported by a *project* resource.
17587/// It is not used directly, but through a [`ProjectMethods`] instance.
17588///
17589/// # Example
17590///
17591/// Instantiate a resource method builder
17592///
17593/// ```test_harness,no_run
17594/// # extern crate hyper;
17595/// # extern crate hyper_rustls;
17596/// # extern crate google_datamigration1 as datamigration1;
17597/// use datamigration1::api::MigrationJob;
17598/// # async fn dox() {
17599/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17600///
17601/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17602/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17603/// # .with_native_roots()
17604/// # .unwrap()
17605/// # .https_only()
17606/// # .enable_http2()
17607/// # .build();
17608///
17609/// # let executor = hyper_util::rt::TokioExecutor::new();
17610/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17611/// # secret,
17612/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17613/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17614/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17615/// # ),
17616/// # ).build().await.unwrap();
17617///
17618/// # let client = hyper_util::client::legacy::Client::builder(
17619/// # hyper_util::rt::TokioExecutor::new()
17620/// # )
17621/// # .build(
17622/// # hyper_rustls::HttpsConnectorBuilder::new()
17623/// # .with_native_roots()
17624/// # .unwrap()
17625/// # .https_or_http()
17626/// # .enable_http2()
17627/// # .build()
17628/// # );
17629/// # let mut hub = DatabaseMigrationService::new(client, auth);
17630/// // As the method needs a request, you would usually fill it with the desired information
17631/// // into the respective structure. Some of the parts shown here might not be applicable !
17632/// // Values shown here are possibly random and not representative !
17633/// let mut req = MigrationJob::default();
17634///
17635/// // You can configure optional parameters by calling the respective setters at will, and
17636/// // execute the final call using `doit()`.
17637/// // Values shown here are possibly random and not representative !
17638/// let result = hub.projects().locations_migration_jobs_create(req, "parent")
17639/// .request_id("et")
17640/// .migration_job_id("sanctus")
17641/// .doit().await;
17642/// # }
17643/// ```
17644pub struct ProjectLocationMigrationJobCreateCall<'a, C>
17645where
17646 C: 'a,
17647{
17648 hub: &'a DatabaseMigrationService<C>,
17649 _request: MigrationJob,
17650 _parent: String,
17651 _request_id: Option<String>,
17652 _migration_job_id: Option<String>,
17653 _delegate: Option<&'a mut dyn common::Delegate>,
17654 _additional_params: HashMap<String, String>,
17655 _scopes: BTreeSet<String>,
17656}
17657
17658impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobCreateCall<'a, C> {}
17659
17660impl<'a, C> ProjectLocationMigrationJobCreateCall<'a, C>
17661where
17662 C: common::Connector,
17663{
17664 /// Perform the operation you have build so far.
17665 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17666 use std::borrow::Cow;
17667 use std::io::{Read, Seek};
17668
17669 use common::{url::Params, ToParts};
17670 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17671
17672 let mut dd = common::DefaultDelegate;
17673 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17674 dlg.begin(common::MethodInfo {
17675 id: "datamigration.projects.locations.migrationJobs.create",
17676 http_method: hyper::Method::POST,
17677 });
17678
17679 for &field in ["alt", "parent", "requestId", "migrationJobId"].iter() {
17680 if self._additional_params.contains_key(field) {
17681 dlg.finished(false);
17682 return Err(common::Error::FieldClash(field));
17683 }
17684 }
17685
17686 let mut params = Params::with_capacity(6 + self._additional_params.len());
17687 params.push("parent", self._parent);
17688 if let Some(value) = self._request_id.as_ref() {
17689 params.push("requestId", value);
17690 }
17691 if let Some(value) = self._migration_job_id.as_ref() {
17692 params.push("migrationJobId", value);
17693 }
17694
17695 params.extend(self._additional_params.iter());
17696
17697 params.push("alt", "json");
17698 let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationJobs";
17699 if self._scopes.is_empty() {
17700 self._scopes
17701 .insert(Scope::CloudPlatform.as_ref().to_string());
17702 }
17703
17704 #[allow(clippy::single_element_loop)]
17705 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17706 url = params.uri_replacement(url, param_name, find_this, true);
17707 }
17708 {
17709 let to_remove = ["parent"];
17710 params.remove_params(&to_remove);
17711 }
17712
17713 let url = params.parse_with_url(&url);
17714
17715 let mut json_mime_type = mime::APPLICATION_JSON;
17716 let mut request_value_reader = {
17717 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17718 common::remove_json_null_values(&mut value);
17719 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17720 serde_json::to_writer(&mut dst, &value).unwrap();
17721 dst
17722 };
17723 let request_size = request_value_reader
17724 .seek(std::io::SeekFrom::End(0))
17725 .unwrap();
17726 request_value_reader
17727 .seek(std::io::SeekFrom::Start(0))
17728 .unwrap();
17729
17730 loop {
17731 let token = match self
17732 .hub
17733 .auth
17734 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17735 .await
17736 {
17737 Ok(token) => token,
17738 Err(e) => match dlg.token(e) {
17739 Ok(token) => token,
17740 Err(e) => {
17741 dlg.finished(false);
17742 return Err(common::Error::MissingToken(e));
17743 }
17744 },
17745 };
17746 request_value_reader
17747 .seek(std::io::SeekFrom::Start(0))
17748 .unwrap();
17749 let mut req_result = {
17750 let client = &self.hub.client;
17751 dlg.pre_request();
17752 let mut req_builder = hyper::Request::builder()
17753 .method(hyper::Method::POST)
17754 .uri(url.as_str())
17755 .header(USER_AGENT, self.hub._user_agent.clone());
17756
17757 if let Some(token) = token.as_ref() {
17758 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17759 }
17760
17761 let request = req_builder
17762 .header(CONTENT_TYPE, json_mime_type.to_string())
17763 .header(CONTENT_LENGTH, request_size as u64)
17764 .body(common::to_body(
17765 request_value_reader.get_ref().clone().into(),
17766 ));
17767
17768 client.request(request.unwrap()).await
17769 };
17770
17771 match req_result {
17772 Err(err) => {
17773 if let common::Retry::After(d) = dlg.http_error(&err) {
17774 sleep(d).await;
17775 continue;
17776 }
17777 dlg.finished(false);
17778 return Err(common::Error::HttpError(err));
17779 }
17780 Ok(res) => {
17781 let (mut parts, body) = res.into_parts();
17782 let mut body = common::Body::new(body);
17783 if !parts.status.is_success() {
17784 let bytes = common::to_bytes(body).await.unwrap_or_default();
17785 let error = serde_json::from_str(&common::to_string(&bytes));
17786 let response = common::to_response(parts, bytes.into());
17787
17788 if let common::Retry::After(d) =
17789 dlg.http_failure(&response, error.as_ref().ok())
17790 {
17791 sleep(d).await;
17792 continue;
17793 }
17794
17795 dlg.finished(false);
17796
17797 return Err(match error {
17798 Ok(value) => common::Error::BadRequest(value),
17799 _ => common::Error::Failure(response),
17800 });
17801 }
17802 let response = {
17803 let bytes = common::to_bytes(body).await.unwrap_or_default();
17804 let encoded = common::to_string(&bytes);
17805 match serde_json::from_str(&encoded) {
17806 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17807 Err(error) => {
17808 dlg.response_json_decode_error(&encoded, &error);
17809 return Err(common::Error::JsonDecodeError(
17810 encoded.to_string(),
17811 error,
17812 ));
17813 }
17814 }
17815 };
17816
17817 dlg.finished(true);
17818 return Ok(response);
17819 }
17820 }
17821 }
17822 }
17823
17824 ///
17825 /// Sets the *request* property to the given value.
17826 ///
17827 /// Even though the property as already been set when instantiating this call,
17828 /// we provide this method for API completeness.
17829 pub fn request(
17830 mut self,
17831 new_value: MigrationJob,
17832 ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17833 self._request = new_value;
17834 self
17835 }
17836 /// Required. The parent which owns this collection of migration jobs.
17837 ///
17838 /// Sets the *parent* path property to the given value.
17839 ///
17840 /// Even though the property as already been set when instantiating this call,
17841 /// we provide this method for API completeness.
17842 pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17843 self._parent = new_value.to_string();
17844 self
17845 }
17846 /// 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.
17847 ///
17848 /// Sets the *request id* query property to the given value.
17849 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17850 self._request_id = Some(new_value.to_string());
17851 self
17852 }
17853 /// Required. The ID of the instance to create.
17854 ///
17855 /// Sets the *migration job id* query property to the given value.
17856 pub fn migration_job_id(
17857 mut self,
17858 new_value: &str,
17859 ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17860 self._migration_job_id = Some(new_value.to_string());
17861 self
17862 }
17863 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17864 /// while executing the actual API request.
17865 ///
17866 /// ````text
17867 /// It should be used to handle progress information, and to implement a certain level of resilience.
17868 /// ````
17869 ///
17870 /// Sets the *delegate* property to the given value.
17871 pub fn delegate(
17872 mut self,
17873 new_value: &'a mut dyn common::Delegate,
17874 ) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17875 self._delegate = Some(new_value);
17876 self
17877 }
17878
17879 /// Set any additional parameter of the query string used in the request.
17880 /// It should be used to set parameters which are not yet available through their own
17881 /// setters.
17882 ///
17883 /// Please note that this method must not be used to set any of the known parameters
17884 /// which have their own setter method. If done anyway, the request will fail.
17885 ///
17886 /// # Additional Parameters
17887 ///
17888 /// * *$.xgafv* (query-string) - V1 error format.
17889 /// * *access_token* (query-string) - OAuth access token.
17890 /// * *alt* (query-string) - Data format for response.
17891 /// * *callback* (query-string) - JSONP
17892 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17893 /// * *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.
17894 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17895 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17896 /// * *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.
17897 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17898 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17899 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobCreateCall<'a, C>
17900 where
17901 T: AsRef<str>,
17902 {
17903 self._additional_params
17904 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17905 self
17906 }
17907
17908 /// Identifies the authorization scope for the method you are building.
17909 ///
17910 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17911 /// [`Scope::CloudPlatform`].
17912 ///
17913 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17914 /// tokens for more than one scope.
17915 ///
17916 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17917 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17918 /// sufficient, a read-write scope will do as well.
17919 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobCreateCall<'a, C>
17920 where
17921 St: AsRef<str>,
17922 {
17923 self._scopes.insert(String::from(scope.as_ref()));
17924 self
17925 }
17926 /// Identifies the authorization scope(s) for the method you are building.
17927 ///
17928 /// See [`Self::add_scope()`] for details.
17929 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobCreateCall<'a, C>
17930 where
17931 I: IntoIterator<Item = St>,
17932 St: AsRef<str>,
17933 {
17934 self._scopes
17935 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17936 self
17937 }
17938
17939 /// Removes all scopes, and no default scope will be used either.
17940 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17941 /// for details).
17942 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobCreateCall<'a, C> {
17943 self._scopes.clear();
17944 self
17945 }
17946}
17947
17948/// Deletes a single migration job.
17949///
17950/// A builder for the *locations.migrationJobs.delete* method supported by a *project* resource.
17951/// It is not used directly, but through a [`ProjectMethods`] instance.
17952///
17953/// # Example
17954///
17955/// Instantiate a resource method builder
17956///
17957/// ```test_harness,no_run
17958/// # extern crate hyper;
17959/// # extern crate hyper_rustls;
17960/// # extern crate google_datamigration1 as datamigration1;
17961/// # async fn dox() {
17962/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17963///
17964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17965/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17966/// # .with_native_roots()
17967/// # .unwrap()
17968/// # .https_only()
17969/// # .enable_http2()
17970/// # .build();
17971///
17972/// # let executor = hyper_util::rt::TokioExecutor::new();
17973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17974/// # secret,
17975/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17976/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17977/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17978/// # ),
17979/// # ).build().await.unwrap();
17980///
17981/// # let client = hyper_util::client::legacy::Client::builder(
17982/// # hyper_util::rt::TokioExecutor::new()
17983/// # )
17984/// # .build(
17985/// # hyper_rustls::HttpsConnectorBuilder::new()
17986/// # .with_native_roots()
17987/// # .unwrap()
17988/// # .https_or_http()
17989/// # .enable_http2()
17990/// # .build()
17991/// # );
17992/// # let mut hub = DatabaseMigrationService::new(client, auth);
17993/// // You can configure optional parameters by calling the respective setters at will, and
17994/// // execute the final call using `doit()`.
17995/// // Values shown here are possibly random and not representative !
17996/// let result = hub.projects().locations_migration_jobs_delete("name")
17997/// .request_id("est")
17998/// .force(true)
17999/// .doit().await;
18000/// # }
18001/// ```
18002pub struct ProjectLocationMigrationJobDeleteCall<'a, C>
18003where
18004 C: 'a,
18005{
18006 hub: &'a DatabaseMigrationService<C>,
18007 _name: String,
18008 _request_id: Option<String>,
18009 _force: Option<bool>,
18010 _delegate: Option<&'a mut dyn common::Delegate>,
18011 _additional_params: HashMap<String, String>,
18012 _scopes: BTreeSet<String>,
18013}
18014
18015impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobDeleteCall<'a, C> {}
18016
18017impl<'a, C> ProjectLocationMigrationJobDeleteCall<'a, C>
18018where
18019 C: common::Connector,
18020{
18021 /// Perform the operation you have build so far.
18022 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18023 use std::borrow::Cow;
18024 use std::io::{Read, Seek};
18025
18026 use common::{url::Params, ToParts};
18027 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18028
18029 let mut dd = common::DefaultDelegate;
18030 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18031 dlg.begin(common::MethodInfo {
18032 id: "datamigration.projects.locations.migrationJobs.delete",
18033 http_method: hyper::Method::DELETE,
18034 });
18035
18036 for &field in ["alt", "name", "requestId", "force"].iter() {
18037 if self._additional_params.contains_key(field) {
18038 dlg.finished(false);
18039 return Err(common::Error::FieldClash(field));
18040 }
18041 }
18042
18043 let mut params = Params::with_capacity(5 + self._additional_params.len());
18044 params.push("name", self._name);
18045 if let Some(value) = self._request_id.as_ref() {
18046 params.push("requestId", value);
18047 }
18048 if let Some(value) = self._force.as_ref() {
18049 params.push("force", value.to_string());
18050 }
18051
18052 params.extend(self._additional_params.iter());
18053
18054 params.push("alt", "json");
18055 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18056 if self._scopes.is_empty() {
18057 self._scopes
18058 .insert(Scope::CloudPlatform.as_ref().to_string());
18059 }
18060
18061 #[allow(clippy::single_element_loop)]
18062 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18063 url = params.uri_replacement(url, param_name, find_this, true);
18064 }
18065 {
18066 let to_remove = ["name"];
18067 params.remove_params(&to_remove);
18068 }
18069
18070 let url = params.parse_with_url(&url);
18071
18072 loop {
18073 let token = match self
18074 .hub
18075 .auth
18076 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18077 .await
18078 {
18079 Ok(token) => token,
18080 Err(e) => match dlg.token(e) {
18081 Ok(token) => token,
18082 Err(e) => {
18083 dlg.finished(false);
18084 return Err(common::Error::MissingToken(e));
18085 }
18086 },
18087 };
18088 let mut req_result = {
18089 let client = &self.hub.client;
18090 dlg.pre_request();
18091 let mut req_builder = hyper::Request::builder()
18092 .method(hyper::Method::DELETE)
18093 .uri(url.as_str())
18094 .header(USER_AGENT, self.hub._user_agent.clone());
18095
18096 if let Some(token) = token.as_ref() {
18097 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18098 }
18099
18100 let request = req_builder
18101 .header(CONTENT_LENGTH, 0_u64)
18102 .body(common::to_body::<String>(None));
18103
18104 client.request(request.unwrap()).await
18105 };
18106
18107 match req_result {
18108 Err(err) => {
18109 if let common::Retry::After(d) = dlg.http_error(&err) {
18110 sleep(d).await;
18111 continue;
18112 }
18113 dlg.finished(false);
18114 return Err(common::Error::HttpError(err));
18115 }
18116 Ok(res) => {
18117 let (mut parts, body) = res.into_parts();
18118 let mut body = common::Body::new(body);
18119 if !parts.status.is_success() {
18120 let bytes = common::to_bytes(body).await.unwrap_or_default();
18121 let error = serde_json::from_str(&common::to_string(&bytes));
18122 let response = common::to_response(parts, bytes.into());
18123
18124 if let common::Retry::After(d) =
18125 dlg.http_failure(&response, error.as_ref().ok())
18126 {
18127 sleep(d).await;
18128 continue;
18129 }
18130
18131 dlg.finished(false);
18132
18133 return Err(match error {
18134 Ok(value) => common::Error::BadRequest(value),
18135 _ => common::Error::Failure(response),
18136 });
18137 }
18138 let response = {
18139 let bytes = common::to_bytes(body).await.unwrap_or_default();
18140 let encoded = common::to_string(&bytes);
18141 match serde_json::from_str(&encoded) {
18142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18143 Err(error) => {
18144 dlg.response_json_decode_error(&encoded, &error);
18145 return Err(common::Error::JsonDecodeError(
18146 encoded.to_string(),
18147 error,
18148 ));
18149 }
18150 }
18151 };
18152
18153 dlg.finished(true);
18154 return Ok(response);
18155 }
18156 }
18157 }
18158 }
18159
18160 /// Required. Name of the migration job resource to delete.
18161 ///
18162 /// Sets the *name* path property to the given value.
18163 ///
18164 /// Even though the property as already been set when instantiating this call,
18165 /// we provide this method for API completeness.
18166 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
18167 self._name = new_value.to_string();
18168 self
18169 }
18170 /// 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.
18171 ///
18172 /// Sets the *request id* query property to the given value.
18173 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
18174 self._request_id = Some(new_value.to_string());
18175 self
18176 }
18177 /// 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.
18178 ///
18179 /// Sets the *force* query property to the given value.
18180 pub fn force(mut self, new_value: bool) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
18181 self._force = Some(new_value);
18182 self
18183 }
18184 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18185 /// while executing the actual API request.
18186 ///
18187 /// ````text
18188 /// It should be used to handle progress information, and to implement a certain level of resilience.
18189 /// ````
18190 ///
18191 /// Sets the *delegate* property to the given value.
18192 pub fn delegate(
18193 mut self,
18194 new_value: &'a mut dyn common::Delegate,
18195 ) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
18196 self._delegate = Some(new_value);
18197 self
18198 }
18199
18200 /// Set any additional parameter of the query string used in the request.
18201 /// It should be used to set parameters which are not yet available through their own
18202 /// setters.
18203 ///
18204 /// Please note that this method must not be used to set any of the known parameters
18205 /// which have their own setter method. If done anyway, the request will fail.
18206 ///
18207 /// # Additional Parameters
18208 ///
18209 /// * *$.xgafv* (query-string) - V1 error format.
18210 /// * *access_token* (query-string) - OAuth access token.
18211 /// * *alt* (query-string) - Data format for response.
18212 /// * *callback* (query-string) - JSONP
18213 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18214 /// * *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.
18215 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18216 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18217 /// * *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.
18218 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18219 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18220 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobDeleteCall<'a, C>
18221 where
18222 T: AsRef<str>,
18223 {
18224 self._additional_params
18225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18226 self
18227 }
18228
18229 /// Identifies the authorization scope for the method you are building.
18230 ///
18231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18232 /// [`Scope::CloudPlatform`].
18233 ///
18234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18235 /// tokens for more than one scope.
18236 ///
18237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18239 /// sufficient, a read-write scope will do as well.
18240 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobDeleteCall<'a, C>
18241 where
18242 St: AsRef<str>,
18243 {
18244 self._scopes.insert(String::from(scope.as_ref()));
18245 self
18246 }
18247 /// Identifies the authorization scope(s) for the method you are building.
18248 ///
18249 /// See [`Self::add_scope()`] for details.
18250 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobDeleteCall<'a, C>
18251 where
18252 I: IntoIterator<Item = St>,
18253 St: AsRef<str>,
18254 {
18255 self._scopes
18256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18257 self
18258 }
18259
18260 /// Removes all scopes, and no default scope will be used either.
18261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18262 /// for details).
18263 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobDeleteCall<'a, C> {
18264 self._scopes.clear();
18265 self
18266 }
18267}
18268
18269/// 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.
18270///
18271/// A builder for the *locations.migrationJobs.demoteDestination* method supported by a *project* resource.
18272/// It is not used directly, but through a [`ProjectMethods`] instance.
18273///
18274/// # Example
18275///
18276/// Instantiate a resource method builder
18277///
18278/// ```test_harness,no_run
18279/// # extern crate hyper;
18280/// # extern crate hyper_rustls;
18281/// # extern crate google_datamigration1 as datamigration1;
18282/// use datamigration1::api::DemoteDestinationRequest;
18283/// # async fn dox() {
18284/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18285///
18286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18287/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18288/// # .with_native_roots()
18289/// # .unwrap()
18290/// # .https_only()
18291/// # .enable_http2()
18292/// # .build();
18293///
18294/// # let executor = hyper_util::rt::TokioExecutor::new();
18295/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18296/// # secret,
18297/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18298/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18299/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18300/// # ),
18301/// # ).build().await.unwrap();
18302///
18303/// # let client = hyper_util::client::legacy::Client::builder(
18304/// # hyper_util::rt::TokioExecutor::new()
18305/// # )
18306/// # .build(
18307/// # hyper_rustls::HttpsConnectorBuilder::new()
18308/// # .with_native_roots()
18309/// # .unwrap()
18310/// # .https_or_http()
18311/// # .enable_http2()
18312/// # .build()
18313/// # );
18314/// # let mut hub = DatabaseMigrationService::new(client, auth);
18315/// // As the method needs a request, you would usually fill it with the desired information
18316/// // into the respective structure. Some of the parts shown here might not be applicable !
18317/// // Values shown here are possibly random and not representative !
18318/// let mut req = DemoteDestinationRequest::default();
18319///
18320/// // You can configure optional parameters by calling the respective setters at will, and
18321/// // execute the final call using `doit()`.
18322/// // Values shown here are possibly random and not representative !
18323/// let result = hub.projects().locations_migration_jobs_demote_destination(req, "name")
18324/// .doit().await;
18325/// # }
18326/// ```
18327pub struct ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
18328where
18329 C: 'a,
18330{
18331 hub: &'a DatabaseMigrationService<C>,
18332 _request: DemoteDestinationRequest,
18333 _name: String,
18334 _delegate: Option<&'a mut dyn common::Delegate>,
18335 _additional_params: HashMap<String, String>,
18336 _scopes: BTreeSet<String>,
18337}
18338
18339impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {}
18340
18341impl<'a, C> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
18342where
18343 C: common::Connector,
18344{
18345 /// Perform the operation you have build so far.
18346 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18347 use std::borrow::Cow;
18348 use std::io::{Read, Seek};
18349
18350 use common::{url::Params, ToParts};
18351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18352
18353 let mut dd = common::DefaultDelegate;
18354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18355 dlg.begin(common::MethodInfo {
18356 id: "datamigration.projects.locations.migrationJobs.demoteDestination",
18357 http_method: hyper::Method::POST,
18358 });
18359
18360 for &field in ["alt", "name"].iter() {
18361 if self._additional_params.contains_key(field) {
18362 dlg.finished(false);
18363 return Err(common::Error::FieldClash(field));
18364 }
18365 }
18366
18367 let mut params = Params::with_capacity(4 + self._additional_params.len());
18368 params.push("name", self._name);
18369
18370 params.extend(self._additional_params.iter());
18371
18372 params.push("alt", "json");
18373 let mut url = self.hub._base_url.clone() + "v1/{+name}:demoteDestination";
18374 if self._scopes.is_empty() {
18375 self._scopes
18376 .insert(Scope::CloudPlatform.as_ref().to_string());
18377 }
18378
18379 #[allow(clippy::single_element_loop)]
18380 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18381 url = params.uri_replacement(url, param_name, find_this, true);
18382 }
18383 {
18384 let to_remove = ["name"];
18385 params.remove_params(&to_remove);
18386 }
18387
18388 let url = params.parse_with_url(&url);
18389
18390 let mut json_mime_type = mime::APPLICATION_JSON;
18391 let mut request_value_reader = {
18392 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18393 common::remove_json_null_values(&mut value);
18394 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18395 serde_json::to_writer(&mut dst, &value).unwrap();
18396 dst
18397 };
18398 let request_size = request_value_reader
18399 .seek(std::io::SeekFrom::End(0))
18400 .unwrap();
18401 request_value_reader
18402 .seek(std::io::SeekFrom::Start(0))
18403 .unwrap();
18404
18405 loop {
18406 let token = match self
18407 .hub
18408 .auth
18409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18410 .await
18411 {
18412 Ok(token) => token,
18413 Err(e) => match dlg.token(e) {
18414 Ok(token) => token,
18415 Err(e) => {
18416 dlg.finished(false);
18417 return Err(common::Error::MissingToken(e));
18418 }
18419 },
18420 };
18421 request_value_reader
18422 .seek(std::io::SeekFrom::Start(0))
18423 .unwrap();
18424 let mut req_result = {
18425 let client = &self.hub.client;
18426 dlg.pre_request();
18427 let mut req_builder = hyper::Request::builder()
18428 .method(hyper::Method::POST)
18429 .uri(url.as_str())
18430 .header(USER_AGENT, self.hub._user_agent.clone());
18431
18432 if let Some(token) = token.as_ref() {
18433 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18434 }
18435
18436 let request = req_builder
18437 .header(CONTENT_TYPE, json_mime_type.to_string())
18438 .header(CONTENT_LENGTH, request_size as u64)
18439 .body(common::to_body(
18440 request_value_reader.get_ref().clone().into(),
18441 ));
18442
18443 client.request(request.unwrap()).await
18444 };
18445
18446 match req_result {
18447 Err(err) => {
18448 if let common::Retry::After(d) = dlg.http_error(&err) {
18449 sleep(d).await;
18450 continue;
18451 }
18452 dlg.finished(false);
18453 return Err(common::Error::HttpError(err));
18454 }
18455 Ok(res) => {
18456 let (mut parts, body) = res.into_parts();
18457 let mut body = common::Body::new(body);
18458 if !parts.status.is_success() {
18459 let bytes = common::to_bytes(body).await.unwrap_or_default();
18460 let error = serde_json::from_str(&common::to_string(&bytes));
18461 let response = common::to_response(parts, bytes.into());
18462
18463 if let common::Retry::After(d) =
18464 dlg.http_failure(&response, error.as_ref().ok())
18465 {
18466 sleep(d).await;
18467 continue;
18468 }
18469
18470 dlg.finished(false);
18471
18472 return Err(match error {
18473 Ok(value) => common::Error::BadRequest(value),
18474 _ => common::Error::Failure(response),
18475 });
18476 }
18477 let response = {
18478 let bytes = common::to_bytes(body).await.unwrap_or_default();
18479 let encoded = common::to_string(&bytes);
18480 match serde_json::from_str(&encoded) {
18481 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18482 Err(error) => {
18483 dlg.response_json_decode_error(&encoded, &error);
18484 return Err(common::Error::JsonDecodeError(
18485 encoded.to_string(),
18486 error,
18487 ));
18488 }
18489 }
18490 };
18491
18492 dlg.finished(true);
18493 return Ok(response);
18494 }
18495 }
18496 }
18497 }
18498
18499 ///
18500 /// Sets the *request* property to the given value.
18501 ///
18502 /// Even though the property as already been set when instantiating this call,
18503 /// we provide this method for API completeness.
18504 pub fn request(
18505 mut self,
18506 new_value: DemoteDestinationRequest,
18507 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
18508 self._request = new_value;
18509 self
18510 }
18511 /// Name of the migration job resource to demote its destination.
18512 ///
18513 /// Sets the *name* path property to the given value.
18514 ///
18515 /// Even though the property as already been set when instantiating this call,
18516 /// we provide this method for API completeness.
18517 pub fn name(
18518 mut self,
18519 new_value: &str,
18520 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
18521 self._name = new_value.to_string();
18522 self
18523 }
18524 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18525 /// while executing the actual API request.
18526 ///
18527 /// ````text
18528 /// It should be used to handle progress information, and to implement a certain level of resilience.
18529 /// ````
18530 ///
18531 /// Sets the *delegate* property to the given value.
18532 pub fn delegate(
18533 mut self,
18534 new_value: &'a mut dyn common::Delegate,
18535 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
18536 self._delegate = Some(new_value);
18537 self
18538 }
18539
18540 /// Set any additional parameter of the query string used in the request.
18541 /// It should be used to set parameters which are not yet available through their own
18542 /// setters.
18543 ///
18544 /// Please note that this method must not be used to set any of the known parameters
18545 /// which have their own setter method. If done anyway, the request will fail.
18546 ///
18547 /// # Additional Parameters
18548 ///
18549 /// * *$.xgafv* (query-string) - V1 error format.
18550 /// * *access_token* (query-string) - OAuth access token.
18551 /// * *alt* (query-string) - Data format for response.
18552 /// * *callback* (query-string) - JSONP
18553 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18554 /// * *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.
18555 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18556 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18557 /// * *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.
18558 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18559 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18560 pub fn param<T>(
18561 mut self,
18562 name: T,
18563 value: T,
18564 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
18565 where
18566 T: AsRef<str>,
18567 {
18568 self._additional_params
18569 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18570 self
18571 }
18572
18573 /// Identifies the authorization scope for the method you are building.
18574 ///
18575 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18576 /// [`Scope::CloudPlatform`].
18577 ///
18578 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18579 /// tokens for more than one scope.
18580 ///
18581 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18582 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18583 /// sufficient, a read-write scope will do as well.
18584 pub fn add_scope<St>(
18585 mut self,
18586 scope: St,
18587 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
18588 where
18589 St: AsRef<str>,
18590 {
18591 self._scopes.insert(String::from(scope.as_ref()));
18592 self
18593 }
18594 /// Identifies the authorization scope(s) for the method you are building.
18595 ///
18596 /// See [`Self::add_scope()`] for details.
18597 pub fn add_scopes<I, St>(
18598 mut self,
18599 scopes: I,
18600 ) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C>
18601 where
18602 I: IntoIterator<Item = St>,
18603 St: AsRef<str>,
18604 {
18605 self._scopes
18606 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18607 self
18608 }
18609
18610 /// Removes all scopes, and no default scope will be used either.
18611 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18612 /// for details).
18613 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobDemoteDestinationCall<'a, C> {
18614 self._scopes.clear();
18615 self
18616 }
18617}
18618
18619/// Retrieves objects from the source database that can be selected for data migration. This is applicable for the following migrations: 1. PostgreSQL to Cloud SQL for PostgreSQL 2. PostgreSQL to AlloyDB for PostgreSQL.
18620///
18621/// A builder for the *locations.migrationJobs.fetchSourceObjects* method supported by a *project* resource.
18622/// It is not used directly, but through a [`ProjectMethods`] instance.
18623///
18624/// # Example
18625///
18626/// Instantiate a resource method builder
18627///
18628/// ```test_harness,no_run
18629/// # extern crate hyper;
18630/// # extern crate hyper_rustls;
18631/// # extern crate google_datamigration1 as datamigration1;
18632/// # async fn dox() {
18633/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18634///
18635/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18636/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18637/// # .with_native_roots()
18638/// # .unwrap()
18639/// # .https_only()
18640/// # .enable_http2()
18641/// # .build();
18642///
18643/// # let executor = hyper_util::rt::TokioExecutor::new();
18644/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18645/// # secret,
18646/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18647/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18648/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18649/// # ),
18650/// # ).build().await.unwrap();
18651///
18652/// # let client = hyper_util::client::legacy::Client::builder(
18653/// # hyper_util::rt::TokioExecutor::new()
18654/// # )
18655/// # .build(
18656/// # hyper_rustls::HttpsConnectorBuilder::new()
18657/// # .with_native_roots()
18658/// # .unwrap()
18659/// # .https_or_http()
18660/// # .enable_http2()
18661/// # .build()
18662/// # );
18663/// # let mut hub = DatabaseMigrationService::new(client, auth);
18664/// // You can configure optional parameters by calling the respective setters at will, and
18665/// // execute the final call using `doit()`.
18666/// // Values shown here are possibly random and not representative !
18667/// let result = hub.projects().locations_migration_jobs_fetch_source_objects("name")
18668/// .doit().await;
18669/// # }
18670/// ```
18671pub struct ProjectLocationMigrationJobFetchSourceObjectCall<'a, C>
18672where
18673 C: 'a,
18674{
18675 hub: &'a DatabaseMigrationService<C>,
18676 _name: String,
18677 _delegate: Option<&'a mut dyn common::Delegate>,
18678 _additional_params: HashMap<String, String>,
18679 _scopes: BTreeSet<String>,
18680}
18681
18682impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobFetchSourceObjectCall<'a, C> {}
18683
18684impl<'a, C> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C>
18685where
18686 C: common::Connector,
18687{
18688 /// Perform the operation you have build so far.
18689 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18690 use std::borrow::Cow;
18691 use std::io::{Read, Seek};
18692
18693 use common::{url::Params, ToParts};
18694 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18695
18696 let mut dd = common::DefaultDelegate;
18697 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18698 dlg.begin(common::MethodInfo {
18699 id: "datamigration.projects.locations.migrationJobs.fetchSourceObjects",
18700 http_method: hyper::Method::GET,
18701 });
18702
18703 for &field in ["alt", "name"].iter() {
18704 if self._additional_params.contains_key(field) {
18705 dlg.finished(false);
18706 return Err(common::Error::FieldClash(field));
18707 }
18708 }
18709
18710 let mut params = Params::with_capacity(3 + self._additional_params.len());
18711 params.push("name", self._name);
18712
18713 params.extend(self._additional_params.iter());
18714
18715 params.push("alt", "json");
18716 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchSourceObjects";
18717 if self._scopes.is_empty() {
18718 self._scopes
18719 .insert(Scope::CloudPlatform.as_ref().to_string());
18720 }
18721
18722 #[allow(clippy::single_element_loop)]
18723 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18724 url = params.uri_replacement(url, param_name, find_this, true);
18725 }
18726 {
18727 let to_remove = ["name"];
18728 params.remove_params(&to_remove);
18729 }
18730
18731 let url = params.parse_with_url(&url);
18732
18733 loop {
18734 let token = match self
18735 .hub
18736 .auth
18737 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18738 .await
18739 {
18740 Ok(token) => token,
18741 Err(e) => match dlg.token(e) {
18742 Ok(token) => token,
18743 Err(e) => {
18744 dlg.finished(false);
18745 return Err(common::Error::MissingToken(e));
18746 }
18747 },
18748 };
18749 let mut req_result = {
18750 let client = &self.hub.client;
18751 dlg.pre_request();
18752 let mut req_builder = hyper::Request::builder()
18753 .method(hyper::Method::GET)
18754 .uri(url.as_str())
18755 .header(USER_AGENT, self.hub._user_agent.clone());
18756
18757 if let Some(token) = token.as_ref() {
18758 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18759 }
18760
18761 let request = req_builder
18762 .header(CONTENT_LENGTH, 0_u64)
18763 .body(common::to_body::<String>(None));
18764
18765 client.request(request.unwrap()).await
18766 };
18767
18768 match req_result {
18769 Err(err) => {
18770 if let common::Retry::After(d) = dlg.http_error(&err) {
18771 sleep(d).await;
18772 continue;
18773 }
18774 dlg.finished(false);
18775 return Err(common::Error::HttpError(err));
18776 }
18777 Ok(res) => {
18778 let (mut parts, body) = res.into_parts();
18779 let mut body = common::Body::new(body);
18780 if !parts.status.is_success() {
18781 let bytes = common::to_bytes(body).await.unwrap_or_default();
18782 let error = serde_json::from_str(&common::to_string(&bytes));
18783 let response = common::to_response(parts, bytes.into());
18784
18785 if let common::Retry::After(d) =
18786 dlg.http_failure(&response, error.as_ref().ok())
18787 {
18788 sleep(d).await;
18789 continue;
18790 }
18791
18792 dlg.finished(false);
18793
18794 return Err(match error {
18795 Ok(value) => common::Error::BadRequest(value),
18796 _ => common::Error::Failure(response),
18797 });
18798 }
18799 let response = {
18800 let bytes = common::to_bytes(body).await.unwrap_or_default();
18801 let encoded = common::to_string(&bytes);
18802 match serde_json::from_str(&encoded) {
18803 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18804 Err(error) => {
18805 dlg.response_json_decode_error(&encoded, &error);
18806 return Err(common::Error::JsonDecodeError(
18807 encoded.to_string(),
18808 error,
18809 ));
18810 }
18811 }
18812 };
18813
18814 dlg.finished(true);
18815 return Ok(response);
18816 }
18817 }
18818 }
18819 }
18820
18821 /// Required. The resource name for the migration job for which source objects should be returned.
18822 ///
18823 /// Sets the *name* path property to the given value.
18824 ///
18825 /// Even though the property as already been set when instantiating this call,
18826 /// we provide this method for API completeness.
18827 pub fn name(
18828 mut self,
18829 new_value: &str,
18830 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C> {
18831 self._name = new_value.to_string();
18832 self
18833 }
18834 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18835 /// while executing the actual API request.
18836 ///
18837 /// ````text
18838 /// It should be used to handle progress information, and to implement a certain level of resilience.
18839 /// ````
18840 ///
18841 /// Sets the *delegate* property to the given value.
18842 pub fn delegate(
18843 mut self,
18844 new_value: &'a mut dyn common::Delegate,
18845 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C> {
18846 self._delegate = Some(new_value);
18847 self
18848 }
18849
18850 /// Set any additional parameter of the query string used in the request.
18851 /// It should be used to set parameters which are not yet available through their own
18852 /// setters.
18853 ///
18854 /// Please note that this method must not be used to set any of the known parameters
18855 /// which have their own setter method. If done anyway, the request will fail.
18856 ///
18857 /// # Additional Parameters
18858 ///
18859 /// * *$.xgafv* (query-string) - V1 error format.
18860 /// * *access_token* (query-string) - OAuth access token.
18861 /// * *alt* (query-string) - Data format for response.
18862 /// * *callback* (query-string) - JSONP
18863 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18864 /// * *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.
18865 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18866 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18867 /// * *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.
18868 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18869 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18870 pub fn param<T>(
18871 mut self,
18872 name: T,
18873 value: T,
18874 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C>
18875 where
18876 T: AsRef<str>,
18877 {
18878 self._additional_params
18879 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18880 self
18881 }
18882
18883 /// Identifies the authorization scope for the method you are building.
18884 ///
18885 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18886 /// [`Scope::CloudPlatform`].
18887 ///
18888 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18889 /// tokens for more than one scope.
18890 ///
18891 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18892 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18893 /// sufficient, a read-write scope will do as well.
18894 pub fn add_scope<St>(
18895 mut self,
18896 scope: St,
18897 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C>
18898 where
18899 St: AsRef<str>,
18900 {
18901 self._scopes.insert(String::from(scope.as_ref()));
18902 self
18903 }
18904 /// Identifies the authorization scope(s) for the method you are building.
18905 ///
18906 /// See [`Self::add_scope()`] for details.
18907 pub fn add_scopes<I, St>(
18908 mut self,
18909 scopes: I,
18910 ) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C>
18911 where
18912 I: IntoIterator<Item = St>,
18913 St: AsRef<str>,
18914 {
18915 self._scopes
18916 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18917 self
18918 }
18919
18920 /// Removes all scopes, and no default scope will be used either.
18921 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18922 /// for details).
18923 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobFetchSourceObjectCall<'a, C> {
18924 self._scopes.clear();
18925 self
18926 }
18927}
18928
18929/// Generate a SSH configuration script to configure the reverse SSH connectivity.
18930///
18931/// A builder for the *locations.migrationJobs.generateSshScript* method supported by a *project* resource.
18932/// It is not used directly, but through a [`ProjectMethods`] instance.
18933///
18934/// # Example
18935///
18936/// Instantiate a resource method builder
18937///
18938/// ```test_harness,no_run
18939/// # extern crate hyper;
18940/// # extern crate hyper_rustls;
18941/// # extern crate google_datamigration1 as datamigration1;
18942/// use datamigration1::api::GenerateSshScriptRequest;
18943/// # async fn dox() {
18944/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18945///
18946/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18947/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18948/// # .with_native_roots()
18949/// # .unwrap()
18950/// # .https_only()
18951/// # .enable_http2()
18952/// # .build();
18953///
18954/// # let executor = hyper_util::rt::TokioExecutor::new();
18955/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18956/// # secret,
18957/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18958/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18959/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18960/// # ),
18961/// # ).build().await.unwrap();
18962///
18963/// # let client = hyper_util::client::legacy::Client::builder(
18964/// # hyper_util::rt::TokioExecutor::new()
18965/// # )
18966/// # .build(
18967/// # hyper_rustls::HttpsConnectorBuilder::new()
18968/// # .with_native_roots()
18969/// # .unwrap()
18970/// # .https_or_http()
18971/// # .enable_http2()
18972/// # .build()
18973/// # );
18974/// # let mut hub = DatabaseMigrationService::new(client, auth);
18975/// // As the method needs a request, you would usually fill it with the desired information
18976/// // into the respective structure. Some of the parts shown here might not be applicable !
18977/// // Values shown here are possibly random and not representative !
18978/// let mut req = GenerateSshScriptRequest::default();
18979///
18980/// // You can configure optional parameters by calling the respective setters at will, and
18981/// // execute the final call using `doit()`.
18982/// // Values shown here are possibly random and not representative !
18983/// let result = hub.projects().locations_migration_jobs_generate_ssh_script(req, "migrationJob")
18984/// .doit().await;
18985/// # }
18986/// ```
18987pub struct ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
18988where
18989 C: 'a,
18990{
18991 hub: &'a DatabaseMigrationService<C>,
18992 _request: GenerateSshScriptRequest,
18993 _migration_job: String,
18994 _delegate: Option<&'a mut dyn common::Delegate>,
18995 _additional_params: HashMap<String, String>,
18996 _scopes: BTreeSet<String>,
18997}
18998
18999impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {}
19000
19001impl<'a, C> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
19002where
19003 C: common::Connector,
19004{
19005 /// Perform the operation you have build so far.
19006 pub async fn doit(mut self) -> common::Result<(common::Response, SshScript)> {
19007 use std::borrow::Cow;
19008 use std::io::{Read, Seek};
19009
19010 use common::{url::Params, ToParts};
19011 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19012
19013 let mut dd = common::DefaultDelegate;
19014 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19015 dlg.begin(common::MethodInfo {
19016 id: "datamigration.projects.locations.migrationJobs.generateSshScript",
19017 http_method: hyper::Method::POST,
19018 });
19019
19020 for &field in ["alt", "migrationJob"].iter() {
19021 if self._additional_params.contains_key(field) {
19022 dlg.finished(false);
19023 return Err(common::Error::FieldClash(field));
19024 }
19025 }
19026
19027 let mut params = Params::with_capacity(4 + self._additional_params.len());
19028 params.push("migrationJob", self._migration_job);
19029
19030 params.extend(self._additional_params.iter());
19031
19032 params.push("alt", "json");
19033 let mut url = self.hub._base_url.clone() + "v1/{+migrationJob}:generateSshScript";
19034 if self._scopes.is_empty() {
19035 self._scopes
19036 .insert(Scope::CloudPlatform.as_ref().to_string());
19037 }
19038
19039 #[allow(clippy::single_element_loop)]
19040 for &(find_this, param_name) in [("{+migrationJob}", "migrationJob")].iter() {
19041 url = params.uri_replacement(url, param_name, find_this, true);
19042 }
19043 {
19044 let to_remove = ["migrationJob"];
19045 params.remove_params(&to_remove);
19046 }
19047
19048 let url = params.parse_with_url(&url);
19049
19050 let mut json_mime_type = mime::APPLICATION_JSON;
19051 let mut request_value_reader = {
19052 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19053 common::remove_json_null_values(&mut value);
19054 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19055 serde_json::to_writer(&mut dst, &value).unwrap();
19056 dst
19057 };
19058 let request_size = request_value_reader
19059 .seek(std::io::SeekFrom::End(0))
19060 .unwrap();
19061 request_value_reader
19062 .seek(std::io::SeekFrom::Start(0))
19063 .unwrap();
19064
19065 loop {
19066 let token = match self
19067 .hub
19068 .auth
19069 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19070 .await
19071 {
19072 Ok(token) => token,
19073 Err(e) => match dlg.token(e) {
19074 Ok(token) => token,
19075 Err(e) => {
19076 dlg.finished(false);
19077 return Err(common::Error::MissingToken(e));
19078 }
19079 },
19080 };
19081 request_value_reader
19082 .seek(std::io::SeekFrom::Start(0))
19083 .unwrap();
19084 let mut req_result = {
19085 let client = &self.hub.client;
19086 dlg.pre_request();
19087 let mut req_builder = hyper::Request::builder()
19088 .method(hyper::Method::POST)
19089 .uri(url.as_str())
19090 .header(USER_AGENT, self.hub._user_agent.clone());
19091
19092 if let Some(token) = token.as_ref() {
19093 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19094 }
19095
19096 let request = req_builder
19097 .header(CONTENT_TYPE, json_mime_type.to_string())
19098 .header(CONTENT_LENGTH, request_size as u64)
19099 .body(common::to_body(
19100 request_value_reader.get_ref().clone().into(),
19101 ));
19102
19103 client.request(request.unwrap()).await
19104 };
19105
19106 match req_result {
19107 Err(err) => {
19108 if let common::Retry::After(d) = dlg.http_error(&err) {
19109 sleep(d).await;
19110 continue;
19111 }
19112 dlg.finished(false);
19113 return Err(common::Error::HttpError(err));
19114 }
19115 Ok(res) => {
19116 let (mut parts, body) = res.into_parts();
19117 let mut body = common::Body::new(body);
19118 if !parts.status.is_success() {
19119 let bytes = common::to_bytes(body).await.unwrap_or_default();
19120 let error = serde_json::from_str(&common::to_string(&bytes));
19121 let response = common::to_response(parts, bytes.into());
19122
19123 if let common::Retry::After(d) =
19124 dlg.http_failure(&response, error.as_ref().ok())
19125 {
19126 sleep(d).await;
19127 continue;
19128 }
19129
19130 dlg.finished(false);
19131
19132 return Err(match error {
19133 Ok(value) => common::Error::BadRequest(value),
19134 _ => common::Error::Failure(response),
19135 });
19136 }
19137 let response = {
19138 let bytes = common::to_bytes(body).await.unwrap_or_default();
19139 let encoded = common::to_string(&bytes);
19140 match serde_json::from_str(&encoded) {
19141 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19142 Err(error) => {
19143 dlg.response_json_decode_error(&encoded, &error);
19144 return Err(common::Error::JsonDecodeError(
19145 encoded.to_string(),
19146 error,
19147 ));
19148 }
19149 }
19150 };
19151
19152 dlg.finished(true);
19153 return Ok(response);
19154 }
19155 }
19156 }
19157 }
19158
19159 ///
19160 /// Sets the *request* property to the given value.
19161 ///
19162 /// Even though the property as already been set when instantiating this call,
19163 /// we provide this method for API completeness.
19164 pub fn request(
19165 mut self,
19166 new_value: GenerateSshScriptRequest,
19167 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
19168 self._request = new_value;
19169 self
19170 }
19171 /// Name of the migration job resource to generate the SSH script.
19172 ///
19173 /// Sets the *migration job* path property to the given value.
19174 ///
19175 /// Even though the property as already been set when instantiating this call,
19176 /// we provide this method for API completeness.
19177 pub fn migration_job(
19178 mut self,
19179 new_value: &str,
19180 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
19181 self._migration_job = new_value.to_string();
19182 self
19183 }
19184 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19185 /// while executing the actual API request.
19186 ///
19187 /// ````text
19188 /// It should be used to handle progress information, and to implement a certain level of resilience.
19189 /// ````
19190 ///
19191 /// Sets the *delegate* property to the given value.
19192 pub fn delegate(
19193 mut self,
19194 new_value: &'a mut dyn common::Delegate,
19195 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
19196 self._delegate = Some(new_value);
19197 self
19198 }
19199
19200 /// Set any additional parameter of the query string used in the request.
19201 /// It should be used to set parameters which are not yet available through their own
19202 /// setters.
19203 ///
19204 /// Please note that this method must not be used to set any of the known parameters
19205 /// which have their own setter method. If done anyway, the request will fail.
19206 ///
19207 /// # Additional Parameters
19208 ///
19209 /// * *$.xgafv* (query-string) - V1 error format.
19210 /// * *access_token* (query-string) - OAuth access token.
19211 /// * *alt* (query-string) - Data format for response.
19212 /// * *callback* (query-string) - JSONP
19213 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19214 /// * *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.
19215 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19216 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19217 /// * *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.
19218 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19219 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19220 pub fn param<T>(
19221 mut self,
19222 name: T,
19223 value: T,
19224 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
19225 where
19226 T: AsRef<str>,
19227 {
19228 self._additional_params
19229 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19230 self
19231 }
19232
19233 /// Identifies the authorization scope for the method you are building.
19234 ///
19235 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19236 /// [`Scope::CloudPlatform`].
19237 ///
19238 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19239 /// tokens for more than one scope.
19240 ///
19241 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19242 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19243 /// sufficient, a read-write scope will do as well.
19244 pub fn add_scope<St>(
19245 mut self,
19246 scope: St,
19247 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
19248 where
19249 St: AsRef<str>,
19250 {
19251 self._scopes.insert(String::from(scope.as_ref()));
19252 self
19253 }
19254 /// Identifies the authorization scope(s) for the method you are building.
19255 ///
19256 /// See [`Self::add_scope()`] for details.
19257 pub fn add_scopes<I, St>(
19258 mut self,
19259 scopes: I,
19260 ) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C>
19261 where
19262 I: IntoIterator<Item = St>,
19263 St: AsRef<str>,
19264 {
19265 self._scopes
19266 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19267 self
19268 }
19269
19270 /// Removes all scopes, and no default scope will be used either.
19271 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19272 /// for details).
19273 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGenerateSshScriptCall<'a, C> {
19274 self._scopes.clear();
19275 self
19276 }
19277}
19278
19279/// Generate a TCP Proxy configuration script to configure a cloud-hosted VM running a TCP Proxy.
19280///
19281/// A builder for the *locations.migrationJobs.generateTcpProxyScript* method supported by a *project* resource.
19282/// It is not used directly, but through a [`ProjectMethods`] instance.
19283///
19284/// # Example
19285///
19286/// Instantiate a resource method builder
19287///
19288/// ```test_harness,no_run
19289/// # extern crate hyper;
19290/// # extern crate hyper_rustls;
19291/// # extern crate google_datamigration1 as datamigration1;
19292/// use datamigration1::api::GenerateTcpProxyScriptRequest;
19293/// # async fn dox() {
19294/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19295///
19296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19297/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19298/// # .with_native_roots()
19299/// # .unwrap()
19300/// # .https_only()
19301/// # .enable_http2()
19302/// # .build();
19303///
19304/// # let executor = hyper_util::rt::TokioExecutor::new();
19305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19306/// # secret,
19307/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19308/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19309/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19310/// # ),
19311/// # ).build().await.unwrap();
19312///
19313/// # let client = hyper_util::client::legacy::Client::builder(
19314/// # hyper_util::rt::TokioExecutor::new()
19315/// # )
19316/// # .build(
19317/// # hyper_rustls::HttpsConnectorBuilder::new()
19318/// # .with_native_roots()
19319/// # .unwrap()
19320/// # .https_or_http()
19321/// # .enable_http2()
19322/// # .build()
19323/// # );
19324/// # let mut hub = DatabaseMigrationService::new(client, auth);
19325/// // As the method needs a request, you would usually fill it with the desired information
19326/// // into the respective structure. Some of the parts shown here might not be applicable !
19327/// // Values shown here are possibly random and not representative !
19328/// let mut req = GenerateTcpProxyScriptRequest::default();
19329///
19330/// // You can configure optional parameters by calling the respective setters at will, and
19331/// // execute the final call using `doit()`.
19332/// // Values shown here are possibly random and not representative !
19333/// let result = hub.projects().locations_migration_jobs_generate_tcp_proxy_script(req, "migrationJob")
19334/// .doit().await;
19335/// # }
19336/// ```
19337pub struct ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
19338where
19339 C: 'a,
19340{
19341 hub: &'a DatabaseMigrationService<C>,
19342 _request: GenerateTcpProxyScriptRequest,
19343 _migration_job: String,
19344 _delegate: Option<&'a mut dyn common::Delegate>,
19345 _additional_params: HashMap<String, String>,
19346 _scopes: BTreeSet<String>,
19347}
19348
19349impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {}
19350
19351impl<'a, C> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
19352where
19353 C: common::Connector,
19354{
19355 /// Perform the operation you have build so far.
19356 pub async fn doit(mut self) -> common::Result<(common::Response, TcpProxyScript)> {
19357 use std::borrow::Cow;
19358 use std::io::{Read, Seek};
19359
19360 use common::{url::Params, ToParts};
19361 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19362
19363 let mut dd = common::DefaultDelegate;
19364 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19365 dlg.begin(common::MethodInfo {
19366 id: "datamigration.projects.locations.migrationJobs.generateTcpProxyScript",
19367 http_method: hyper::Method::POST,
19368 });
19369
19370 for &field in ["alt", "migrationJob"].iter() {
19371 if self._additional_params.contains_key(field) {
19372 dlg.finished(false);
19373 return Err(common::Error::FieldClash(field));
19374 }
19375 }
19376
19377 let mut params = Params::with_capacity(4 + self._additional_params.len());
19378 params.push("migrationJob", self._migration_job);
19379
19380 params.extend(self._additional_params.iter());
19381
19382 params.push("alt", "json");
19383 let mut url = self.hub._base_url.clone() + "v1/{+migrationJob}:generateTcpProxyScript";
19384 if self._scopes.is_empty() {
19385 self._scopes
19386 .insert(Scope::CloudPlatform.as_ref().to_string());
19387 }
19388
19389 #[allow(clippy::single_element_loop)]
19390 for &(find_this, param_name) in [("{+migrationJob}", "migrationJob")].iter() {
19391 url = params.uri_replacement(url, param_name, find_this, true);
19392 }
19393 {
19394 let to_remove = ["migrationJob"];
19395 params.remove_params(&to_remove);
19396 }
19397
19398 let url = params.parse_with_url(&url);
19399
19400 let mut json_mime_type = mime::APPLICATION_JSON;
19401 let mut request_value_reader = {
19402 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19403 common::remove_json_null_values(&mut value);
19404 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19405 serde_json::to_writer(&mut dst, &value).unwrap();
19406 dst
19407 };
19408 let request_size = request_value_reader
19409 .seek(std::io::SeekFrom::End(0))
19410 .unwrap();
19411 request_value_reader
19412 .seek(std::io::SeekFrom::Start(0))
19413 .unwrap();
19414
19415 loop {
19416 let token = match self
19417 .hub
19418 .auth
19419 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19420 .await
19421 {
19422 Ok(token) => token,
19423 Err(e) => match dlg.token(e) {
19424 Ok(token) => token,
19425 Err(e) => {
19426 dlg.finished(false);
19427 return Err(common::Error::MissingToken(e));
19428 }
19429 },
19430 };
19431 request_value_reader
19432 .seek(std::io::SeekFrom::Start(0))
19433 .unwrap();
19434 let mut req_result = {
19435 let client = &self.hub.client;
19436 dlg.pre_request();
19437 let mut req_builder = hyper::Request::builder()
19438 .method(hyper::Method::POST)
19439 .uri(url.as_str())
19440 .header(USER_AGENT, self.hub._user_agent.clone());
19441
19442 if let Some(token) = token.as_ref() {
19443 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19444 }
19445
19446 let request = req_builder
19447 .header(CONTENT_TYPE, json_mime_type.to_string())
19448 .header(CONTENT_LENGTH, request_size as u64)
19449 .body(common::to_body(
19450 request_value_reader.get_ref().clone().into(),
19451 ));
19452
19453 client.request(request.unwrap()).await
19454 };
19455
19456 match req_result {
19457 Err(err) => {
19458 if let common::Retry::After(d) = dlg.http_error(&err) {
19459 sleep(d).await;
19460 continue;
19461 }
19462 dlg.finished(false);
19463 return Err(common::Error::HttpError(err));
19464 }
19465 Ok(res) => {
19466 let (mut parts, body) = res.into_parts();
19467 let mut body = common::Body::new(body);
19468 if !parts.status.is_success() {
19469 let bytes = common::to_bytes(body).await.unwrap_or_default();
19470 let error = serde_json::from_str(&common::to_string(&bytes));
19471 let response = common::to_response(parts, bytes.into());
19472
19473 if let common::Retry::After(d) =
19474 dlg.http_failure(&response, error.as_ref().ok())
19475 {
19476 sleep(d).await;
19477 continue;
19478 }
19479
19480 dlg.finished(false);
19481
19482 return Err(match error {
19483 Ok(value) => common::Error::BadRequest(value),
19484 _ => common::Error::Failure(response),
19485 });
19486 }
19487 let response = {
19488 let bytes = common::to_bytes(body).await.unwrap_or_default();
19489 let encoded = common::to_string(&bytes);
19490 match serde_json::from_str(&encoded) {
19491 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19492 Err(error) => {
19493 dlg.response_json_decode_error(&encoded, &error);
19494 return Err(common::Error::JsonDecodeError(
19495 encoded.to_string(),
19496 error,
19497 ));
19498 }
19499 }
19500 };
19501
19502 dlg.finished(true);
19503 return Ok(response);
19504 }
19505 }
19506 }
19507 }
19508
19509 ///
19510 /// Sets the *request* property to the given value.
19511 ///
19512 /// Even though the property as already been set when instantiating this call,
19513 /// we provide this method for API completeness.
19514 pub fn request(
19515 mut self,
19516 new_value: GenerateTcpProxyScriptRequest,
19517 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
19518 self._request = new_value;
19519 self
19520 }
19521 /// Name of the migration job resource to generate the TCP Proxy script.
19522 ///
19523 /// Sets the *migration job* path property to the given value.
19524 ///
19525 /// Even though the property as already been set when instantiating this call,
19526 /// we provide this method for API completeness.
19527 pub fn migration_job(
19528 mut self,
19529 new_value: &str,
19530 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
19531 self._migration_job = new_value.to_string();
19532 self
19533 }
19534 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19535 /// while executing the actual API request.
19536 ///
19537 /// ````text
19538 /// It should be used to handle progress information, and to implement a certain level of resilience.
19539 /// ````
19540 ///
19541 /// Sets the *delegate* property to the given value.
19542 pub fn delegate(
19543 mut self,
19544 new_value: &'a mut dyn common::Delegate,
19545 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
19546 self._delegate = Some(new_value);
19547 self
19548 }
19549
19550 /// Set any additional parameter of the query string used in the request.
19551 /// It should be used to set parameters which are not yet available through their own
19552 /// setters.
19553 ///
19554 /// Please note that this method must not be used to set any of the known parameters
19555 /// which have their own setter method. If done anyway, the request will fail.
19556 ///
19557 /// # Additional Parameters
19558 ///
19559 /// * *$.xgafv* (query-string) - V1 error format.
19560 /// * *access_token* (query-string) - OAuth access token.
19561 /// * *alt* (query-string) - Data format for response.
19562 /// * *callback* (query-string) - JSONP
19563 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19564 /// * *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.
19565 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19566 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19567 /// * *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.
19568 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19569 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19570 pub fn param<T>(
19571 mut self,
19572 name: T,
19573 value: T,
19574 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
19575 where
19576 T: AsRef<str>,
19577 {
19578 self._additional_params
19579 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19580 self
19581 }
19582
19583 /// Identifies the authorization scope for the method you are building.
19584 ///
19585 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19586 /// [`Scope::CloudPlatform`].
19587 ///
19588 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19589 /// tokens for more than one scope.
19590 ///
19591 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19592 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19593 /// sufficient, a read-write scope will do as well.
19594 pub fn add_scope<St>(
19595 mut self,
19596 scope: St,
19597 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
19598 where
19599 St: AsRef<str>,
19600 {
19601 self._scopes.insert(String::from(scope.as_ref()));
19602 self
19603 }
19604 /// Identifies the authorization scope(s) for the method you are building.
19605 ///
19606 /// See [`Self::add_scope()`] for details.
19607 pub fn add_scopes<I, St>(
19608 mut self,
19609 scopes: I,
19610 ) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C>
19611 where
19612 I: IntoIterator<Item = St>,
19613 St: AsRef<str>,
19614 {
19615 self._scopes
19616 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19617 self
19618 }
19619
19620 /// Removes all scopes, and no default scope will be used either.
19621 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19622 /// for details).
19623 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGenerateTcpProxyScriptCall<'a, C> {
19624 self._scopes.clear();
19625 self
19626 }
19627}
19628
19629/// Gets details of a single migration job.
19630///
19631/// A builder for the *locations.migrationJobs.get* method supported by a *project* resource.
19632/// It is not used directly, but through a [`ProjectMethods`] instance.
19633///
19634/// # Example
19635///
19636/// Instantiate a resource method builder
19637///
19638/// ```test_harness,no_run
19639/// # extern crate hyper;
19640/// # extern crate hyper_rustls;
19641/// # extern crate google_datamigration1 as datamigration1;
19642/// # async fn dox() {
19643/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19644///
19645/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19646/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19647/// # .with_native_roots()
19648/// # .unwrap()
19649/// # .https_only()
19650/// # .enable_http2()
19651/// # .build();
19652///
19653/// # let executor = hyper_util::rt::TokioExecutor::new();
19654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19655/// # secret,
19656/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19657/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19658/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19659/// # ),
19660/// # ).build().await.unwrap();
19661///
19662/// # let client = hyper_util::client::legacy::Client::builder(
19663/// # hyper_util::rt::TokioExecutor::new()
19664/// # )
19665/// # .build(
19666/// # hyper_rustls::HttpsConnectorBuilder::new()
19667/// # .with_native_roots()
19668/// # .unwrap()
19669/// # .https_or_http()
19670/// # .enable_http2()
19671/// # .build()
19672/// # );
19673/// # let mut hub = DatabaseMigrationService::new(client, auth);
19674/// // You can configure optional parameters by calling the respective setters at will, and
19675/// // execute the final call using `doit()`.
19676/// // Values shown here are possibly random and not representative !
19677/// let result = hub.projects().locations_migration_jobs_get("name")
19678/// .doit().await;
19679/// # }
19680/// ```
19681pub struct ProjectLocationMigrationJobGetCall<'a, C>
19682where
19683 C: 'a,
19684{
19685 hub: &'a DatabaseMigrationService<C>,
19686 _name: String,
19687 _delegate: Option<&'a mut dyn common::Delegate>,
19688 _additional_params: HashMap<String, String>,
19689 _scopes: BTreeSet<String>,
19690}
19691
19692impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGetCall<'a, C> {}
19693
19694impl<'a, C> ProjectLocationMigrationJobGetCall<'a, C>
19695where
19696 C: common::Connector,
19697{
19698 /// Perform the operation you have build so far.
19699 pub async fn doit(mut self) -> common::Result<(common::Response, MigrationJob)> {
19700 use std::borrow::Cow;
19701 use std::io::{Read, Seek};
19702
19703 use common::{url::Params, ToParts};
19704 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19705
19706 let mut dd = common::DefaultDelegate;
19707 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19708 dlg.begin(common::MethodInfo {
19709 id: "datamigration.projects.locations.migrationJobs.get",
19710 http_method: hyper::Method::GET,
19711 });
19712
19713 for &field in ["alt", "name"].iter() {
19714 if self._additional_params.contains_key(field) {
19715 dlg.finished(false);
19716 return Err(common::Error::FieldClash(field));
19717 }
19718 }
19719
19720 let mut params = Params::with_capacity(3 + self._additional_params.len());
19721 params.push("name", self._name);
19722
19723 params.extend(self._additional_params.iter());
19724
19725 params.push("alt", "json");
19726 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19727 if self._scopes.is_empty() {
19728 self._scopes
19729 .insert(Scope::CloudPlatform.as_ref().to_string());
19730 }
19731
19732 #[allow(clippy::single_element_loop)]
19733 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19734 url = params.uri_replacement(url, param_name, find_this, true);
19735 }
19736 {
19737 let to_remove = ["name"];
19738 params.remove_params(&to_remove);
19739 }
19740
19741 let url = params.parse_with_url(&url);
19742
19743 loop {
19744 let token = match self
19745 .hub
19746 .auth
19747 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19748 .await
19749 {
19750 Ok(token) => token,
19751 Err(e) => match dlg.token(e) {
19752 Ok(token) => token,
19753 Err(e) => {
19754 dlg.finished(false);
19755 return Err(common::Error::MissingToken(e));
19756 }
19757 },
19758 };
19759 let mut req_result = {
19760 let client = &self.hub.client;
19761 dlg.pre_request();
19762 let mut req_builder = hyper::Request::builder()
19763 .method(hyper::Method::GET)
19764 .uri(url.as_str())
19765 .header(USER_AGENT, self.hub._user_agent.clone());
19766
19767 if let Some(token) = token.as_ref() {
19768 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19769 }
19770
19771 let request = req_builder
19772 .header(CONTENT_LENGTH, 0_u64)
19773 .body(common::to_body::<String>(None));
19774
19775 client.request(request.unwrap()).await
19776 };
19777
19778 match req_result {
19779 Err(err) => {
19780 if let common::Retry::After(d) = dlg.http_error(&err) {
19781 sleep(d).await;
19782 continue;
19783 }
19784 dlg.finished(false);
19785 return Err(common::Error::HttpError(err));
19786 }
19787 Ok(res) => {
19788 let (mut parts, body) = res.into_parts();
19789 let mut body = common::Body::new(body);
19790 if !parts.status.is_success() {
19791 let bytes = common::to_bytes(body).await.unwrap_or_default();
19792 let error = serde_json::from_str(&common::to_string(&bytes));
19793 let response = common::to_response(parts, bytes.into());
19794
19795 if let common::Retry::After(d) =
19796 dlg.http_failure(&response, error.as_ref().ok())
19797 {
19798 sleep(d).await;
19799 continue;
19800 }
19801
19802 dlg.finished(false);
19803
19804 return Err(match error {
19805 Ok(value) => common::Error::BadRequest(value),
19806 _ => common::Error::Failure(response),
19807 });
19808 }
19809 let response = {
19810 let bytes = common::to_bytes(body).await.unwrap_or_default();
19811 let encoded = common::to_string(&bytes);
19812 match serde_json::from_str(&encoded) {
19813 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19814 Err(error) => {
19815 dlg.response_json_decode_error(&encoded, &error);
19816 return Err(common::Error::JsonDecodeError(
19817 encoded.to_string(),
19818 error,
19819 ));
19820 }
19821 }
19822 };
19823
19824 dlg.finished(true);
19825 return Ok(response);
19826 }
19827 }
19828 }
19829 }
19830
19831 /// Required. Name of the migration job resource to get.
19832 ///
19833 /// Sets the *name* path property to the given value.
19834 ///
19835 /// Even though the property as already been set when instantiating this call,
19836 /// we provide this method for API completeness.
19837 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobGetCall<'a, C> {
19838 self._name = new_value.to_string();
19839 self
19840 }
19841 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19842 /// while executing the actual API request.
19843 ///
19844 /// ````text
19845 /// It should be used to handle progress information, and to implement a certain level of resilience.
19846 /// ````
19847 ///
19848 /// Sets the *delegate* property to the given value.
19849 pub fn delegate(
19850 mut self,
19851 new_value: &'a mut dyn common::Delegate,
19852 ) -> ProjectLocationMigrationJobGetCall<'a, C> {
19853 self._delegate = Some(new_value);
19854 self
19855 }
19856
19857 /// Set any additional parameter of the query string used in the request.
19858 /// It should be used to set parameters which are not yet available through their own
19859 /// setters.
19860 ///
19861 /// Please note that this method must not be used to set any of the known parameters
19862 /// which have their own setter method. If done anyway, the request will fail.
19863 ///
19864 /// # Additional Parameters
19865 ///
19866 /// * *$.xgafv* (query-string) - V1 error format.
19867 /// * *access_token* (query-string) - OAuth access token.
19868 /// * *alt* (query-string) - Data format for response.
19869 /// * *callback* (query-string) - JSONP
19870 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19871 /// * *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.
19872 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19873 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19874 /// * *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.
19875 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19876 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19877 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobGetCall<'a, C>
19878 where
19879 T: AsRef<str>,
19880 {
19881 self._additional_params
19882 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19883 self
19884 }
19885
19886 /// Identifies the authorization scope for the method you are building.
19887 ///
19888 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19889 /// [`Scope::CloudPlatform`].
19890 ///
19891 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19892 /// tokens for more than one scope.
19893 ///
19894 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19895 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19896 /// sufficient, a read-write scope will do as well.
19897 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobGetCall<'a, C>
19898 where
19899 St: AsRef<str>,
19900 {
19901 self._scopes.insert(String::from(scope.as_ref()));
19902 self
19903 }
19904 /// Identifies the authorization scope(s) for the method you are building.
19905 ///
19906 /// See [`Self::add_scope()`] for details.
19907 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobGetCall<'a, C>
19908 where
19909 I: IntoIterator<Item = St>,
19910 St: AsRef<str>,
19911 {
19912 self._scopes
19913 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19914 self
19915 }
19916
19917 /// Removes all scopes, and no default scope will be used either.
19918 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19919 /// for details).
19920 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGetCall<'a, C> {
19921 self._scopes.clear();
19922 self
19923 }
19924}
19925
19926/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
19927///
19928/// A builder for the *locations.migrationJobs.getIamPolicy* method supported by a *project* resource.
19929/// It is not used directly, but through a [`ProjectMethods`] instance.
19930///
19931/// # Example
19932///
19933/// Instantiate a resource method builder
19934///
19935/// ```test_harness,no_run
19936/// # extern crate hyper;
19937/// # extern crate hyper_rustls;
19938/// # extern crate google_datamigration1 as datamigration1;
19939/// # async fn dox() {
19940/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19941///
19942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19943/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19944/// # .with_native_roots()
19945/// # .unwrap()
19946/// # .https_only()
19947/// # .enable_http2()
19948/// # .build();
19949///
19950/// # let executor = hyper_util::rt::TokioExecutor::new();
19951/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19952/// # secret,
19953/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19954/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19955/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19956/// # ),
19957/// # ).build().await.unwrap();
19958///
19959/// # let client = hyper_util::client::legacy::Client::builder(
19960/// # hyper_util::rt::TokioExecutor::new()
19961/// # )
19962/// # .build(
19963/// # hyper_rustls::HttpsConnectorBuilder::new()
19964/// # .with_native_roots()
19965/// # .unwrap()
19966/// # .https_or_http()
19967/// # .enable_http2()
19968/// # .build()
19969/// # );
19970/// # let mut hub = DatabaseMigrationService::new(client, auth);
19971/// // You can configure optional parameters by calling the respective setters at will, and
19972/// // execute the final call using `doit()`.
19973/// // Values shown here are possibly random and not representative !
19974/// let result = hub.projects().locations_migration_jobs_get_iam_policy("resource")
19975/// .options_requested_policy_version(-61)
19976/// .doit().await;
19977/// # }
19978/// ```
19979pub struct ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
19980where
19981 C: 'a,
19982{
19983 hub: &'a DatabaseMigrationService<C>,
19984 _resource: String,
19985 _options_requested_policy_version: Option<i32>,
19986 _delegate: Option<&'a mut dyn common::Delegate>,
19987 _additional_params: HashMap<String, String>,
19988 _scopes: BTreeSet<String>,
19989}
19990
19991impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {}
19992
19993impl<'a, C> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
19994where
19995 C: common::Connector,
19996{
19997 /// Perform the operation you have build so far.
19998 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
19999 use std::borrow::Cow;
20000 use std::io::{Read, Seek};
20001
20002 use common::{url::Params, ToParts};
20003 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20004
20005 let mut dd = common::DefaultDelegate;
20006 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20007 dlg.begin(common::MethodInfo {
20008 id: "datamigration.projects.locations.migrationJobs.getIamPolicy",
20009 http_method: hyper::Method::GET,
20010 });
20011
20012 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
20013 if self._additional_params.contains_key(field) {
20014 dlg.finished(false);
20015 return Err(common::Error::FieldClash(field));
20016 }
20017 }
20018
20019 let mut params = Params::with_capacity(4 + self._additional_params.len());
20020 params.push("resource", self._resource);
20021 if let Some(value) = self._options_requested_policy_version.as_ref() {
20022 params.push("options.requestedPolicyVersion", value.to_string());
20023 }
20024
20025 params.extend(self._additional_params.iter());
20026
20027 params.push("alt", "json");
20028 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
20029 if self._scopes.is_empty() {
20030 self._scopes
20031 .insert(Scope::CloudPlatform.as_ref().to_string());
20032 }
20033
20034 #[allow(clippy::single_element_loop)]
20035 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20036 url = params.uri_replacement(url, param_name, find_this, true);
20037 }
20038 {
20039 let to_remove = ["resource"];
20040 params.remove_params(&to_remove);
20041 }
20042
20043 let url = params.parse_with_url(&url);
20044
20045 loop {
20046 let token = match self
20047 .hub
20048 .auth
20049 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20050 .await
20051 {
20052 Ok(token) => token,
20053 Err(e) => match dlg.token(e) {
20054 Ok(token) => token,
20055 Err(e) => {
20056 dlg.finished(false);
20057 return Err(common::Error::MissingToken(e));
20058 }
20059 },
20060 };
20061 let mut req_result = {
20062 let client = &self.hub.client;
20063 dlg.pre_request();
20064 let mut req_builder = hyper::Request::builder()
20065 .method(hyper::Method::GET)
20066 .uri(url.as_str())
20067 .header(USER_AGENT, self.hub._user_agent.clone());
20068
20069 if let Some(token) = token.as_ref() {
20070 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20071 }
20072
20073 let request = req_builder
20074 .header(CONTENT_LENGTH, 0_u64)
20075 .body(common::to_body::<String>(None));
20076
20077 client.request(request.unwrap()).await
20078 };
20079
20080 match req_result {
20081 Err(err) => {
20082 if let common::Retry::After(d) = dlg.http_error(&err) {
20083 sleep(d).await;
20084 continue;
20085 }
20086 dlg.finished(false);
20087 return Err(common::Error::HttpError(err));
20088 }
20089 Ok(res) => {
20090 let (mut parts, body) = res.into_parts();
20091 let mut body = common::Body::new(body);
20092 if !parts.status.is_success() {
20093 let bytes = common::to_bytes(body).await.unwrap_or_default();
20094 let error = serde_json::from_str(&common::to_string(&bytes));
20095 let response = common::to_response(parts, bytes.into());
20096
20097 if let common::Retry::After(d) =
20098 dlg.http_failure(&response, error.as_ref().ok())
20099 {
20100 sleep(d).await;
20101 continue;
20102 }
20103
20104 dlg.finished(false);
20105
20106 return Err(match error {
20107 Ok(value) => common::Error::BadRequest(value),
20108 _ => common::Error::Failure(response),
20109 });
20110 }
20111 let response = {
20112 let bytes = common::to_bytes(body).await.unwrap_or_default();
20113 let encoded = common::to_string(&bytes);
20114 match serde_json::from_str(&encoded) {
20115 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20116 Err(error) => {
20117 dlg.response_json_decode_error(&encoded, &error);
20118 return Err(common::Error::JsonDecodeError(
20119 encoded.to_string(),
20120 error,
20121 ));
20122 }
20123 }
20124 };
20125
20126 dlg.finished(true);
20127 return Ok(response);
20128 }
20129 }
20130 }
20131 }
20132
20133 /// 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.
20134 ///
20135 /// Sets the *resource* path property to the given value.
20136 ///
20137 /// Even though the property as already been set when instantiating this call,
20138 /// we provide this method for API completeness.
20139 pub fn resource(
20140 mut self,
20141 new_value: &str,
20142 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
20143 self._resource = new_value.to_string();
20144 self
20145 }
20146 /// 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).
20147 ///
20148 /// Sets the *options.requested policy version* query property to the given value.
20149 pub fn options_requested_policy_version(
20150 mut self,
20151 new_value: i32,
20152 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
20153 self._options_requested_policy_version = Some(new_value);
20154 self
20155 }
20156 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20157 /// while executing the actual API request.
20158 ///
20159 /// ````text
20160 /// It should be used to handle progress information, and to implement a certain level of resilience.
20161 /// ````
20162 ///
20163 /// Sets the *delegate* property to the given value.
20164 pub fn delegate(
20165 mut self,
20166 new_value: &'a mut dyn common::Delegate,
20167 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
20168 self._delegate = Some(new_value);
20169 self
20170 }
20171
20172 /// Set any additional parameter of the query string used in the request.
20173 /// It should be used to set parameters which are not yet available through their own
20174 /// setters.
20175 ///
20176 /// Please note that this method must not be used to set any of the known parameters
20177 /// which have their own setter method. If done anyway, the request will fail.
20178 ///
20179 /// # Additional Parameters
20180 ///
20181 /// * *$.xgafv* (query-string) - V1 error format.
20182 /// * *access_token* (query-string) - OAuth access token.
20183 /// * *alt* (query-string) - Data format for response.
20184 /// * *callback* (query-string) - JSONP
20185 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20186 /// * *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.
20187 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20188 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20189 /// * *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.
20190 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20191 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20192 pub fn param<T>(
20193 mut self,
20194 name: T,
20195 value: T,
20196 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
20197 where
20198 T: AsRef<str>,
20199 {
20200 self._additional_params
20201 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20202 self
20203 }
20204
20205 /// Identifies the authorization scope for the method you are building.
20206 ///
20207 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20208 /// [`Scope::CloudPlatform`].
20209 ///
20210 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20211 /// tokens for more than one scope.
20212 ///
20213 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20214 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20215 /// sufficient, a read-write scope will do as well.
20216 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
20217 where
20218 St: AsRef<str>,
20219 {
20220 self._scopes.insert(String::from(scope.as_ref()));
20221 self
20222 }
20223 /// Identifies the authorization scope(s) for the method you are building.
20224 ///
20225 /// See [`Self::add_scope()`] for details.
20226 pub fn add_scopes<I, St>(
20227 mut self,
20228 scopes: I,
20229 ) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C>
20230 where
20231 I: IntoIterator<Item = St>,
20232 St: AsRef<str>,
20233 {
20234 self._scopes
20235 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20236 self
20237 }
20238
20239 /// Removes all scopes, and no default scope will be used either.
20240 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20241 /// for details).
20242 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobGetIamPolicyCall<'a, C> {
20243 self._scopes.clear();
20244 self
20245 }
20246}
20247
20248/// Lists migration jobs in a given project and location.
20249///
20250/// A builder for the *locations.migrationJobs.list* method supported by a *project* resource.
20251/// It is not used directly, but through a [`ProjectMethods`] instance.
20252///
20253/// # Example
20254///
20255/// Instantiate a resource method builder
20256///
20257/// ```test_harness,no_run
20258/// # extern crate hyper;
20259/// # extern crate hyper_rustls;
20260/// # extern crate google_datamigration1 as datamigration1;
20261/// # async fn dox() {
20262/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20263///
20264/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20265/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20266/// # .with_native_roots()
20267/// # .unwrap()
20268/// # .https_only()
20269/// # .enable_http2()
20270/// # .build();
20271///
20272/// # let executor = hyper_util::rt::TokioExecutor::new();
20273/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20274/// # secret,
20275/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20276/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20277/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20278/// # ),
20279/// # ).build().await.unwrap();
20280///
20281/// # let client = hyper_util::client::legacy::Client::builder(
20282/// # hyper_util::rt::TokioExecutor::new()
20283/// # )
20284/// # .build(
20285/// # hyper_rustls::HttpsConnectorBuilder::new()
20286/// # .with_native_roots()
20287/// # .unwrap()
20288/// # .https_or_http()
20289/// # .enable_http2()
20290/// # .build()
20291/// # );
20292/// # let mut hub = DatabaseMigrationService::new(client, auth);
20293/// // You can configure optional parameters by calling the respective setters at will, and
20294/// // execute the final call using `doit()`.
20295/// // Values shown here are possibly random and not representative !
20296/// let result = hub.projects().locations_migration_jobs_list("parent")
20297/// .page_token("At")
20298/// .page_size(-45)
20299/// .order_by("aliquyam")
20300/// .filter("dolores")
20301/// .doit().await;
20302/// # }
20303/// ```
20304pub struct ProjectLocationMigrationJobListCall<'a, C>
20305where
20306 C: 'a,
20307{
20308 hub: &'a DatabaseMigrationService<C>,
20309 _parent: String,
20310 _page_token: Option<String>,
20311 _page_size: Option<i32>,
20312 _order_by: Option<String>,
20313 _filter: Option<String>,
20314 _delegate: Option<&'a mut dyn common::Delegate>,
20315 _additional_params: HashMap<String, String>,
20316 _scopes: BTreeSet<String>,
20317}
20318
20319impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobListCall<'a, C> {}
20320
20321impl<'a, C> ProjectLocationMigrationJobListCall<'a, C>
20322where
20323 C: common::Connector,
20324{
20325 /// Perform the operation you have build so far.
20326 pub async fn doit(mut self) -> common::Result<(common::Response, ListMigrationJobsResponse)> {
20327 use std::borrow::Cow;
20328 use std::io::{Read, Seek};
20329
20330 use common::{url::Params, ToParts};
20331 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20332
20333 let mut dd = common::DefaultDelegate;
20334 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20335 dlg.begin(common::MethodInfo {
20336 id: "datamigration.projects.locations.migrationJobs.list",
20337 http_method: hyper::Method::GET,
20338 });
20339
20340 for &field in [
20341 "alt",
20342 "parent",
20343 "pageToken",
20344 "pageSize",
20345 "orderBy",
20346 "filter",
20347 ]
20348 .iter()
20349 {
20350 if self._additional_params.contains_key(field) {
20351 dlg.finished(false);
20352 return Err(common::Error::FieldClash(field));
20353 }
20354 }
20355
20356 let mut params = Params::with_capacity(7 + self._additional_params.len());
20357 params.push("parent", self._parent);
20358 if let Some(value) = self._page_token.as_ref() {
20359 params.push("pageToken", value);
20360 }
20361 if let Some(value) = self._page_size.as_ref() {
20362 params.push("pageSize", value.to_string());
20363 }
20364 if let Some(value) = self._order_by.as_ref() {
20365 params.push("orderBy", value);
20366 }
20367 if let Some(value) = self._filter.as_ref() {
20368 params.push("filter", value);
20369 }
20370
20371 params.extend(self._additional_params.iter());
20372
20373 params.push("alt", "json");
20374 let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationJobs";
20375 if self._scopes.is_empty() {
20376 self._scopes
20377 .insert(Scope::CloudPlatform.as_ref().to_string());
20378 }
20379
20380 #[allow(clippy::single_element_loop)]
20381 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20382 url = params.uri_replacement(url, param_name, find_this, true);
20383 }
20384 {
20385 let to_remove = ["parent"];
20386 params.remove_params(&to_remove);
20387 }
20388
20389 let url = params.parse_with_url(&url);
20390
20391 loop {
20392 let token = match self
20393 .hub
20394 .auth
20395 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20396 .await
20397 {
20398 Ok(token) => token,
20399 Err(e) => match dlg.token(e) {
20400 Ok(token) => token,
20401 Err(e) => {
20402 dlg.finished(false);
20403 return Err(common::Error::MissingToken(e));
20404 }
20405 },
20406 };
20407 let mut req_result = {
20408 let client = &self.hub.client;
20409 dlg.pre_request();
20410 let mut req_builder = hyper::Request::builder()
20411 .method(hyper::Method::GET)
20412 .uri(url.as_str())
20413 .header(USER_AGENT, self.hub._user_agent.clone());
20414
20415 if let Some(token) = token.as_ref() {
20416 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20417 }
20418
20419 let request = req_builder
20420 .header(CONTENT_LENGTH, 0_u64)
20421 .body(common::to_body::<String>(None));
20422
20423 client.request(request.unwrap()).await
20424 };
20425
20426 match req_result {
20427 Err(err) => {
20428 if let common::Retry::After(d) = dlg.http_error(&err) {
20429 sleep(d).await;
20430 continue;
20431 }
20432 dlg.finished(false);
20433 return Err(common::Error::HttpError(err));
20434 }
20435 Ok(res) => {
20436 let (mut parts, body) = res.into_parts();
20437 let mut body = common::Body::new(body);
20438 if !parts.status.is_success() {
20439 let bytes = common::to_bytes(body).await.unwrap_or_default();
20440 let error = serde_json::from_str(&common::to_string(&bytes));
20441 let response = common::to_response(parts, bytes.into());
20442
20443 if let common::Retry::After(d) =
20444 dlg.http_failure(&response, error.as_ref().ok())
20445 {
20446 sleep(d).await;
20447 continue;
20448 }
20449
20450 dlg.finished(false);
20451
20452 return Err(match error {
20453 Ok(value) => common::Error::BadRequest(value),
20454 _ => common::Error::Failure(response),
20455 });
20456 }
20457 let response = {
20458 let bytes = common::to_bytes(body).await.unwrap_or_default();
20459 let encoded = common::to_string(&bytes);
20460 match serde_json::from_str(&encoded) {
20461 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20462 Err(error) => {
20463 dlg.response_json_decode_error(&encoded, &error);
20464 return Err(common::Error::JsonDecodeError(
20465 encoded.to_string(),
20466 error,
20467 ));
20468 }
20469 }
20470 };
20471
20472 dlg.finished(true);
20473 return Ok(response);
20474 }
20475 }
20476 }
20477 }
20478
20479 /// Required. The parent which owns this collection of migrationJobs.
20480 ///
20481 /// Sets the *parent* path property to the given value.
20482 ///
20483 /// Even though the property as already been set when instantiating this call,
20484 /// we provide this method for API completeness.
20485 pub fn parent(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
20486 self._parent = new_value.to_string();
20487 self
20488 }
20489 /// 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.
20490 ///
20491 /// Sets the *page token* query property to the given value.
20492 pub fn page_token(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
20493 self._page_token = Some(new_value.to_string());
20494 self
20495 }
20496 /// 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.
20497 ///
20498 /// Sets the *page size* query property to the given value.
20499 pub fn page_size(mut self, new_value: i32) -> ProjectLocationMigrationJobListCall<'a, C> {
20500 self._page_size = Some(new_value);
20501 self
20502 }
20503 /// Sort the results based on the migration job name. Valid values are: "name", "name asc", and "name desc".
20504 ///
20505 /// Sets the *order by* query property to the given value.
20506 pub fn order_by(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
20507 self._order_by = Some(new_value.to_string());
20508 self
20509 }
20510 /// 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.
20511 ///
20512 /// Sets the *filter* query property to the given value.
20513 pub fn filter(mut self, new_value: &str) -> ProjectLocationMigrationJobListCall<'a, C> {
20514 self._filter = Some(new_value.to_string());
20515 self
20516 }
20517 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20518 /// while executing the actual API request.
20519 ///
20520 /// ````text
20521 /// It should be used to handle progress information, and to implement a certain level of resilience.
20522 /// ````
20523 ///
20524 /// Sets the *delegate* property to the given value.
20525 pub fn delegate(
20526 mut self,
20527 new_value: &'a mut dyn common::Delegate,
20528 ) -> ProjectLocationMigrationJobListCall<'a, C> {
20529 self._delegate = Some(new_value);
20530 self
20531 }
20532
20533 /// Set any additional parameter of the query string used in the request.
20534 /// It should be used to set parameters which are not yet available through their own
20535 /// setters.
20536 ///
20537 /// Please note that this method must not be used to set any of the known parameters
20538 /// which have their own setter method. If done anyway, the request will fail.
20539 ///
20540 /// # Additional Parameters
20541 ///
20542 /// * *$.xgafv* (query-string) - V1 error format.
20543 /// * *access_token* (query-string) - OAuth access token.
20544 /// * *alt* (query-string) - Data format for response.
20545 /// * *callback* (query-string) - JSONP
20546 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20547 /// * *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.
20548 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20549 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20550 /// * *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.
20551 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20552 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20553 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobListCall<'a, C>
20554 where
20555 T: AsRef<str>,
20556 {
20557 self._additional_params
20558 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20559 self
20560 }
20561
20562 /// Identifies the authorization scope for the method you are building.
20563 ///
20564 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20565 /// [`Scope::CloudPlatform`].
20566 ///
20567 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20568 /// tokens for more than one scope.
20569 ///
20570 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20571 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20572 /// sufficient, a read-write scope will do as well.
20573 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobListCall<'a, C>
20574 where
20575 St: AsRef<str>,
20576 {
20577 self._scopes.insert(String::from(scope.as_ref()));
20578 self
20579 }
20580 /// Identifies the authorization scope(s) for the method you are building.
20581 ///
20582 /// See [`Self::add_scope()`] for details.
20583 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobListCall<'a, C>
20584 where
20585 I: IntoIterator<Item = St>,
20586 St: AsRef<str>,
20587 {
20588 self._scopes
20589 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20590 self
20591 }
20592
20593 /// Removes all scopes, and no default scope will be used either.
20594 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20595 /// for details).
20596 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobListCall<'a, C> {
20597 self._scopes.clear();
20598 self
20599 }
20600}
20601
20602/// Updates the parameters of a single migration job.
20603///
20604/// A builder for the *locations.migrationJobs.patch* method supported by a *project* resource.
20605/// It is not used directly, but through a [`ProjectMethods`] instance.
20606///
20607/// # Example
20608///
20609/// Instantiate a resource method builder
20610///
20611/// ```test_harness,no_run
20612/// # extern crate hyper;
20613/// # extern crate hyper_rustls;
20614/// # extern crate google_datamigration1 as datamigration1;
20615/// use datamigration1::api::MigrationJob;
20616/// # async fn dox() {
20617/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20618///
20619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20621/// # .with_native_roots()
20622/// # .unwrap()
20623/// # .https_only()
20624/// # .enable_http2()
20625/// # .build();
20626///
20627/// # let executor = hyper_util::rt::TokioExecutor::new();
20628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20629/// # secret,
20630/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20631/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20632/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20633/// # ),
20634/// # ).build().await.unwrap();
20635///
20636/// # let client = hyper_util::client::legacy::Client::builder(
20637/// # hyper_util::rt::TokioExecutor::new()
20638/// # )
20639/// # .build(
20640/// # hyper_rustls::HttpsConnectorBuilder::new()
20641/// # .with_native_roots()
20642/// # .unwrap()
20643/// # .https_or_http()
20644/// # .enable_http2()
20645/// # .build()
20646/// # );
20647/// # let mut hub = DatabaseMigrationService::new(client, auth);
20648/// // As the method needs a request, you would usually fill it with the desired information
20649/// // into the respective structure. Some of the parts shown here might not be applicable !
20650/// // Values shown here are possibly random and not representative !
20651/// let mut req = MigrationJob::default();
20652///
20653/// // You can configure optional parameters by calling the respective setters at will, and
20654/// // execute the final call using `doit()`.
20655/// // Values shown here are possibly random and not representative !
20656/// let result = hub.projects().locations_migration_jobs_patch(req, "name")
20657/// .update_mask(FieldMask::new::<&str>(&[]))
20658/// .request_id("erat")
20659/// .doit().await;
20660/// # }
20661/// ```
20662pub struct ProjectLocationMigrationJobPatchCall<'a, C>
20663where
20664 C: 'a,
20665{
20666 hub: &'a DatabaseMigrationService<C>,
20667 _request: MigrationJob,
20668 _name: String,
20669 _update_mask: Option<common::FieldMask>,
20670 _request_id: Option<String>,
20671 _delegate: Option<&'a mut dyn common::Delegate>,
20672 _additional_params: HashMap<String, String>,
20673 _scopes: BTreeSet<String>,
20674}
20675
20676impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobPatchCall<'a, C> {}
20677
20678impl<'a, C> ProjectLocationMigrationJobPatchCall<'a, C>
20679where
20680 C: common::Connector,
20681{
20682 /// Perform the operation you have build so far.
20683 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20684 use std::borrow::Cow;
20685 use std::io::{Read, Seek};
20686
20687 use common::{url::Params, ToParts};
20688 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20689
20690 let mut dd = common::DefaultDelegate;
20691 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20692 dlg.begin(common::MethodInfo {
20693 id: "datamigration.projects.locations.migrationJobs.patch",
20694 http_method: hyper::Method::PATCH,
20695 });
20696
20697 for &field in ["alt", "name", "updateMask", "requestId"].iter() {
20698 if self._additional_params.contains_key(field) {
20699 dlg.finished(false);
20700 return Err(common::Error::FieldClash(field));
20701 }
20702 }
20703
20704 let mut params = Params::with_capacity(6 + self._additional_params.len());
20705 params.push("name", self._name);
20706 if let Some(value) = self._update_mask.as_ref() {
20707 params.push("updateMask", value.to_string());
20708 }
20709 if let Some(value) = self._request_id.as_ref() {
20710 params.push("requestId", value);
20711 }
20712
20713 params.extend(self._additional_params.iter());
20714
20715 params.push("alt", "json");
20716 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20717 if self._scopes.is_empty() {
20718 self._scopes
20719 .insert(Scope::CloudPlatform.as_ref().to_string());
20720 }
20721
20722 #[allow(clippy::single_element_loop)]
20723 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20724 url = params.uri_replacement(url, param_name, find_this, true);
20725 }
20726 {
20727 let to_remove = ["name"];
20728 params.remove_params(&to_remove);
20729 }
20730
20731 let url = params.parse_with_url(&url);
20732
20733 let mut json_mime_type = mime::APPLICATION_JSON;
20734 let mut request_value_reader = {
20735 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20736 common::remove_json_null_values(&mut value);
20737 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20738 serde_json::to_writer(&mut dst, &value).unwrap();
20739 dst
20740 };
20741 let request_size = request_value_reader
20742 .seek(std::io::SeekFrom::End(0))
20743 .unwrap();
20744 request_value_reader
20745 .seek(std::io::SeekFrom::Start(0))
20746 .unwrap();
20747
20748 loop {
20749 let token = match self
20750 .hub
20751 .auth
20752 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20753 .await
20754 {
20755 Ok(token) => token,
20756 Err(e) => match dlg.token(e) {
20757 Ok(token) => token,
20758 Err(e) => {
20759 dlg.finished(false);
20760 return Err(common::Error::MissingToken(e));
20761 }
20762 },
20763 };
20764 request_value_reader
20765 .seek(std::io::SeekFrom::Start(0))
20766 .unwrap();
20767 let mut req_result = {
20768 let client = &self.hub.client;
20769 dlg.pre_request();
20770 let mut req_builder = hyper::Request::builder()
20771 .method(hyper::Method::PATCH)
20772 .uri(url.as_str())
20773 .header(USER_AGENT, self.hub._user_agent.clone());
20774
20775 if let Some(token) = token.as_ref() {
20776 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20777 }
20778
20779 let request = req_builder
20780 .header(CONTENT_TYPE, json_mime_type.to_string())
20781 .header(CONTENT_LENGTH, request_size as u64)
20782 .body(common::to_body(
20783 request_value_reader.get_ref().clone().into(),
20784 ));
20785
20786 client.request(request.unwrap()).await
20787 };
20788
20789 match req_result {
20790 Err(err) => {
20791 if let common::Retry::After(d) = dlg.http_error(&err) {
20792 sleep(d).await;
20793 continue;
20794 }
20795 dlg.finished(false);
20796 return Err(common::Error::HttpError(err));
20797 }
20798 Ok(res) => {
20799 let (mut parts, body) = res.into_parts();
20800 let mut body = common::Body::new(body);
20801 if !parts.status.is_success() {
20802 let bytes = common::to_bytes(body).await.unwrap_or_default();
20803 let error = serde_json::from_str(&common::to_string(&bytes));
20804 let response = common::to_response(parts, bytes.into());
20805
20806 if let common::Retry::After(d) =
20807 dlg.http_failure(&response, error.as_ref().ok())
20808 {
20809 sleep(d).await;
20810 continue;
20811 }
20812
20813 dlg.finished(false);
20814
20815 return Err(match error {
20816 Ok(value) => common::Error::BadRequest(value),
20817 _ => common::Error::Failure(response),
20818 });
20819 }
20820 let response = {
20821 let bytes = common::to_bytes(body).await.unwrap_or_default();
20822 let encoded = common::to_string(&bytes);
20823 match serde_json::from_str(&encoded) {
20824 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20825 Err(error) => {
20826 dlg.response_json_decode_error(&encoded, &error);
20827 return Err(common::Error::JsonDecodeError(
20828 encoded.to_string(),
20829 error,
20830 ));
20831 }
20832 }
20833 };
20834
20835 dlg.finished(true);
20836 return Ok(response);
20837 }
20838 }
20839 }
20840 }
20841
20842 ///
20843 /// Sets the *request* property to the given value.
20844 ///
20845 /// Even though the property as already been set when instantiating this call,
20846 /// we provide this method for API completeness.
20847 pub fn request(
20848 mut self,
20849 new_value: MigrationJob,
20850 ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20851 self._request = new_value;
20852 self
20853 }
20854 /// The name (URI) of this migration job resource, in the form of: projects/{project}/locations/{location}/migrationJobs/{migrationJob}.
20855 ///
20856 /// Sets the *name* path property to the given value.
20857 ///
20858 /// Even though the property as already been set when instantiating this call,
20859 /// we provide this method for API completeness.
20860 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20861 self._name = new_value.to_string();
20862 self
20863 }
20864 /// Required. Field mask is used to specify the fields to be overwritten by the update in the conversion workspace resource.
20865 ///
20866 /// Sets the *update mask* query property to the given value.
20867 pub fn update_mask(
20868 mut self,
20869 new_value: common::FieldMask,
20870 ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20871 self._update_mask = Some(new_value);
20872 self
20873 }
20874 /// 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.
20875 ///
20876 /// Sets the *request id* query property to the given value.
20877 pub fn request_id(mut self, new_value: &str) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20878 self._request_id = Some(new_value.to_string());
20879 self
20880 }
20881 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20882 /// while executing the actual API request.
20883 ///
20884 /// ````text
20885 /// It should be used to handle progress information, and to implement a certain level of resilience.
20886 /// ````
20887 ///
20888 /// Sets the *delegate* property to the given value.
20889 pub fn delegate(
20890 mut self,
20891 new_value: &'a mut dyn common::Delegate,
20892 ) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20893 self._delegate = Some(new_value);
20894 self
20895 }
20896
20897 /// Set any additional parameter of the query string used in the request.
20898 /// It should be used to set parameters which are not yet available through their own
20899 /// setters.
20900 ///
20901 /// Please note that this method must not be used to set any of the known parameters
20902 /// which have their own setter method. If done anyway, the request will fail.
20903 ///
20904 /// # Additional Parameters
20905 ///
20906 /// * *$.xgafv* (query-string) - V1 error format.
20907 /// * *access_token* (query-string) - OAuth access token.
20908 /// * *alt* (query-string) - Data format for response.
20909 /// * *callback* (query-string) - JSONP
20910 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20911 /// * *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.
20912 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20913 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20914 /// * *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.
20915 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20916 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20917 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobPatchCall<'a, C>
20918 where
20919 T: AsRef<str>,
20920 {
20921 self._additional_params
20922 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20923 self
20924 }
20925
20926 /// Identifies the authorization scope for the method you are building.
20927 ///
20928 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20929 /// [`Scope::CloudPlatform`].
20930 ///
20931 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20932 /// tokens for more than one scope.
20933 ///
20934 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20935 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20936 /// sufficient, a read-write scope will do as well.
20937 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobPatchCall<'a, C>
20938 where
20939 St: AsRef<str>,
20940 {
20941 self._scopes.insert(String::from(scope.as_ref()));
20942 self
20943 }
20944 /// Identifies the authorization scope(s) for the method you are building.
20945 ///
20946 /// See [`Self::add_scope()`] for details.
20947 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobPatchCall<'a, C>
20948 where
20949 I: IntoIterator<Item = St>,
20950 St: AsRef<str>,
20951 {
20952 self._scopes
20953 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20954 self
20955 }
20956
20957 /// Removes all scopes, and no default scope will be used either.
20958 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20959 /// for details).
20960 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobPatchCall<'a, C> {
20961 self._scopes.clear();
20962 self
20963 }
20964}
20965
20966/// Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database.
20967///
20968/// A builder for the *locations.migrationJobs.promote* method supported by a *project* resource.
20969/// It is not used directly, but through a [`ProjectMethods`] instance.
20970///
20971/// # Example
20972///
20973/// Instantiate a resource method builder
20974///
20975/// ```test_harness,no_run
20976/// # extern crate hyper;
20977/// # extern crate hyper_rustls;
20978/// # extern crate google_datamigration1 as datamigration1;
20979/// use datamigration1::api::PromoteMigrationJobRequest;
20980/// # async fn dox() {
20981/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20982///
20983/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20984/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20985/// # .with_native_roots()
20986/// # .unwrap()
20987/// # .https_only()
20988/// # .enable_http2()
20989/// # .build();
20990///
20991/// # let executor = hyper_util::rt::TokioExecutor::new();
20992/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20993/// # secret,
20994/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20995/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20996/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20997/// # ),
20998/// # ).build().await.unwrap();
20999///
21000/// # let client = hyper_util::client::legacy::Client::builder(
21001/// # hyper_util::rt::TokioExecutor::new()
21002/// # )
21003/// # .build(
21004/// # hyper_rustls::HttpsConnectorBuilder::new()
21005/// # .with_native_roots()
21006/// # .unwrap()
21007/// # .https_or_http()
21008/// # .enable_http2()
21009/// # .build()
21010/// # );
21011/// # let mut hub = DatabaseMigrationService::new(client, auth);
21012/// // As the method needs a request, you would usually fill it with the desired information
21013/// // into the respective structure. Some of the parts shown here might not be applicable !
21014/// // Values shown here are possibly random and not representative !
21015/// let mut req = PromoteMigrationJobRequest::default();
21016///
21017/// // You can configure optional parameters by calling the respective setters at will, and
21018/// // execute the final call using `doit()`.
21019/// // Values shown here are possibly random and not representative !
21020/// let result = hub.projects().locations_migration_jobs_promote(req, "name")
21021/// .doit().await;
21022/// # }
21023/// ```
21024pub struct ProjectLocationMigrationJobPromoteCall<'a, C>
21025where
21026 C: 'a,
21027{
21028 hub: &'a DatabaseMigrationService<C>,
21029 _request: PromoteMigrationJobRequest,
21030 _name: String,
21031 _delegate: Option<&'a mut dyn common::Delegate>,
21032 _additional_params: HashMap<String, String>,
21033 _scopes: BTreeSet<String>,
21034}
21035
21036impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobPromoteCall<'a, C> {}
21037
21038impl<'a, C> ProjectLocationMigrationJobPromoteCall<'a, C>
21039where
21040 C: common::Connector,
21041{
21042 /// Perform the operation you have build so far.
21043 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21044 use std::borrow::Cow;
21045 use std::io::{Read, Seek};
21046
21047 use common::{url::Params, ToParts};
21048 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21049
21050 let mut dd = common::DefaultDelegate;
21051 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21052 dlg.begin(common::MethodInfo {
21053 id: "datamigration.projects.locations.migrationJobs.promote",
21054 http_method: hyper::Method::POST,
21055 });
21056
21057 for &field in ["alt", "name"].iter() {
21058 if self._additional_params.contains_key(field) {
21059 dlg.finished(false);
21060 return Err(common::Error::FieldClash(field));
21061 }
21062 }
21063
21064 let mut params = Params::with_capacity(4 + self._additional_params.len());
21065 params.push("name", self._name);
21066
21067 params.extend(self._additional_params.iter());
21068
21069 params.push("alt", "json");
21070 let mut url = self.hub._base_url.clone() + "v1/{+name}:promote";
21071 if self._scopes.is_empty() {
21072 self._scopes
21073 .insert(Scope::CloudPlatform.as_ref().to_string());
21074 }
21075
21076 #[allow(clippy::single_element_loop)]
21077 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21078 url = params.uri_replacement(url, param_name, find_this, true);
21079 }
21080 {
21081 let to_remove = ["name"];
21082 params.remove_params(&to_remove);
21083 }
21084
21085 let url = params.parse_with_url(&url);
21086
21087 let mut json_mime_type = mime::APPLICATION_JSON;
21088 let mut request_value_reader = {
21089 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21090 common::remove_json_null_values(&mut value);
21091 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21092 serde_json::to_writer(&mut dst, &value).unwrap();
21093 dst
21094 };
21095 let request_size = request_value_reader
21096 .seek(std::io::SeekFrom::End(0))
21097 .unwrap();
21098 request_value_reader
21099 .seek(std::io::SeekFrom::Start(0))
21100 .unwrap();
21101
21102 loop {
21103 let token = match self
21104 .hub
21105 .auth
21106 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21107 .await
21108 {
21109 Ok(token) => token,
21110 Err(e) => match dlg.token(e) {
21111 Ok(token) => token,
21112 Err(e) => {
21113 dlg.finished(false);
21114 return Err(common::Error::MissingToken(e));
21115 }
21116 },
21117 };
21118 request_value_reader
21119 .seek(std::io::SeekFrom::Start(0))
21120 .unwrap();
21121 let mut req_result = {
21122 let client = &self.hub.client;
21123 dlg.pre_request();
21124 let mut req_builder = hyper::Request::builder()
21125 .method(hyper::Method::POST)
21126 .uri(url.as_str())
21127 .header(USER_AGENT, self.hub._user_agent.clone());
21128
21129 if let Some(token) = token.as_ref() {
21130 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21131 }
21132
21133 let request = req_builder
21134 .header(CONTENT_TYPE, json_mime_type.to_string())
21135 .header(CONTENT_LENGTH, request_size as u64)
21136 .body(common::to_body(
21137 request_value_reader.get_ref().clone().into(),
21138 ));
21139
21140 client.request(request.unwrap()).await
21141 };
21142
21143 match req_result {
21144 Err(err) => {
21145 if let common::Retry::After(d) = dlg.http_error(&err) {
21146 sleep(d).await;
21147 continue;
21148 }
21149 dlg.finished(false);
21150 return Err(common::Error::HttpError(err));
21151 }
21152 Ok(res) => {
21153 let (mut parts, body) = res.into_parts();
21154 let mut body = common::Body::new(body);
21155 if !parts.status.is_success() {
21156 let bytes = common::to_bytes(body).await.unwrap_or_default();
21157 let error = serde_json::from_str(&common::to_string(&bytes));
21158 let response = common::to_response(parts, bytes.into());
21159
21160 if let common::Retry::After(d) =
21161 dlg.http_failure(&response, error.as_ref().ok())
21162 {
21163 sleep(d).await;
21164 continue;
21165 }
21166
21167 dlg.finished(false);
21168
21169 return Err(match error {
21170 Ok(value) => common::Error::BadRequest(value),
21171 _ => common::Error::Failure(response),
21172 });
21173 }
21174 let response = {
21175 let bytes = common::to_bytes(body).await.unwrap_or_default();
21176 let encoded = common::to_string(&bytes);
21177 match serde_json::from_str(&encoded) {
21178 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21179 Err(error) => {
21180 dlg.response_json_decode_error(&encoded, &error);
21181 return Err(common::Error::JsonDecodeError(
21182 encoded.to_string(),
21183 error,
21184 ));
21185 }
21186 }
21187 };
21188
21189 dlg.finished(true);
21190 return Ok(response);
21191 }
21192 }
21193 }
21194 }
21195
21196 ///
21197 /// Sets the *request* property to the given value.
21198 ///
21199 /// Even though the property as already been set when instantiating this call,
21200 /// we provide this method for API completeness.
21201 pub fn request(
21202 mut self,
21203 new_value: PromoteMigrationJobRequest,
21204 ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
21205 self._request = new_value;
21206 self
21207 }
21208 /// Name of the migration job resource to promote.
21209 ///
21210 /// Sets the *name* path property to the given value.
21211 ///
21212 /// Even though the property as already been set when instantiating this call,
21213 /// we provide this method for API completeness.
21214 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
21215 self._name = new_value.to_string();
21216 self
21217 }
21218 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21219 /// while executing the actual API request.
21220 ///
21221 /// ````text
21222 /// It should be used to handle progress information, and to implement a certain level of resilience.
21223 /// ````
21224 ///
21225 /// Sets the *delegate* property to the given value.
21226 pub fn delegate(
21227 mut self,
21228 new_value: &'a mut dyn common::Delegate,
21229 ) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
21230 self._delegate = Some(new_value);
21231 self
21232 }
21233
21234 /// Set any additional parameter of the query string used in the request.
21235 /// It should be used to set parameters which are not yet available through their own
21236 /// setters.
21237 ///
21238 /// Please note that this method must not be used to set any of the known parameters
21239 /// which have their own setter method. If done anyway, the request will fail.
21240 ///
21241 /// # Additional Parameters
21242 ///
21243 /// * *$.xgafv* (query-string) - V1 error format.
21244 /// * *access_token* (query-string) - OAuth access token.
21245 /// * *alt* (query-string) - Data format for response.
21246 /// * *callback* (query-string) - JSONP
21247 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21248 /// * *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.
21249 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21250 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21251 /// * *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.
21252 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21253 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21254 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobPromoteCall<'a, C>
21255 where
21256 T: AsRef<str>,
21257 {
21258 self._additional_params
21259 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21260 self
21261 }
21262
21263 /// Identifies the authorization scope for the method you are building.
21264 ///
21265 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21266 /// [`Scope::CloudPlatform`].
21267 ///
21268 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21269 /// tokens for more than one scope.
21270 ///
21271 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21272 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21273 /// sufficient, a read-write scope will do as well.
21274 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobPromoteCall<'a, C>
21275 where
21276 St: AsRef<str>,
21277 {
21278 self._scopes.insert(String::from(scope.as_ref()));
21279 self
21280 }
21281 /// Identifies the authorization scope(s) for the method you are building.
21282 ///
21283 /// See [`Self::add_scope()`] for details.
21284 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobPromoteCall<'a, C>
21285 where
21286 I: IntoIterator<Item = St>,
21287 St: AsRef<str>,
21288 {
21289 self._scopes
21290 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21291 self
21292 }
21293
21294 /// Removes all scopes, and no default scope will be used either.
21295 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21296 /// for details).
21297 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobPromoteCall<'a, C> {
21298 self._scopes.clear();
21299 self
21300 }
21301}
21302
21303/// Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch.
21304///
21305/// A builder for the *locations.migrationJobs.restart* method supported by a *project* resource.
21306/// It is not used directly, but through a [`ProjectMethods`] instance.
21307///
21308/// # Example
21309///
21310/// Instantiate a resource method builder
21311///
21312/// ```test_harness,no_run
21313/// # extern crate hyper;
21314/// # extern crate hyper_rustls;
21315/// # extern crate google_datamigration1 as datamigration1;
21316/// use datamigration1::api::RestartMigrationJobRequest;
21317/// # async fn dox() {
21318/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21319///
21320/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21321/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21322/// # .with_native_roots()
21323/// # .unwrap()
21324/// # .https_only()
21325/// # .enable_http2()
21326/// # .build();
21327///
21328/// # let executor = hyper_util::rt::TokioExecutor::new();
21329/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21330/// # secret,
21331/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21332/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21333/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21334/// # ),
21335/// # ).build().await.unwrap();
21336///
21337/// # let client = hyper_util::client::legacy::Client::builder(
21338/// # hyper_util::rt::TokioExecutor::new()
21339/// # )
21340/// # .build(
21341/// # hyper_rustls::HttpsConnectorBuilder::new()
21342/// # .with_native_roots()
21343/// # .unwrap()
21344/// # .https_or_http()
21345/// # .enable_http2()
21346/// # .build()
21347/// # );
21348/// # let mut hub = DatabaseMigrationService::new(client, auth);
21349/// // As the method needs a request, you would usually fill it with the desired information
21350/// // into the respective structure. Some of the parts shown here might not be applicable !
21351/// // Values shown here are possibly random and not representative !
21352/// let mut req = RestartMigrationJobRequest::default();
21353///
21354/// // You can configure optional parameters by calling the respective setters at will, and
21355/// // execute the final call using `doit()`.
21356/// // Values shown here are possibly random and not representative !
21357/// let result = hub.projects().locations_migration_jobs_restart(req, "name")
21358/// .doit().await;
21359/// # }
21360/// ```
21361pub struct ProjectLocationMigrationJobRestartCall<'a, C>
21362where
21363 C: 'a,
21364{
21365 hub: &'a DatabaseMigrationService<C>,
21366 _request: RestartMigrationJobRequest,
21367 _name: String,
21368 _delegate: Option<&'a mut dyn common::Delegate>,
21369 _additional_params: HashMap<String, String>,
21370 _scopes: BTreeSet<String>,
21371}
21372
21373impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobRestartCall<'a, C> {}
21374
21375impl<'a, C> ProjectLocationMigrationJobRestartCall<'a, C>
21376where
21377 C: common::Connector,
21378{
21379 /// Perform the operation you have build so far.
21380 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21381 use std::borrow::Cow;
21382 use std::io::{Read, Seek};
21383
21384 use common::{url::Params, ToParts};
21385 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21386
21387 let mut dd = common::DefaultDelegate;
21388 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21389 dlg.begin(common::MethodInfo {
21390 id: "datamigration.projects.locations.migrationJobs.restart",
21391 http_method: hyper::Method::POST,
21392 });
21393
21394 for &field in ["alt", "name"].iter() {
21395 if self._additional_params.contains_key(field) {
21396 dlg.finished(false);
21397 return Err(common::Error::FieldClash(field));
21398 }
21399 }
21400
21401 let mut params = Params::with_capacity(4 + self._additional_params.len());
21402 params.push("name", self._name);
21403
21404 params.extend(self._additional_params.iter());
21405
21406 params.push("alt", "json");
21407 let mut url = self.hub._base_url.clone() + "v1/{+name}:restart";
21408 if self._scopes.is_empty() {
21409 self._scopes
21410 .insert(Scope::CloudPlatform.as_ref().to_string());
21411 }
21412
21413 #[allow(clippy::single_element_loop)]
21414 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21415 url = params.uri_replacement(url, param_name, find_this, true);
21416 }
21417 {
21418 let to_remove = ["name"];
21419 params.remove_params(&to_remove);
21420 }
21421
21422 let url = params.parse_with_url(&url);
21423
21424 let mut json_mime_type = mime::APPLICATION_JSON;
21425 let mut request_value_reader = {
21426 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21427 common::remove_json_null_values(&mut value);
21428 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21429 serde_json::to_writer(&mut dst, &value).unwrap();
21430 dst
21431 };
21432 let request_size = request_value_reader
21433 .seek(std::io::SeekFrom::End(0))
21434 .unwrap();
21435 request_value_reader
21436 .seek(std::io::SeekFrom::Start(0))
21437 .unwrap();
21438
21439 loop {
21440 let token = match self
21441 .hub
21442 .auth
21443 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21444 .await
21445 {
21446 Ok(token) => token,
21447 Err(e) => match dlg.token(e) {
21448 Ok(token) => token,
21449 Err(e) => {
21450 dlg.finished(false);
21451 return Err(common::Error::MissingToken(e));
21452 }
21453 },
21454 };
21455 request_value_reader
21456 .seek(std::io::SeekFrom::Start(0))
21457 .unwrap();
21458 let mut req_result = {
21459 let client = &self.hub.client;
21460 dlg.pre_request();
21461 let mut req_builder = hyper::Request::builder()
21462 .method(hyper::Method::POST)
21463 .uri(url.as_str())
21464 .header(USER_AGENT, self.hub._user_agent.clone());
21465
21466 if let Some(token) = token.as_ref() {
21467 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21468 }
21469
21470 let request = req_builder
21471 .header(CONTENT_TYPE, json_mime_type.to_string())
21472 .header(CONTENT_LENGTH, request_size as u64)
21473 .body(common::to_body(
21474 request_value_reader.get_ref().clone().into(),
21475 ));
21476
21477 client.request(request.unwrap()).await
21478 };
21479
21480 match req_result {
21481 Err(err) => {
21482 if let common::Retry::After(d) = dlg.http_error(&err) {
21483 sleep(d).await;
21484 continue;
21485 }
21486 dlg.finished(false);
21487 return Err(common::Error::HttpError(err));
21488 }
21489 Ok(res) => {
21490 let (mut parts, body) = res.into_parts();
21491 let mut body = common::Body::new(body);
21492 if !parts.status.is_success() {
21493 let bytes = common::to_bytes(body).await.unwrap_or_default();
21494 let error = serde_json::from_str(&common::to_string(&bytes));
21495 let response = common::to_response(parts, bytes.into());
21496
21497 if let common::Retry::After(d) =
21498 dlg.http_failure(&response, error.as_ref().ok())
21499 {
21500 sleep(d).await;
21501 continue;
21502 }
21503
21504 dlg.finished(false);
21505
21506 return Err(match error {
21507 Ok(value) => common::Error::BadRequest(value),
21508 _ => common::Error::Failure(response),
21509 });
21510 }
21511 let response = {
21512 let bytes = common::to_bytes(body).await.unwrap_or_default();
21513 let encoded = common::to_string(&bytes);
21514 match serde_json::from_str(&encoded) {
21515 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21516 Err(error) => {
21517 dlg.response_json_decode_error(&encoded, &error);
21518 return Err(common::Error::JsonDecodeError(
21519 encoded.to_string(),
21520 error,
21521 ));
21522 }
21523 }
21524 };
21525
21526 dlg.finished(true);
21527 return Ok(response);
21528 }
21529 }
21530 }
21531 }
21532
21533 ///
21534 /// Sets the *request* property to the given value.
21535 ///
21536 /// Even though the property as already been set when instantiating this call,
21537 /// we provide this method for API completeness.
21538 pub fn request(
21539 mut self,
21540 new_value: RestartMigrationJobRequest,
21541 ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
21542 self._request = new_value;
21543 self
21544 }
21545 /// Name of the migration job resource to restart.
21546 ///
21547 /// Sets the *name* path property to the given value.
21548 ///
21549 /// Even though the property as already been set when instantiating this call,
21550 /// we provide this method for API completeness.
21551 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobRestartCall<'a, C> {
21552 self._name = new_value.to_string();
21553 self
21554 }
21555 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21556 /// while executing the actual API request.
21557 ///
21558 /// ````text
21559 /// It should be used to handle progress information, and to implement a certain level of resilience.
21560 /// ````
21561 ///
21562 /// Sets the *delegate* property to the given value.
21563 pub fn delegate(
21564 mut self,
21565 new_value: &'a mut dyn common::Delegate,
21566 ) -> ProjectLocationMigrationJobRestartCall<'a, C> {
21567 self._delegate = Some(new_value);
21568 self
21569 }
21570
21571 /// Set any additional parameter of the query string used in the request.
21572 /// It should be used to set parameters which are not yet available through their own
21573 /// setters.
21574 ///
21575 /// Please note that this method must not be used to set any of the known parameters
21576 /// which have their own setter method. If done anyway, the request will fail.
21577 ///
21578 /// # Additional Parameters
21579 ///
21580 /// * *$.xgafv* (query-string) - V1 error format.
21581 /// * *access_token* (query-string) - OAuth access token.
21582 /// * *alt* (query-string) - Data format for response.
21583 /// * *callback* (query-string) - JSONP
21584 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21585 /// * *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.
21586 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21587 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21588 /// * *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.
21589 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21590 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21591 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobRestartCall<'a, C>
21592 where
21593 T: AsRef<str>,
21594 {
21595 self._additional_params
21596 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21597 self
21598 }
21599
21600 /// Identifies the authorization scope for the method you are building.
21601 ///
21602 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21603 /// [`Scope::CloudPlatform`].
21604 ///
21605 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21606 /// tokens for more than one scope.
21607 ///
21608 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21609 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21610 /// sufficient, a read-write scope will do as well.
21611 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobRestartCall<'a, C>
21612 where
21613 St: AsRef<str>,
21614 {
21615 self._scopes.insert(String::from(scope.as_ref()));
21616 self
21617 }
21618 /// Identifies the authorization scope(s) for the method you are building.
21619 ///
21620 /// See [`Self::add_scope()`] for details.
21621 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobRestartCall<'a, C>
21622 where
21623 I: IntoIterator<Item = St>,
21624 St: AsRef<str>,
21625 {
21626 self._scopes
21627 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21628 self
21629 }
21630
21631 /// Removes all scopes, and no default scope will be used either.
21632 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21633 /// for details).
21634 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobRestartCall<'a, C> {
21635 self._scopes.clear();
21636 self
21637 }
21638}
21639
21640/// Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase).
21641///
21642/// A builder for the *locations.migrationJobs.resume* method supported by a *project* resource.
21643/// It is not used directly, but through a [`ProjectMethods`] instance.
21644///
21645/// # Example
21646///
21647/// Instantiate a resource method builder
21648///
21649/// ```test_harness,no_run
21650/// # extern crate hyper;
21651/// # extern crate hyper_rustls;
21652/// # extern crate google_datamigration1 as datamigration1;
21653/// use datamigration1::api::ResumeMigrationJobRequest;
21654/// # async fn dox() {
21655/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21656///
21657/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21658/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21659/// # .with_native_roots()
21660/// # .unwrap()
21661/// # .https_only()
21662/// # .enable_http2()
21663/// # .build();
21664///
21665/// # let executor = hyper_util::rt::TokioExecutor::new();
21666/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21667/// # secret,
21668/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21669/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21670/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21671/// # ),
21672/// # ).build().await.unwrap();
21673///
21674/// # let client = hyper_util::client::legacy::Client::builder(
21675/// # hyper_util::rt::TokioExecutor::new()
21676/// # )
21677/// # .build(
21678/// # hyper_rustls::HttpsConnectorBuilder::new()
21679/// # .with_native_roots()
21680/// # .unwrap()
21681/// # .https_or_http()
21682/// # .enable_http2()
21683/// # .build()
21684/// # );
21685/// # let mut hub = DatabaseMigrationService::new(client, auth);
21686/// // As the method needs a request, you would usually fill it with the desired information
21687/// // into the respective structure. Some of the parts shown here might not be applicable !
21688/// // Values shown here are possibly random and not representative !
21689/// let mut req = ResumeMigrationJobRequest::default();
21690///
21691/// // You can configure optional parameters by calling the respective setters at will, and
21692/// // execute the final call using `doit()`.
21693/// // Values shown here are possibly random and not representative !
21694/// let result = hub.projects().locations_migration_jobs_resume(req, "name")
21695/// .doit().await;
21696/// # }
21697/// ```
21698pub struct ProjectLocationMigrationJobResumeCall<'a, C>
21699where
21700 C: 'a,
21701{
21702 hub: &'a DatabaseMigrationService<C>,
21703 _request: ResumeMigrationJobRequest,
21704 _name: String,
21705 _delegate: Option<&'a mut dyn common::Delegate>,
21706 _additional_params: HashMap<String, String>,
21707 _scopes: BTreeSet<String>,
21708}
21709
21710impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobResumeCall<'a, C> {}
21711
21712impl<'a, C> ProjectLocationMigrationJobResumeCall<'a, C>
21713where
21714 C: common::Connector,
21715{
21716 /// Perform the operation you have build so far.
21717 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21718 use std::borrow::Cow;
21719 use std::io::{Read, Seek};
21720
21721 use common::{url::Params, ToParts};
21722 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21723
21724 let mut dd = common::DefaultDelegate;
21725 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21726 dlg.begin(common::MethodInfo {
21727 id: "datamigration.projects.locations.migrationJobs.resume",
21728 http_method: hyper::Method::POST,
21729 });
21730
21731 for &field in ["alt", "name"].iter() {
21732 if self._additional_params.contains_key(field) {
21733 dlg.finished(false);
21734 return Err(common::Error::FieldClash(field));
21735 }
21736 }
21737
21738 let mut params = Params::with_capacity(4 + self._additional_params.len());
21739 params.push("name", self._name);
21740
21741 params.extend(self._additional_params.iter());
21742
21743 params.push("alt", "json");
21744 let mut url = self.hub._base_url.clone() + "v1/{+name}:resume";
21745 if self._scopes.is_empty() {
21746 self._scopes
21747 .insert(Scope::CloudPlatform.as_ref().to_string());
21748 }
21749
21750 #[allow(clippy::single_element_loop)]
21751 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21752 url = params.uri_replacement(url, param_name, find_this, true);
21753 }
21754 {
21755 let to_remove = ["name"];
21756 params.remove_params(&to_remove);
21757 }
21758
21759 let url = params.parse_with_url(&url);
21760
21761 let mut json_mime_type = mime::APPLICATION_JSON;
21762 let mut request_value_reader = {
21763 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21764 common::remove_json_null_values(&mut value);
21765 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21766 serde_json::to_writer(&mut dst, &value).unwrap();
21767 dst
21768 };
21769 let request_size = request_value_reader
21770 .seek(std::io::SeekFrom::End(0))
21771 .unwrap();
21772 request_value_reader
21773 .seek(std::io::SeekFrom::Start(0))
21774 .unwrap();
21775
21776 loop {
21777 let token = match self
21778 .hub
21779 .auth
21780 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21781 .await
21782 {
21783 Ok(token) => token,
21784 Err(e) => match dlg.token(e) {
21785 Ok(token) => token,
21786 Err(e) => {
21787 dlg.finished(false);
21788 return Err(common::Error::MissingToken(e));
21789 }
21790 },
21791 };
21792 request_value_reader
21793 .seek(std::io::SeekFrom::Start(0))
21794 .unwrap();
21795 let mut req_result = {
21796 let client = &self.hub.client;
21797 dlg.pre_request();
21798 let mut req_builder = hyper::Request::builder()
21799 .method(hyper::Method::POST)
21800 .uri(url.as_str())
21801 .header(USER_AGENT, self.hub._user_agent.clone());
21802
21803 if let Some(token) = token.as_ref() {
21804 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21805 }
21806
21807 let request = req_builder
21808 .header(CONTENT_TYPE, json_mime_type.to_string())
21809 .header(CONTENT_LENGTH, request_size as u64)
21810 .body(common::to_body(
21811 request_value_reader.get_ref().clone().into(),
21812 ));
21813
21814 client.request(request.unwrap()).await
21815 };
21816
21817 match req_result {
21818 Err(err) => {
21819 if let common::Retry::After(d) = dlg.http_error(&err) {
21820 sleep(d).await;
21821 continue;
21822 }
21823 dlg.finished(false);
21824 return Err(common::Error::HttpError(err));
21825 }
21826 Ok(res) => {
21827 let (mut parts, body) = res.into_parts();
21828 let mut body = common::Body::new(body);
21829 if !parts.status.is_success() {
21830 let bytes = common::to_bytes(body).await.unwrap_or_default();
21831 let error = serde_json::from_str(&common::to_string(&bytes));
21832 let response = common::to_response(parts, bytes.into());
21833
21834 if let common::Retry::After(d) =
21835 dlg.http_failure(&response, error.as_ref().ok())
21836 {
21837 sleep(d).await;
21838 continue;
21839 }
21840
21841 dlg.finished(false);
21842
21843 return Err(match error {
21844 Ok(value) => common::Error::BadRequest(value),
21845 _ => common::Error::Failure(response),
21846 });
21847 }
21848 let response = {
21849 let bytes = common::to_bytes(body).await.unwrap_or_default();
21850 let encoded = common::to_string(&bytes);
21851 match serde_json::from_str(&encoded) {
21852 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21853 Err(error) => {
21854 dlg.response_json_decode_error(&encoded, &error);
21855 return Err(common::Error::JsonDecodeError(
21856 encoded.to_string(),
21857 error,
21858 ));
21859 }
21860 }
21861 };
21862
21863 dlg.finished(true);
21864 return Ok(response);
21865 }
21866 }
21867 }
21868 }
21869
21870 ///
21871 /// Sets the *request* property to the given value.
21872 ///
21873 /// Even though the property as already been set when instantiating this call,
21874 /// we provide this method for API completeness.
21875 pub fn request(
21876 mut self,
21877 new_value: ResumeMigrationJobRequest,
21878 ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
21879 self._request = new_value;
21880 self
21881 }
21882 /// Name of the migration job resource to resume.
21883 ///
21884 /// Sets the *name* path property to the given value.
21885 ///
21886 /// Even though the property as already been set when instantiating this call,
21887 /// we provide this method for API completeness.
21888 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobResumeCall<'a, C> {
21889 self._name = new_value.to_string();
21890 self
21891 }
21892 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21893 /// while executing the actual API request.
21894 ///
21895 /// ````text
21896 /// It should be used to handle progress information, and to implement a certain level of resilience.
21897 /// ````
21898 ///
21899 /// Sets the *delegate* property to the given value.
21900 pub fn delegate(
21901 mut self,
21902 new_value: &'a mut dyn common::Delegate,
21903 ) -> ProjectLocationMigrationJobResumeCall<'a, C> {
21904 self._delegate = Some(new_value);
21905 self
21906 }
21907
21908 /// Set any additional parameter of the query string used in the request.
21909 /// It should be used to set parameters which are not yet available through their own
21910 /// setters.
21911 ///
21912 /// Please note that this method must not be used to set any of the known parameters
21913 /// which have their own setter method. If done anyway, the request will fail.
21914 ///
21915 /// # Additional Parameters
21916 ///
21917 /// * *$.xgafv* (query-string) - V1 error format.
21918 /// * *access_token* (query-string) - OAuth access token.
21919 /// * *alt* (query-string) - Data format for response.
21920 /// * *callback* (query-string) - JSONP
21921 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21922 /// * *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.
21923 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21924 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21925 /// * *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.
21926 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21927 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21928 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobResumeCall<'a, C>
21929 where
21930 T: AsRef<str>,
21931 {
21932 self._additional_params
21933 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21934 self
21935 }
21936
21937 /// Identifies the authorization scope for the method you are building.
21938 ///
21939 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21940 /// [`Scope::CloudPlatform`].
21941 ///
21942 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21943 /// tokens for more than one scope.
21944 ///
21945 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21946 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21947 /// sufficient, a read-write scope will do as well.
21948 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobResumeCall<'a, C>
21949 where
21950 St: AsRef<str>,
21951 {
21952 self._scopes.insert(String::from(scope.as_ref()));
21953 self
21954 }
21955 /// Identifies the authorization scope(s) for the method you are building.
21956 ///
21957 /// See [`Self::add_scope()`] for details.
21958 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobResumeCall<'a, C>
21959 where
21960 I: IntoIterator<Item = St>,
21961 St: AsRef<str>,
21962 {
21963 self._scopes
21964 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21965 self
21966 }
21967
21968 /// Removes all scopes, and no default scope will be used either.
21969 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21970 /// for details).
21971 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobResumeCall<'a, C> {
21972 self._scopes.clear();
21973 self
21974 }
21975}
21976
21977/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
21978///
21979/// A builder for the *locations.migrationJobs.setIamPolicy* method supported by a *project* resource.
21980/// It is not used directly, but through a [`ProjectMethods`] instance.
21981///
21982/// # Example
21983///
21984/// Instantiate a resource method builder
21985///
21986/// ```test_harness,no_run
21987/// # extern crate hyper;
21988/// # extern crate hyper_rustls;
21989/// # extern crate google_datamigration1 as datamigration1;
21990/// use datamigration1::api::SetIamPolicyRequest;
21991/// # async fn dox() {
21992/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21993///
21994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21996/// # .with_native_roots()
21997/// # .unwrap()
21998/// # .https_only()
21999/// # .enable_http2()
22000/// # .build();
22001///
22002/// # let executor = hyper_util::rt::TokioExecutor::new();
22003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22004/// # secret,
22005/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22006/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22007/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22008/// # ),
22009/// # ).build().await.unwrap();
22010///
22011/// # let client = hyper_util::client::legacy::Client::builder(
22012/// # hyper_util::rt::TokioExecutor::new()
22013/// # )
22014/// # .build(
22015/// # hyper_rustls::HttpsConnectorBuilder::new()
22016/// # .with_native_roots()
22017/// # .unwrap()
22018/// # .https_or_http()
22019/// # .enable_http2()
22020/// # .build()
22021/// # );
22022/// # let mut hub = DatabaseMigrationService::new(client, auth);
22023/// // As the method needs a request, you would usually fill it with the desired information
22024/// // into the respective structure. Some of the parts shown here might not be applicable !
22025/// // Values shown here are possibly random and not representative !
22026/// let mut req = SetIamPolicyRequest::default();
22027///
22028/// // You can configure optional parameters by calling the respective setters at will, and
22029/// // execute the final call using `doit()`.
22030/// // Values shown here are possibly random and not representative !
22031/// let result = hub.projects().locations_migration_jobs_set_iam_policy(req, "resource")
22032/// .doit().await;
22033/// # }
22034/// ```
22035pub struct ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
22036where
22037 C: 'a,
22038{
22039 hub: &'a DatabaseMigrationService<C>,
22040 _request: SetIamPolicyRequest,
22041 _resource: String,
22042 _delegate: Option<&'a mut dyn common::Delegate>,
22043 _additional_params: HashMap<String, String>,
22044 _scopes: BTreeSet<String>,
22045}
22046
22047impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {}
22048
22049impl<'a, C> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
22050where
22051 C: common::Connector,
22052{
22053 /// Perform the operation you have build so far.
22054 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22055 use std::borrow::Cow;
22056 use std::io::{Read, Seek};
22057
22058 use common::{url::Params, ToParts};
22059 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22060
22061 let mut dd = common::DefaultDelegate;
22062 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22063 dlg.begin(common::MethodInfo {
22064 id: "datamigration.projects.locations.migrationJobs.setIamPolicy",
22065 http_method: hyper::Method::POST,
22066 });
22067
22068 for &field in ["alt", "resource"].iter() {
22069 if self._additional_params.contains_key(field) {
22070 dlg.finished(false);
22071 return Err(common::Error::FieldClash(field));
22072 }
22073 }
22074
22075 let mut params = Params::with_capacity(4 + self._additional_params.len());
22076 params.push("resource", self._resource);
22077
22078 params.extend(self._additional_params.iter());
22079
22080 params.push("alt", "json");
22081 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
22082 if self._scopes.is_empty() {
22083 self._scopes
22084 .insert(Scope::CloudPlatform.as_ref().to_string());
22085 }
22086
22087 #[allow(clippy::single_element_loop)]
22088 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22089 url = params.uri_replacement(url, param_name, find_this, true);
22090 }
22091 {
22092 let to_remove = ["resource"];
22093 params.remove_params(&to_remove);
22094 }
22095
22096 let url = params.parse_with_url(&url);
22097
22098 let mut json_mime_type = mime::APPLICATION_JSON;
22099 let mut request_value_reader = {
22100 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22101 common::remove_json_null_values(&mut value);
22102 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22103 serde_json::to_writer(&mut dst, &value).unwrap();
22104 dst
22105 };
22106 let request_size = request_value_reader
22107 .seek(std::io::SeekFrom::End(0))
22108 .unwrap();
22109 request_value_reader
22110 .seek(std::io::SeekFrom::Start(0))
22111 .unwrap();
22112
22113 loop {
22114 let token = match self
22115 .hub
22116 .auth
22117 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22118 .await
22119 {
22120 Ok(token) => token,
22121 Err(e) => match dlg.token(e) {
22122 Ok(token) => token,
22123 Err(e) => {
22124 dlg.finished(false);
22125 return Err(common::Error::MissingToken(e));
22126 }
22127 },
22128 };
22129 request_value_reader
22130 .seek(std::io::SeekFrom::Start(0))
22131 .unwrap();
22132 let mut req_result = {
22133 let client = &self.hub.client;
22134 dlg.pre_request();
22135 let mut req_builder = hyper::Request::builder()
22136 .method(hyper::Method::POST)
22137 .uri(url.as_str())
22138 .header(USER_AGENT, self.hub._user_agent.clone());
22139
22140 if let Some(token) = token.as_ref() {
22141 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22142 }
22143
22144 let request = req_builder
22145 .header(CONTENT_TYPE, json_mime_type.to_string())
22146 .header(CONTENT_LENGTH, request_size as u64)
22147 .body(common::to_body(
22148 request_value_reader.get_ref().clone().into(),
22149 ));
22150
22151 client.request(request.unwrap()).await
22152 };
22153
22154 match req_result {
22155 Err(err) => {
22156 if let common::Retry::After(d) = dlg.http_error(&err) {
22157 sleep(d).await;
22158 continue;
22159 }
22160 dlg.finished(false);
22161 return Err(common::Error::HttpError(err));
22162 }
22163 Ok(res) => {
22164 let (mut parts, body) = res.into_parts();
22165 let mut body = common::Body::new(body);
22166 if !parts.status.is_success() {
22167 let bytes = common::to_bytes(body).await.unwrap_or_default();
22168 let error = serde_json::from_str(&common::to_string(&bytes));
22169 let response = common::to_response(parts, bytes.into());
22170
22171 if let common::Retry::After(d) =
22172 dlg.http_failure(&response, error.as_ref().ok())
22173 {
22174 sleep(d).await;
22175 continue;
22176 }
22177
22178 dlg.finished(false);
22179
22180 return Err(match error {
22181 Ok(value) => common::Error::BadRequest(value),
22182 _ => common::Error::Failure(response),
22183 });
22184 }
22185 let response = {
22186 let bytes = common::to_bytes(body).await.unwrap_or_default();
22187 let encoded = common::to_string(&bytes);
22188 match serde_json::from_str(&encoded) {
22189 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22190 Err(error) => {
22191 dlg.response_json_decode_error(&encoded, &error);
22192 return Err(common::Error::JsonDecodeError(
22193 encoded.to_string(),
22194 error,
22195 ));
22196 }
22197 }
22198 };
22199
22200 dlg.finished(true);
22201 return Ok(response);
22202 }
22203 }
22204 }
22205 }
22206
22207 ///
22208 /// Sets the *request* property to the given value.
22209 ///
22210 /// Even though the property as already been set when instantiating this call,
22211 /// we provide this method for API completeness.
22212 pub fn request(
22213 mut self,
22214 new_value: SetIamPolicyRequest,
22215 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
22216 self._request = new_value;
22217 self
22218 }
22219 /// 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.
22220 ///
22221 /// Sets the *resource* path property to the given value.
22222 ///
22223 /// Even though the property as already been set when instantiating this call,
22224 /// we provide this method for API completeness.
22225 pub fn resource(
22226 mut self,
22227 new_value: &str,
22228 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
22229 self._resource = new_value.to_string();
22230 self
22231 }
22232 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22233 /// while executing the actual API request.
22234 ///
22235 /// ````text
22236 /// It should be used to handle progress information, and to implement a certain level of resilience.
22237 /// ````
22238 ///
22239 /// Sets the *delegate* property to the given value.
22240 pub fn delegate(
22241 mut self,
22242 new_value: &'a mut dyn common::Delegate,
22243 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
22244 self._delegate = Some(new_value);
22245 self
22246 }
22247
22248 /// Set any additional parameter of the query string used in the request.
22249 /// It should be used to set parameters which are not yet available through their own
22250 /// setters.
22251 ///
22252 /// Please note that this method must not be used to set any of the known parameters
22253 /// which have their own setter method. If done anyway, the request will fail.
22254 ///
22255 /// # Additional Parameters
22256 ///
22257 /// * *$.xgafv* (query-string) - V1 error format.
22258 /// * *access_token* (query-string) - OAuth access token.
22259 /// * *alt* (query-string) - Data format for response.
22260 /// * *callback* (query-string) - JSONP
22261 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22262 /// * *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.
22263 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22264 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22265 /// * *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.
22266 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22267 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22268 pub fn param<T>(
22269 mut self,
22270 name: T,
22271 value: T,
22272 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
22273 where
22274 T: AsRef<str>,
22275 {
22276 self._additional_params
22277 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22278 self
22279 }
22280
22281 /// Identifies the authorization scope for the method you are building.
22282 ///
22283 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22284 /// [`Scope::CloudPlatform`].
22285 ///
22286 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22287 /// tokens for more than one scope.
22288 ///
22289 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22290 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22291 /// sufficient, a read-write scope will do as well.
22292 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
22293 where
22294 St: AsRef<str>,
22295 {
22296 self._scopes.insert(String::from(scope.as_ref()));
22297 self
22298 }
22299 /// Identifies the authorization scope(s) for the method you are building.
22300 ///
22301 /// See [`Self::add_scope()`] for details.
22302 pub fn add_scopes<I, St>(
22303 mut self,
22304 scopes: I,
22305 ) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C>
22306 where
22307 I: IntoIterator<Item = St>,
22308 St: AsRef<str>,
22309 {
22310 self._scopes
22311 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22312 self
22313 }
22314
22315 /// Removes all scopes, and no default scope will be used either.
22316 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22317 /// for details).
22318 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobSetIamPolicyCall<'a, C> {
22319 self._scopes.clear();
22320 self
22321 }
22322}
22323
22324/// Start an already created migration job.
22325///
22326/// A builder for the *locations.migrationJobs.start* method supported by a *project* resource.
22327/// It is not used directly, but through a [`ProjectMethods`] instance.
22328///
22329/// # Example
22330///
22331/// Instantiate a resource method builder
22332///
22333/// ```test_harness,no_run
22334/// # extern crate hyper;
22335/// # extern crate hyper_rustls;
22336/// # extern crate google_datamigration1 as datamigration1;
22337/// use datamigration1::api::StartMigrationJobRequest;
22338/// # async fn dox() {
22339/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22340///
22341/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22342/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22343/// # .with_native_roots()
22344/// # .unwrap()
22345/// # .https_only()
22346/// # .enable_http2()
22347/// # .build();
22348///
22349/// # let executor = hyper_util::rt::TokioExecutor::new();
22350/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22351/// # secret,
22352/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22353/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22354/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22355/// # ),
22356/// # ).build().await.unwrap();
22357///
22358/// # let client = hyper_util::client::legacy::Client::builder(
22359/// # hyper_util::rt::TokioExecutor::new()
22360/// # )
22361/// # .build(
22362/// # hyper_rustls::HttpsConnectorBuilder::new()
22363/// # .with_native_roots()
22364/// # .unwrap()
22365/// # .https_or_http()
22366/// # .enable_http2()
22367/// # .build()
22368/// # );
22369/// # let mut hub = DatabaseMigrationService::new(client, auth);
22370/// // As the method needs a request, you would usually fill it with the desired information
22371/// // into the respective structure. Some of the parts shown here might not be applicable !
22372/// // Values shown here are possibly random and not representative !
22373/// let mut req = StartMigrationJobRequest::default();
22374///
22375/// // You can configure optional parameters by calling the respective setters at will, and
22376/// // execute the final call using `doit()`.
22377/// // Values shown here are possibly random and not representative !
22378/// let result = hub.projects().locations_migration_jobs_start(req, "name")
22379/// .doit().await;
22380/// # }
22381/// ```
22382pub struct ProjectLocationMigrationJobStartCall<'a, C>
22383where
22384 C: 'a,
22385{
22386 hub: &'a DatabaseMigrationService<C>,
22387 _request: StartMigrationJobRequest,
22388 _name: String,
22389 _delegate: Option<&'a mut dyn common::Delegate>,
22390 _additional_params: HashMap<String, String>,
22391 _scopes: BTreeSet<String>,
22392}
22393
22394impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobStartCall<'a, C> {}
22395
22396impl<'a, C> ProjectLocationMigrationJobStartCall<'a, C>
22397where
22398 C: common::Connector,
22399{
22400 /// Perform the operation you have build so far.
22401 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22402 use std::borrow::Cow;
22403 use std::io::{Read, Seek};
22404
22405 use common::{url::Params, ToParts};
22406 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22407
22408 let mut dd = common::DefaultDelegate;
22409 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22410 dlg.begin(common::MethodInfo {
22411 id: "datamigration.projects.locations.migrationJobs.start",
22412 http_method: hyper::Method::POST,
22413 });
22414
22415 for &field in ["alt", "name"].iter() {
22416 if self._additional_params.contains_key(field) {
22417 dlg.finished(false);
22418 return Err(common::Error::FieldClash(field));
22419 }
22420 }
22421
22422 let mut params = Params::with_capacity(4 + self._additional_params.len());
22423 params.push("name", self._name);
22424
22425 params.extend(self._additional_params.iter());
22426
22427 params.push("alt", "json");
22428 let mut url = self.hub._base_url.clone() + "v1/{+name}:start";
22429 if self._scopes.is_empty() {
22430 self._scopes
22431 .insert(Scope::CloudPlatform.as_ref().to_string());
22432 }
22433
22434 #[allow(clippy::single_element_loop)]
22435 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22436 url = params.uri_replacement(url, param_name, find_this, true);
22437 }
22438 {
22439 let to_remove = ["name"];
22440 params.remove_params(&to_remove);
22441 }
22442
22443 let url = params.parse_with_url(&url);
22444
22445 let mut json_mime_type = mime::APPLICATION_JSON;
22446 let mut request_value_reader = {
22447 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22448 common::remove_json_null_values(&mut value);
22449 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22450 serde_json::to_writer(&mut dst, &value).unwrap();
22451 dst
22452 };
22453 let request_size = request_value_reader
22454 .seek(std::io::SeekFrom::End(0))
22455 .unwrap();
22456 request_value_reader
22457 .seek(std::io::SeekFrom::Start(0))
22458 .unwrap();
22459
22460 loop {
22461 let token = match self
22462 .hub
22463 .auth
22464 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22465 .await
22466 {
22467 Ok(token) => token,
22468 Err(e) => match dlg.token(e) {
22469 Ok(token) => token,
22470 Err(e) => {
22471 dlg.finished(false);
22472 return Err(common::Error::MissingToken(e));
22473 }
22474 },
22475 };
22476 request_value_reader
22477 .seek(std::io::SeekFrom::Start(0))
22478 .unwrap();
22479 let mut req_result = {
22480 let client = &self.hub.client;
22481 dlg.pre_request();
22482 let mut req_builder = hyper::Request::builder()
22483 .method(hyper::Method::POST)
22484 .uri(url.as_str())
22485 .header(USER_AGENT, self.hub._user_agent.clone());
22486
22487 if let Some(token) = token.as_ref() {
22488 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22489 }
22490
22491 let request = req_builder
22492 .header(CONTENT_TYPE, json_mime_type.to_string())
22493 .header(CONTENT_LENGTH, request_size as u64)
22494 .body(common::to_body(
22495 request_value_reader.get_ref().clone().into(),
22496 ));
22497
22498 client.request(request.unwrap()).await
22499 };
22500
22501 match req_result {
22502 Err(err) => {
22503 if let common::Retry::After(d) = dlg.http_error(&err) {
22504 sleep(d).await;
22505 continue;
22506 }
22507 dlg.finished(false);
22508 return Err(common::Error::HttpError(err));
22509 }
22510 Ok(res) => {
22511 let (mut parts, body) = res.into_parts();
22512 let mut body = common::Body::new(body);
22513 if !parts.status.is_success() {
22514 let bytes = common::to_bytes(body).await.unwrap_or_default();
22515 let error = serde_json::from_str(&common::to_string(&bytes));
22516 let response = common::to_response(parts, bytes.into());
22517
22518 if let common::Retry::After(d) =
22519 dlg.http_failure(&response, error.as_ref().ok())
22520 {
22521 sleep(d).await;
22522 continue;
22523 }
22524
22525 dlg.finished(false);
22526
22527 return Err(match error {
22528 Ok(value) => common::Error::BadRequest(value),
22529 _ => common::Error::Failure(response),
22530 });
22531 }
22532 let response = {
22533 let bytes = common::to_bytes(body).await.unwrap_or_default();
22534 let encoded = common::to_string(&bytes);
22535 match serde_json::from_str(&encoded) {
22536 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22537 Err(error) => {
22538 dlg.response_json_decode_error(&encoded, &error);
22539 return Err(common::Error::JsonDecodeError(
22540 encoded.to_string(),
22541 error,
22542 ));
22543 }
22544 }
22545 };
22546
22547 dlg.finished(true);
22548 return Ok(response);
22549 }
22550 }
22551 }
22552 }
22553
22554 ///
22555 /// Sets the *request* property to the given value.
22556 ///
22557 /// Even though the property as already been set when instantiating this call,
22558 /// we provide this method for API completeness.
22559 pub fn request(
22560 mut self,
22561 new_value: StartMigrationJobRequest,
22562 ) -> ProjectLocationMigrationJobStartCall<'a, C> {
22563 self._request = new_value;
22564 self
22565 }
22566 /// Name of the migration job resource to start.
22567 ///
22568 /// Sets the *name* path property to the given value.
22569 ///
22570 /// Even though the property as already been set when instantiating this call,
22571 /// we provide this method for API completeness.
22572 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobStartCall<'a, C> {
22573 self._name = new_value.to_string();
22574 self
22575 }
22576 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22577 /// while executing the actual API request.
22578 ///
22579 /// ````text
22580 /// It should be used to handle progress information, and to implement a certain level of resilience.
22581 /// ````
22582 ///
22583 /// Sets the *delegate* property to the given value.
22584 pub fn delegate(
22585 mut self,
22586 new_value: &'a mut dyn common::Delegate,
22587 ) -> ProjectLocationMigrationJobStartCall<'a, C> {
22588 self._delegate = Some(new_value);
22589 self
22590 }
22591
22592 /// Set any additional parameter of the query string used in the request.
22593 /// It should be used to set parameters which are not yet available through their own
22594 /// setters.
22595 ///
22596 /// Please note that this method must not be used to set any of the known parameters
22597 /// which have their own setter method. If done anyway, the request will fail.
22598 ///
22599 /// # Additional Parameters
22600 ///
22601 /// * *$.xgafv* (query-string) - V1 error format.
22602 /// * *access_token* (query-string) - OAuth access token.
22603 /// * *alt* (query-string) - Data format for response.
22604 /// * *callback* (query-string) - JSONP
22605 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22606 /// * *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.
22607 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22608 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22609 /// * *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.
22610 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22611 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22612 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobStartCall<'a, C>
22613 where
22614 T: AsRef<str>,
22615 {
22616 self._additional_params
22617 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22618 self
22619 }
22620
22621 /// Identifies the authorization scope for the method you are building.
22622 ///
22623 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22624 /// [`Scope::CloudPlatform`].
22625 ///
22626 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22627 /// tokens for more than one scope.
22628 ///
22629 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22630 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22631 /// sufficient, a read-write scope will do as well.
22632 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobStartCall<'a, C>
22633 where
22634 St: AsRef<str>,
22635 {
22636 self._scopes.insert(String::from(scope.as_ref()));
22637 self
22638 }
22639 /// Identifies the authorization scope(s) for the method you are building.
22640 ///
22641 /// See [`Self::add_scope()`] for details.
22642 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobStartCall<'a, C>
22643 where
22644 I: IntoIterator<Item = St>,
22645 St: AsRef<str>,
22646 {
22647 self._scopes
22648 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22649 self
22650 }
22651
22652 /// Removes all scopes, and no default scope will be used either.
22653 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22654 /// for details).
22655 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobStartCall<'a, C> {
22656 self._scopes.clear();
22657 self
22658 }
22659}
22660
22661/// Stops a running migration job.
22662///
22663/// A builder for the *locations.migrationJobs.stop* method supported by a *project* resource.
22664/// It is not used directly, but through a [`ProjectMethods`] instance.
22665///
22666/// # Example
22667///
22668/// Instantiate a resource method builder
22669///
22670/// ```test_harness,no_run
22671/// # extern crate hyper;
22672/// # extern crate hyper_rustls;
22673/// # extern crate google_datamigration1 as datamigration1;
22674/// use datamigration1::api::StopMigrationJobRequest;
22675/// # async fn dox() {
22676/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22677///
22678/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22679/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22680/// # .with_native_roots()
22681/// # .unwrap()
22682/// # .https_only()
22683/// # .enable_http2()
22684/// # .build();
22685///
22686/// # let executor = hyper_util::rt::TokioExecutor::new();
22687/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22688/// # secret,
22689/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22690/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22691/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22692/// # ),
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_http2()
22704/// # .build()
22705/// # );
22706/// # let mut hub = DatabaseMigrationService::new(client, auth);
22707/// // As the method needs a request, you would usually fill it with the desired information
22708/// // into the respective structure. Some of the parts shown here might not be applicable !
22709/// // Values shown here are possibly random and not representative !
22710/// let mut req = StopMigrationJobRequest::default();
22711///
22712/// // You can configure optional parameters by calling the respective setters at will, and
22713/// // execute the final call using `doit()`.
22714/// // Values shown here are possibly random and not representative !
22715/// let result = hub.projects().locations_migration_jobs_stop(req, "name")
22716/// .doit().await;
22717/// # }
22718/// ```
22719pub struct ProjectLocationMigrationJobStopCall<'a, C>
22720where
22721 C: 'a,
22722{
22723 hub: &'a DatabaseMigrationService<C>,
22724 _request: StopMigrationJobRequest,
22725 _name: String,
22726 _delegate: Option<&'a mut dyn common::Delegate>,
22727 _additional_params: HashMap<String, String>,
22728 _scopes: BTreeSet<String>,
22729}
22730
22731impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobStopCall<'a, C> {}
22732
22733impl<'a, C> ProjectLocationMigrationJobStopCall<'a, C>
22734where
22735 C: common::Connector,
22736{
22737 /// Perform the operation you have build so far.
22738 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22739 use std::borrow::Cow;
22740 use std::io::{Read, Seek};
22741
22742 use common::{url::Params, ToParts};
22743 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22744
22745 let mut dd = common::DefaultDelegate;
22746 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22747 dlg.begin(common::MethodInfo {
22748 id: "datamigration.projects.locations.migrationJobs.stop",
22749 http_method: hyper::Method::POST,
22750 });
22751
22752 for &field in ["alt", "name"].iter() {
22753 if self._additional_params.contains_key(field) {
22754 dlg.finished(false);
22755 return Err(common::Error::FieldClash(field));
22756 }
22757 }
22758
22759 let mut params = Params::with_capacity(4 + self._additional_params.len());
22760 params.push("name", self._name);
22761
22762 params.extend(self._additional_params.iter());
22763
22764 params.push("alt", "json");
22765 let mut url = self.hub._base_url.clone() + "v1/{+name}:stop";
22766 if self._scopes.is_empty() {
22767 self._scopes
22768 .insert(Scope::CloudPlatform.as_ref().to_string());
22769 }
22770
22771 #[allow(clippy::single_element_loop)]
22772 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22773 url = params.uri_replacement(url, param_name, find_this, true);
22774 }
22775 {
22776 let to_remove = ["name"];
22777 params.remove_params(&to_remove);
22778 }
22779
22780 let url = params.parse_with_url(&url);
22781
22782 let mut json_mime_type = mime::APPLICATION_JSON;
22783 let mut request_value_reader = {
22784 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22785 common::remove_json_null_values(&mut value);
22786 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22787 serde_json::to_writer(&mut dst, &value).unwrap();
22788 dst
22789 };
22790 let request_size = request_value_reader
22791 .seek(std::io::SeekFrom::End(0))
22792 .unwrap();
22793 request_value_reader
22794 .seek(std::io::SeekFrom::Start(0))
22795 .unwrap();
22796
22797 loop {
22798 let token = match self
22799 .hub
22800 .auth
22801 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22802 .await
22803 {
22804 Ok(token) => token,
22805 Err(e) => match dlg.token(e) {
22806 Ok(token) => token,
22807 Err(e) => {
22808 dlg.finished(false);
22809 return Err(common::Error::MissingToken(e));
22810 }
22811 },
22812 };
22813 request_value_reader
22814 .seek(std::io::SeekFrom::Start(0))
22815 .unwrap();
22816 let mut req_result = {
22817 let client = &self.hub.client;
22818 dlg.pre_request();
22819 let mut req_builder = hyper::Request::builder()
22820 .method(hyper::Method::POST)
22821 .uri(url.as_str())
22822 .header(USER_AGENT, self.hub._user_agent.clone());
22823
22824 if let Some(token) = token.as_ref() {
22825 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22826 }
22827
22828 let request = req_builder
22829 .header(CONTENT_TYPE, json_mime_type.to_string())
22830 .header(CONTENT_LENGTH, request_size as u64)
22831 .body(common::to_body(
22832 request_value_reader.get_ref().clone().into(),
22833 ));
22834
22835 client.request(request.unwrap()).await
22836 };
22837
22838 match req_result {
22839 Err(err) => {
22840 if let common::Retry::After(d) = dlg.http_error(&err) {
22841 sleep(d).await;
22842 continue;
22843 }
22844 dlg.finished(false);
22845 return Err(common::Error::HttpError(err));
22846 }
22847 Ok(res) => {
22848 let (mut parts, body) = res.into_parts();
22849 let mut body = common::Body::new(body);
22850 if !parts.status.is_success() {
22851 let bytes = common::to_bytes(body).await.unwrap_or_default();
22852 let error = serde_json::from_str(&common::to_string(&bytes));
22853 let response = common::to_response(parts, bytes.into());
22854
22855 if let common::Retry::After(d) =
22856 dlg.http_failure(&response, error.as_ref().ok())
22857 {
22858 sleep(d).await;
22859 continue;
22860 }
22861
22862 dlg.finished(false);
22863
22864 return Err(match error {
22865 Ok(value) => common::Error::BadRequest(value),
22866 _ => common::Error::Failure(response),
22867 });
22868 }
22869 let response = {
22870 let bytes = common::to_bytes(body).await.unwrap_or_default();
22871 let encoded = common::to_string(&bytes);
22872 match serde_json::from_str(&encoded) {
22873 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22874 Err(error) => {
22875 dlg.response_json_decode_error(&encoded, &error);
22876 return Err(common::Error::JsonDecodeError(
22877 encoded.to_string(),
22878 error,
22879 ));
22880 }
22881 }
22882 };
22883
22884 dlg.finished(true);
22885 return Ok(response);
22886 }
22887 }
22888 }
22889 }
22890
22891 ///
22892 /// Sets the *request* property to the given value.
22893 ///
22894 /// Even though the property as already been set when instantiating this call,
22895 /// we provide this method for API completeness.
22896 pub fn request(
22897 mut self,
22898 new_value: StopMigrationJobRequest,
22899 ) -> ProjectLocationMigrationJobStopCall<'a, C> {
22900 self._request = new_value;
22901 self
22902 }
22903 /// Name of the migration job resource to stop.
22904 ///
22905 /// Sets the *name* path property to the given value.
22906 ///
22907 /// Even though the property as already been set when instantiating this call,
22908 /// we provide this method for API completeness.
22909 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobStopCall<'a, C> {
22910 self._name = new_value.to_string();
22911 self
22912 }
22913 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22914 /// while executing the actual API request.
22915 ///
22916 /// ````text
22917 /// It should be used to handle progress information, and to implement a certain level of resilience.
22918 /// ````
22919 ///
22920 /// Sets the *delegate* property to the given value.
22921 pub fn delegate(
22922 mut self,
22923 new_value: &'a mut dyn common::Delegate,
22924 ) -> ProjectLocationMigrationJobStopCall<'a, C> {
22925 self._delegate = Some(new_value);
22926 self
22927 }
22928
22929 /// Set any additional parameter of the query string used in the request.
22930 /// It should be used to set parameters which are not yet available through their own
22931 /// setters.
22932 ///
22933 /// Please note that this method must not be used to set any of the known parameters
22934 /// which have their own setter method. If done anyway, the request will fail.
22935 ///
22936 /// # Additional Parameters
22937 ///
22938 /// * *$.xgafv* (query-string) - V1 error format.
22939 /// * *access_token* (query-string) - OAuth access token.
22940 /// * *alt* (query-string) - Data format for response.
22941 /// * *callback* (query-string) - JSONP
22942 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22943 /// * *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.
22944 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22945 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22946 /// * *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.
22947 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22948 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22949 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobStopCall<'a, C>
22950 where
22951 T: AsRef<str>,
22952 {
22953 self._additional_params
22954 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22955 self
22956 }
22957
22958 /// Identifies the authorization scope for the method you are building.
22959 ///
22960 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22961 /// [`Scope::CloudPlatform`].
22962 ///
22963 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22964 /// tokens for more than one scope.
22965 ///
22966 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22967 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22968 /// sufficient, a read-write scope will do as well.
22969 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobStopCall<'a, C>
22970 where
22971 St: AsRef<str>,
22972 {
22973 self._scopes.insert(String::from(scope.as_ref()));
22974 self
22975 }
22976 /// Identifies the authorization scope(s) for the method you are building.
22977 ///
22978 /// See [`Self::add_scope()`] for details.
22979 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobStopCall<'a, C>
22980 where
22981 I: IntoIterator<Item = St>,
22982 St: AsRef<str>,
22983 {
22984 self._scopes
22985 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22986 self
22987 }
22988
22989 /// Removes all scopes, and no default scope will be used either.
22990 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22991 /// for details).
22992 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobStopCall<'a, C> {
22993 self._scopes.clear();
22994 self
22995 }
22996}
22997
22998/// 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.
22999///
23000/// A builder for the *locations.migrationJobs.testIamPermissions* method supported by a *project* resource.
23001/// It is not used directly, but through a [`ProjectMethods`] instance.
23002///
23003/// # Example
23004///
23005/// Instantiate a resource method builder
23006///
23007/// ```test_harness,no_run
23008/// # extern crate hyper;
23009/// # extern crate hyper_rustls;
23010/// # extern crate google_datamigration1 as datamigration1;
23011/// use datamigration1::api::TestIamPermissionsRequest;
23012/// # async fn dox() {
23013/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23014///
23015/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23016/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23017/// # .with_native_roots()
23018/// # .unwrap()
23019/// # .https_only()
23020/// # .enable_http2()
23021/// # .build();
23022///
23023/// # let executor = hyper_util::rt::TokioExecutor::new();
23024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23025/// # secret,
23026/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23027/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23028/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23029/// # ),
23030/// # ).build().await.unwrap();
23031///
23032/// # let client = hyper_util::client::legacy::Client::builder(
23033/// # hyper_util::rt::TokioExecutor::new()
23034/// # )
23035/// # .build(
23036/// # hyper_rustls::HttpsConnectorBuilder::new()
23037/// # .with_native_roots()
23038/// # .unwrap()
23039/// # .https_or_http()
23040/// # .enable_http2()
23041/// # .build()
23042/// # );
23043/// # let mut hub = DatabaseMigrationService::new(client, auth);
23044/// // As the method needs a request, you would usually fill it with the desired information
23045/// // into the respective structure. Some of the parts shown here might not be applicable !
23046/// // Values shown here are possibly random and not representative !
23047/// let mut req = TestIamPermissionsRequest::default();
23048///
23049/// // You can configure optional parameters by calling the respective setters at will, and
23050/// // execute the final call using `doit()`.
23051/// // Values shown here are possibly random and not representative !
23052/// let result = hub.projects().locations_migration_jobs_test_iam_permissions(req, "resource")
23053/// .doit().await;
23054/// # }
23055/// ```
23056pub struct ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
23057where
23058 C: 'a,
23059{
23060 hub: &'a DatabaseMigrationService<C>,
23061 _request: TestIamPermissionsRequest,
23062 _resource: String,
23063 _delegate: Option<&'a mut dyn common::Delegate>,
23064 _additional_params: HashMap<String, String>,
23065 _scopes: BTreeSet<String>,
23066}
23067
23068impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {}
23069
23070impl<'a, C> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
23071where
23072 C: common::Connector,
23073{
23074 /// Perform the operation you have build so far.
23075 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
23076 use std::borrow::Cow;
23077 use std::io::{Read, Seek};
23078
23079 use common::{url::Params, ToParts};
23080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23081
23082 let mut dd = common::DefaultDelegate;
23083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23084 dlg.begin(common::MethodInfo {
23085 id: "datamigration.projects.locations.migrationJobs.testIamPermissions",
23086 http_method: hyper::Method::POST,
23087 });
23088
23089 for &field in ["alt", "resource"].iter() {
23090 if self._additional_params.contains_key(field) {
23091 dlg.finished(false);
23092 return Err(common::Error::FieldClash(field));
23093 }
23094 }
23095
23096 let mut params = Params::with_capacity(4 + self._additional_params.len());
23097 params.push("resource", self._resource);
23098
23099 params.extend(self._additional_params.iter());
23100
23101 params.push("alt", "json");
23102 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
23103 if self._scopes.is_empty() {
23104 self._scopes
23105 .insert(Scope::CloudPlatform.as_ref().to_string());
23106 }
23107
23108 #[allow(clippy::single_element_loop)]
23109 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23110 url = params.uri_replacement(url, param_name, find_this, true);
23111 }
23112 {
23113 let to_remove = ["resource"];
23114 params.remove_params(&to_remove);
23115 }
23116
23117 let url = params.parse_with_url(&url);
23118
23119 let mut json_mime_type = mime::APPLICATION_JSON;
23120 let mut request_value_reader = {
23121 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23122 common::remove_json_null_values(&mut value);
23123 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23124 serde_json::to_writer(&mut dst, &value).unwrap();
23125 dst
23126 };
23127 let request_size = request_value_reader
23128 .seek(std::io::SeekFrom::End(0))
23129 .unwrap();
23130 request_value_reader
23131 .seek(std::io::SeekFrom::Start(0))
23132 .unwrap();
23133
23134 loop {
23135 let token = match self
23136 .hub
23137 .auth
23138 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23139 .await
23140 {
23141 Ok(token) => token,
23142 Err(e) => match dlg.token(e) {
23143 Ok(token) => token,
23144 Err(e) => {
23145 dlg.finished(false);
23146 return Err(common::Error::MissingToken(e));
23147 }
23148 },
23149 };
23150 request_value_reader
23151 .seek(std::io::SeekFrom::Start(0))
23152 .unwrap();
23153 let mut req_result = {
23154 let client = &self.hub.client;
23155 dlg.pre_request();
23156 let mut req_builder = hyper::Request::builder()
23157 .method(hyper::Method::POST)
23158 .uri(url.as_str())
23159 .header(USER_AGENT, self.hub._user_agent.clone());
23160
23161 if let Some(token) = token.as_ref() {
23162 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23163 }
23164
23165 let request = req_builder
23166 .header(CONTENT_TYPE, json_mime_type.to_string())
23167 .header(CONTENT_LENGTH, request_size as u64)
23168 .body(common::to_body(
23169 request_value_reader.get_ref().clone().into(),
23170 ));
23171
23172 client.request(request.unwrap()).await
23173 };
23174
23175 match req_result {
23176 Err(err) => {
23177 if let common::Retry::After(d) = dlg.http_error(&err) {
23178 sleep(d).await;
23179 continue;
23180 }
23181 dlg.finished(false);
23182 return Err(common::Error::HttpError(err));
23183 }
23184 Ok(res) => {
23185 let (mut parts, body) = res.into_parts();
23186 let mut body = common::Body::new(body);
23187 if !parts.status.is_success() {
23188 let bytes = common::to_bytes(body).await.unwrap_or_default();
23189 let error = serde_json::from_str(&common::to_string(&bytes));
23190 let response = common::to_response(parts, bytes.into());
23191
23192 if let common::Retry::After(d) =
23193 dlg.http_failure(&response, error.as_ref().ok())
23194 {
23195 sleep(d).await;
23196 continue;
23197 }
23198
23199 dlg.finished(false);
23200
23201 return Err(match error {
23202 Ok(value) => common::Error::BadRequest(value),
23203 _ => common::Error::Failure(response),
23204 });
23205 }
23206 let response = {
23207 let bytes = common::to_bytes(body).await.unwrap_or_default();
23208 let encoded = common::to_string(&bytes);
23209 match serde_json::from_str(&encoded) {
23210 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23211 Err(error) => {
23212 dlg.response_json_decode_error(&encoded, &error);
23213 return Err(common::Error::JsonDecodeError(
23214 encoded.to_string(),
23215 error,
23216 ));
23217 }
23218 }
23219 };
23220
23221 dlg.finished(true);
23222 return Ok(response);
23223 }
23224 }
23225 }
23226 }
23227
23228 ///
23229 /// Sets the *request* property to the given value.
23230 ///
23231 /// Even though the property as already been set when instantiating this call,
23232 /// we provide this method for API completeness.
23233 pub fn request(
23234 mut self,
23235 new_value: TestIamPermissionsRequest,
23236 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
23237 self._request = new_value;
23238 self
23239 }
23240 /// 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.
23241 ///
23242 /// Sets the *resource* path property to the given value.
23243 ///
23244 /// Even though the property as already been set when instantiating this call,
23245 /// we provide this method for API completeness.
23246 pub fn resource(
23247 mut self,
23248 new_value: &str,
23249 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
23250 self._resource = new_value.to_string();
23251 self
23252 }
23253 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23254 /// while executing the actual API request.
23255 ///
23256 /// ````text
23257 /// It should be used to handle progress information, and to implement a certain level of resilience.
23258 /// ````
23259 ///
23260 /// Sets the *delegate* property to the given value.
23261 pub fn delegate(
23262 mut self,
23263 new_value: &'a mut dyn common::Delegate,
23264 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
23265 self._delegate = Some(new_value);
23266 self
23267 }
23268
23269 /// Set any additional parameter of the query string used in the request.
23270 /// It should be used to set parameters which are not yet available through their own
23271 /// setters.
23272 ///
23273 /// Please note that this method must not be used to set any of the known parameters
23274 /// which have their own setter method. If done anyway, the request will fail.
23275 ///
23276 /// # Additional Parameters
23277 ///
23278 /// * *$.xgafv* (query-string) - V1 error format.
23279 /// * *access_token* (query-string) - OAuth access token.
23280 /// * *alt* (query-string) - Data format for response.
23281 /// * *callback* (query-string) - JSONP
23282 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23283 /// * *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.
23284 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23285 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23286 /// * *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.
23287 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23288 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23289 pub fn param<T>(
23290 mut self,
23291 name: T,
23292 value: T,
23293 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
23294 where
23295 T: AsRef<str>,
23296 {
23297 self._additional_params
23298 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23299 self
23300 }
23301
23302 /// Identifies the authorization scope for the method you are building.
23303 ///
23304 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23305 /// [`Scope::CloudPlatform`].
23306 ///
23307 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23308 /// tokens for more than one scope.
23309 ///
23310 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23311 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23312 /// sufficient, a read-write scope will do as well.
23313 pub fn add_scope<St>(
23314 mut self,
23315 scope: St,
23316 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
23317 where
23318 St: AsRef<str>,
23319 {
23320 self._scopes.insert(String::from(scope.as_ref()));
23321 self
23322 }
23323 /// Identifies the authorization scope(s) for the method you are building.
23324 ///
23325 /// See [`Self::add_scope()`] for details.
23326 pub fn add_scopes<I, St>(
23327 mut self,
23328 scopes: I,
23329 ) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C>
23330 where
23331 I: IntoIterator<Item = St>,
23332 St: AsRef<str>,
23333 {
23334 self._scopes
23335 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23336 self
23337 }
23338
23339 /// Removes all scopes, and no default scope will be used either.
23340 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23341 /// for details).
23342 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobTestIamPermissionCall<'a, C> {
23343 self._scopes.clear();
23344 self
23345 }
23346}
23347
23348/// Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met.
23349///
23350/// A builder for the *locations.migrationJobs.verify* method supported by a *project* resource.
23351/// It is not used directly, but through a [`ProjectMethods`] instance.
23352///
23353/// # Example
23354///
23355/// Instantiate a resource method builder
23356///
23357/// ```test_harness,no_run
23358/// # extern crate hyper;
23359/// # extern crate hyper_rustls;
23360/// # extern crate google_datamigration1 as datamigration1;
23361/// use datamigration1::api::VerifyMigrationJobRequest;
23362/// # async fn dox() {
23363/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23364///
23365/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23366/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23367/// # .with_native_roots()
23368/// # .unwrap()
23369/// # .https_only()
23370/// # .enable_http2()
23371/// # .build();
23372///
23373/// # let executor = hyper_util::rt::TokioExecutor::new();
23374/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23375/// # secret,
23376/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23377/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23378/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23379/// # ),
23380/// # ).build().await.unwrap();
23381///
23382/// # let client = hyper_util::client::legacy::Client::builder(
23383/// # hyper_util::rt::TokioExecutor::new()
23384/// # )
23385/// # .build(
23386/// # hyper_rustls::HttpsConnectorBuilder::new()
23387/// # .with_native_roots()
23388/// # .unwrap()
23389/// # .https_or_http()
23390/// # .enable_http2()
23391/// # .build()
23392/// # );
23393/// # let mut hub = DatabaseMigrationService::new(client, auth);
23394/// // As the method needs a request, you would usually fill it with the desired information
23395/// // into the respective structure. Some of the parts shown here might not be applicable !
23396/// // Values shown here are possibly random and not representative !
23397/// let mut req = VerifyMigrationJobRequest::default();
23398///
23399/// // You can configure optional parameters by calling the respective setters at will, and
23400/// // execute the final call using `doit()`.
23401/// // Values shown here are possibly random and not representative !
23402/// let result = hub.projects().locations_migration_jobs_verify(req, "name")
23403/// .doit().await;
23404/// # }
23405/// ```
23406pub struct ProjectLocationMigrationJobVerifyCall<'a, C>
23407where
23408 C: 'a,
23409{
23410 hub: &'a DatabaseMigrationService<C>,
23411 _request: VerifyMigrationJobRequest,
23412 _name: String,
23413 _delegate: Option<&'a mut dyn common::Delegate>,
23414 _additional_params: HashMap<String, String>,
23415 _scopes: BTreeSet<String>,
23416}
23417
23418impl<'a, C> common::CallBuilder for ProjectLocationMigrationJobVerifyCall<'a, C> {}
23419
23420impl<'a, C> ProjectLocationMigrationJobVerifyCall<'a, C>
23421where
23422 C: common::Connector,
23423{
23424 /// Perform the operation you have build so far.
23425 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23426 use std::borrow::Cow;
23427 use std::io::{Read, Seek};
23428
23429 use common::{url::Params, ToParts};
23430 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23431
23432 let mut dd = common::DefaultDelegate;
23433 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23434 dlg.begin(common::MethodInfo {
23435 id: "datamigration.projects.locations.migrationJobs.verify",
23436 http_method: hyper::Method::POST,
23437 });
23438
23439 for &field in ["alt", "name"].iter() {
23440 if self._additional_params.contains_key(field) {
23441 dlg.finished(false);
23442 return Err(common::Error::FieldClash(field));
23443 }
23444 }
23445
23446 let mut params = Params::with_capacity(4 + self._additional_params.len());
23447 params.push("name", self._name);
23448
23449 params.extend(self._additional_params.iter());
23450
23451 params.push("alt", "json");
23452 let mut url = self.hub._base_url.clone() + "v1/{+name}:verify";
23453 if self._scopes.is_empty() {
23454 self._scopes
23455 .insert(Scope::CloudPlatform.as_ref().to_string());
23456 }
23457
23458 #[allow(clippy::single_element_loop)]
23459 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23460 url = params.uri_replacement(url, param_name, find_this, true);
23461 }
23462 {
23463 let to_remove = ["name"];
23464 params.remove_params(&to_remove);
23465 }
23466
23467 let url = params.parse_with_url(&url);
23468
23469 let mut json_mime_type = mime::APPLICATION_JSON;
23470 let mut request_value_reader = {
23471 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23472 common::remove_json_null_values(&mut value);
23473 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23474 serde_json::to_writer(&mut dst, &value).unwrap();
23475 dst
23476 };
23477 let request_size = request_value_reader
23478 .seek(std::io::SeekFrom::End(0))
23479 .unwrap();
23480 request_value_reader
23481 .seek(std::io::SeekFrom::Start(0))
23482 .unwrap();
23483
23484 loop {
23485 let token = match self
23486 .hub
23487 .auth
23488 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23489 .await
23490 {
23491 Ok(token) => token,
23492 Err(e) => match dlg.token(e) {
23493 Ok(token) => token,
23494 Err(e) => {
23495 dlg.finished(false);
23496 return Err(common::Error::MissingToken(e));
23497 }
23498 },
23499 };
23500 request_value_reader
23501 .seek(std::io::SeekFrom::Start(0))
23502 .unwrap();
23503 let mut req_result = {
23504 let client = &self.hub.client;
23505 dlg.pre_request();
23506 let mut req_builder = hyper::Request::builder()
23507 .method(hyper::Method::POST)
23508 .uri(url.as_str())
23509 .header(USER_AGENT, self.hub._user_agent.clone());
23510
23511 if let Some(token) = token.as_ref() {
23512 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23513 }
23514
23515 let request = req_builder
23516 .header(CONTENT_TYPE, json_mime_type.to_string())
23517 .header(CONTENT_LENGTH, request_size as u64)
23518 .body(common::to_body(
23519 request_value_reader.get_ref().clone().into(),
23520 ));
23521
23522 client.request(request.unwrap()).await
23523 };
23524
23525 match req_result {
23526 Err(err) => {
23527 if let common::Retry::After(d) = dlg.http_error(&err) {
23528 sleep(d).await;
23529 continue;
23530 }
23531 dlg.finished(false);
23532 return Err(common::Error::HttpError(err));
23533 }
23534 Ok(res) => {
23535 let (mut parts, body) = res.into_parts();
23536 let mut body = common::Body::new(body);
23537 if !parts.status.is_success() {
23538 let bytes = common::to_bytes(body).await.unwrap_or_default();
23539 let error = serde_json::from_str(&common::to_string(&bytes));
23540 let response = common::to_response(parts, bytes.into());
23541
23542 if let common::Retry::After(d) =
23543 dlg.http_failure(&response, error.as_ref().ok())
23544 {
23545 sleep(d).await;
23546 continue;
23547 }
23548
23549 dlg.finished(false);
23550
23551 return Err(match error {
23552 Ok(value) => common::Error::BadRequest(value),
23553 _ => common::Error::Failure(response),
23554 });
23555 }
23556 let response = {
23557 let bytes = common::to_bytes(body).await.unwrap_or_default();
23558 let encoded = common::to_string(&bytes);
23559 match serde_json::from_str(&encoded) {
23560 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23561 Err(error) => {
23562 dlg.response_json_decode_error(&encoded, &error);
23563 return Err(common::Error::JsonDecodeError(
23564 encoded.to_string(),
23565 error,
23566 ));
23567 }
23568 }
23569 };
23570
23571 dlg.finished(true);
23572 return Ok(response);
23573 }
23574 }
23575 }
23576 }
23577
23578 ///
23579 /// Sets the *request* property to the given value.
23580 ///
23581 /// Even though the property as already been set when instantiating this call,
23582 /// we provide this method for API completeness.
23583 pub fn request(
23584 mut self,
23585 new_value: VerifyMigrationJobRequest,
23586 ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
23587 self._request = new_value;
23588 self
23589 }
23590 /// Name of the migration job resource to verify.
23591 ///
23592 /// Sets the *name* path property to the given value.
23593 ///
23594 /// Even though the property as already been set when instantiating this call,
23595 /// we provide this method for API completeness.
23596 pub fn name(mut self, new_value: &str) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
23597 self._name = new_value.to_string();
23598 self
23599 }
23600 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23601 /// while executing the actual API request.
23602 ///
23603 /// ````text
23604 /// It should be used to handle progress information, and to implement a certain level of resilience.
23605 /// ````
23606 ///
23607 /// Sets the *delegate* property to the given value.
23608 pub fn delegate(
23609 mut self,
23610 new_value: &'a mut dyn common::Delegate,
23611 ) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
23612 self._delegate = Some(new_value);
23613 self
23614 }
23615
23616 /// Set any additional parameter of the query string used in the request.
23617 /// It should be used to set parameters which are not yet available through their own
23618 /// setters.
23619 ///
23620 /// Please note that this method must not be used to set any of the known parameters
23621 /// which have their own setter method. If done anyway, the request will fail.
23622 ///
23623 /// # Additional Parameters
23624 ///
23625 /// * *$.xgafv* (query-string) - V1 error format.
23626 /// * *access_token* (query-string) - OAuth access token.
23627 /// * *alt* (query-string) - Data format for response.
23628 /// * *callback* (query-string) - JSONP
23629 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23630 /// * *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.
23631 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23632 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23633 /// * *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.
23634 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23635 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23636 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationMigrationJobVerifyCall<'a, C>
23637 where
23638 T: AsRef<str>,
23639 {
23640 self._additional_params
23641 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23642 self
23643 }
23644
23645 /// Identifies the authorization scope for the method you are building.
23646 ///
23647 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23648 /// [`Scope::CloudPlatform`].
23649 ///
23650 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23651 /// tokens for more than one scope.
23652 ///
23653 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23654 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23655 /// sufficient, a read-write scope will do as well.
23656 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationMigrationJobVerifyCall<'a, C>
23657 where
23658 St: AsRef<str>,
23659 {
23660 self._scopes.insert(String::from(scope.as_ref()));
23661 self
23662 }
23663 /// Identifies the authorization scope(s) for the method you are building.
23664 ///
23665 /// See [`Self::add_scope()`] for details.
23666 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationMigrationJobVerifyCall<'a, C>
23667 where
23668 I: IntoIterator<Item = St>,
23669 St: AsRef<str>,
23670 {
23671 self._scopes
23672 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23673 self
23674 }
23675
23676 /// Removes all scopes, and no default scope will be used either.
23677 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23678 /// for details).
23679 pub fn clear_scopes(mut self) -> ProjectLocationMigrationJobVerifyCall<'a, C> {
23680 self._scopes.clear();
23681 self
23682 }
23683}
23684
23685/// 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`.
23686///
23687/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
23688/// It is not used directly, but through a [`ProjectMethods`] instance.
23689///
23690/// # Example
23691///
23692/// Instantiate a resource method builder
23693///
23694/// ```test_harness,no_run
23695/// # extern crate hyper;
23696/// # extern crate hyper_rustls;
23697/// # extern crate google_datamigration1 as datamigration1;
23698/// use datamigration1::api::CancelOperationRequest;
23699/// # async fn dox() {
23700/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23701///
23702/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23703/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23704/// # .with_native_roots()
23705/// # .unwrap()
23706/// # .https_only()
23707/// # .enable_http2()
23708/// # .build();
23709///
23710/// # let executor = hyper_util::rt::TokioExecutor::new();
23711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23712/// # secret,
23713/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23714/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23715/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23716/// # ),
23717/// # ).build().await.unwrap();
23718///
23719/// # let client = hyper_util::client::legacy::Client::builder(
23720/// # hyper_util::rt::TokioExecutor::new()
23721/// # )
23722/// # .build(
23723/// # hyper_rustls::HttpsConnectorBuilder::new()
23724/// # .with_native_roots()
23725/// # .unwrap()
23726/// # .https_or_http()
23727/// # .enable_http2()
23728/// # .build()
23729/// # );
23730/// # let mut hub = DatabaseMigrationService::new(client, auth);
23731/// // As the method needs a request, you would usually fill it with the desired information
23732/// // into the respective structure. Some of the parts shown here might not be applicable !
23733/// // Values shown here are possibly random and not representative !
23734/// let mut req = CancelOperationRequest::default();
23735///
23736/// // You can configure optional parameters by calling the respective setters at will, and
23737/// // execute the final call using `doit()`.
23738/// // Values shown here are possibly random and not representative !
23739/// let result = hub.projects().locations_operations_cancel(req, "name")
23740/// .doit().await;
23741/// # }
23742/// ```
23743pub struct ProjectLocationOperationCancelCall<'a, C>
23744where
23745 C: 'a,
23746{
23747 hub: &'a DatabaseMigrationService<C>,
23748 _request: CancelOperationRequest,
23749 _name: String,
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 ProjectLocationOperationCancelCall<'a, C> {}
23756
23757impl<'a, C> ProjectLocationOperationCancelCall<'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, Empty)> {
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.operations.cancel",
23773 http_method: hyper::Method::POST,
23774 });
23775
23776 for &field in ["alt", "name"].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(4 + self._additional_params.len());
23784 params.push("name", self._name);
23785
23786 params.extend(self._additional_params.iter());
23787
23788 params.push("alt", "json");
23789 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
23790 if self._scopes.is_empty() {
23791 self._scopes
23792 .insert(Scope::CloudPlatform.as_ref().to_string());
23793 }
23794
23795 #[allow(clippy::single_element_loop)]
23796 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23797 url = params.uri_replacement(url, param_name, find_this, true);
23798 }
23799 {
23800 let to_remove = ["name"];
23801 params.remove_params(&to_remove);
23802 }
23803
23804 let url = params.parse_with_url(&url);
23805
23806 let mut json_mime_type = mime::APPLICATION_JSON;
23807 let mut request_value_reader = {
23808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23809 common::remove_json_null_values(&mut value);
23810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23811 serde_json::to_writer(&mut dst, &value).unwrap();
23812 dst
23813 };
23814 let request_size = request_value_reader
23815 .seek(std::io::SeekFrom::End(0))
23816 .unwrap();
23817 request_value_reader
23818 .seek(std::io::SeekFrom::Start(0))
23819 .unwrap();
23820
23821 loop {
23822 let token = match self
23823 .hub
23824 .auth
23825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23826 .await
23827 {
23828 Ok(token) => token,
23829 Err(e) => match dlg.token(e) {
23830 Ok(token) => token,
23831 Err(e) => {
23832 dlg.finished(false);
23833 return Err(common::Error::MissingToken(e));
23834 }
23835 },
23836 };
23837 request_value_reader
23838 .seek(std::io::SeekFrom::Start(0))
23839 .unwrap();
23840 let mut req_result = {
23841 let client = &self.hub.client;
23842 dlg.pre_request();
23843 let mut req_builder = hyper::Request::builder()
23844 .method(hyper::Method::POST)
23845 .uri(url.as_str())
23846 .header(USER_AGENT, self.hub._user_agent.clone());
23847
23848 if let Some(token) = token.as_ref() {
23849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23850 }
23851
23852 let request = req_builder
23853 .header(CONTENT_TYPE, json_mime_type.to_string())
23854 .header(CONTENT_LENGTH, request_size as u64)
23855 .body(common::to_body(
23856 request_value_reader.get_ref().clone().into(),
23857 ));
23858
23859 client.request(request.unwrap()).await
23860 };
23861
23862 match req_result {
23863 Err(err) => {
23864 if let common::Retry::After(d) = dlg.http_error(&err) {
23865 sleep(d).await;
23866 continue;
23867 }
23868 dlg.finished(false);
23869 return Err(common::Error::HttpError(err));
23870 }
23871 Ok(res) => {
23872 let (mut parts, body) = res.into_parts();
23873 let mut body = common::Body::new(body);
23874 if !parts.status.is_success() {
23875 let bytes = common::to_bytes(body).await.unwrap_or_default();
23876 let error = serde_json::from_str(&common::to_string(&bytes));
23877 let response = common::to_response(parts, bytes.into());
23878
23879 if let common::Retry::After(d) =
23880 dlg.http_failure(&response, error.as_ref().ok())
23881 {
23882 sleep(d).await;
23883 continue;
23884 }
23885
23886 dlg.finished(false);
23887
23888 return Err(match error {
23889 Ok(value) => common::Error::BadRequest(value),
23890 _ => common::Error::Failure(response),
23891 });
23892 }
23893 let response = {
23894 let bytes = common::to_bytes(body).await.unwrap_or_default();
23895 let encoded = common::to_string(&bytes);
23896 match serde_json::from_str(&encoded) {
23897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23898 Err(error) => {
23899 dlg.response_json_decode_error(&encoded, &error);
23900 return Err(common::Error::JsonDecodeError(
23901 encoded.to_string(),
23902 error,
23903 ));
23904 }
23905 }
23906 };
23907
23908 dlg.finished(true);
23909 return Ok(response);
23910 }
23911 }
23912 }
23913 }
23914
23915 ///
23916 /// Sets the *request* property to the given value.
23917 ///
23918 /// Even though the property as already been set when instantiating this call,
23919 /// we provide this method for API completeness.
23920 pub fn request(
23921 mut self,
23922 new_value: CancelOperationRequest,
23923 ) -> ProjectLocationOperationCancelCall<'a, C> {
23924 self._request = new_value;
23925 self
23926 }
23927 /// The name of the operation resource to be cancelled.
23928 ///
23929 /// Sets the *name* path property to the given value.
23930 ///
23931 /// Even though the property as already been set when instantiating this call,
23932 /// we provide this method for API completeness.
23933 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
23934 self._name = new_value.to_string();
23935 self
23936 }
23937 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23938 /// while executing the actual API request.
23939 ///
23940 /// ````text
23941 /// It should be used to handle progress information, and to implement a certain level of resilience.
23942 /// ````
23943 ///
23944 /// Sets the *delegate* property to the given value.
23945 pub fn delegate(
23946 mut self,
23947 new_value: &'a mut dyn common::Delegate,
23948 ) -> ProjectLocationOperationCancelCall<'a, C> {
23949 self._delegate = Some(new_value);
23950 self
23951 }
23952
23953 /// Set any additional parameter of the query string used in the request.
23954 /// It should be used to set parameters which are not yet available through their own
23955 /// setters.
23956 ///
23957 /// Please note that this method must not be used to set any of the known parameters
23958 /// which have their own setter method. If done anyway, the request will fail.
23959 ///
23960 /// # Additional Parameters
23961 ///
23962 /// * *$.xgafv* (query-string) - V1 error format.
23963 /// * *access_token* (query-string) - OAuth access token.
23964 /// * *alt* (query-string) - Data format for response.
23965 /// * *callback* (query-string) - JSONP
23966 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23967 /// * *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.
23968 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23969 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23970 /// * *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.
23971 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23972 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23973 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
23974 where
23975 T: AsRef<str>,
23976 {
23977 self._additional_params
23978 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23979 self
23980 }
23981
23982 /// Identifies the authorization scope for the method you are building.
23983 ///
23984 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23985 /// [`Scope::CloudPlatform`].
23986 ///
23987 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23988 /// tokens for more than one scope.
23989 ///
23990 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23991 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23992 /// sufficient, a read-write scope will do as well.
23993 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
23994 where
23995 St: AsRef<str>,
23996 {
23997 self._scopes.insert(String::from(scope.as_ref()));
23998 self
23999 }
24000 /// Identifies the authorization scope(s) for the method you are building.
24001 ///
24002 /// See [`Self::add_scope()`] for details.
24003 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
24004 where
24005 I: IntoIterator<Item = St>,
24006 St: AsRef<str>,
24007 {
24008 self._scopes
24009 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24010 self
24011 }
24012
24013 /// Removes all scopes, and no default scope will be used either.
24014 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24015 /// for details).
24016 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
24017 self._scopes.clear();
24018 self
24019 }
24020}
24021
24022/// 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`.
24023///
24024/// A builder for the *locations.operations.delete* method supported by a *project* resource.
24025/// It is not used directly, but through a [`ProjectMethods`] instance.
24026///
24027/// # Example
24028///
24029/// Instantiate a resource method builder
24030///
24031/// ```test_harness,no_run
24032/// # extern crate hyper;
24033/// # extern crate hyper_rustls;
24034/// # extern crate google_datamigration1 as datamigration1;
24035/// # async fn dox() {
24036/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24037///
24038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24039/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24040/// # .with_native_roots()
24041/// # .unwrap()
24042/// # .https_only()
24043/// # .enable_http2()
24044/// # .build();
24045///
24046/// # let executor = hyper_util::rt::TokioExecutor::new();
24047/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24048/// # secret,
24049/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24050/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24051/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24052/// # ),
24053/// # ).build().await.unwrap();
24054///
24055/// # let client = hyper_util::client::legacy::Client::builder(
24056/// # hyper_util::rt::TokioExecutor::new()
24057/// # )
24058/// # .build(
24059/// # hyper_rustls::HttpsConnectorBuilder::new()
24060/// # .with_native_roots()
24061/// # .unwrap()
24062/// # .https_or_http()
24063/// # .enable_http2()
24064/// # .build()
24065/// # );
24066/// # let mut hub = DatabaseMigrationService::new(client, auth);
24067/// // You can configure optional parameters by calling the respective setters at will, and
24068/// // execute the final call using `doit()`.
24069/// // Values shown here are possibly random and not representative !
24070/// let result = hub.projects().locations_operations_delete("name")
24071/// .doit().await;
24072/// # }
24073/// ```
24074pub struct ProjectLocationOperationDeleteCall<'a, C>
24075where
24076 C: 'a,
24077{
24078 hub: &'a DatabaseMigrationService<C>,
24079 _name: String,
24080 _delegate: Option<&'a mut dyn common::Delegate>,
24081 _additional_params: HashMap<String, String>,
24082 _scopes: BTreeSet<String>,
24083}
24084
24085impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
24086
24087impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
24088where
24089 C: common::Connector,
24090{
24091 /// Perform the operation you have build so far.
24092 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
24093 use std::borrow::Cow;
24094 use std::io::{Read, Seek};
24095
24096 use common::{url::Params, ToParts};
24097 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24098
24099 let mut dd = common::DefaultDelegate;
24100 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24101 dlg.begin(common::MethodInfo {
24102 id: "datamigration.projects.locations.operations.delete",
24103 http_method: hyper::Method::DELETE,
24104 });
24105
24106 for &field in ["alt", "name"].iter() {
24107 if self._additional_params.contains_key(field) {
24108 dlg.finished(false);
24109 return Err(common::Error::FieldClash(field));
24110 }
24111 }
24112
24113 let mut params = Params::with_capacity(3 + self._additional_params.len());
24114 params.push("name", self._name);
24115
24116 params.extend(self._additional_params.iter());
24117
24118 params.push("alt", "json");
24119 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24120 if self._scopes.is_empty() {
24121 self._scopes
24122 .insert(Scope::CloudPlatform.as_ref().to_string());
24123 }
24124
24125 #[allow(clippy::single_element_loop)]
24126 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24127 url = params.uri_replacement(url, param_name, find_this, true);
24128 }
24129 {
24130 let to_remove = ["name"];
24131 params.remove_params(&to_remove);
24132 }
24133
24134 let url = params.parse_with_url(&url);
24135
24136 loop {
24137 let token = match self
24138 .hub
24139 .auth
24140 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24141 .await
24142 {
24143 Ok(token) => token,
24144 Err(e) => match dlg.token(e) {
24145 Ok(token) => token,
24146 Err(e) => {
24147 dlg.finished(false);
24148 return Err(common::Error::MissingToken(e));
24149 }
24150 },
24151 };
24152 let mut req_result = {
24153 let client = &self.hub.client;
24154 dlg.pre_request();
24155 let mut req_builder = hyper::Request::builder()
24156 .method(hyper::Method::DELETE)
24157 .uri(url.as_str())
24158 .header(USER_AGENT, self.hub._user_agent.clone());
24159
24160 if let Some(token) = token.as_ref() {
24161 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24162 }
24163
24164 let request = req_builder
24165 .header(CONTENT_LENGTH, 0_u64)
24166 .body(common::to_body::<String>(None));
24167
24168 client.request(request.unwrap()).await
24169 };
24170
24171 match req_result {
24172 Err(err) => {
24173 if let common::Retry::After(d) = dlg.http_error(&err) {
24174 sleep(d).await;
24175 continue;
24176 }
24177 dlg.finished(false);
24178 return Err(common::Error::HttpError(err));
24179 }
24180 Ok(res) => {
24181 let (mut parts, body) = res.into_parts();
24182 let mut body = common::Body::new(body);
24183 if !parts.status.is_success() {
24184 let bytes = common::to_bytes(body).await.unwrap_or_default();
24185 let error = serde_json::from_str(&common::to_string(&bytes));
24186 let response = common::to_response(parts, bytes.into());
24187
24188 if let common::Retry::After(d) =
24189 dlg.http_failure(&response, error.as_ref().ok())
24190 {
24191 sleep(d).await;
24192 continue;
24193 }
24194
24195 dlg.finished(false);
24196
24197 return Err(match error {
24198 Ok(value) => common::Error::BadRequest(value),
24199 _ => common::Error::Failure(response),
24200 });
24201 }
24202 let response = {
24203 let bytes = common::to_bytes(body).await.unwrap_or_default();
24204 let encoded = common::to_string(&bytes);
24205 match serde_json::from_str(&encoded) {
24206 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24207 Err(error) => {
24208 dlg.response_json_decode_error(&encoded, &error);
24209 return Err(common::Error::JsonDecodeError(
24210 encoded.to_string(),
24211 error,
24212 ));
24213 }
24214 }
24215 };
24216
24217 dlg.finished(true);
24218 return Ok(response);
24219 }
24220 }
24221 }
24222 }
24223
24224 /// The name of the operation resource to be deleted.
24225 ///
24226 /// Sets the *name* path property to the given value.
24227 ///
24228 /// Even though the property as already been set when instantiating this call,
24229 /// we provide this method for API completeness.
24230 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
24231 self._name = new_value.to_string();
24232 self
24233 }
24234 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24235 /// while executing the actual API request.
24236 ///
24237 /// ````text
24238 /// It should be used to handle progress information, and to implement a certain level of resilience.
24239 /// ````
24240 ///
24241 /// Sets the *delegate* property to the given value.
24242 pub fn delegate(
24243 mut self,
24244 new_value: &'a mut dyn common::Delegate,
24245 ) -> ProjectLocationOperationDeleteCall<'a, C> {
24246 self._delegate = Some(new_value);
24247 self
24248 }
24249
24250 /// Set any additional parameter of the query string used in the request.
24251 /// It should be used to set parameters which are not yet available through their own
24252 /// setters.
24253 ///
24254 /// Please note that this method must not be used to set any of the known parameters
24255 /// which have their own setter method. If done anyway, the request will fail.
24256 ///
24257 /// # Additional Parameters
24258 ///
24259 /// * *$.xgafv* (query-string) - V1 error format.
24260 /// * *access_token* (query-string) - OAuth access token.
24261 /// * *alt* (query-string) - Data format for response.
24262 /// * *callback* (query-string) - JSONP
24263 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24264 /// * *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.
24265 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24266 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24267 /// * *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.
24268 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24269 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24270 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
24271 where
24272 T: AsRef<str>,
24273 {
24274 self._additional_params
24275 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24276 self
24277 }
24278
24279 /// Identifies the authorization scope for the method you are building.
24280 ///
24281 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24282 /// [`Scope::CloudPlatform`].
24283 ///
24284 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24285 /// tokens for more than one scope.
24286 ///
24287 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24288 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24289 /// sufficient, a read-write scope will do as well.
24290 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
24291 where
24292 St: AsRef<str>,
24293 {
24294 self._scopes.insert(String::from(scope.as_ref()));
24295 self
24296 }
24297 /// Identifies the authorization scope(s) for the method you are building.
24298 ///
24299 /// See [`Self::add_scope()`] for details.
24300 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
24301 where
24302 I: IntoIterator<Item = St>,
24303 St: AsRef<str>,
24304 {
24305 self._scopes
24306 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24307 self
24308 }
24309
24310 /// Removes all scopes, and no default scope will be used either.
24311 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24312 /// for details).
24313 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
24314 self._scopes.clear();
24315 self
24316 }
24317}
24318
24319/// 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.
24320///
24321/// A builder for the *locations.operations.get* method supported by a *project* resource.
24322/// It is not used directly, but through a [`ProjectMethods`] instance.
24323///
24324/// # Example
24325///
24326/// Instantiate a resource method builder
24327///
24328/// ```test_harness,no_run
24329/// # extern crate hyper;
24330/// # extern crate hyper_rustls;
24331/// # extern crate google_datamigration1 as datamigration1;
24332/// # async fn dox() {
24333/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24334///
24335/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24336/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24337/// # .with_native_roots()
24338/// # .unwrap()
24339/// # .https_only()
24340/// # .enable_http2()
24341/// # .build();
24342///
24343/// # let executor = hyper_util::rt::TokioExecutor::new();
24344/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24345/// # secret,
24346/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24347/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24348/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24349/// # ),
24350/// # ).build().await.unwrap();
24351///
24352/// # let client = hyper_util::client::legacy::Client::builder(
24353/// # hyper_util::rt::TokioExecutor::new()
24354/// # )
24355/// # .build(
24356/// # hyper_rustls::HttpsConnectorBuilder::new()
24357/// # .with_native_roots()
24358/// # .unwrap()
24359/// # .https_or_http()
24360/// # .enable_http2()
24361/// # .build()
24362/// # );
24363/// # let mut hub = DatabaseMigrationService::new(client, auth);
24364/// // You can configure optional parameters by calling the respective setters at will, and
24365/// // execute the final call using `doit()`.
24366/// // Values shown here are possibly random and not representative !
24367/// let result = hub.projects().locations_operations_get("name")
24368/// .doit().await;
24369/// # }
24370/// ```
24371pub struct ProjectLocationOperationGetCall<'a, C>
24372where
24373 C: 'a,
24374{
24375 hub: &'a DatabaseMigrationService<C>,
24376 _name: String,
24377 _delegate: Option<&'a mut dyn common::Delegate>,
24378 _additional_params: HashMap<String, String>,
24379 _scopes: BTreeSet<String>,
24380}
24381
24382impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
24383
24384impl<'a, C> ProjectLocationOperationGetCall<'a, C>
24385where
24386 C: common::Connector,
24387{
24388 /// Perform the operation you have build so far.
24389 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24390 use std::borrow::Cow;
24391 use std::io::{Read, Seek};
24392
24393 use common::{url::Params, ToParts};
24394 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24395
24396 let mut dd = common::DefaultDelegate;
24397 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24398 dlg.begin(common::MethodInfo {
24399 id: "datamigration.projects.locations.operations.get",
24400 http_method: hyper::Method::GET,
24401 });
24402
24403 for &field in ["alt", "name"].iter() {
24404 if self._additional_params.contains_key(field) {
24405 dlg.finished(false);
24406 return Err(common::Error::FieldClash(field));
24407 }
24408 }
24409
24410 let mut params = Params::with_capacity(3 + self._additional_params.len());
24411 params.push("name", self._name);
24412
24413 params.extend(self._additional_params.iter());
24414
24415 params.push("alt", "json");
24416 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24417 if self._scopes.is_empty() {
24418 self._scopes
24419 .insert(Scope::CloudPlatform.as_ref().to_string());
24420 }
24421
24422 #[allow(clippy::single_element_loop)]
24423 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24424 url = params.uri_replacement(url, param_name, find_this, true);
24425 }
24426 {
24427 let to_remove = ["name"];
24428 params.remove_params(&to_remove);
24429 }
24430
24431 let url = params.parse_with_url(&url);
24432
24433 loop {
24434 let token = match self
24435 .hub
24436 .auth
24437 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24438 .await
24439 {
24440 Ok(token) => token,
24441 Err(e) => match dlg.token(e) {
24442 Ok(token) => token,
24443 Err(e) => {
24444 dlg.finished(false);
24445 return Err(common::Error::MissingToken(e));
24446 }
24447 },
24448 };
24449 let mut req_result = {
24450 let client = &self.hub.client;
24451 dlg.pre_request();
24452 let mut req_builder = hyper::Request::builder()
24453 .method(hyper::Method::GET)
24454 .uri(url.as_str())
24455 .header(USER_AGENT, self.hub._user_agent.clone());
24456
24457 if let Some(token) = token.as_ref() {
24458 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24459 }
24460
24461 let request = req_builder
24462 .header(CONTENT_LENGTH, 0_u64)
24463 .body(common::to_body::<String>(None));
24464
24465 client.request(request.unwrap()).await
24466 };
24467
24468 match req_result {
24469 Err(err) => {
24470 if let common::Retry::After(d) = dlg.http_error(&err) {
24471 sleep(d).await;
24472 continue;
24473 }
24474 dlg.finished(false);
24475 return Err(common::Error::HttpError(err));
24476 }
24477 Ok(res) => {
24478 let (mut parts, body) = res.into_parts();
24479 let mut body = common::Body::new(body);
24480 if !parts.status.is_success() {
24481 let bytes = common::to_bytes(body).await.unwrap_or_default();
24482 let error = serde_json::from_str(&common::to_string(&bytes));
24483 let response = common::to_response(parts, bytes.into());
24484
24485 if let common::Retry::After(d) =
24486 dlg.http_failure(&response, error.as_ref().ok())
24487 {
24488 sleep(d).await;
24489 continue;
24490 }
24491
24492 dlg.finished(false);
24493
24494 return Err(match error {
24495 Ok(value) => common::Error::BadRequest(value),
24496 _ => common::Error::Failure(response),
24497 });
24498 }
24499 let response = {
24500 let bytes = common::to_bytes(body).await.unwrap_or_default();
24501 let encoded = common::to_string(&bytes);
24502 match serde_json::from_str(&encoded) {
24503 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24504 Err(error) => {
24505 dlg.response_json_decode_error(&encoded, &error);
24506 return Err(common::Error::JsonDecodeError(
24507 encoded.to_string(),
24508 error,
24509 ));
24510 }
24511 }
24512 };
24513
24514 dlg.finished(true);
24515 return Ok(response);
24516 }
24517 }
24518 }
24519 }
24520
24521 /// The name of the operation resource.
24522 ///
24523 /// Sets the *name* path property to the given value.
24524 ///
24525 /// Even though the property as already been set when instantiating this call,
24526 /// we provide this method for API completeness.
24527 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
24528 self._name = new_value.to_string();
24529 self
24530 }
24531 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24532 /// while executing the actual API request.
24533 ///
24534 /// ````text
24535 /// It should be used to handle progress information, and to implement a certain level of resilience.
24536 /// ````
24537 ///
24538 /// Sets the *delegate* property to the given value.
24539 pub fn delegate(
24540 mut self,
24541 new_value: &'a mut dyn common::Delegate,
24542 ) -> ProjectLocationOperationGetCall<'a, C> {
24543 self._delegate = Some(new_value);
24544 self
24545 }
24546
24547 /// Set any additional parameter of the query string used in the request.
24548 /// It should be used to set parameters which are not yet available through their own
24549 /// setters.
24550 ///
24551 /// Please note that this method must not be used to set any of the known parameters
24552 /// which have their own setter method. If done anyway, the request will fail.
24553 ///
24554 /// # Additional Parameters
24555 ///
24556 /// * *$.xgafv* (query-string) - V1 error format.
24557 /// * *access_token* (query-string) - OAuth access token.
24558 /// * *alt* (query-string) - Data format for response.
24559 /// * *callback* (query-string) - JSONP
24560 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24561 /// * *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.
24562 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24563 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24564 /// * *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.
24565 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24566 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24567 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
24568 where
24569 T: AsRef<str>,
24570 {
24571 self._additional_params
24572 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24573 self
24574 }
24575
24576 /// Identifies the authorization scope for the method you are building.
24577 ///
24578 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24579 /// [`Scope::CloudPlatform`].
24580 ///
24581 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24582 /// tokens for more than one scope.
24583 ///
24584 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24585 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24586 /// sufficient, a read-write scope will do as well.
24587 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
24588 where
24589 St: AsRef<str>,
24590 {
24591 self._scopes.insert(String::from(scope.as_ref()));
24592 self
24593 }
24594 /// Identifies the authorization scope(s) for the method you are building.
24595 ///
24596 /// See [`Self::add_scope()`] for details.
24597 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
24598 where
24599 I: IntoIterator<Item = St>,
24600 St: AsRef<str>,
24601 {
24602 self._scopes
24603 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24604 self
24605 }
24606
24607 /// Removes all scopes, and no default scope will be used either.
24608 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24609 /// for details).
24610 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
24611 self._scopes.clear();
24612 self
24613 }
24614}
24615
24616/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
24617///
24618/// A builder for the *locations.operations.list* method supported by a *project* resource.
24619/// It is not used directly, but through a [`ProjectMethods`] instance.
24620///
24621/// # Example
24622///
24623/// Instantiate a resource method builder
24624///
24625/// ```test_harness,no_run
24626/// # extern crate hyper;
24627/// # extern crate hyper_rustls;
24628/// # extern crate google_datamigration1 as datamigration1;
24629/// # async fn dox() {
24630/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24631///
24632/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24633/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24634/// # .with_native_roots()
24635/// # .unwrap()
24636/// # .https_only()
24637/// # .enable_http2()
24638/// # .build();
24639///
24640/// # let executor = hyper_util::rt::TokioExecutor::new();
24641/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24642/// # secret,
24643/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24644/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24645/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24646/// # ),
24647/// # ).build().await.unwrap();
24648///
24649/// # let client = hyper_util::client::legacy::Client::builder(
24650/// # hyper_util::rt::TokioExecutor::new()
24651/// # )
24652/// # .build(
24653/// # hyper_rustls::HttpsConnectorBuilder::new()
24654/// # .with_native_roots()
24655/// # .unwrap()
24656/// # .https_or_http()
24657/// # .enable_http2()
24658/// # .build()
24659/// # );
24660/// # let mut hub = DatabaseMigrationService::new(client, auth);
24661/// // You can configure optional parameters by calling the respective setters at will, and
24662/// // execute the final call using `doit()`.
24663/// // Values shown here are possibly random and not representative !
24664/// let result = hub.projects().locations_operations_list("name")
24665/// .return_partial_success(true)
24666/// .page_token("est")
24667/// .page_size(-53)
24668/// .filter("sed")
24669/// .doit().await;
24670/// # }
24671/// ```
24672pub struct ProjectLocationOperationListCall<'a, C>
24673where
24674 C: 'a,
24675{
24676 hub: &'a DatabaseMigrationService<C>,
24677 _name: String,
24678 _return_partial_success: Option<bool>,
24679 _page_token: Option<String>,
24680 _page_size: Option<i32>,
24681 _filter: Option<String>,
24682 _delegate: Option<&'a mut dyn common::Delegate>,
24683 _additional_params: HashMap<String, String>,
24684 _scopes: BTreeSet<String>,
24685}
24686
24687impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
24688
24689impl<'a, C> ProjectLocationOperationListCall<'a, C>
24690where
24691 C: common::Connector,
24692{
24693 /// Perform the operation you have build so far.
24694 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
24695 use std::borrow::Cow;
24696 use std::io::{Read, Seek};
24697
24698 use common::{url::Params, ToParts};
24699 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24700
24701 let mut dd = common::DefaultDelegate;
24702 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24703 dlg.begin(common::MethodInfo {
24704 id: "datamigration.projects.locations.operations.list",
24705 http_method: hyper::Method::GET,
24706 });
24707
24708 for &field in [
24709 "alt",
24710 "name",
24711 "returnPartialSuccess",
24712 "pageToken",
24713 "pageSize",
24714 "filter",
24715 ]
24716 .iter()
24717 {
24718 if self._additional_params.contains_key(field) {
24719 dlg.finished(false);
24720 return Err(common::Error::FieldClash(field));
24721 }
24722 }
24723
24724 let mut params = Params::with_capacity(7 + self._additional_params.len());
24725 params.push("name", self._name);
24726 if let Some(value) = self._return_partial_success.as_ref() {
24727 params.push("returnPartialSuccess", value.to_string());
24728 }
24729 if let Some(value) = self._page_token.as_ref() {
24730 params.push("pageToken", value);
24731 }
24732 if let Some(value) = self._page_size.as_ref() {
24733 params.push("pageSize", value.to_string());
24734 }
24735 if let Some(value) = self._filter.as_ref() {
24736 params.push("filter", value);
24737 }
24738
24739 params.extend(self._additional_params.iter());
24740
24741 params.push("alt", "json");
24742 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
24743 if self._scopes.is_empty() {
24744 self._scopes
24745 .insert(Scope::CloudPlatform.as_ref().to_string());
24746 }
24747
24748 #[allow(clippy::single_element_loop)]
24749 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24750 url = params.uri_replacement(url, param_name, find_this, true);
24751 }
24752 {
24753 let to_remove = ["name"];
24754 params.remove_params(&to_remove);
24755 }
24756
24757 let url = params.parse_with_url(&url);
24758
24759 loop {
24760 let token = match self
24761 .hub
24762 .auth
24763 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24764 .await
24765 {
24766 Ok(token) => token,
24767 Err(e) => match dlg.token(e) {
24768 Ok(token) => token,
24769 Err(e) => {
24770 dlg.finished(false);
24771 return Err(common::Error::MissingToken(e));
24772 }
24773 },
24774 };
24775 let mut req_result = {
24776 let client = &self.hub.client;
24777 dlg.pre_request();
24778 let mut req_builder = hyper::Request::builder()
24779 .method(hyper::Method::GET)
24780 .uri(url.as_str())
24781 .header(USER_AGENT, self.hub._user_agent.clone());
24782
24783 if let Some(token) = token.as_ref() {
24784 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24785 }
24786
24787 let request = req_builder
24788 .header(CONTENT_LENGTH, 0_u64)
24789 .body(common::to_body::<String>(None));
24790
24791 client.request(request.unwrap()).await
24792 };
24793
24794 match req_result {
24795 Err(err) => {
24796 if let common::Retry::After(d) = dlg.http_error(&err) {
24797 sleep(d).await;
24798 continue;
24799 }
24800 dlg.finished(false);
24801 return Err(common::Error::HttpError(err));
24802 }
24803 Ok(res) => {
24804 let (mut parts, body) = res.into_parts();
24805 let mut body = common::Body::new(body);
24806 if !parts.status.is_success() {
24807 let bytes = common::to_bytes(body).await.unwrap_or_default();
24808 let error = serde_json::from_str(&common::to_string(&bytes));
24809 let response = common::to_response(parts, bytes.into());
24810
24811 if let common::Retry::After(d) =
24812 dlg.http_failure(&response, error.as_ref().ok())
24813 {
24814 sleep(d).await;
24815 continue;
24816 }
24817
24818 dlg.finished(false);
24819
24820 return Err(match error {
24821 Ok(value) => common::Error::BadRequest(value),
24822 _ => common::Error::Failure(response),
24823 });
24824 }
24825 let response = {
24826 let bytes = common::to_bytes(body).await.unwrap_or_default();
24827 let encoded = common::to_string(&bytes);
24828 match serde_json::from_str(&encoded) {
24829 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24830 Err(error) => {
24831 dlg.response_json_decode_error(&encoded, &error);
24832 return Err(common::Error::JsonDecodeError(
24833 encoded.to_string(),
24834 error,
24835 ));
24836 }
24837 }
24838 };
24839
24840 dlg.finished(true);
24841 return Ok(response);
24842 }
24843 }
24844 }
24845 }
24846
24847 /// The name of the operation's parent resource.
24848 ///
24849 /// Sets the *name* path property to the given value.
24850 ///
24851 /// Even though the property as already been set when instantiating this call,
24852 /// we provide this method for API completeness.
24853 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
24854 self._name = new_value.to_string();
24855 self
24856 }
24857 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
24858 ///
24859 /// Sets the *return partial success* query property to the given value.
24860 pub fn return_partial_success(
24861 mut self,
24862 new_value: bool,
24863 ) -> ProjectLocationOperationListCall<'a, C> {
24864 self._return_partial_success = Some(new_value);
24865 self
24866 }
24867 /// The standard list page token.
24868 ///
24869 /// Sets the *page token* query property to the given value.
24870 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
24871 self._page_token = Some(new_value.to_string());
24872 self
24873 }
24874 /// The standard list page size.
24875 ///
24876 /// Sets the *page size* query property to the given value.
24877 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
24878 self._page_size = Some(new_value);
24879 self
24880 }
24881 /// The standard list filter.
24882 ///
24883 /// Sets the *filter* query property to the given value.
24884 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
24885 self._filter = Some(new_value.to_string());
24886 self
24887 }
24888 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24889 /// while executing the actual API request.
24890 ///
24891 /// ````text
24892 /// It should be used to handle progress information, and to implement a certain level of resilience.
24893 /// ````
24894 ///
24895 /// Sets the *delegate* property to the given value.
24896 pub fn delegate(
24897 mut self,
24898 new_value: &'a mut dyn common::Delegate,
24899 ) -> ProjectLocationOperationListCall<'a, C> {
24900 self._delegate = Some(new_value);
24901 self
24902 }
24903
24904 /// Set any additional parameter of the query string used in the request.
24905 /// It should be used to set parameters which are not yet available through their own
24906 /// setters.
24907 ///
24908 /// Please note that this method must not be used to set any of the known parameters
24909 /// which have their own setter method. If done anyway, the request will fail.
24910 ///
24911 /// # Additional Parameters
24912 ///
24913 /// * *$.xgafv* (query-string) - V1 error format.
24914 /// * *access_token* (query-string) - OAuth access token.
24915 /// * *alt* (query-string) - Data format for response.
24916 /// * *callback* (query-string) - JSONP
24917 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24918 /// * *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.
24919 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24920 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24921 /// * *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.
24922 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24923 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24924 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
24925 where
24926 T: AsRef<str>,
24927 {
24928 self._additional_params
24929 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24930 self
24931 }
24932
24933 /// Identifies the authorization scope for the method you are building.
24934 ///
24935 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24936 /// [`Scope::CloudPlatform`].
24937 ///
24938 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24939 /// tokens for more than one scope.
24940 ///
24941 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24942 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24943 /// sufficient, a read-write scope will do as well.
24944 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
24945 where
24946 St: AsRef<str>,
24947 {
24948 self._scopes.insert(String::from(scope.as_ref()));
24949 self
24950 }
24951 /// Identifies the authorization scope(s) for the method you are building.
24952 ///
24953 /// See [`Self::add_scope()`] for details.
24954 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
24955 where
24956 I: IntoIterator<Item = St>,
24957 St: AsRef<str>,
24958 {
24959 self._scopes
24960 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24961 self
24962 }
24963
24964 /// Removes all scopes, and no default scope will be used either.
24965 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24966 /// for details).
24967 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
24968 self._scopes.clear();
24969 self
24970 }
24971}
24972
24973/// Creates a new private connection in a given project and location.
24974///
24975/// A builder for the *locations.privateConnections.create* method supported by a *project* resource.
24976/// It is not used directly, but through a [`ProjectMethods`] instance.
24977///
24978/// # Example
24979///
24980/// Instantiate a resource method builder
24981///
24982/// ```test_harness,no_run
24983/// # extern crate hyper;
24984/// # extern crate hyper_rustls;
24985/// # extern crate google_datamigration1 as datamigration1;
24986/// use datamigration1::api::PrivateConnection;
24987/// # async fn dox() {
24988/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24989///
24990/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24991/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24992/// # .with_native_roots()
24993/// # .unwrap()
24994/// # .https_only()
24995/// # .enable_http2()
24996/// # .build();
24997///
24998/// # let executor = hyper_util::rt::TokioExecutor::new();
24999/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25000/// # secret,
25001/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25002/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25003/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25004/// # ),
25005/// # ).build().await.unwrap();
25006///
25007/// # let client = hyper_util::client::legacy::Client::builder(
25008/// # hyper_util::rt::TokioExecutor::new()
25009/// # )
25010/// # .build(
25011/// # hyper_rustls::HttpsConnectorBuilder::new()
25012/// # .with_native_roots()
25013/// # .unwrap()
25014/// # .https_or_http()
25015/// # .enable_http2()
25016/// # .build()
25017/// # );
25018/// # let mut hub = DatabaseMigrationService::new(client, auth);
25019/// // As the method needs a request, you would usually fill it with the desired information
25020/// // into the respective structure. Some of the parts shown here might not be applicable !
25021/// // Values shown here are possibly random and not representative !
25022/// let mut req = PrivateConnection::default();
25023///
25024/// // You can configure optional parameters by calling the respective setters at will, and
25025/// // execute the final call using `doit()`.
25026/// // Values shown here are possibly random and not representative !
25027/// let result = hub.projects().locations_private_connections_create(req, "parent")
25028/// .validate_only(true)
25029/// .skip_validation(true)
25030/// .request_id("sea")
25031/// .private_connection_id("et")
25032/// .doit().await;
25033/// # }
25034/// ```
25035pub struct ProjectLocationPrivateConnectionCreateCall<'a, C>
25036where
25037 C: 'a,
25038{
25039 hub: &'a DatabaseMigrationService<C>,
25040 _request: PrivateConnection,
25041 _parent: String,
25042 _validate_only: Option<bool>,
25043 _skip_validation: Option<bool>,
25044 _request_id: Option<String>,
25045 _private_connection_id: Option<String>,
25046 _delegate: Option<&'a mut dyn common::Delegate>,
25047 _additional_params: HashMap<String, String>,
25048 _scopes: BTreeSet<String>,
25049}
25050
25051impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionCreateCall<'a, C> {}
25052
25053impl<'a, C> ProjectLocationPrivateConnectionCreateCall<'a, C>
25054where
25055 C: common::Connector,
25056{
25057 /// Perform the operation you have build so far.
25058 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25059 use std::borrow::Cow;
25060 use std::io::{Read, Seek};
25061
25062 use common::{url::Params, ToParts};
25063 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25064
25065 let mut dd = common::DefaultDelegate;
25066 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25067 dlg.begin(common::MethodInfo {
25068 id: "datamigration.projects.locations.privateConnections.create",
25069 http_method: hyper::Method::POST,
25070 });
25071
25072 for &field in [
25073 "alt",
25074 "parent",
25075 "validateOnly",
25076 "skipValidation",
25077 "requestId",
25078 "privateConnectionId",
25079 ]
25080 .iter()
25081 {
25082 if self._additional_params.contains_key(field) {
25083 dlg.finished(false);
25084 return Err(common::Error::FieldClash(field));
25085 }
25086 }
25087
25088 let mut params = Params::with_capacity(8 + self._additional_params.len());
25089 params.push("parent", self._parent);
25090 if let Some(value) = self._validate_only.as_ref() {
25091 params.push("validateOnly", value.to_string());
25092 }
25093 if let Some(value) = self._skip_validation.as_ref() {
25094 params.push("skipValidation", value.to_string());
25095 }
25096 if let Some(value) = self._request_id.as_ref() {
25097 params.push("requestId", value);
25098 }
25099 if let Some(value) = self._private_connection_id.as_ref() {
25100 params.push("privateConnectionId", value);
25101 }
25102
25103 params.extend(self._additional_params.iter());
25104
25105 params.push("alt", "json");
25106 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
25107 if self._scopes.is_empty() {
25108 self._scopes
25109 .insert(Scope::CloudPlatform.as_ref().to_string());
25110 }
25111
25112 #[allow(clippy::single_element_loop)]
25113 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
25114 url = params.uri_replacement(url, param_name, find_this, true);
25115 }
25116 {
25117 let to_remove = ["parent"];
25118 params.remove_params(&to_remove);
25119 }
25120
25121 let url = params.parse_with_url(&url);
25122
25123 let mut json_mime_type = mime::APPLICATION_JSON;
25124 let mut request_value_reader = {
25125 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25126 common::remove_json_null_values(&mut value);
25127 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25128 serde_json::to_writer(&mut dst, &value).unwrap();
25129 dst
25130 };
25131 let request_size = request_value_reader
25132 .seek(std::io::SeekFrom::End(0))
25133 .unwrap();
25134 request_value_reader
25135 .seek(std::io::SeekFrom::Start(0))
25136 .unwrap();
25137
25138 loop {
25139 let token = match self
25140 .hub
25141 .auth
25142 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25143 .await
25144 {
25145 Ok(token) => token,
25146 Err(e) => match dlg.token(e) {
25147 Ok(token) => token,
25148 Err(e) => {
25149 dlg.finished(false);
25150 return Err(common::Error::MissingToken(e));
25151 }
25152 },
25153 };
25154 request_value_reader
25155 .seek(std::io::SeekFrom::Start(0))
25156 .unwrap();
25157 let mut req_result = {
25158 let client = &self.hub.client;
25159 dlg.pre_request();
25160 let mut req_builder = hyper::Request::builder()
25161 .method(hyper::Method::POST)
25162 .uri(url.as_str())
25163 .header(USER_AGENT, self.hub._user_agent.clone());
25164
25165 if let Some(token) = token.as_ref() {
25166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25167 }
25168
25169 let request = req_builder
25170 .header(CONTENT_TYPE, json_mime_type.to_string())
25171 .header(CONTENT_LENGTH, request_size as u64)
25172 .body(common::to_body(
25173 request_value_reader.get_ref().clone().into(),
25174 ));
25175
25176 client.request(request.unwrap()).await
25177 };
25178
25179 match req_result {
25180 Err(err) => {
25181 if let common::Retry::After(d) = dlg.http_error(&err) {
25182 sleep(d).await;
25183 continue;
25184 }
25185 dlg.finished(false);
25186 return Err(common::Error::HttpError(err));
25187 }
25188 Ok(res) => {
25189 let (mut parts, body) = res.into_parts();
25190 let mut body = common::Body::new(body);
25191 if !parts.status.is_success() {
25192 let bytes = common::to_bytes(body).await.unwrap_or_default();
25193 let error = serde_json::from_str(&common::to_string(&bytes));
25194 let response = common::to_response(parts, bytes.into());
25195
25196 if let common::Retry::After(d) =
25197 dlg.http_failure(&response, error.as_ref().ok())
25198 {
25199 sleep(d).await;
25200 continue;
25201 }
25202
25203 dlg.finished(false);
25204
25205 return Err(match error {
25206 Ok(value) => common::Error::BadRequest(value),
25207 _ => common::Error::Failure(response),
25208 });
25209 }
25210 let response = {
25211 let bytes = common::to_bytes(body).await.unwrap_or_default();
25212 let encoded = common::to_string(&bytes);
25213 match serde_json::from_str(&encoded) {
25214 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25215 Err(error) => {
25216 dlg.response_json_decode_error(&encoded, &error);
25217 return Err(common::Error::JsonDecodeError(
25218 encoded.to_string(),
25219 error,
25220 ));
25221 }
25222 }
25223 };
25224
25225 dlg.finished(true);
25226 return Ok(response);
25227 }
25228 }
25229 }
25230 }
25231
25232 ///
25233 /// Sets the *request* property to the given value.
25234 ///
25235 /// Even though the property as already been set when instantiating this call,
25236 /// we provide this method for API completeness.
25237 pub fn request(
25238 mut self,
25239 new_value: PrivateConnection,
25240 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25241 self._request = new_value;
25242 self
25243 }
25244 /// Required. The parent that owns the collection of PrivateConnections.
25245 ///
25246 /// Sets the *parent* path property to the given value.
25247 ///
25248 /// Even though the property as already been set when instantiating this call,
25249 /// we provide this method for API completeness.
25250 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25251 self._parent = new_value.to_string();
25252 self
25253 }
25254 /// Optional. For PSC Interface only - get the tenant project before creating the resource.
25255 ///
25256 /// Sets the *validate only* query property to the given value.
25257 pub fn validate_only(
25258 mut self,
25259 new_value: bool,
25260 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25261 self._validate_only = Some(new_value);
25262 self
25263 }
25264 /// Optional. If set to true, will skip validations.
25265 ///
25266 /// Sets the *skip validation* query property to the given value.
25267 pub fn skip_validation(
25268 mut self,
25269 new_value: bool,
25270 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25271 self._skip_validation = Some(new_value);
25272 self
25273 }
25274 /// 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.
25275 ///
25276 /// Sets the *request id* query property to the given value.
25277 pub fn request_id(
25278 mut self,
25279 new_value: &str,
25280 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25281 self._request_id = Some(new_value.to_string());
25282 self
25283 }
25284 /// Required. The private connection identifier.
25285 ///
25286 /// Sets the *private connection id* query property to the given value.
25287 pub fn private_connection_id(
25288 mut self,
25289 new_value: &str,
25290 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25291 self._private_connection_id = Some(new_value.to_string());
25292 self
25293 }
25294 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25295 /// while executing the actual API request.
25296 ///
25297 /// ````text
25298 /// It should be used to handle progress information, and to implement a certain level of resilience.
25299 /// ````
25300 ///
25301 /// Sets the *delegate* property to the given value.
25302 pub fn delegate(
25303 mut self,
25304 new_value: &'a mut dyn common::Delegate,
25305 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25306 self._delegate = Some(new_value);
25307 self
25308 }
25309
25310 /// Set any additional parameter of the query string used in the request.
25311 /// It should be used to set parameters which are not yet available through their own
25312 /// setters.
25313 ///
25314 /// Please note that this method must not be used to set any of the known parameters
25315 /// which have their own setter method. If done anyway, the request will fail.
25316 ///
25317 /// # Additional Parameters
25318 ///
25319 /// * *$.xgafv* (query-string) - V1 error format.
25320 /// * *access_token* (query-string) - OAuth access token.
25321 /// * *alt* (query-string) - Data format for response.
25322 /// * *callback* (query-string) - JSONP
25323 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25324 /// * *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.
25325 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25326 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25327 /// * *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.
25328 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25329 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25330 pub fn param<T>(
25331 mut self,
25332 name: T,
25333 value: T,
25334 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
25335 where
25336 T: AsRef<str>,
25337 {
25338 self._additional_params
25339 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25340 self
25341 }
25342
25343 /// Identifies the authorization scope for the method you are building.
25344 ///
25345 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25346 /// [`Scope::CloudPlatform`].
25347 ///
25348 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25349 /// tokens for more than one scope.
25350 ///
25351 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25352 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25353 /// sufficient, a read-write scope will do as well.
25354 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
25355 where
25356 St: AsRef<str>,
25357 {
25358 self._scopes.insert(String::from(scope.as_ref()));
25359 self
25360 }
25361 /// Identifies the authorization scope(s) for the method you are building.
25362 ///
25363 /// See [`Self::add_scope()`] for details.
25364 pub fn add_scopes<I, St>(
25365 mut self,
25366 scopes: I,
25367 ) -> ProjectLocationPrivateConnectionCreateCall<'a, C>
25368 where
25369 I: IntoIterator<Item = St>,
25370 St: AsRef<str>,
25371 {
25372 self._scopes
25373 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25374 self
25375 }
25376
25377 /// Removes all scopes, and no default scope will be used either.
25378 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25379 /// for details).
25380 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionCreateCall<'a, C> {
25381 self._scopes.clear();
25382 self
25383 }
25384}
25385
25386/// Deletes a single Database Migration Service private connection.
25387///
25388/// A builder for the *locations.privateConnections.delete* method supported by a *project* resource.
25389/// It is not used directly, but through a [`ProjectMethods`] instance.
25390///
25391/// # Example
25392///
25393/// Instantiate a resource method builder
25394///
25395/// ```test_harness,no_run
25396/// # extern crate hyper;
25397/// # extern crate hyper_rustls;
25398/// # extern crate google_datamigration1 as datamigration1;
25399/// # async fn dox() {
25400/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25401///
25402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25403/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25404/// # .with_native_roots()
25405/// # .unwrap()
25406/// # .https_only()
25407/// # .enable_http2()
25408/// # .build();
25409///
25410/// # let executor = hyper_util::rt::TokioExecutor::new();
25411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25412/// # secret,
25413/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25414/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25415/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25416/// # ),
25417/// # ).build().await.unwrap();
25418///
25419/// # let client = hyper_util::client::legacy::Client::builder(
25420/// # hyper_util::rt::TokioExecutor::new()
25421/// # )
25422/// # .build(
25423/// # hyper_rustls::HttpsConnectorBuilder::new()
25424/// # .with_native_roots()
25425/// # .unwrap()
25426/// # .https_or_http()
25427/// # .enable_http2()
25428/// # .build()
25429/// # );
25430/// # let mut hub = DatabaseMigrationService::new(client, auth);
25431/// // You can configure optional parameters by calling the respective setters at will, and
25432/// // execute the final call using `doit()`.
25433/// // Values shown here are possibly random and not representative !
25434/// let result = hub.projects().locations_private_connections_delete("name")
25435/// .request_id("dolore")
25436/// .doit().await;
25437/// # }
25438/// ```
25439pub struct ProjectLocationPrivateConnectionDeleteCall<'a, C>
25440where
25441 C: 'a,
25442{
25443 hub: &'a DatabaseMigrationService<C>,
25444 _name: String,
25445 _request_id: Option<String>,
25446 _delegate: Option<&'a mut dyn common::Delegate>,
25447 _additional_params: HashMap<String, String>,
25448 _scopes: BTreeSet<String>,
25449}
25450
25451impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionDeleteCall<'a, C> {}
25452
25453impl<'a, C> ProjectLocationPrivateConnectionDeleteCall<'a, C>
25454where
25455 C: common::Connector,
25456{
25457 /// Perform the operation you have build so far.
25458 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25459 use std::borrow::Cow;
25460 use std::io::{Read, Seek};
25461
25462 use common::{url::Params, ToParts};
25463 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25464
25465 let mut dd = common::DefaultDelegate;
25466 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25467 dlg.begin(common::MethodInfo {
25468 id: "datamigration.projects.locations.privateConnections.delete",
25469 http_method: hyper::Method::DELETE,
25470 });
25471
25472 for &field in ["alt", "name", "requestId"].iter() {
25473 if self._additional_params.contains_key(field) {
25474 dlg.finished(false);
25475 return Err(common::Error::FieldClash(field));
25476 }
25477 }
25478
25479 let mut params = Params::with_capacity(4 + self._additional_params.len());
25480 params.push("name", self._name);
25481 if let Some(value) = self._request_id.as_ref() {
25482 params.push("requestId", value);
25483 }
25484
25485 params.extend(self._additional_params.iter());
25486
25487 params.push("alt", "json");
25488 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25489 if self._scopes.is_empty() {
25490 self._scopes
25491 .insert(Scope::CloudPlatform.as_ref().to_string());
25492 }
25493
25494 #[allow(clippy::single_element_loop)]
25495 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25496 url = params.uri_replacement(url, param_name, find_this, true);
25497 }
25498 {
25499 let to_remove = ["name"];
25500 params.remove_params(&to_remove);
25501 }
25502
25503 let url = params.parse_with_url(&url);
25504
25505 loop {
25506 let token = match self
25507 .hub
25508 .auth
25509 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25510 .await
25511 {
25512 Ok(token) => token,
25513 Err(e) => match dlg.token(e) {
25514 Ok(token) => token,
25515 Err(e) => {
25516 dlg.finished(false);
25517 return Err(common::Error::MissingToken(e));
25518 }
25519 },
25520 };
25521 let mut req_result = {
25522 let client = &self.hub.client;
25523 dlg.pre_request();
25524 let mut req_builder = hyper::Request::builder()
25525 .method(hyper::Method::DELETE)
25526 .uri(url.as_str())
25527 .header(USER_AGENT, self.hub._user_agent.clone());
25528
25529 if let Some(token) = token.as_ref() {
25530 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25531 }
25532
25533 let request = req_builder
25534 .header(CONTENT_LENGTH, 0_u64)
25535 .body(common::to_body::<String>(None));
25536
25537 client.request(request.unwrap()).await
25538 };
25539
25540 match req_result {
25541 Err(err) => {
25542 if let common::Retry::After(d) = dlg.http_error(&err) {
25543 sleep(d).await;
25544 continue;
25545 }
25546 dlg.finished(false);
25547 return Err(common::Error::HttpError(err));
25548 }
25549 Ok(res) => {
25550 let (mut parts, body) = res.into_parts();
25551 let mut body = common::Body::new(body);
25552 if !parts.status.is_success() {
25553 let bytes = common::to_bytes(body).await.unwrap_or_default();
25554 let error = serde_json::from_str(&common::to_string(&bytes));
25555 let response = common::to_response(parts, bytes.into());
25556
25557 if let common::Retry::After(d) =
25558 dlg.http_failure(&response, error.as_ref().ok())
25559 {
25560 sleep(d).await;
25561 continue;
25562 }
25563
25564 dlg.finished(false);
25565
25566 return Err(match error {
25567 Ok(value) => common::Error::BadRequest(value),
25568 _ => common::Error::Failure(response),
25569 });
25570 }
25571 let response = {
25572 let bytes = common::to_bytes(body).await.unwrap_or_default();
25573 let encoded = common::to_string(&bytes);
25574 match serde_json::from_str(&encoded) {
25575 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25576 Err(error) => {
25577 dlg.response_json_decode_error(&encoded, &error);
25578 return Err(common::Error::JsonDecodeError(
25579 encoded.to_string(),
25580 error,
25581 ));
25582 }
25583 }
25584 };
25585
25586 dlg.finished(true);
25587 return Ok(response);
25588 }
25589 }
25590 }
25591 }
25592
25593 /// Required. The name of the private connection to delete.
25594 ///
25595 /// Sets the *name* path property to the given value.
25596 ///
25597 /// Even though the property as already been set when instantiating this call,
25598 /// we provide this method for API completeness.
25599 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
25600 self._name = new_value.to_string();
25601 self
25602 }
25603 /// 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.
25604 ///
25605 /// Sets the *request id* query property to the given value.
25606 pub fn request_id(
25607 mut self,
25608 new_value: &str,
25609 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
25610 self._request_id = Some(new_value.to_string());
25611 self
25612 }
25613 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25614 /// while executing the actual API request.
25615 ///
25616 /// ````text
25617 /// It should be used to handle progress information, and to implement a certain level of resilience.
25618 /// ````
25619 ///
25620 /// Sets the *delegate* property to the given value.
25621 pub fn delegate(
25622 mut self,
25623 new_value: &'a mut dyn common::Delegate,
25624 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
25625 self._delegate = Some(new_value);
25626 self
25627 }
25628
25629 /// Set any additional parameter of the query string used in the request.
25630 /// It should be used to set parameters which are not yet available through their own
25631 /// setters.
25632 ///
25633 /// Please note that this method must not be used to set any of the known parameters
25634 /// which have their own setter method. If done anyway, the request will fail.
25635 ///
25636 /// # Additional Parameters
25637 ///
25638 /// * *$.xgafv* (query-string) - V1 error format.
25639 /// * *access_token* (query-string) - OAuth access token.
25640 /// * *alt* (query-string) - Data format for response.
25641 /// * *callback* (query-string) - JSONP
25642 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25643 /// * *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.
25644 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25645 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25646 /// * *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.
25647 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25648 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25649 pub fn param<T>(
25650 mut self,
25651 name: T,
25652 value: T,
25653 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
25654 where
25655 T: AsRef<str>,
25656 {
25657 self._additional_params
25658 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25659 self
25660 }
25661
25662 /// Identifies the authorization scope for the method you are building.
25663 ///
25664 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25665 /// [`Scope::CloudPlatform`].
25666 ///
25667 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25668 /// tokens for more than one scope.
25669 ///
25670 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25671 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25672 /// sufficient, a read-write scope will do as well.
25673 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
25674 where
25675 St: AsRef<str>,
25676 {
25677 self._scopes.insert(String::from(scope.as_ref()));
25678 self
25679 }
25680 /// Identifies the authorization scope(s) for the method you are building.
25681 ///
25682 /// See [`Self::add_scope()`] for details.
25683 pub fn add_scopes<I, St>(
25684 mut self,
25685 scopes: I,
25686 ) -> ProjectLocationPrivateConnectionDeleteCall<'a, C>
25687 where
25688 I: IntoIterator<Item = St>,
25689 St: AsRef<str>,
25690 {
25691 self._scopes
25692 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25693 self
25694 }
25695
25696 /// Removes all scopes, and no default scope will be used either.
25697 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25698 /// for details).
25699 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionDeleteCall<'a, C> {
25700 self._scopes.clear();
25701 self
25702 }
25703}
25704
25705/// Gets details of a single private connection.
25706///
25707/// A builder for the *locations.privateConnections.get* method supported by a *project* resource.
25708/// It is not used directly, but through a [`ProjectMethods`] instance.
25709///
25710/// # Example
25711///
25712/// Instantiate a resource method builder
25713///
25714/// ```test_harness,no_run
25715/// # extern crate hyper;
25716/// # extern crate hyper_rustls;
25717/// # extern crate google_datamigration1 as datamigration1;
25718/// # async fn dox() {
25719/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25720///
25721/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25722/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25723/// # .with_native_roots()
25724/// # .unwrap()
25725/// # .https_only()
25726/// # .enable_http2()
25727/// # .build();
25728///
25729/// # let executor = hyper_util::rt::TokioExecutor::new();
25730/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25731/// # secret,
25732/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25733/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25734/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25735/// # ),
25736/// # ).build().await.unwrap();
25737///
25738/// # let client = hyper_util::client::legacy::Client::builder(
25739/// # hyper_util::rt::TokioExecutor::new()
25740/// # )
25741/// # .build(
25742/// # hyper_rustls::HttpsConnectorBuilder::new()
25743/// # .with_native_roots()
25744/// # .unwrap()
25745/// # .https_or_http()
25746/// # .enable_http2()
25747/// # .build()
25748/// # );
25749/// # let mut hub = DatabaseMigrationService::new(client, auth);
25750/// // You can configure optional parameters by calling the respective setters at will, and
25751/// // execute the final call using `doit()`.
25752/// // Values shown here are possibly random and not representative !
25753/// let result = hub.projects().locations_private_connections_get("name")
25754/// .doit().await;
25755/// # }
25756/// ```
25757pub struct ProjectLocationPrivateConnectionGetCall<'a, C>
25758where
25759 C: 'a,
25760{
25761 hub: &'a DatabaseMigrationService<C>,
25762 _name: String,
25763 _delegate: Option<&'a mut dyn common::Delegate>,
25764 _additional_params: HashMap<String, String>,
25765 _scopes: BTreeSet<String>,
25766}
25767
25768impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetCall<'a, C> {}
25769
25770impl<'a, C> ProjectLocationPrivateConnectionGetCall<'a, C>
25771where
25772 C: common::Connector,
25773{
25774 /// Perform the operation you have build so far.
25775 pub async fn doit(mut self) -> common::Result<(common::Response, PrivateConnection)> {
25776 use std::borrow::Cow;
25777 use std::io::{Read, Seek};
25778
25779 use common::{url::Params, ToParts};
25780 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25781
25782 let mut dd = common::DefaultDelegate;
25783 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25784 dlg.begin(common::MethodInfo {
25785 id: "datamigration.projects.locations.privateConnections.get",
25786 http_method: hyper::Method::GET,
25787 });
25788
25789 for &field in ["alt", "name"].iter() {
25790 if self._additional_params.contains_key(field) {
25791 dlg.finished(false);
25792 return Err(common::Error::FieldClash(field));
25793 }
25794 }
25795
25796 let mut params = Params::with_capacity(3 + self._additional_params.len());
25797 params.push("name", self._name);
25798
25799 params.extend(self._additional_params.iter());
25800
25801 params.push("alt", "json");
25802 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25803 if self._scopes.is_empty() {
25804 self._scopes
25805 .insert(Scope::CloudPlatform.as_ref().to_string());
25806 }
25807
25808 #[allow(clippy::single_element_loop)]
25809 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25810 url = params.uri_replacement(url, param_name, find_this, true);
25811 }
25812 {
25813 let to_remove = ["name"];
25814 params.remove_params(&to_remove);
25815 }
25816
25817 let url = params.parse_with_url(&url);
25818
25819 loop {
25820 let token = match self
25821 .hub
25822 .auth
25823 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25824 .await
25825 {
25826 Ok(token) => token,
25827 Err(e) => match dlg.token(e) {
25828 Ok(token) => token,
25829 Err(e) => {
25830 dlg.finished(false);
25831 return Err(common::Error::MissingToken(e));
25832 }
25833 },
25834 };
25835 let mut req_result = {
25836 let client = &self.hub.client;
25837 dlg.pre_request();
25838 let mut req_builder = hyper::Request::builder()
25839 .method(hyper::Method::GET)
25840 .uri(url.as_str())
25841 .header(USER_AGENT, self.hub._user_agent.clone());
25842
25843 if let Some(token) = token.as_ref() {
25844 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25845 }
25846
25847 let request = req_builder
25848 .header(CONTENT_LENGTH, 0_u64)
25849 .body(common::to_body::<String>(None));
25850
25851 client.request(request.unwrap()).await
25852 };
25853
25854 match req_result {
25855 Err(err) => {
25856 if let common::Retry::After(d) = dlg.http_error(&err) {
25857 sleep(d).await;
25858 continue;
25859 }
25860 dlg.finished(false);
25861 return Err(common::Error::HttpError(err));
25862 }
25863 Ok(res) => {
25864 let (mut parts, body) = res.into_parts();
25865 let mut body = common::Body::new(body);
25866 if !parts.status.is_success() {
25867 let bytes = common::to_bytes(body).await.unwrap_or_default();
25868 let error = serde_json::from_str(&common::to_string(&bytes));
25869 let response = common::to_response(parts, bytes.into());
25870
25871 if let common::Retry::After(d) =
25872 dlg.http_failure(&response, error.as_ref().ok())
25873 {
25874 sleep(d).await;
25875 continue;
25876 }
25877
25878 dlg.finished(false);
25879
25880 return Err(match error {
25881 Ok(value) => common::Error::BadRequest(value),
25882 _ => common::Error::Failure(response),
25883 });
25884 }
25885 let response = {
25886 let bytes = common::to_bytes(body).await.unwrap_or_default();
25887 let encoded = common::to_string(&bytes);
25888 match serde_json::from_str(&encoded) {
25889 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25890 Err(error) => {
25891 dlg.response_json_decode_error(&encoded, &error);
25892 return Err(common::Error::JsonDecodeError(
25893 encoded.to_string(),
25894 error,
25895 ));
25896 }
25897 }
25898 };
25899
25900 dlg.finished(true);
25901 return Ok(response);
25902 }
25903 }
25904 }
25905 }
25906
25907 /// Required. The name of the private connection to get.
25908 ///
25909 /// Sets the *name* path property to the given value.
25910 ///
25911 /// Even though the property as already been set when instantiating this call,
25912 /// we provide this method for API completeness.
25913 pub fn name(mut self, new_value: &str) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
25914 self._name = new_value.to_string();
25915 self
25916 }
25917 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25918 /// while executing the actual API request.
25919 ///
25920 /// ````text
25921 /// It should be used to handle progress information, and to implement a certain level of resilience.
25922 /// ````
25923 ///
25924 /// Sets the *delegate* property to the given value.
25925 pub fn delegate(
25926 mut self,
25927 new_value: &'a mut dyn common::Delegate,
25928 ) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
25929 self._delegate = Some(new_value);
25930 self
25931 }
25932
25933 /// Set any additional parameter of the query string used in the request.
25934 /// It should be used to set parameters which are not yet available through their own
25935 /// setters.
25936 ///
25937 /// Please note that this method must not be used to set any of the known parameters
25938 /// which have their own setter method. If done anyway, the request will fail.
25939 ///
25940 /// # Additional Parameters
25941 ///
25942 /// * *$.xgafv* (query-string) - V1 error format.
25943 /// * *access_token* (query-string) - OAuth access token.
25944 /// * *alt* (query-string) - Data format for response.
25945 /// * *callback* (query-string) - JSONP
25946 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25947 /// * *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.
25948 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25949 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25950 /// * *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.
25951 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25952 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25953 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionGetCall<'a, C>
25954 where
25955 T: AsRef<str>,
25956 {
25957 self._additional_params
25958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25959 self
25960 }
25961
25962 /// Identifies the authorization scope for the method you are building.
25963 ///
25964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25965 /// [`Scope::CloudPlatform`].
25966 ///
25967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25968 /// tokens for more than one scope.
25969 ///
25970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25972 /// sufficient, a read-write scope will do as well.
25973 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionGetCall<'a, C>
25974 where
25975 St: AsRef<str>,
25976 {
25977 self._scopes.insert(String::from(scope.as_ref()));
25978 self
25979 }
25980 /// Identifies the authorization scope(s) for the method you are building.
25981 ///
25982 /// See [`Self::add_scope()`] for details.
25983 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionGetCall<'a, C>
25984 where
25985 I: IntoIterator<Item = St>,
25986 St: AsRef<str>,
25987 {
25988 self._scopes
25989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25990 self
25991 }
25992
25993 /// Removes all scopes, and no default scope will be used either.
25994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25995 /// for details).
25996 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetCall<'a, C> {
25997 self._scopes.clear();
25998 self
25999 }
26000}
26001
26002/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
26003///
26004/// A builder for the *locations.privateConnections.getIamPolicy* method supported by a *project* resource.
26005/// It is not used directly, but through a [`ProjectMethods`] instance.
26006///
26007/// # Example
26008///
26009/// Instantiate a resource method builder
26010///
26011/// ```test_harness,no_run
26012/// # extern crate hyper;
26013/// # extern crate hyper_rustls;
26014/// # extern crate google_datamigration1 as datamigration1;
26015/// # async fn dox() {
26016/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26017///
26018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26019/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26020/// # .with_native_roots()
26021/// # .unwrap()
26022/// # .https_only()
26023/// # .enable_http2()
26024/// # .build();
26025///
26026/// # let executor = hyper_util::rt::TokioExecutor::new();
26027/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26028/// # secret,
26029/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26030/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26031/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26032/// # ),
26033/// # ).build().await.unwrap();
26034///
26035/// # let client = hyper_util::client::legacy::Client::builder(
26036/// # hyper_util::rt::TokioExecutor::new()
26037/// # )
26038/// # .build(
26039/// # hyper_rustls::HttpsConnectorBuilder::new()
26040/// # .with_native_roots()
26041/// # .unwrap()
26042/// # .https_or_http()
26043/// # .enable_http2()
26044/// # .build()
26045/// # );
26046/// # let mut hub = DatabaseMigrationService::new(client, auth);
26047/// // You can configure optional parameters by calling the respective setters at will, and
26048/// // execute the final call using `doit()`.
26049/// // Values shown here are possibly random and not representative !
26050/// let result = hub.projects().locations_private_connections_get_iam_policy("resource")
26051/// .options_requested_policy_version(-23)
26052/// .doit().await;
26053/// # }
26054/// ```
26055pub struct ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
26056where
26057 C: 'a,
26058{
26059 hub: &'a DatabaseMigrationService<C>,
26060 _resource: String,
26061 _options_requested_policy_version: Option<i32>,
26062 _delegate: Option<&'a mut dyn common::Delegate>,
26063 _additional_params: HashMap<String, String>,
26064 _scopes: BTreeSet<String>,
26065}
26066
26067impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {}
26068
26069impl<'a, C> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
26070where
26071 C: common::Connector,
26072{
26073 /// Perform the operation you have build so far.
26074 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26075 use std::borrow::Cow;
26076 use std::io::{Read, Seek};
26077
26078 use common::{url::Params, ToParts};
26079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26080
26081 let mut dd = common::DefaultDelegate;
26082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26083 dlg.begin(common::MethodInfo {
26084 id: "datamigration.projects.locations.privateConnections.getIamPolicy",
26085 http_method: hyper::Method::GET,
26086 });
26087
26088 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
26089 if self._additional_params.contains_key(field) {
26090 dlg.finished(false);
26091 return Err(common::Error::FieldClash(field));
26092 }
26093 }
26094
26095 let mut params = Params::with_capacity(4 + self._additional_params.len());
26096 params.push("resource", self._resource);
26097 if let Some(value) = self._options_requested_policy_version.as_ref() {
26098 params.push("options.requestedPolicyVersion", value.to_string());
26099 }
26100
26101 params.extend(self._additional_params.iter());
26102
26103 params.push("alt", "json");
26104 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
26105 if self._scopes.is_empty() {
26106 self._scopes
26107 .insert(Scope::CloudPlatform.as_ref().to_string());
26108 }
26109
26110 #[allow(clippy::single_element_loop)]
26111 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26112 url = params.uri_replacement(url, param_name, find_this, true);
26113 }
26114 {
26115 let to_remove = ["resource"];
26116 params.remove_params(&to_remove);
26117 }
26118
26119 let url = params.parse_with_url(&url);
26120
26121 loop {
26122 let token = match self
26123 .hub
26124 .auth
26125 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26126 .await
26127 {
26128 Ok(token) => token,
26129 Err(e) => match dlg.token(e) {
26130 Ok(token) => token,
26131 Err(e) => {
26132 dlg.finished(false);
26133 return Err(common::Error::MissingToken(e));
26134 }
26135 },
26136 };
26137 let mut req_result = {
26138 let client = &self.hub.client;
26139 dlg.pre_request();
26140 let mut req_builder = hyper::Request::builder()
26141 .method(hyper::Method::GET)
26142 .uri(url.as_str())
26143 .header(USER_AGENT, self.hub._user_agent.clone());
26144
26145 if let Some(token) = token.as_ref() {
26146 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26147 }
26148
26149 let request = req_builder
26150 .header(CONTENT_LENGTH, 0_u64)
26151 .body(common::to_body::<String>(None));
26152
26153 client.request(request.unwrap()).await
26154 };
26155
26156 match req_result {
26157 Err(err) => {
26158 if let common::Retry::After(d) = dlg.http_error(&err) {
26159 sleep(d).await;
26160 continue;
26161 }
26162 dlg.finished(false);
26163 return Err(common::Error::HttpError(err));
26164 }
26165 Ok(res) => {
26166 let (mut parts, body) = res.into_parts();
26167 let mut body = common::Body::new(body);
26168 if !parts.status.is_success() {
26169 let bytes = common::to_bytes(body).await.unwrap_or_default();
26170 let error = serde_json::from_str(&common::to_string(&bytes));
26171 let response = common::to_response(parts, bytes.into());
26172
26173 if let common::Retry::After(d) =
26174 dlg.http_failure(&response, error.as_ref().ok())
26175 {
26176 sleep(d).await;
26177 continue;
26178 }
26179
26180 dlg.finished(false);
26181
26182 return Err(match error {
26183 Ok(value) => common::Error::BadRequest(value),
26184 _ => common::Error::Failure(response),
26185 });
26186 }
26187 let response = {
26188 let bytes = common::to_bytes(body).await.unwrap_or_default();
26189 let encoded = common::to_string(&bytes);
26190 match serde_json::from_str(&encoded) {
26191 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26192 Err(error) => {
26193 dlg.response_json_decode_error(&encoded, &error);
26194 return Err(common::Error::JsonDecodeError(
26195 encoded.to_string(),
26196 error,
26197 ));
26198 }
26199 }
26200 };
26201
26202 dlg.finished(true);
26203 return Ok(response);
26204 }
26205 }
26206 }
26207 }
26208
26209 /// 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.
26210 ///
26211 /// Sets the *resource* path property to the given value.
26212 ///
26213 /// Even though the property as already been set when instantiating this call,
26214 /// we provide this method for API completeness.
26215 pub fn resource(
26216 mut self,
26217 new_value: &str,
26218 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
26219 self._resource = new_value.to_string();
26220 self
26221 }
26222 /// 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).
26223 ///
26224 /// Sets the *options.requested policy version* query property to the given value.
26225 pub fn options_requested_policy_version(
26226 mut self,
26227 new_value: i32,
26228 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
26229 self._options_requested_policy_version = Some(new_value);
26230 self
26231 }
26232 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26233 /// while executing the actual API request.
26234 ///
26235 /// ````text
26236 /// It should be used to handle progress information, and to implement a certain level of resilience.
26237 /// ````
26238 ///
26239 /// Sets the *delegate* property to the given value.
26240 pub fn delegate(
26241 mut self,
26242 new_value: &'a mut dyn common::Delegate,
26243 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
26244 self._delegate = Some(new_value);
26245 self
26246 }
26247
26248 /// Set any additional parameter of the query string used in the request.
26249 /// It should be used to set parameters which are not yet available through their own
26250 /// setters.
26251 ///
26252 /// Please note that this method must not be used to set any of the known parameters
26253 /// which have their own setter method. If done anyway, the request will fail.
26254 ///
26255 /// # Additional Parameters
26256 ///
26257 /// * *$.xgafv* (query-string) - V1 error format.
26258 /// * *access_token* (query-string) - OAuth access token.
26259 /// * *alt* (query-string) - Data format for response.
26260 /// * *callback* (query-string) - JSONP
26261 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26262 /// * *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.
26263 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26264 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26265 /// * *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.
26266 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26267 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26268 pub fn param<T>(
26269 mut self,
26270 name: T,
26271 value: T,
26272 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
26273 where
26274 T: AsRef<str>,
26275 {
26276 self._additional_params
26277 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26278 self
26279 }
26280
26281 /// Identifies the authorization scope for the method you are building.
26282 ///
26283 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26284 /// [`Scope::CloudPlatform`].
26285 ///
26286 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26287 /// tokens for more than one scope.
26288 ///
26289 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26290 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26291 /// sufficient, a read-write scope will do as well.
26292 pub fn add_scope<St>(
26293 mut self,
26294 scope: St,
26295 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
26296 where
26297 St: AsRef<str>,
26298 {
26299 self._scopes.insert(String::from(scope.as_ref()));
26300 self
26301 }
26302 /// Identifies the authorization scope(s) for the method you are building.
26303 ///
26304 /// See [`Self::add_scope()`] for details.
26305 pub fn add_scopes<I, St>(
26306 mut self,
26307 scopes: I,
26308 ) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C>
26309 where
26310 I: IntoIterator<Item = St>,
26311 St: AsRef<str>,
26312 {
26313 self._scopes
26314 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26315 self
26316 }
26317
26318 /// Removes all scopes, and no default scope will be used either.
26319 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26320 /// for details).
26321 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionGetIamPolicyCall<'a, C> {
26322 self._scopes.clear();
26323 self
26324 }
26325}
26326
26327/// Retrieves a list of private connections in a given project and location.
26328///
26329/// A builder for the *locations.privateConnections.list* method supported by a *project* resource.
26330/// It is not used directly, but through a [`ProjectMethods`] instance.
26331///
26332/// # Example
26333///
26334/// Instantiate a resource method builder
26335///
26336/// ```test_harness,no_run
26337/// # extern crate hyper;
26338/// # extern crate hyper_rustls;
26339/// # extern crate google_datamigration1 as datamigration1;
26340/// # async fn dox() {
26341/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26342///
26343/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26344/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26345/// # .with_native_roots()
26346/// # .unwrap()
26347/// # .https_only()
26348/// # .enable_http2()
26349/// # .build();
26350///
26351/// # let executor = hyper_util::rt::TokioExecutor::new();
26352/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26353/// # secret,
26354/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26355/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26356/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26357/// # ),
26358/// # ).build().await.unwrap();
26359///
26360/// # let client = hyper_util::client::legacy::Client::builder(
26361/// # hyper_util::rt::TokioExecutor::new()
26362/// # )
26363/// # .build(
26364/// # hyper_rustls::HttpsConnectorBuilder::new()
26365/// # .with_native_roots()
26366/// # .unwrap()
26367/// # .https_or_http()
26368/// # .enable_http2()
26369/// # .build()
26370/// # );
26371/// # let mut hub = DatabaseMigrationService::new(client, auth);
26372/// // You can configure optional parameters by calling the respective setters at will, and
26373/// // execute the final call using `doit()`.
26374/// // Values shown here are possibly random and not representative !
26375/// let result = hub.projects().locations_private_connections_list("parent")
26376/// .page_token("erat")
26377/// .page_size(-69)
26378/// .order_by("erat")
26379/// .filter("accusam")
26380/// .doit().await;
26381/// # }
26382/// ```
26383pub struct ProjectLocationPrivateConnectionListCall<'a, C>
26384where
26385 C: 'a,
26386{
26387 hub: &'a DatabaseMigrationService<C>,
26388 _parent: String,
26389 _page_token: Option<String>,
26390 _page_size: Option<i32>,
26391 _order_by: Option<String>,
26392 _filter: Option<String>,
26393 _delegate: Option<&'a mut dyn common::Delegate>,
26394 _additional_params: HashMap<String, String>,
26395 _scopes: BTreeSet<String>,
26396}
26397
26398impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionListCall<'a, C> {}
26399
26400impl<'a, C> ProjectLocationPrivateConnectionListCall<'a, C>
26401where
26402 C: common::Connector,
26403{
26404 /// Perform the operation you have build so far.
26405 pub async fn doit(
26406 mut self,
26407 ) -> common::Result<(common::Response, ListPrivateConnectionsResponse)> {
26408 use std::borrow::Cow;
26409 use std::io::{Read, Seek};
26410
26411 use common::{url::Params, ToParts};
26412 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26413
26414 let mut dd = common::DefaultDelegate;
26415 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26416 dlg.begin(common::MethodInfo {
26417 id: "datamigration.projects.locations.privateConnections.list",
26418 http_method: hyper::Method::GET,
26419 });
26420
26421 for &field in [
26422 "alt",
26423 "parent",
26424 "pageToken",
26425 "pageSize",
26426 "orderBy",
26427 "filter",
26428 ]
26429 .iter()
26430 {
26431 if self._additional_params.contains_key(field) {
26432 dlg.finished(false);
26433 return Err(common::Error::FieldClash(field));
26434 }
26435 }
26436
26437 let mut params = Params::with_capacity(7 + self._additional_params.len());
26438 params.push("parent", self._parent);
26439 if let Some(value) = self._page_token.as_ref() {
26440 params.push("pageToken", value);
26441 }
26442 if let Some(value) = self._page_size.as_ref() {
26443 params.push("pageSize", value.to_string());
26444 }
26445 if let Some(value) = self._order_by.as_ref() {
26446 params.push("orderBy", value);
26447 }
26448 if let Some(value) = self._filter.as_ref() {
26449 params.push("filter", value);
26450 }
26451
26452 params.extend(self._additional_params.iter());
26453
26454 params.push("alt", "json");
26455 let mut url = self.hub._base_url.clone() + "v1/{+parent}/privateConnections";
26456 if self._scopes.is_empty() {
26457 self._scopes
26458 .insert(Scope::CloudPlatform.as_ref().to_string());
26459 }
26460
26461 #[allow(clippy::single_element_loop)]
26462 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26463 url = params.uri_replacement(url, param_name, find_this, true);
26464 }
26465 {
26466 let to_remove = ["parent"];
26467 params.remove_params(&to_remove);
26468 }
26469
26470 let url = params.parse_with_url(&url);
26471
26472 loop {
26473 let token = match self
26474 .hub
26475 .auth
26476 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26477 .await
26478 {
26479 Ok(token) => token,
26480 Err(e) => match dlg.token(e) {
26481 Ok(token) => token,
26482 Err(e) => {
26483 dlg.finished(false);
26484 return Err(common::Error::MissingToken(e));
26485 }
26486 },
26487 };
26488 let mut req_result = {
26489 let client = &self.hub.client;
26490 dlg.pre_request();
26491 let mut req_builder = hyper::Request::builder()
26492 .method(hyper::Method::GET)
26493 .uri(url.as_str())
26494 .header(USER_AGENT, self.hub._user_agent.clone());
26495
26496 if let Some(token) = token.as_ref() {
26497 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26498 }
26499
26500 let request = req_builder
26501 .header(CONTENT_LENGTH, 0_u64)
26502 .body(common::to_body::<String>(None));
26503
26504 client.request(request.unwrap()).await
26505 };
26506
26507 match req_result {
26508 Err(err) => {
26509 if let common::Retry::After(d) = dlg.http_error(&err) {
26510 sleep(d).await;
26511 continue;
26512 }
26513 dlg.finished(false);
26514 return Err(common::Error::HttpError(err));
26515 }
26516 Ok(res) => {
26517 let (mut parts, body) = res.into_parts();
26518 let mut body = common::Body::new(body);
26519 if !parts.status.is_success() {
26520 let bytes = common::to_bytes(body).await.unwrap_or_default();
26521 let error = serde_json::from_str(&common::to_string(&bytes));
26522 let response = common::to_response(parts, bytes.into());
26523
26524 if let common::Retry::After(d) =
26525 dlg.http_failure(&response, error.as_ref().ok())
26526 {
26527 sleep(d).await;
26528 continue;
26529 }
26530
26531 dlg.finished(false);
26532
26533 return Err(match error {
26534 Ok(value) => common::Error::BadRequest(value),
26535 _ => common::Error::Failure(response),
26536 });
26537 }
26538 let response = {
26539 let bytes = common::to_bytes(body).await.unwrap_or_default();
26540 let encoded = common::to_string(&bytes);
26541 match serde_json::from_str(&encoded) {
26542 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26543 Err(error) => {
26544 dlg.response_json_decode_error(&encoded, &error);
26545 return Err(common::Error::JsonDecodeError(
26546 encoded.to_string(),
26547 error,
26548 ));
26549 }
26550 }
26551 };
26552
26553 dlg.finished(true);
26554 return Ok(response);
26555 }
26556 }
26557 }
26558 }
26559
26560 /// Required. The parent that owns the collection of private connections.
26561 ///
26562 /// Sets the *parent* path property to the given value.
26563 ///
26564 /// Even though the property as already been set when instantiating this call,
26565 /// we provide this method for API completeness.
26566 pub fn parent(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26567 self._parent = new_value.to_string();
26568 self
26569 }
26570 /// 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.
26571 ///
26572 /// Sets the *page token* query property to the given value.
26573 pub fn page_token(
26574 mut self,
26575 new_value: &str,
26576 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26577 self._page_token = Some(new_value.to_string());
26578 self
26579 }
26580 /// 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.
26581 ///
26582 /// Sets the *page size* query property to the given value.
26583 pub fn page_size(mut self, new_value: i32) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26584 self._page_size = Some(new_value);
26585 self
26586 }
26587 /// Order by fields for the result.
26588 ///
26589 /// Sets the *order by* query property to the given value.
26590 pub fn order_by(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26591 self._order_by = Some(new_value.to_string());
26592 self
26593 }
26594 /// 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**.
26595 ///
26596 /// Sets the *filter* query property to the given value.
26597 pub fn filter(mut self, new_value: &str) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26598 self._filter = Some(new_value.to_string());
26599 self
26600 }
26601 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26602 /// while executing the actual API request.
26603 ///
26604 /// ````text
26605 /// It should be used to handle progress information, and to implement a certain level of resilience.
26606 /// ````
26607 ///
26608 /// Sets the *delegate* property to the given value.
26609 pub fn delegate(
26610 mut self,
26611 new_value: &'a mut dyn common::Delegate,
26612 ) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26613 self._delegate = Some(new_value);
26614 self
26615 }
26616
26617 /// Set any additional parameter of the query string used in the request.
26618 /// It should be used to set parameters which are not yet available through their own
26619 /// setters.
26620 ///
26621 /// Please note that this method must not be used to set any of the known parameters
26622 /// which have their own setter method. If done anyway, the request will fail.
26623 ///
26624 /// # Additional Parameters
26625 ///
26626 /// * *$.xgafv* (query-string) - V1 error format.
26627 /// * *access_token* (query-string) - OAuth access token.
26628 /// * *alt* (query-string) - Data format for response.
26629 /// * *callback* (query-string) - JSONP
26630 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26631 /// * *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.
26632 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26633 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26634 /// * *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.
26635 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26636 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26637 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationPrivateConnectionListCall<'a, C>
26638 where
26639 T: AsRef<str>,
26640 {
26641 self._additional_params
26642 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26643 self
26644 }
26645
26646 /// Identifies the authorization scope for the method you are building.
26647 ///
26648 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26649 /// [`Scope::CloudPlatform`].
26650 ///
26651 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26652 /// tokens for more than one scope.
26653 ///
26654 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26655 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26656 /// sufficient, a read-write scope will do as well.
26657 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationPrivateConnectionListCall<'a, C>
26658 where
26659 St: AsRef<str>,
26660 {
26661 self._scopes.insert(String::from(scope.as_ref()));
26662 self
26663 }
26664 /// Identifies the authorization scope(s) for the method you are building.
26665 ///
26666 /// See [`Self::add_scope()`] for details.
26667 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationPrivateConnectionListCall<'a, C>
26668 where
26669 I: IntoIterator<Item = St>,
26670 St: AsRef<str>,
26671 {
26672 self._scopes
26673 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26674 self
26675 }
26676
26677 /// Removes all scopes, and no default scope will be used either.
26678 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26679 /// for details).
26680 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionListCall<'a, C> {
26681 self._scopes.clear();
26682 self
26683 }
26684}
26685
26686/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
26687///
26688/// A builder for the *locations.privateConnections.setIamPolicy* method supported by a *project* resource.
26689/// It is not used directly, but through a [`ProjectMethods`] instance.
26690///
26691/// # Example
26692///
26693/// Instantiate a resource method builder
26694///
26695/// ```test_harness,no_run
26696/// # extern crate hyper;
26697/// # extern crate hyper_rustls;
26698/// # extern crate google_datamigration1 as datamigration1;
26699/// use datamigration1::api::SetIamPolicyRequest;
26700/// # async fn dox() {
26701/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26702///
26703/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26704/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26705/// # .with_native_roots()
26706/// # .unwrap()
26707/// # .https_only()
26708/// # .enable_http2()
26709/// # .build();
26710///
26711/// # let executor = hyper_util::rt::TokioExecutor::new();
26712/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26713/// # secret,
26714/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26715/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26716/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26717/// # ),
26718/// # ).build().await.unwrap();
26719///
26720/// # let client = hyper_util::client::legacy::Client::builder(
26721/// # hyper_util::rt::TokioExecutor::new()
26722/// # )
26723/// # .build(
26724/// # hyper_rustls::HttpsConnectorBuilder::new()
26725/// # .with_native_roots()
26726/// # .unwrap()
26727/// # .https_or_http()
26728/// # .enable_http2()
26729/// # .build()
26730/// # );
26731/// # let mut hub = DatabaseMigrationService::new(client, auth);
26732/// // As the method needs a request, you would usually fill it with the desired information
26733/// // into the respective structure. Some of the parts shown here might not be applicable !
26734/// // Values shown here are possibly random and not representative !
26735/// let mut req = SetIamPolicyRequest::default();
26736///
26737/// // You can configure optional parameters by calling the respective setters at will, and
26738/// // execute the final call using `doit()`.
26739/// // Values shown here are possibly random and not representative !
26740/// let result = hub.projects().locations_private_connections_set_iam_policy(req, "resource")
26741/// .doit().await;
26742/// # }
26743/// ```
26744pub struct ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
26745where
26746 C: 'a,
26747{
26748 hub: &'a DatabaseMigrationService<C>,
26749 _request: SetIamPolicyRequest,
26750 _resource: String,
26751 _delegate: Option<&'a mut dyn common::Delegate>,
26752 _additional_params: HashMap<String, String>,
26753 _scopes: BTreeSet<String>,
26754}
26755
26756impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {}
26757
26758impl<'a, C> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
26759where
26760 C: common::Connector,
26761{
26762 /// Perform the operation you have build so far.
26763 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
26764 use std::borrow::Cow;
26765 use std::io::{Read, Seek};
26766
26767 use common::{url::Params, ToParts};
26768 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26769
26770 let mut dd = common::DefaultDelegate;
26771 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26772 dlg.begin(common::MethodInfo {
26773 id: "datamigration.projects.locations.privateConnections.setIamPolicy",
26774 http_method: hyper::Method::POST,
26775 });
26776
26777 for &field in ["alt", "resource"].iter() {
26778 if self._additional_params.contains_key(field) {
26779 dlg.finished(false);
26780 return Err(common::Error::FieldClash(field));
26781 }
26782 }
26783
26784 let mut params = Params::with_capacity(4 + self._additional_params.len());
26785 params.push("resource", self._resource);
26786
26787 params.extend(self._additional_params.iter());
26788
26789 params.push("alt", "json");
26790 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
26791 if self._scopes.is_empty() {
26792 self._scopes
26793 .insert(Scope::CloudPlatform.as_ref().to_string());
26794 }
26795
26796 #[allow(clippy::single_element_loop)]
26797 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
26798 url = params.uri_replacement(url, param_name, find_this, true);
26799 }
26800 {
26801 let to_remove = ["resource"];
26802 params.remove_params(&to_remove);
26803 }
26804
26805 let url = params.parse_with_url(&url);
26806
26807 let mut json_mime_type = mime::APPLICATION_JSON;
26808 let mut request_value_reader = {
26809 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26810 common::remove_json_null_values(&mut value);
26811 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26812 serde_json::to_writer(&mut dst, &value).unwrap();
26813 dst
26814 };
26815 let request_size = request_value_reader
26816 .seek(std::io::SeekFrom::End(0))
26817 .unwrap();
26818 request_value_reader
26819 .seek(std::io::SeekFrom::Start(0))
26820 .unwrap();
26821
26822 loop {
26823 let token = match self
26824 .hub
26825 .auth
26826 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26827 .await
26828 {
26829 Ok(token) => token,
26830 Err(e) => match dlg.token(e) {
26831 Ok(token) => token,
26832 Err(e) => {
26833 dlg.finished(false);
26834 return Err(common::Error::MissingToken(e));
26835 }
26836 },
26837 };
26838 request_value_reader
26839 .seek(std::io::SeekFrom::Start(0))
26840 .unwrap();
26841 let mut req_result = {
26842 let client = &self.hub.client;
26843 dlg.pre_request();
26844 let mut req_builder = hyper::Request::builder()
26845 .method(hyper::Method::POST)
26846 .uri(url.as_str())
26847 .header(USER_AGENT, self.hub._user_agent.clone());
26848
26849 if let Some(token) = token.as_ref() {
26850 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26851 }
26852
26853 let request = req_builder
26854 .header(CONTENT_TYPE, json_mime_type.to_string())
26855 .header(CONTENT_LENGTH, request_size as u64)
26856 .body(common::to_body(
26857 request_value_reader.get_ref().clone().into(),
26858 ));
26859
26860 client.request(request.unwrap()).await
26861 };
26862
26863 match req_result {
26864 Err(err) => {
26865 if let common::Retry::After(d) = dlg.http_error(&err) {
26866 sleep(d).await;
26867 continue;
26868 }
26869 dlg.finished(false);
26870 return Err(common::Error::HttpError(err));
26871 }
26872 Ok(res) => {
26873 let (mut parts, body) = res.into_parts();
26874 let mut body = common::Body::new(body);
26875 if !parts.status.is_success() {
26876 let bytes = common::to_bytes(body).await.unwrap_or_default();
26877 let error = serde_json::from_str(&common::to_string(&bytes));
26878 let response = common::to_response(parts, bytes.into());
26879
26880 if let common::Retry::After(d) =
26881 dlg.http_failure(&response, error.as_ref().ok())
26882 {
26883 sleep(d).await;
26884 continue;
26885 }
26886
26887 dlg.finished(false);
26888
26889 return Err(match error {
26890 Ok(value) => common::Error::BadRequest(value),
26891 _ => common::Error::Failure(response),
26892 });
26893 }
26894 let response = {
26895 let bytes = common::to_bytes(body).await.unwrap_or_default();
26896 let encoded = common::to_string(&bytes);
26897 match serde_json::from_str(&encoded) {
26898 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26899 Err(error) => {
26900 dlg.response_json_decode_error(&encoded, &error);
26901 return Err(common::Error::JsonDecodeError(
26902 encoded.to_string(),
26903 error,
26904 ));
26905 }
26906 }
26907 };
26908
26909 dlg.finished(true);
26910 return Ok(response);
26911 }
26912 }
26913 }
26914 }
26915
26916 ///
26917 /// Sets the *request* property to the given value.
26918 ///
26919 /// Even though the property as already been set when instantiating this call,
26920 /// we provide this method for API completeness.
26921 pub fn request(
26922 mut self,
26923 new_value: SetIamPolicyRequest,
26924 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
26925 self._request = new_value;
26926 self
26927 }
26928 /// 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.
26929 ///
26930 /// Sets the *resource* path property to the given value.
26931 ///
26932 /// Even though the property as already been set when instantiating this call,
26933 /// we provide this method for API completeness.
26934 pub fn resource(
26935 mut self,
26936 new_value: &str,
26937 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
26938 self._resource = new_value.to_string();
26939 self
26940 }
26941 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26942 /// while executing the actual API request.
26943 ///
26944 /// ````text
26945 /// It should be used to handle progress information, and to implement a certain level of resilience.
26946 /// ````
26947 ///
26948 /// Sets the *delegate* property to the given value.
26949 pub fn delegate(
26950 mut self,
26951 new_value: &'a mut dyn common::Delegate,
26952 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
26953 self._delegate = Some(new_value);
26954 self
26955 }
26956
26957 /// Set any additional parameter of the query string used in the request.
26958 /// It should be used to set parameters which are not yet available through their own
26959 /// setters.
26960 ///
26961 /// Please note that this method must not be used to set any of the known parameters
26962 /// which have their own setter method. If done anyway, the request will fail.
26963 ///
26964 /// # Additional Parameters
26965 ///
26966 /// * *$.xgafv* (query-string) - V1 error format.
26967 /// * *access_token* (query-string) - OAuth access token.
26968 /// * *alt* (query-string) - Data format for response.
26969 /// * *callback* (query-string) - JSONP
26970 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26971 /// * *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.
26972 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26973 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26974 /// * *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.
26975 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26976 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26977 pub fn param<T>(
26978 mut self,
26979 name: T,
26980 value: T,
26981 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
26982 where
26983 T: AsRef<str>,
26984 {
26985 self._additional_params
26986 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26987 self
26988 }
26989
26990 /// Identifies the authorization scope for the method you are building.
26991 ///
26992 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26993 /// [`Scope::CloudPlatform`].
26994 ///
26995 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26996 /// tokens for more than one scope.
26997 ///
26998 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26999 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27000 /// sufficient, a read-write scope will do as well.
27001 pub fn add_scope<St>(
27002 mut self,
27003 scope: St,
27004 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
27005 where
27006 St: AsRef<str>,
27007 {
27008 self._scopes.insert(String::from(scope.as_ref()));
27009 self
27010 }
27011 /// Identifies the authorization scope(s) for the method you are building.
27012 ///
27013 /// See [`Self::add_scope()`] for details.
27014 pub fn add_scopes<I, St>(
27015 mut self,
27016 scopes: I,
27017 ) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C>
27018 where
27019 I: IntoIterator<Item = St>,
27020 St: AsRef<str>,
27021 {
27022 self._scopes
27023 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27024 self
27025 }
27026
27027 /// Removes all scopes, and no default scope will be used either.
27028 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27029 /// for details).
27030 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionSetIamPolicyCall<'a, C> {
27031 self._scopes.clear();
27032 self
27033 }
27034}
27035
27036/// 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.
27037///
27038/// A builder for the *locations.privateConnections.testIamPermissions* method supported by a *project* resource.
27039/// It is not used directly, but through a [`ProjectMethods`] instance.
27040///
27041/// # Example
27042///
27043/// Instantiate a resource method builder
27044///
27045/// ```test_harness,no_run
27046/// # extern crate hyper;
27047/// # extern crate hyper_rustls;
27048/// # extern crate google_datamigration1 as datamigration1;
27049/// use datamigration1::api::TestIamPermissionsRequest;
27050/// # async fn dox() {
27051/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27052///
27053/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27054/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27055/// # .with_native_roots()
27056/// # .unwrap()
27057/// # .https_only()
27058/// # .enable_http2()
27059/// # .build();
27060///
27061/// # let executor = hyper_util::rt::TokioExecutor::new();
27062/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27063/// # secret,
27064/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27065/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27066/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27067/// # ),
27068/// # ).build().await.unwrap();
27069///
27070/// # let client = hyper_util::client::legacy::Client::builder(
27071/// # hyper_util::rt::TokioExecutor::new()
27072/// # )
27073/// # .build(
27074/// # hyper_rustls::HttpsConnectorBuilder::new()
27075/// # .with_native_roots()
27076/// # .unwrap()
27077/// # .https_or_http()
27078/// # .enable_http2()
27079/// # .build()
27080/// # );
27081/// # let mut hub = DatabaseMigrationService::new(client, auth);
27082/// // As the method needs a request, you would usually fill it with the desired information
27083/// // into the respective structure. Some of the parts shown here might not be applicable !
27084/// // Values shown here are possibly random and not representative !
27085/// let mut req = TestIamPermissionsRequest::default();
27086///
27087/// // You can configure optional parameters by calling the respective setters at will, and
27088/// // execute the final call using `doit()`.
27089/// // Values shown here are possibly random and not representative !
27090/// let result = hub.projects().locations_private_connections_test_iam_permissions(req, "resource")
27091/// .doit().await;
27092/// # }
27093/// ```
27094pub struct ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
27095where
27096 C: 'a,
27097{
27098 hub: &'a DatabaseMigrationService<C>,
27099 _request: TestIamPermissionsRequest,
27100 _resource: String,
27101 _delegate: Option<&'a mut dyn common::Delegate>,
27102 _additional_params: HashMap<String, String>,
27103 _scopes: BTreeSet<String>,
27104}
27105
27106impl<'a, C> common::CallBuilder for ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {}
27107
27108impl<'a, C> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
27109where
27110 C: common::Connector,
27111{
27112 /// Perform the operation you have build so far.
27113 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
27114 use std::borrow::Cow;
27115 use std::io::{Read, Seek};
27116
27117 use common::{url::Params, ToParts};
27118 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27119
27120 let mut dd = common::DefaultDelegate;
27121 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27122 dlg.begin(common::MethodInfo {
27123 id: "datamigration.projects.locations.privateConnections.testIamPermissions",
27124 http_method: hyper::Method::POST,
27125 });
27126
27127 for &field in ["alt", "resource"].iter() {
27128 if self._additional_params.contains_key(field) {
27129 dlg.finished(false);
27130 return Err(common::Error::FieldClash(field));
27131 }
27132 }
27133
27134 let mut params = Params::with_capacity(4 + self._additional_params.len());
27135 params.push("resource", self._resource);
27136
27137 params.extend(self._additional_params.iter());
27138
27139 params.push("alt", "json");
27140 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
27141 if self._scopes.is_empty() {
27142 self._scopes
27143 .insert(Scope::CloudPlatform.as_ref().to_string());
27144 }
27145
27146 #[allow(clippy::single_element_loop)]
27147 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
27148 url = params.uri_replacement(url, param_name, find_this, true);
27149 }
27150 {
27151 let to_remove = ["resource"];
27152 params.remove_params(&to_remove);
27153 }
27154
27155 let url = params.parse_with_url(&url);
27156
27157 let mut json_mime_type = mime::APPLICATION_JSON;
27158 let mut request_value_reader = {
27159 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27160 common::remove_json_null_values(&mut value);
27161 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27162 serde_json::to_writer(&mut dst, &value).unwrap();
27163 dst
27164 };
27165 let request_size = request_value_reader
27166 .seek(std::io::SeekFrom::End(0))
27167 .unwrap();
27168 request_value_reader
27169 .seek(std::io::SeekFrom::Start(0))
27170 .unwrap();
27171
27172 loop {
27173 let token = match self
27174 .hub
27175 .auth
27176 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27177 .await
27178 {
27179 Ok(token) => token,
27180 Err(e) => match dlg.token(e) {
27181 Ok(token) => token,
27182 Err(e) => {
27183 dlg.finished(false);
27184 return Err(common::Error::MissingToken(e));
27185 }
27186 },
27187 };
27188 request_value_reader
27189 .seek(std::io::SeekFrom::Start(0))
27190 .unwrap();
27191 let mut req_result = {
27192 let client = &self.hub.client;
27193 dlg.pre_request();
27194 let mut req_builder = hyper::Request::builder()
27195 .method(hyper::Method::POST)
27196 .uri(url.as_str())
27197 .header(USER_AGENT, self.hub._user_agent.clone());
27198
27199 if let Some(token) = token.as_ref() {
27200 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27201 }
27202
27203 let request = req_builder
27204 .header(CONTENT_TYPE, json_mime_type.to_string())
27205 .header(CONTENT_LENGTH, request_size as u64)
27206 .body(common::to_body(
27207 request_value_reader.get_ref().clone().into(),
27208 ));
27209
27210 client.request(request.unwrap()).await
27211 };
27212
27213 match req_result {
27214 Err(err) => {
27215 if let common::Retry::After(d) = dlg.http_error(&err) {
27216 sleep(d).await;
27217 continue;
27218 }
27219 dlg.finished(false);
27220 return Err(common::Error::HttpError(err));
27221 }
27222 Ok(res) => {
27223 let (mut parts, body) = res.into_parts();
27224 let mut body = common::Body::new(body);
27225 if !parts.status.is_success() {
27226 let bytes = common::to_bytes(body).await.unwrap_or_default();
27227 let error = serde_json::from_str(&common::to_string(&bytes));
27228 let response = common::to_response(parts, bytes.into());
27229
27230 if let common::Retry::After(d) =
27231 dlg.http_failure(&response, error.as_ref().ok())
27232 {
27233 sleep(d).await;
27234 continue;
27235 }
27236
27237 dlg.finished(false);
27238
27239 return Err(match error {
27240 Ok(value) => common::Error::BadRequest(value),
27241 _ => common::Error::Failure(response),
27242 });
27243 }
27244 let response = {
27245 let bytes = common::to_bytes(body).await.unwrap_or_default();
27246 let encoded = common::to_string(&bytes);
27247 match serde_json::from_str(&encoded) {
27248 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27249 Err(error) => {
27250 dlg.response_json_decode_error(&encoded, &error);
27251 return Err(common::Error::JsonDecodeError(
27252 encoded.to_string(),
27253 error,
27254 ));
27255 }
27256 }
27257 };
27258
27259 dlg.finished(true);
27260 return Ok(response);
27261 }
27262 }
27263 }
27264 }
27265
27266 ///
27267 /// Sets the *request* property to the given value.
27268 ///
27269 /// Even though the property as already been set when instantiating this call,
27270 /// we provide this method for API completeness.
27271 pub fn request(
27272 mut self,
27273 new_value: TestIamPermissionsRequest,
27274 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
27275 self._request = new_value;
27276 self
27277 }
27278 /// 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.
27279 ///
27280 /// Sets the *resource* path property to the given value.
27281 ///
27282 /// Even though the property as already been set when instantiating this call,
27283 /// we provide this method for API completeness.
27284 pub fn resource(
27285 mut self,
27286 new_value: &str,
27287 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
27288 self._resource = new_value.to_string();
27289 self
27290 }
27291 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27292 /// while executing the actual API request.
27293 ///
27294 /// ````text
27295 /// It should be used to handle progress information, and to implement a certain level of resilience.
27296 /// ````
27297 ///
27298 /// Sets the *delegate* property to the given value.
27299 pub fn delegate(
27300 mut self,
27301 new_value: &'a mut dyn common::Delegate,
27302 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
27303 self._delegate = Some(new_value);
27304 self
27305 }
27306
27307 /// Set any additional parameter of the query string used in the request.
27308 /// It should be used to set parameters which are not yet available through their own
27309 /// setters.
27310 ///
27311 /// Please note that this method must not be used to set any of the known parameters
27312 /// which have their own setter method. If done anyway, the request will fail.
27313 ///
27314 /// # Additional Parameters
27315 ///
27316 /// * *$.xgafv* (query-string) - V1 error format.
27317 /// * *access_token* (query-string) - OAuth access token.
27318 /// * *alt* (query-string) - Data format for response.
27319 /// * *callback* (query-string) - JSONP
27320 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27321 /// * *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.
27322 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27323 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27324 /// * *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.
27325 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27326 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27327 pub fn param<T>(
27328 mut self,
27329 name: T,
27330 value: T,
27331 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
27332 where
27333 T: AsRef<str>,
27334 {
27335 self._additional_params
27336 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27337 self
27338 }
27339
27340 /// Identifies the authorization scope for the method you are building.
27341 ///
27342 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27343 /// [`Scope::CloudPlatform`].
27344 ///
27345 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27346 /// tokens for more than one scope.
27347 ///
27348 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27349 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27350 /// sufficient, a read-write scope will do as well.
27351 pub fn add_scope<St>(
27352 mut self,
27353 scope: St,
27354 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
27355 where
27356 St: AsRef<str>,
27357 {
27358 self._scopes.insert(String::from(scope.as_ref()));
27359 self
27360 }
27361 /// Identifies the authorization scope(s) for the method you are building.
27362 ///
27363 /// See [`Self::add_scope()`] for details.
27364 pub fn add_scopes<I, St>(
27365 mut self,
27366 scopes: I,
27367 ) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C>
27368 where
27369 I: IntoIterator<Item = St>,
27370 St: AsRef<str>,
27371 {
27372 self._scopes
27373 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27374 self
27375 }
27376
27377 /// Removes all scopes, and no default scope will be used either.
27378 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27379 /// for details).
27380 pub fn clear_scopes(mut self) -> ProjectLocationPrivateConnectionTestIamPermissionCall<'a, C> {
27381 self._scopes.clear();
27382 self
27383 }
27384}
27385
27386/// Fetches a set of static IP addresses that need to be allowlisted by the customer when using the static-IP connectivity method.
27387///
27388/// A builder for the *locations.fetchStaticIps* method supported by a *project* resource.
27389/// It is not used directly, but through a [`ProjectMethods`] instance.
27390///
27391/// # Example
27392///
27393/// Instantiate a resource method builder
27394///
27395/// ```test_harness,no_run
27396/// # extern crate hyper;
27397/// # extern crate hyper_rustls;
27398/// # extern crate google_datamigration1 as datamigration1;
27399/// # async fn dox() {
27400/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27401///
27402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27403/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27404/// # .with_native_roots()
27405/// # .unwrap()
27406/// # .https_only()
27407/// # .enable_http2()
27408/// # .build();
27409///
27410/// # let executor = hyper_util::rt::TokioExecutor::new();
27411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27412/// # secret,
27413/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27414/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27415/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27416/// # ),
27417/// # ).build().await.unwrap();
27418///
27419/// # let client = hyper_util::client::legacy::Client::builder(
27420/// # hyper_util::rt::TokioExecutor::new()
27421/// # )
27422/// # .build(
27423/// # hyper_rustls::HttpsConnectorBuilder::new()
27424/// # .with_native_roots()
27425/// # .unwrap()
27426/// # .https_or_http()
27427/// # .enable_http2()
27428/// # .build()
27429/// # );
27430/// # let mut hub = DatabaseMigrationService::new(client, auth);
27431/// // You can configure optional parameters by calling the respective setters at will, and
27432/// // execute the final call using `doit()`.
27433/// // Values shown here are possibly random and not representative !
27434/// let result = hub.projects().locations_fetch_static_ips("name")
27435/// .page_token("et")
27436/// .page_size(-77)
27437/// .doit().await;
27438/// # }
27439/// ```
27440pub struct ProjectLocationFetchStaticIpCall<'a, C>
27441where
27442 C: 'a,
27443{
27444 hub: &'a DatabaseMigrationService<C>,
27445 _name: String,
27446 _page_token: Option<String>,
27447 _page_size: Option<i32>,
27448 _delegate: Option<&'a mut dyn common::Delegate>,
27449 _additional_params: HashMap<String, String>,
27450 _scopes: BTreeSet<String>,
27451}
27452
27453impl<'a, C> common::CallBuilder for ProjectLocationFetchStaticIpCall<'a, C> {}
27454
27455impl<'a, C> ProjectLocationFetchStaticIpCall<'a, C>
27456where
27457 C: common::Connector,
27458{
27459 /// Perform the operation you have build so far.
27460 pub async fn doit(mut self) -> common::Result<(common::Response, FetchStaticIpsResponse)> {
27461 use std::borrow::Cow;
27462 use std::io::{Read, Seek};
27463
27464 use common::{url::Params, ToParts};
27465 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27466
27467 let mut dd = common::DefaultDelegate;
27468 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27469 dlg.begin(common::MethodInfo {
27470 id: "datamigration.projects.locations.fetchStaticIps",
27471 http_method: hyper::Method::GET,
27472 });
27473
27474 for &field in ["alt", "name", "pageToken", "pageSize"].iter() {
27475 if self._additional_params.contains_key(field) {
27476 dlg.finished(false);
27477 return Err(common::Error::FieldClash(field));
27478 }
27479 }
27480
27481 let mut params = Params::with_capacity(5 + self._additional_params.len());
27482 params.push("name", self._name);
27483 if let Some(value) = self._page_token.as_ref() {
27484 params.push("pageToken", value);
27485 }
27486 if let Some(value) = self._page_size.as_ref() {
27487 params.push("pageSize", value.to_string());
27488 }
27489
27490 params.extend(self._additional_params.iter());
27491
27492 params.push("alt", "json");
27493 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchStaticIps";
27494 if self._scopes.is_empty() {
27495 self._scopes
27496 .insert(Scope::CloudPlatform.as_ref().to_string());
27497 }
27498
27499 #[allow(clippy::single_element_loop)]
27500 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27501 url = params.uri_replacement(url, param_name, find_this, true);
27502 }
27503 {
27504 let to_remove = ["name"];
27505 params.remove_params(&to_remove);
27506 }
27507
27508 let url = params.parse_with_url(&url);
27509
27510 loop {
27511 let token = match self
27512 .hub
27513 .auth
27514 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27515 .await
27516 {
27517 Ok(token) => token,
27518 Err(e) => match dlg.token(e) {
27519 Ok(token) => token,
27520 Err(e) => {
27521 dlg.finished(false);
27522 return Err(common::Error::MissingToken(e));
27523 }
27524 },
27525 };
27526 let mut req_result = {
27527 let client = &self.hub.client;
27528 dlg.pre_request();
27529 let mut req_builder = hyper::Request::builder()
27530 .method(hyper::Method::GET)
27531 .uri(url.as_str())
27532 .header(USER_AGENT, self.hub._user_agent.clone());
27533
27534 if let Some(token) = token.as_ref() {
27535 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27536 }
27537
27538 let request = req_builder
27539 .header(CONTENT_LENGTH, 0_u64)
27540 .body(common::to_body::<String>(None));
27541
27542 client.request(request.unwrap()).await
27543 };
27544
27545 match req_result {
27546 Err(err) => {
27547 if let common::Retry::After(d) = dlg.http_error(&err) {
27548 sleep(d).await;
27549 continue;
27550 }
27551 dlg.finished(false);
27552 return Err(common::Error::HttpError(err));
27553 }
27554 Ok(res) => {
27555 let (mut parts, body) = res.into_parts();
27556 let mut body = common::Body::new(body);
27557 if !parts.status.is_success() {
27558 let bytes = common::to_bytes(body).await.unwrap_or_default();
27559 let error = serde_json::from_str(&common::to_string(&bytes));
27560 let response = common::to_response(parts, bytes.into());
27561
27562 if let common::Retry::After(d) =
27563 dlg.http_failure(&response, error.as_ref().ok())
27564 {
27565 sleep(d).await;
27566 continue;
27567 }
27568
27569 dlg.finished(false);
27570
27571 return Err(match error {
27572 Ok(value) => common::Error::BadRequest(value),
27573 _ => common::Error::Failure(response),
27574 });
27575 }
27576 let response = {
27577 let bytes = common::to_bytes(body).await.unwrap_or_default();
27578 let encoded = common::to_string(&bytes);
27579 match serde_json::from_str(&encoded) {
27580 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27581 Err(error) => {
27582 dlg.response_json_decode_error(&encoded, &error);
27583 return Err(common::Error::JsonDecodeError(
27584 encoded.to_string(),
27585 error,
27586 ));
27587 }
27588 }
27589 };
27590
27591 dlg.finished(true);
27592 return Ok(response);
27593 }
27594 }
27595 }
27596 }
27597
27598 /// Required. The resource name for the location for which static IPs should be returned. Must be in the format `projects/*/locations/*`.
27599 ///
27600 /// Sets the *name* path property to the given value.
27601 ///
27602 /// Even though the property as already been set when instantiating this call,
27603 /// we provide this method for API completeness.
27604 pub fn name(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
27605 self._name = new_value.to_string();
27606 self
27607 }
27608 /// A page token, received from a previous `FetchStaticIps` call.
27609 ///
27610 /// Sets the *page token* query property to the given value.
27611 pub fn page_token(mut self, new_value: &str) -> ProjectLocationFetchStaticIpCall<'a, C> {
27612 self._page_token = Some(new_value.to_string());
27613 self
27614 }
27615 /// Maximum number of IPs to return.
27616 ///
27617 /// Sets the *page size* query property to the given value.
27618 pub fn page_size(mut self, new_value: i32) -> ProjectLocationFetchStaticIpCall<'a, C> {
27619 self._page_size = Some(new_value);
27620 self
27621 }
27622 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27623 /// while executing the actual API request.
27624 ///
27625 /// ````text
27626 /// It should be used to handle progress information, and to implement a certain level of resilience.
27627 /// ````
27628 ///
27629 /// Sets the *delegate* property to the given value.
27630 pub fn delegate(
27631 mut self,
27632 new_value: &'a mut dyn common::Delegate,
27633 ) -> ProjectLocationFetchStaticIpCall<'a, C> {
27634 self._delegate = Some(new_value);
27635 self
27636 }
27637
27638 /// Set any additional parameter of the query string used in the request.
27639 /// It should be used to set parameters which are not yet available through their own
27640 /// setters.
27641 ///
27642 /// Please note that this method must not be used to set any of the known parameters
27643 /// which have their own setter method. If done anyway, the request will fail.
27644 ///
27645 /// # Additional Parameters
27646 ///
27647 /// * *$.xgafv* (query-string) - V1 error format.
27648 /// * *access_token* (query-string) - OAuth access token.
27649 /// * *alt* (query-string) - Data format for response.
27650 /// * *callback* (query-string) - JSONP
27651 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27652 /// * *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.
27653 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27654 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27655 /// * *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.
27656 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27657 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27658 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationFetchStaticIpCall<'a, C>
27659 where
27660 T: AsRef<str>,
27661 {
27662 self._additional_params
27663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27664 self
27665 }
27666
27667 /// Identifies the authorization scope for the method you are building.
27668 ///
27669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27670 /// [`Scope::CloudPlatform`].
27671 ///
27672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27673 /// tokens for more than one scope.
27674 ///
27675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27677 /// sufficient, a read-write scope will do as well.
27678 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationFetchStaticIpCall<'a, C>
27679 where
27680 St: AsRef<str>,
27681 {
27682 self._scopes.insert(String::from(scope.as_ref()));
27683 self
27684 }
27685 /// Identifies the authorization scope(s) for the method you are building.
27686 ///
27687 /// See [`Self::add_scope()`] for details.
27688 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationFetchStaticIpCall<'a, C>
27689 where
27690 I: IntoIterator<Item = St>,
27691 St: AsRef<str>,
27692 {
27693 self._scopes
27694 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27695 self
27696 }
27697
27698 /// Removes all scopes, and no default scope will be used either.
27699 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27700 /// for details).
27701 pub fn clear_scopes(mut self) -> ProjectLocationFetchStaticIpCall<'a, C> {
27702 self._scopes.clear();
27703 self
27704 }
27705}
27706
27707/// Gets information about a location.
27708///
27709/// A builder for the *locations.get* method supported by a *project* resource.
27710/// It is not used directly, but through a [`ProjectMethods`] instance.
27711///
27712/// # Example
27713///
27714/// Instantiate a resource method builder
27715///
27716/// ```test_harness,no_run
27717/// # extern crate hyper;
27718/// # extern crate hyper_rustls;
27719/// # extern crate google_datamigration1 as datamigration1;
27720/// # async fn dox() {
27721/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27722///
27723/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27724/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27725/// # .with_native_roots()
27726/// # .unwrap()
27727/// # .https_only()
27728/// # .enable_http2()
27729/// # .build();
27730///
27731/// # let executor = hyper_util::rt::TokioExecutor::new();
27732/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27733/// # secret,
27734/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27735/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27736/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27737/// # ),
27738/// # ).build().await.unwrap();
27739///
27740/// # let client = hyper_util::client::legacy::Client::builder(
27741/// # hyper_util::rt::TokioExecutor::new()
27742/// # )
27743/// # .build(
27744/// # hyper_rustls::HttpsConnectorBuilder::new()
27745/// # .with_native_roots()
27746/// # .unwrap()
27747/// # .https_or_http()
27748/// # .enable_http2()
27749/// # .build()
27750/// # );
27751/// # let mut hub = DatabaseMigrationService::new(client, auth);
27752/// // You can configure optional parameters by calling the respective setters at will, and
27753/// // execute the final call using `doit()`.
27754/// // Values shown here are possibly random and not representative !
27755/// let result = hub.projects().locations_get("name")
27756/// .doit().await;
27757/// # }
27758/// ```
27759pub struct ProjectLocationGetCall<'a, C>
27760where
27761 C: 'a,
27762{
27763 hub: &'a DatabaseMigrationService<C>,
27764 _name: String,
27765 _delegate: Option<&'a mut dyn common::Delegate>,
27766 _additional_params: HashMap<String, String>,
27767 _scopes: BTreeSet<String>,
27768}
27769
27770impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
27771
27772impl<'a, C> ProjectLocationGetCall<'a, C>
27773where
27774 C: common::Connector,
27775{
27776 /// Perform the operation you have build so far.
27777 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
27778 use std::borrow::Cow;
27779 use std::io::{Read, Seek};
27780
27781 use common::{url::Params, ToParts};
27782 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27783
27784 let mut dd = common::DefaultDelegate;
27785 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27786 dlg.begin(common::MethodInfo {
27787 id: "datamigration.projects.locations.get",
27788 http_method: hyper::Method::GET,
27789 });
27790
27791 for &field in ["alt", "name"].iter() {
27792 if self._additional_params.contains_key(field) {
27793 dlg.finished(false);
27794 return Err(common::Error::FieldClash(field));
27795 }
27796 }
27797
27798 let mut params = Params::with_capacity(3 + self._additional_params.len());
27799 params.push("name", self._name);
27800
27801 params.extend(self._additional_params.iter());
27802
27803 params.push("alt", "json");
27804 let mut url = self.hub._base_url.clone() + "v1/{+name}";
27805 if self._scopes.is_empty() {
27806 self._scopes
27807 .insert(Scope::CloudPlatform.as_ref().to_string());
27808 }
27809
27810 #[allow(clippy::single_element_loop)]
27811 for &(find_this, param_name) in [("{+name}", "name")].iter() {
27812 url = params.uri_replacement(url, param_name, find_this, true);
27813 }
27814 {
27815 let to_remove = ["name"];
27816 params.remove_params(&to_remove);
27817 }
27818
27819 let url = params.parse_with_url(&url);
27820
27821 loop {
27822 let token = match self
27823 .hub
27824 .auth
27825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27826 .await
27827 {
27828 Ok(token) => token,
27829 Err(e) => match dlg.token(e) {
27830 Ok(token) => token,
27831 Err(e) => {
27832 dlg.finished(false);
27833 return Err(common::Error::MissingToken(e));
27834 }
27835 },
27836 };
27837 let mut req_result = {
27838 let client = &self.hub.client;
27839 dlg.pre_request();
27840 let mut req_builder = hyper::Request::builder()
27841 .method(hyper::Method::GET)
27842 .uri(url.as_str())
27843 .header(USER_AGENT, self.hub._user_agent.clone());
27844
27845 if let Some(token) = token.as_ref() {
27846 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27847 }
27848
27849 let request = req_builder
27850 .header(CONTENT_LENGTH, 0_u64)
27851 .body(common::to_body::<String>(None));
27852
27853 client.request(request.unwrap()).await
27854 };
27855
27856 match req_result {
27857 Err(err) => {
27858 if let common::Retry::After(d) = dlg.http_error(&err) {
27859 sleep(d).await;
27860 continue;
27861 }
27862 dlg.finished(false);
27863 return Err(common::Error::HttpError(err));
27864 }
27865 Ok(res) => {
27866 let (mut parts, body) = res.into_parts();
27867 let mut body = common::Body::new(body);
27868 if !parts.status.is_success() {
27869 let bytes = common::to_bytes(body).await.unwrap_or_default();
27870 let error = serde_json::from_str(&common::to_string(&bytes));
27871 let response = common::to_response(parts, bytes.into());
27872
27873 if let common::Retry::After(d) =
27874 dlg.http_failure(&response, error.as_ref().ok())
27875 {
27876 sleep(d).await;
27877 continue;
27878 }
27879
27880 dlg.finished(false);
27881
27882 return Err(match error {
27883 Ok(value) => common::Error::BadRequest(value),
27884 _ => common::Error::Failure(response),
27885 });
27886 }
27887 let response = {
27888 let bytes = common::to_bytes(body).await.unwrap_or_default();
27889 let encoded = common::to_string(&bytes);
27890 match serde_json::from_str(&encoded) {
27891 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27892 Err(error) => {
27893 dlg.response_json_decode_error(&encoded, &error);
27894 return Err(common::Error::JsonDecodeError(
27895 encoded.to_string(),
27896 error,
27897 ));
27898 }
27899 }
27900 };
27901
27902 dlg.finished(true);
27903 return Ok(response);
27904 }
27905 }
27906 }
27907 }
27908
27909 /// Resource name for the location.
27910 ///
27911 /// Sets the *name* path property to the given value.
27912 ///
27913 /// Even though the property as already been set when instantiating this call,
27914 /// we provide this method for API completeness.
27915 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
27916 self._name = new_value.to_string();
27917 self
27918 }
27919 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27920 /// while executing the actual API request.
27921 ///
27922 /// ````text
27923 /// It should be used to handle progress information, and to implement a certain level of resilience.
27924 /// ````
27925 ///
27926 /// Sets the *delegate* property to the given value.
27927 pub fn delegate(
27928 mut self,
27929 new_value: &'a mut dyn common::Delegate,
27930 ) -> ProjectLocationGetCall<'a, C> {
27931 self._delegate = Some(new_value);
27932 self
27933 }
27934
27935 /// Set any additional parameter of the query string used in the request.
27936 /// It should be used to set parameters which are not yet available through their own
27937 /// setters.
27938 ///
27939 /// Please note that this method must not be used to set any of the known parameters
27940 /// which have their own setter method. If done anyway, the request will fail.
27941 ///
27942 /// # Additional Parameters
27943 ///
27944 /// * *$.xgafv* (query-string) - V1 error format.
27945 /// * *access_token* (query-string) - OAuth access token.
27946 /// * *alt* (query-string) - Data format for response.
27947 /// * *callback* (query-string) - JSONP
27948 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27949 /// * *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.
27950 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27951 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27952 /// * *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.
27953 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27954 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27955 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
27956 where
27957 T: AsRef<str>,
27958 {
27959 self._additional_params
27960 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27961 self
27962 }
27963
27964 /// Identifies the authorization scope for the method you are building.
27965 ///
27966 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27967 /// [`Scope::CloudPlatform`].
27968 ///
27969 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27970 /// tokens for more than one scope.
27971 ///
27972 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27973 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27974 /// sufficient, a read-write scope will do as well.
27975 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
27976 where
27977 St: AsRef<str>,
27978 {
27979 self._scopes.insert(String::from(scope.as_ref()));
27980 self
27981 }
27982 /// Identifies the authorization scope(s) for the method you are building.
27983 ///
27984 /// See [`Self::add_scope()`] for details.
27985 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
27986 where
27987 I: IntoIterator<Item = St>,
27988 St: AsRef<str>,
27989 {
27990 self._scopes
27991 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27992 self
27993 }
27994
27995 /// Removes all scopes, and no default scope will be used either.
27996 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27997 /// for details).
27998 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
27999 self._scopes.clear();
28000 self
28001 }
28002}
28003
28004/// Lists information about the supported locations for this service.
28005///
28006/// A builder for the *locations.list* method supported by a *project* resource.
28007/// It is not used directly, but through a [`ProjectMethods`] instance.
28008///
28009/// # Example
28010///
28011/// Instantiate a resource method builder
28012///
28013/// ```test_harness,no_run
28014/// # extern crate hyper;
28015/// # extern crate hyper_rustls;
28016/// # extern crate google_datamigration1 as datamigration1;
28017/// # async fn dox() {
28018/// # use datamigration1::{DatabaseMigrationService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28019///
28020/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28021/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28022/// # .with_native_roots()
28023/// # .unwrap()
28024/// # .https_only()
28025/// # .enable_http2()
28026/// # .build();
28027///
28028/// # let executor = hyper_util::rt::TokioExecutor::new();
28029/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28030/// # secret,
28031/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28032/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28033/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28034/// # ),
28035/// # ).build().await.unwrap();
28036///
28037/// # let client = hyper_util::client::legacy::Client::builder(
28038/// # hyper_util::rt::TokioExecutor::new()
28039/// # )
28040/// # .build(
28041/// # hyper_rustls::HttpsConnectorBuilder::new()
28042/// # .with_native_roots()
28043/// # .unwrap()
28044/// # .https_or_http()
28045/// # .enable_http2()
28046/// # .build()
28047/// # );
28048/// # let mut hub = DatabaseMigrationService::new(client, auth);
28049/// // You can configure optional parameters by calling the respective setters at will, and
28050/// // execute the final call using `doit()`.
28051/// // Values shown here are possibly random and not representative !
28052/// let result = hub.projects().locations_list("name")
28053/// .page_token("sit")
28054/// .page_size(-81)
28055/// .filter("sea")
28056/// .add_extra_location_types("nonumy")
28057/// .doit().await;
28058/// # }
28059/// ```
28060pub struct ProjectLocationListCall<'a, C>
28061where
28062 C: 'a,
28063{
28064 hub: &'a DatabaseMigrationService<C>,
28065 _name: String,
28066 _page_token: Option<String>,
28067 _page_size: Option<i32>,
28068 _filter: Option<String>,
28069 _extra_location_types: Vec<String>,
28070 _delegate: Option<&'a mut dyn common::Delegate>,
28071 _additional_params: HashMap<String, String>,
28072 _scopes: BTreeSet<String>,
28073}
28074
28075impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
28076
28077impl<'a, C> ProjectLocationListCall<'a, C>
28078where
28079 C: common::Connector,
28080{
28081 /// Perform the operation you have build so far.
28082 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
28083 use std::borrow::Cow;
28084 use std::io::{Read, Seek};
28085
28086 use common::{url::Params, ToParts};
28087 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28088
28089 let mut dd = common::DefaultDelegate;
28090 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28091 dlg.begin(common::MethodInfo {
28092 id: "datamigration.projects.locations.list",
28093 http_method: hyper::Method::GET,
28094 });
28095
28096 for &field in [
28097 "alt",
28098 "name",
28099 "pageToken",
28100 "pageSize",
28101 "filter",
28102 "extraLocationTypes",
28103 ]
28104 .iter()
28105 {
28106 if self._additional_params.contains_key(field) {
28107 dlg.finished(false);
28108 return Err(common::Error::FieldClash(field));
28109 }
28110 }
28111
28112 let mut params = Params::with_capacity(7 + self._additional_params.len());
28113 params.push("name", self._name);
28114 if let Some(value) = self._page_token.as_ref() {
28115 params.push("pageToken", value);
28116 }
28117 if let Some(value) = self._page_size.as_ref() {
28118 params.push("pageSize", value.to_string());
28119 }
28120 if let Some(value) = self._filter.as_ref() {
28121 params.push("filter", value);
28122 }
28123 if !self._extra_location_types.is_empty() {
28124 for f in self._extra_location_types.iter() {
28125 params.push("extraLocationTypes", f);
28126 }
28127 }
28128
28129 params.extend(self._additional_params.iter());
28130
28131 params.push("alt", "json");
28132 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
28133 if self._scopes.is_empty() {
28134 self._scopes
28135 .insert(Scope::CloudPlatform.as_ref().to_string());
28136 }
28137
28138 #[allow(clippy::single_element_loop)]
28139 for &(find_this, param_name) in [("{+name}", "name")].iter() {
28140 url = params.uri_replacement(url, param_name, find_this, true);
28141 }
28142 {
28143 let to_remove = ["name"];
28144 params.remove_params(&to_remove);
28145 }
28146
28147 let url = params.parse_with_url(&url);
28148
28149 loop {
28150 let token = match self
28151 .hub
28152 .auth
28153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28154 .await
28155 {
28156 Ok(token) => token,
28157 Err(e) => match dlg.token(e) {
28158 Ok(token) => token,
28159 Err(e) => {
28160 dlg.finished(false);
28161 return Err(common::Error::MissingToken(e));
28162 }
28163 },
28164 };
28165 let mut req_result = {
28166 let client = &self.hub.client;
28167 dlg.pre_request();
28168 let mut req_builder = hyper::Request::builder()
28169 .method(hyper::Method::GET)
28170 .uri(url.as_str())
28171 .header(USER_AGENT, self.hub._user_agent.clone());
28172
28173 if let Some(token) = token.as_ref() {
28174 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28175 }
28176
28177 let request = req_builder
28178 .header(CONTENT_LENGTH, 0_u64)
28179 .body(common::to_body::<String>(None));
28180
28181 client.request(request.unwrap()).await
28182 };
28183
28184 match req_result {
28185 Err(err) => {
28186 if let common::Retry::After(d) = dlg.http_error(&err) {
28187 sleep(d).await;
28188 continue;
28189 }
28190 dlg.finished(false);
28191 return Err(common::Error::HttpError(err));
28192 }
28193 Ok(res) => {
28194 let (mut parts, body) = res.into_parts();
28195 let mut body = common::Body::new(body);
28196 if !parts.status.is_success() {
28197 let bytes = common::to_bytes(body).await.unwrap_or_default();
28198 let error = serde_json::from_str(&common::to_string(&bytes));
28199 let response = common::to_response(parts, bytes.into());
28200
28201 if let common::Retry::After(d) =
28202 dlg.http_failure(&response, error.as_ref().ok())
28203 {
28204 sleep(d).await;
28205 continue;
28206 }
28207
28208 dlg.finished(false);
28209
28210 return Err(match error {
28211 Ok(value) => common::Error::BadRequest(value),
28212 _ => common::Error::Failure(response),
28213 });
28214 }
28215 let response = {
28216 let bytes = common::to_bytes(body).await.unwrap_or_default();
28217 let encoded = common::to_string(&bytes);
28218 match serde_json::from_str(&encoded) {
28219 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28220 Err(error) => {
28221 dlg.response_json_decode_error(&encoded, &error);
28222 return Err(common::Error::JsonDecodeError(
28223 encoded.to_string(),
28224 error,
28225 ));
28226 }
28227 }
28228 };
28229
28230 dlg.finished(true);
28231 return Ok(response);
28232 }
28233 }
28234 }
28235 }
28236
28237 /// The resource that owns the locations collection, if applicable.
28238 ///
28239 /// Sets the *name* path property to the given value.
28240 ///
28241 /// Even though the property as already been set when instantiating this call,
28242 /// we provide this method for API completeness.
28243 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
28244 self._name = new_value.to_string();
28245 self
28246 }
28247 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
28248 ///
28249 /// Sets the *page token* query property to the given value.
28250 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
28251 self._page_token = Some(new_value.to_string());
28252 self
28253 }
28254 /// The maximum number of results to return. If not set, the service selects a default.
28255 ///
28256 /// Sets the *page size* query property to the given value.
28257 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
28258 self._page_size = Some(new_value);
28259 self
28260 }
28261 /// 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).
28262 ///
28263 /// Sets the *filter* query property to the given value.
28264 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
28265 self._filter = Some(new_value.to_string());
28266 self
28267 }
28268 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
28269 ///
28270 /// Append the given value to the *extra location types* query property.
28271 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
28272 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
28273 self._extra_location_types.push(new_value.to_string());
28274 self
28275 }
28276 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28277 /// while executing the actual API request.
28278 ///
28279 /// ````text
28280 /// It should be used to handle progress information, and to implement a certain level of resilience.
28281 /// ````
28282 ///
28283 /// Sets the *delegate* property to the given value.
28284 pub fn delegate(
28285 mut self,
28286 new_value: &'a mut dyn common::Delegate,
28287 ) -> ProjectLocationListCall<'a, C> {
28288 self._delegate = Some(new_value);
28289 self
28290 }
28291
28292 /// Set any additional parameter of the query string used in the request.
28293 /// It should be used to set parameters which are not yet available through their own
28294 /// setters.
28295 ///
28296 /// Please note that this method must not be used to set any of the known parameters
28297 /// which have their own setter method. If done anyway, the request will fail.
28298 ///
28299 /// # Additional Parameters
28300 ///
28301 /// * *$.xgafv* (query-string) - V1 error format.
28302 /// * *access_token* (query-string) - OAuth access token.
28303 /// * *alt* (query-string) - Data format for response.
28304 /// * *callback* (query-string) - JSONP
28305 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28306 /// * *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.
28307 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28308 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28309 /// * *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.
28310 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28311 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28312 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
28313 where
28314 T: AsRef<str>,
28315 {
28316 self._additional_params
28317 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28318 self
28319 }
28320
28321 /// Identifies the authorization scope for the method you are building.
28322 ///
28323 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28324 /// [`Scope::CloudPlatform`].
28325 ///
28326 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28327 /// tokens for more than one scope.
28328 ///
28329 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28330 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28331 /// sufficient, a read-write scope will do as well.
28332 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
28333 where
28334 St: AsRef<str>,
28335 {
28336 self._scopes.insert(String::from(scope.as_ref()));
28337 self
28338 }
28339 /// Identifies the authorization scope(s) for the method you are building.
28340 ///
28341 /// See [`Self::add_scope()`] for details.
28342 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
28343 where
28344 I: IntoIterator<Item = St>,
28345 St: AsRef<str>,
28346 {
28347 self._scopes
28348 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28349 self
28350 }
28351
28352 /// Removes all scopes, and no default scope will be used either.
28353 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28354 /// for details).
28355 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
28356 self._scopes.clear();
28357 self
28358 }
28359}