google_datafusion1/
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 DataFusion 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_datafusion1 as datafusion1;
49/// use datafusion1::api::Instance;
50/// use datafusion1::{Result, Error};
51/// # async fn dox() {
52/// use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = DataFusion::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Instance::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_instances_create(req, "parent")
88///              .instance_id("At")
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct DataFusion<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for DataFusion<C> {}
120
121impl<'a, C> DataFusion<C> {
122    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> DataFusion<C> {
123        DataFusion {
124            client,
125            auth: Box::new(auth),
126            _user_agent: "google-api-rust-client/6.0.0".to_string(),
127            _base_url: "https://datafusion.googleapis.com/".to_string(),
128            _root_url: "https://datafusion.googleapis.com/".to_string(),
129        }
130    }
131
132    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
133        ProjectMethods { hub: self }
134    }
135
136    /// Set the user-agent header field to use in all requests to the server.
137    /// It defaults to `google-api-rust-client/6.0.0`.
138    ///
139    /// Returns the previously set user-agent.
140    pub fn user_agent(&mut self, agent_name: String) -> String {
141        std::mem::replace(&mut self._user_agent, agent_name)
142    }
143
144    /// Set the base url to use in all requests to the server.
145    /// It defaults to `https://datafusion.googleapis.com/`.
146    ///
147    /// Returns the previously set base url.
148    pub fn base_url(&mut self, new_base_url: String) -> String {
149        std::mem::replace(&mut self._base_url, new_base_url)
150    }
151
152    /// Set the root url to use in all requests to the server.
153    /// It defaults to `https://datafusion.googleapis.com/`.
154    ///
155    /// Returns the previously set root url.
156    pub fn root_url(&mut self, new_root_url: String) -> String {
157        std::mem::replace(&mut self._root_url, new_root_url)
158    }
159}
160
161// ############
162// SCHEMAS ###
163// ##########
164/// Identifies Data Fusion accelerators for an instance.
165///
166/// This type is not used in any activity, and only used as *part* of another schema.
167///
168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
169#[serde_with::serde_as]
170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
171pub struct Accelerator {
172    /// Optional. The type of an accelator for a Cloud Data Fusion instance.
173    #[serde(rename = "acceleratorType")]
174    pub accelerator_type: Option<String>,
175    /// Output only. The state of the accelerator.
176    pub state: Option<String>,
177}
178
179impl common::Part for Accelerator {}
180
181/// 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.
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 AuditConfig {
189    /// The configuration for logging of each type of permission.
190    #[serde(rename = "auditLogConfigs")]
191    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
192    /// 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.
193    pub service: Option<String>,
194}
195
196impl common::Part for AuditConfig {}
197
198/// 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.
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 AuditLogConfig {
206    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
207    #[serde(rename = "exemptedMembers")]
208    pub exempted_members: Option<Vec<String>>,
209    /// The log type that this config enables.
210    #[serde(rename = "logType")]
211    pub log_type: Option<String>,
212}
213
214impl common::Part for AuditLogConfig {}
215
216/// Associates `members`, or principals, with a `role`.
217///
218/// This type is not used in any activity, and only used as *part* of another schema.
219///
220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
221#[serde_with::serde_as]
222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
223pub struct Binding {
224    /// 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).
225    pub condition: Option<Expr>,
226    /// 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`.
227    pub members: Option<Vec<String>>,
228    /// 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).
229    pub role: Option<String>,
230}
231
232impl common::Part for Binding {}
233
234/// The request message for Operations.CancelOperation.
235///
236/// # Activities
237///
238/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
239/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
240///
241/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
243#[serde_with::serde_as]
244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
245pub struct CancelOperationRequest {
246    _never_set: Option<bool>,
247}
248
249impl common::RequestValue for CancelOperationRequest {}
250
251/// The crypto key configuration. This field is used by the Customer-managed encryption keys (CMEK) feature.
252///
253/// This type is not used in any activity, and only used as *part* of another schema.
254///
255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
256#[serde_with::serde_as]
257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
258pub struct CryptoKeyConfig {
259    /// The name of the key which is used to encrypt/decrypt customer data. For key in Cloud KMS, the key should be in the format of `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
260    #[serde(rename = "keyReference")]
261    pub key_reference: Option<String>,
262}
263
264impl common::Part for CryptoKeyConfig {}
265
266/// DNS peering configuration. These configurations are used to create DNS peering with the customer Cloud DNS.
267///
268/// # Activities
269///
270/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
271/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
272///
273/// * [locations instances dns peerings create projects](ProjectLocationInstanceDnsPeeringCreateCall) (request|response)
274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
275#[serde_with::serde_as]
276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
277pub struct DnsPeering {
278    /// Optional. Optional description of the dns zone.
279    pub description: Option<String>,
280    /// Required. The dns name suffix of the zone.
281    pub domain: Option<String>,
282    /// Required. The resource name of the dns peering zone. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
283    pub name: Option<String>,
284    /// Optional. Optional target network to which dns peering should happen.
285    #[serde(rename = "targetNetwork")]
286    pub target_network: Option<String>,
287    /// Optional. Optional target project to which dns peering should happen.
288    #[serde(rename = "targetProject")]
289    pub target_project: Option<String>,
290}
291
292impl common::RequestValue for DnsPeering {}
293impl common::ResponseResult for DnsPeering {}
294
295/// 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); }
296///
297/// # Activities
298///
299/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
300/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
301///
302/// * [locations instances dns peerings delete projects](ProjectLocationInstanceDnsPeeringDeleteCall) (response)
303/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
304/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
306#[serde_with::serde_as]
307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
308pub struct Empty {
309    _never_set: Option<bool>,
310}
311
312impl common::ResponseResult for Empty {}
313
314/// Confirguration of PubSubEventWriter.
315///
316/// This type is not used in any activity, and only used as *part* of another schema.
317///
318#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
319#[serde_with::serde_as]
320#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
321pub struct EventPublishConfig {
322    /// Required. Option to enable Event Publishing.
323    pub enabled: Option<bool>,
324    /// Required. The resource name of the Pub/Sub topic. Format: projects/{project_id}/topics/{topic_id}
325    pub topic: Option<String>,
326}
327
328impl common::Part for EventPublishConfig {}
329
330/// 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.
331///
332/// This type is not used in any activity, and only used as *part* of another schema.
333///
334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
335#[serde_with::serde_as]
336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
337pub struct Expr {
338    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
339    pub description: Option<String>,
340    /// Textual representation of an expression in Common Expression Language syntax.
341    pub expression: Option<String>,
342    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
343    pub location: Option<String>,
344    /// 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.
345    pub title: Option<String>,
346}
347
348impl common::Part for Expr {}
349
350/// Represents a Data Fusion instance.
351///
352/// # Activities
353///
354/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
355/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
356///
357/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
358/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
359/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
361#[serde_with::serde_as]
362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
363pub struct Instance {
364    /// Output only. List of accelerators enabled for this CDF instance.
365    pub accelerators: Option<Vec<Accelerator>>,
366    /// Output only. Endpoint on which the REST APIs is accessible.
367    #[serde(rename = "apiEndpoint")]
368    pub api_endpoint: Option<String>,
369    /// Output only. Available versions that the instance can be upgraded to using UpdateInstanceRequest.
370    #[serde(rename = "availableVersion")]
371    pub available_version: Option<Vec<Version>>,
372    /// Output only. The time the instance was created.
373    #[serde(rename = "createTime")]
374    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
375    /// The crypto key configuration. This field is used by the Customer-Managed Encryption Keys (CMEK) feature.
376    #[serde(rename = "cryptoKeyConfig")]
377    pub crypto_key_config: Option<CryptoKeyConfig>,
378    /// Optional. Option to enable the Dataplex Lineage Integration feature.
379    #[serde(rename = "dataplexDataLineageIntegrationEnabled")]
380    pub dataplex_data_lineage_integration_enabled: Option<bool>,
381    /// User-managed service account to set on Dataproc when Cloud Data Fusion creates Dataproc to run data processing pipelines. This allows users to have fine-grained access control on Dataproc's accesses to cloud resources.
382    #[serde(rename = "dataprocServiceAccount")]
383    pub dataproc_service_account: Option<String>,
384    /// A description of this instance.
385    pub description: Option<String>,
386    /// Output only. If the instance state is DISABLED, the reason for disabling the instance.
387    #[serde(rename = "disabledReason")]
388    pub disabled_reason: Option<Vec<String>>,
389    /// Display name for an instance.
390    #[serde(rename = "displayName")]
391    pub display_name: Option<String>,
392    /// Option to enable granular role-based access control.
393    #[serde(rename = "enableRbac")]
394    pub enable_rbac: Option<bool>,
395    /// Option to enable Stackdriver Logging.
396    #[serde(rename = "enableStackdriverLogging")]
397    pub enable_stackdriver_logging: Option<bool>,
398    /// Option to enable Stackdriver Monitoring.
399    #[serde(rename = "enableStackdriverMonitoring")]
400    pub enable_stackdriver_monitoring: Option<bool>,
401    /// Option to enable granular zone separation.
402    #[serde(rename = "enableZoneSeparation")]
403    pub enable_zone_separation: Option<bool>,
404    /// Option to enable and pass metadata for event publishing.
405    #[serde(rename = "eventPublishConfig")]
406    pub event_publish_config: Option<EventPublishConfig>,
407    /// Output only. Cloud Storage bucket generated by Data Fusion in the customer project.
408    #[serde(rename = "gcsBucket")]
409    pub gcs_bucket: Option<String>,
410    /// The resource labels for instance to use to annotate any related underlying resources such as Compute Engine VMs. The character '=' is not allowed to be used within the labels.
411    pub labels: Option<HashMap<String, String>>,
412    /// Optional. Configure the maintenance policy for this instance.
413    #[serde(rename = "maintenancePolicy")]
414    pub maintenance_policy: Option<MaintenancePolicy>,
415    /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
416    pub name: Option<String>,
417    /// Network configuration options. These are required when a private Data Fusion instance is to be created.
418    #[serde(rename = "networkConfig")]
419    pub network_config: Option<NetworkConfig>,
420    /// Map of additional options used to configure the behavior of Data Fusion instance.
421    pub options: Option<HashMap<String, String>>,
422    /// Output only. Service agent for the customer project.
423    #[serde(rename = "p4ServiceAccount")]
424    pub p4_service_account: Option<String>,
425    /// Optional. Current patch revision of the Data Fusion.
426    #[serde(rename = "patchRevision")]
427    pub patch_revision: Option<String>,
428    /// Specifies whether the Data Fusion instance should be private. If set to true, all Data Fusion nodes will have private IP addresses and will not be able to access the public internet.
429    #[serde(rename = "privateInstance")]
430    pub private_instance: Option<bool>,
431    /// Output only. Reserved for future use.
432    #[serde(rename = "satisfiesPzs")]
433    pub satisfies_pzs: Option<bool>,
434    /// Output only. Deprecated. Use tenant_project_id instead to extract the tenant project ID.
435    #[serde(rename = "serviceAccount")]
436    pub service_account: Option<String>,
437    /// Output only. Endpoint on which the Data Fusion UI is accessible.
438    #[serde(rename = "serviceEndpoint")]
439    pub service_endpoint: Option<String>,
440    /// Output only. The current state of this Data Fusion instance.
441    pub state: Option<String>,
442    /// Output only. Additional information about the current state of this Data Fusion instance if available.
443    #[serde(rename = "stateMessage")]
444    pub state_message: Option<String>,
445    /// Output only. The name of the tenant project.
446    #[serde(rename = "tenantProjectId")]
447    pub tenant_project_id: Option<String>,
448    /// Required. Instance type.
449    #[serde(rename = "type")]
450    pub type_: Option<String>,
451    /// Output only. The time the instance was last updated.
452    #[serde(rename = "updateTime")]
453    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
454    /// Current version of the Data Fusion. Only specifiable in Update.
455    pub version: Option<String>,
456    /// Output only. Endpoint on which the Data Fusion UI is accessible to third-party users
457    #[serde(rename = "workforceIdentityServiceEndpoint")]
458    pub workforce_identity_service_endpoint: Option<String>,
459    /// Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field.
460    pub zone: Option<String>,
461}
462
463impl common::RequestValue for Instance {}
464impl common::ResponseResult for Instance {}
465
466/// Response message for the list available versions request.
467///
468/// # Activities
469///
470/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
471/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
472///
473/// * [locations versions list projects](ProjectLocationVersionListCall) (response)
474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
475#[serde_with::serde_as]
476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
477pub struct ListAvailableVersionsResponse {
478    /// Represents a list of versions that are supported.
479    #[serde(rename = "availableVersions")]
480    pub available_versions: Option<Vec<Version>>,
481    /// Token to retrieve the next page of results or empty if there are no more results in the list.
482    #[serde(rename = "nextPageToken")]
483    pub next_page_token: Option<String>,
484}
485
486impl common::ResponseResult for ListAvailableVersionsResponse {}
487
488/// Response message for list DNS peerings.
489///
490/// # Activities
491///
492/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
493/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
494///
495/// * [locations instances dns peerings list projects](ProjectLocationInstanceDnsPeeringListCall) (response)
496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
497#[serde_with::serde_as]
498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
499pub struct ListDnsPeeringsResponse {
500    /// List of dns peering.
501    #[serde(rename = "dnsPeerings")]
502    pub dns_peerings: Option<Vec<DnsPeering>>,
503    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
504    #[serde(rename = "nextPageToken")]
505    pub next_page_token: Option<String>,
506}
507
508impl common::ResponseResult for ListDnsPeeringsResponse {}
509
510/// Response message for the list instance request.
511///
512/// # Activities
513///
514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
516///
517/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct ListInstancesResponse {
522    /// Represents a list of Data Fusion instances.
523    pub instances: Option<Vec<Instance>>,
524    /// Token to retrieve the next page of results or empty if there are no more results in the list.
525    #[serde(rename = "nextPageToken")]
526    pub next_page_token: Option<String>,
527    /// Locations that could not be reached.
528    pub unreachable: Option<Vec<String>>,
529}
530
531impl common::ResponseResult for ListInstancesResponse {}
532
533/// The response message for Locations.ListLocations.
534///
535/// # Activities
536///
537/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
538/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
539///
540/// * [locations list projects](ProjectLocationListCall) (response)
541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
542#[serde_with::serde_as]
543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
544pub struct ListLocationsResponse {
545    /// A list of locations that matches the specified filter in the request.
546    pub locations: Option<Vec<Location>>,
547    /// The standard List next-page token.
548    #[serde(rename = "nextPageToken")]
549    pub next_page_token: Option<String>,
550}
551
552impl common::ResponseResult for ListLocationsResponse {}
553
554/// The response message for Operations.ListOperations.
555///
556/// # Activities
557///
558/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
559/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
560///
561/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct ListOperationsResponse {
566    /// The standard List next-page token.
567    #[serde(rename = "nextPageToken")]
568    pub next_page_token: Option<String>,
569    /// A list of operations that matches the specified filter in the request.
570    pub operations: Option<Vec<Operation>>,
571}
572
573impl common::ResponseResult for ListOperationsResponse {}
574
575/// A resource that represents a Google Cloud location.
576///
577/// # Activities
578///
579/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
580/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
581///
582/// * [locations get projects](ProjectLocationGetCall) (response)
583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
584#[serde_with::serde_as]
585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
586pub struct Location {
587    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
588    #[serde(rename = "displayName")]
589    pub display_name: Option<String>,
590    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
591    pub labels: Option<HashMap<String, String>>,
592    /// The canonical id for this location. For example: `"us-east1"`.
593    #[serde(rename = "locationId")]
594    pub location_id: Option<String>,
595    /// Service-specific metadata. For example the available capacity at the given location.
596    pub metadata: Option<HashMap<String, serde_json::Value>>,
597    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
598    pub name: Option<String>,
599}
600
601impl common::ResponseResult for Location {}
602
603/// Maintenance policy of the instance.
604///
605/// This type is not used in any activity, and only used as *part* of another schema.
606///
607#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
608#[serde_with::serde_as]
609#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
610pub struct MaintenancePolicy {
611    /// Optional. The maintenance exclusion window of the instance.
612    #[serde(rename = "maintenanceExclusionWindow")]
613    pub maintenance_exclusion_window: Option<TimeWindow>,
614    /// Optional. The maintenance window of the instance.
615    #[serde(rename = "maintenanceWindow")]
616    pub maintenance_window: Option<MaintenanceWindow>,
617}
618
619impl common::Part for MaintenancePolicy {}
620
621/// Maintenance window of the instance.
622///
623/// This type is not used in any activity, and only used as *part* of another schema.
624///
625#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
626#[serde_with::serde_as]
627#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
628pub struct MaintenanceWindow {
629    /// Required. The recurring time window of the maintenance window.
630    #[serde(rename = "recurringTimeWindow")]
631    pub recurring_time_window: Option<RecurringTimeWindow>,
632}
633
634impl common::Part for MaintenanceWindow {}
635
636/// Network configuration for a Data Fusion instance. These configurations are used for peering with the customer network. Configurations are optional when a public Data Fusion instance is to be created. However, providing these configurations allows several benefits, such as reduced network latency while accessing the customer resources from managed Data Fusion instance nodes, as well as access to the customer on-prem resources.
637///
638/// This type is not used in any activity, and only used as *part* of another schema.
639///
640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
641#[serde_with::serde_as]
642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
643pub struct NetworkConfig {
644    /// Optional. Type of connection for establishing private IP connectivity between the Data Fusion customer project VPC and the corresponding tenant project from a predefined list of available connection modes. If this field is unspecified for a private instance, VPC peering is used.
645    #[serde(rename = "connectionType")]
646    pub connection_type: Option<String>,
647    /// Optional. The IP range in CIDR notation to use for the managed Data Fusion instance nodes. This range must not overlap with any other ranges used in the Data Fusion instance network. This is required only when using connection type VPC_PEERING. Format: a.b.c.d/22 Example: 192.168.0.0/22
648    #[serde(rename = "ipAllocation")]
649    pub ip_allocation: Option<String>,
650    /// Optional. Name of the network in the customer project with which the Tenant Project will be peered for executing pipelines. In case of shared VPC where the network resides in another host project the network should specified in the form of projects/{host-project-id}/global/networks/{network}. This is only required for connectivity type VPC_PEERING.
651    pub network: Option<String>,
652    /// Optional. Configuration for Private Service Connect. This is required only when using connection type PRIVATE_SERVICE_CONNECT_INTERFACES.
653    #[serde(rename = "privateServiceConnectConfig")]
654    pub private_service_connect_config: Option<PrivateServiceConnectConfig>,
655}
656
657impl common::Part for NetworkConfig {}
658
659/// This resource represents a long-running operation that is the result of a network API call.
660///
661/// # Activities
662///
663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
665///
666/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
667/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
668/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
669/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (response)
670/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct Operation {
675    /// 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.
676    pub done: Option<bool>,
677    /// The error result of the operation in case of failure or cancellation.
678    pub error: Option<Status>,
679    /// 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.
680    pub metadata: Option<HashMap<String, serde_json::Value>>,
681    /// 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}`.
682    pub name: Option<String>,
683    /// 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`.
684    pub response: Option<HashMap<String, serde_json::Value>>,
685}
686
687impl common::ResponseResult for Operation {}
688
689/// 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/).
690///
691/// # Activities
692///
693/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
694/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
695///
696/// * [locations instances get iam policy projects](ProjectLocationInstanceGetIamPolicyCall) (response)
697/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (response)
698#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
699#[serde_with::serde_as]
700#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
701pub struct Policy {
702    /// Specifies cloud audit logging configuration for this policy.
703    #[serde(rename = "auditConfigs")]
704    pub audit_configs: Option<Vec<AuditConfig>>,
705    /// 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`.
706    pub bindings: Option<Vec<Binding>>,
707    /// `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.
708    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
709    pub etag: Option<Vec<u8>>,
710    /// 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).
711    pub version: Option<i32>,
712}
713
714impl common::ResponseResult for Policy {}
715
716/// Configuration for using Private Service Connect to establish connectivity between the Data Fusion consumer project and the corresponding tenant project.
717///
718/// This type is not used in any activity, and only used as *part* of another schema.
719///
720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
721#[serde_with::serde_as]
722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
723pub struct PrivateServiceConnectConfig {
724    /// Output only. The CIDR block to which the CDF instance can't route traffic to in the consumer project VPC. The size of this block is /25. The format of this field is governed by RFC 4632. Example: 240.0.0.0/25
725    #[serde(rename = "effectiveUnreachableCidrBlock")]
726    pub effective_unreachable_cidr_block: Option<String>,
727    /// Required. The reference to the network attachment used to establish private connectivity. It will be of the form projects/{project-id}/regions/{region}/networkAttachments/{network-attachment-id}.
728    #[serde(rename = "networkAttachment")]
729    pub network_attachment: Option<String>,
730    /// Optional. Input only. The CIDR block to which the CDF instance can't route traffic to in the consumer project VPC. The size of this block should be at least /25. This range should not overlap with the primary address range of any subnetwork used by the network attachment. This range can be used for other purposes in the consumer VPC as long as there is no requirement for CDF to reach destinations using these addresses. If this value is not provided, the server chooses a non RFC 1918 address range. The format of this field is governed by RFC 4632. Example: 192.168.0.0/25
731    #[serde(rename = "unreachableCidrBlock")]
732    pub unreachable_cidr_block: Option<String>,
733}
734
735impl common::Part for PrivateServiceConnectConfig {}
736
737/// Represents an arbitrary window of time that recurs.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct RecurringTimeWindow {
745    /// Required. An RRULE with format [RFC-5545](https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window reccurs. They go on for the span of time between the start and end time. The only supported FREQ value is "WEEKLY". To have something repeat every weekday, use: "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR". This specifies how frequently the window starts. To have a 9 am - 5 pm UTC-4 window every weekday, use something like: ``` start time = 2019-01-01T09:00:00-0400 end time = 2019-01-01T17:00:00-0400 recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR ```
746    pub recurrence: Option<String>,
747    /// Required. The window representing the start and end time of recurrences. This field ignores the date components of the provided timestamps. Only the time of day and duration between start and end time are relevant.
748    pub window: Option<TimeWindow>,
749}
750
751impl common::Part for RecurringTimeWindow {}
752
753/// Request message for restarting a Data Fusion instance.
754///
755/// # Activities
756///
757/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
758/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
759///
760/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (request)
761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
762#[serde_with::serde_as]
763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
764pub struct RestartInstanceRequest {
765    _never_set: Option<bool>,
766}
767
768impl common::RequestValue for RestartInstanceRequest {}
769
770/// Request message for `SetIamPolicy` method.
771///
772/// # Activities
773///
774/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
775/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
776///
777/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (request)
778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
779#[serde_with::serde_as]
780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
781pub struct SetIamPolicyRequest {
782    /// 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.
783    pub policy: Option<Policy>,
784    /// 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"`
785    #[serde(rename = "updateMask")]
786    pub update_mask: Option<common::FieldMask>,
787}
788
789impl common::RequestValue for SetIamPolicyRequest {}
790
791/// 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).
792///
793/// This type is not used in any activity, and only used as *part* of another schema.
794///
795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
796#[serde_with::serde_as]
797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
798pub struct Status {
799    /// The status code, which should be an enum value of google.rpc.Code.
800    pub code: Option<i32>,
801    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
802    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
803    /// 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.
804    pub message: Option<String>,
805}
806
807impl common::Part for Status {}
808
809/// Request message for `TestIamPermissions` method.
810///
811/// # Activities
812///
813/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
814/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
815///
816/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (request)
817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
818#[serde_with::serde_as]
819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
820pub struct TestIamPermissionsRequest {
821    /// 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).
822    pub permissions: Option<Vec<String>>,
823}
824
825impl common::RequestValue for TestIamPermissionsRequest {}
826
827/// Response message for `TestIamPermissions` method.
828///
829/// # Activities
830///
831/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
832/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
833///
834/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (response)
835#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
836#[serde_with::serde_as]
837#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
838pub struct TestIamPermissionsResponse {
839    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
840    pub permissions: Option<Vec<String>>,
841}
842
843impl common::ResponseResult for TestIamPermissionsResponse {}
844
845/// Represents an arbitrary window of time.
846///
847/// This type is not used in any activity, and only used as *part* of another schema.
848///
849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
850#[serde_with::serde_as]
851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
852pub struct TimeWindow {
853    /// Required. The end time of the time window provided in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. The end time should take place after the start time. Example: "2024-01-02T12:04:06-06:00"
854    #[serde(rename = "endTime")]
855    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
856    /// Required. The start time of the time window provided in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. Example: "2024-01-01T12:04:06-04:00"
857    #[serde(rename = "startTime")]
858    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
859}
860
861impl common::Part for TimeWindow {}
862
863/// The Data Fusion version. This proto message stores information about certain Data Fusion version, which is used for Data Fusion version upgrade.
864///
865/// This type is not used in any activity, and only used as *part* of another schema.
866///
867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
868#[serde_with::serde_as]
869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
870pub struct Version {
871    /// Represents a list of available feature names for a given version.
872    #[serde(rename = "availableFeatures")]
873    pub available_features: Option<Vec<String>>,
874    /// Whether this is currently the default version for Cloud Data Fusion
875    #[serde(rename = "defaultVersion")]
876    pub default_version: Option<bool>,
877    /// Type represents the release availability of the version
878    #[serde(rename = "type")]
879    pub type_: Option<String>,
880    /// The version number of the Data Fusion instance, such as '6.0.1.0'.
881    #[serde(rename = "versionNumber")]
882    pub version_number: Option<String>,
883}
884
885impl common::Part for Version {}
886
887// ###################
888// MethodBuilders ###
889// #################
890
891/// A builder providing access to all methods supported on *project* resources.
892/// It is not used directly, but through the [`DataFusion`] hub.
893///
894/// # Example
895///
896/// Instantiate a resource builder
897///
898/// ```test_harness,no_run
899/// extern crate hyper;
900/// extern crate hyper_rustls;
901/// extern crate google_datafusion1 as datafusion1;
902///
903/// # async fn dox() {
904/// use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
905///
906/// let secret: yup_oauth2::ApplicationSecret = Default::default();
907/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
908///     secret,
909///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
910/// ).build().await.unwrap();
911///
912/// let client = hyper_util::client::legacy::Client::builder(
913///     hyper_util::rt::TokioExecutor::new()
914/// )
915/// .build(
916///     hyper_rustls::HttpsConnectorBuilder::new()
917///         .with_native_roots()
918///         .unwrap()
919///         .https_or_http()
920///         .enable_http1()
921///         .build()
922/// );
923/// let mut hub = DataFusion::new(client, auth);
924/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
925/// // like `locations_get(...)`, `locations_instances_create(...)`, `locations_instances_delete(...)`, `locations_instances_dns_peerings_create(...)`, `locations_instances_dns_peerings_delete(...)`, `locations_instances_dns_peerings_list(...)`, `locations_instances_get(...)`, `locations_instances_get_iam_policy(...)`, `locations_instances_list(...)`, `locations_instances_patch(...)`, `locations_instances_restart(...)`, `locations_instances_set_iam_policy(...)`, `locations_instances_test_iam_permissions(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)` and `locations_versions_list(...)`
926/// // to build up your call.
927/// let rb = hub.projects();
928/// # }
929/// ```
930pub struct ProjectMethods<'a, C>
931where
932    C: 'a,
933{
934    hub: &'a DataFusion<C>,
935}
936
937impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
938
939impl<'a, C> ProjectMethods<'a, C> {
940    /// Create a builder to help you perform the following task:
941    ///
942    /// Creates DNS peering on the given resource.
943    ///
944    /// # Arguments
945    ///
946    /// * `request` - No description provided.
947    /// * `parent` - Required. The resource on which DNS peering will be created.
948    pub fn locations_instances_dns_peerings_create(
949        &self,
950        request: DnsPeering,
951        parent: &str,
952    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
953        ProjectLocationInstanceDnsPeeringCreateCall {
954            hub: self.hub,
955            _request: request,
956            _parent: parent.to_string(),
957            _dns_peering_id: Default::default(),
958            _delegate: Default::default(),
959            _additional_params: Default::default(),
960            _scopes: Default::default(),
961        }
962    }
963
964    /// Create a builder to help you perform the following task:
965    ///
966    /// Deletes DNS peering on the given resource.
967    ///
968    /// # Arguments
969    ///
970    /// * `name` - Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
971    pub fn locations_instances_dns_peerings_delete(
972        &self,
973        name: &str,
974    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
975        ProjectLocationInstanceDnsPeeringDeleteCall {
976            hub: self.hub,
977            _name: name.to_string(),
978            _delegate: Default::default(),
979            _additional_params: Default::default(),
980            _scopes: Default::default(),
981        }
982    }
983
984    /// Create a builder to help you perform the following task:
985    ///
986    /// Lists DNS peerings for a given resource.
987    ///
988    /// # Arguments
989    ///
990    /// * `parent` - Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
991    pub fn locations_instances_dns_peerings_list(
992        &self,
993        parent: &str,
994    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
995        ProjectLocationInstanceDnsPeeringListCall {
996            hub: self.hub,
997            _parent: parent.to_string(),
998            _page_token: Default::default(),
999            _page_size: Default::default(),
1000            _delegate: Default::default(),
1001            _additional_params: Default::default(),
1002            _scopes: Default::default(),
1003        }
1004    }
1005
1006    /// Create a builder to help you perform the following task:
1007    ///
1008    /// Creates a new Data Fusion instance in the specified project and location.
1009    ///
1010    /// # Arguments
1011    ///
1012    /// * `request` - No description provided.
1013    /// * `parent` - Required. The instance's project and location in the format projects/{project}/locations/{location}.
1014    pub fn locations_instances_create(
1015        &self,
1016        request: Instance,
1017        parent: &str,
1018    ) -> ProjectLocationInstanceCreateCall<'a, C> {
1019        ProjectLocationInstanceCreateCall {
1020            hub: self.hub,
1021            _request: request,
1022            _parent: parent.to_string(),
1023            _instance_id: Default::default(),
1024            _delegate: Default::default(),
1025            _additional_params: Default::default(),
1026            _scopes: Default::default(),
1027        }
1028    }
1029
1030    /// Create a builder to help you perform the following task:
1031    ///
1032    /// Deletes a single Date Fusion instance.
1033    ///
1034    /// # Arguments
1035    ///
1036    /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
1037    pub fn locations_instances_delete(
1038        &self,
1039        name: &str,
1040    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
1041        ProjectLocationInstanceDeleteCall {
1042            hub: self.hub,
1043            _name: name.to_string(),
1044            _delegate: Default::default(),
1045            _additional_params: Default::default(),
1046            _scopes: Default::default(),
1047        }
1048    }
1049
1050    /// Create a builder to help you perform the following task:
1051    ///
1052    /// Gets details of a single Data Fusion instance.
1053    ///
1054    /// # Arguments
1055    ///
1056    /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
1057    pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
1058        ProjectLocationInstanceGetCall {
1059            hub: self.hub,
1060            _name: name.to_string(),
1061            _delegate: Default::default(),
1062            _additional_params: Default::default(),
1063            _scopes: Default::default(),
1064        }
1065    }
1066
1067    /// Create a builder to help you perform the following task:
1068    ///
1069    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1070    ///
1071    /// # Arguments
1072    ///
1073    /// * `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.
1074    pub fn locations_instances_get_iam_policy(
1075        &self,
1076        resource: &str,
1077    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
1078        ProjectLocationInstanceGetIamPolicyCall {
1079            hub: self.hub,
1080            _resource: resource.to_string(),
1081            _options_requested_policy_version: Default::default(),
1082            _delegate: Default::default(),
1083            _additional_params: Default::default(),
1084            _scopes: Default::default(),
1085        }
1086    }
1087
1088    /// Create a builder to help you perform the following task:
1089    ///
1090    /// Lists Data Fusion instances in the specified project and location.
1091    ///
1092    /// # Arguments
1093    ///
1094    /// * `parent` - Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}. If the location is specified as '-' (wildcard), then all regions available to the project are queried, and the results are aggregated.
1095    pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
1096        ProjectLocationInstanceListCall {
1097            hub: self.hub,
1098            _parent: parent.to_string(),
1099            _page_token: Default::default(),
1100            _page_size: Default::default(),
1101            _order_by: Default::default(),
1102            _filter: Default::default(),
1103            _delegate: Default::default(),
1104            _additional_params: Default::default(),
1105            _scopes: Default::default(),
1106        }
1107    }
1108
1109    /// Create a builder to help you perform the following task:
1110    ///
1111    /// Updates a single Data Fusion instance.
1112    ///
1113    /// # Arguments
1114    ///
1115    /// * `request` - No description provided.
1116    /// * `name` - Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
1117    pub fn locations_instances_patch(
1118        &self,
1119        request: Instance,
1120        name: &str,
1121    ) -> ProjectLocationInstancePatchCall<'a, C> {
1122        ProjectLocationInstancePatchCall {
1123            hub: self.hub,
1124            _request: request,
1125            _name: name.to_string(),
1126            _update_mask: Default::default(),
1127            _delegate: Default::default(),
1128            _additional_params: Default::default(),
1129            _scopes: Default::default(),
1130        }
1131    }
1132
1133    /// Create a builder to help you perform the following task:
1134    ///
1135    /// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
1136    ///
1137    /// # Arguments
1138    ///
1139    /// * `request` - No description provided.
1140    /// * `name` - Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
1141    pub fn locations_instances_restart(
1142        &self,
1143        request: RestartInstanceRequest,
1144        name: &str,
1145    ) -> ProjectLocationInstanceRestartCall<'a, C> {
1146        ProjectLocationInstanceRestartCall {
1147            hub: self.hub,
1148            _request: request,
1149            _name: name.to_string(),
1150            _delegate: Default::default(),
1151            _additional_params: Default::default(),
1152            _scopes: Default::default(),
1153        }
1154    }
1155
1156    /// Create a builder to help you perform the following task:
1157    ///
1158    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1159    ///
1160    /// # Arguments
1161    ///
1162    /// * `request` - No description provided.
1163    /// * `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.
1164    pub fn locations_instances_set_iam_policy(
1165        &self,
1166        request: SetIamPolicyRequest,
1167        resource: &str,
1168    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
1169        ProjectLocationInstanceSetIamPolicyCall {
1170            hub: self.hub,
1171            _request: request,
1172            _resource: resource.to_string(),
1173            _delegate: Default::default(),
1174            _additional_params: Default::default(),
1175            _scopes: Default::default(),
1176        }
1177    }
1178
1179    /// Create a builder to help you perform the following task:
1180    ///
1181    /// 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.
1182    ///
1183    /// # Arguments
1184    ///
1185    /// * `request` - No description provided.
1186    /// * `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.
1187    pub fn locations_instances_test_iam_permissions(
1188        &self,
1189        request: TestIamPermissionsRequest,
1190        resource: &str,
1191    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
1192        ProjectLocationInstanceTestIamPermissionCall {
1193            hub: self.hub,
1194            _request: request,
1195            _resource: resource.to_string(),
1196            _delegate: Default::default(),
1197            _additional_params: Default::default(),
1198            _scopes: Default::default(),
1199        }
1200    }
1201
1202    /// Create a builder to help you perform the following task:
1203    ///
1204    /// 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`.
1205    ///
1206    /// # Arguments
1207    ///
1208    /// * `request` - No description provided.
1209    /// * `name` - The name of the operation resource to be cancelled.
1210    pub fn locations_operations_cancel(
1211        &self,
1212        request: CancelOperationRequest,
1213        name: &str,
1214    ) -> ProjectLocationOperationCancelCall<'a, C> {
1215        ProjectLocationOperationCancelCall {
1216            hub: self.hub,
1217            _request: request,
1218            _name: name.to_string(),
1219            _delegate: Default::default(),
1220            _additional_params: Default::default(),
1221            _scopes: Default::default(),
1222        }
1223    }
1224
1225    /// Create a builder to help you perform the following task:
1226    ///
1227    /// 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`.
1228    ///
1229    /// # Arguments
1230    ///
1231    /// * `name` - The name of the operation resource to be deleted.
1232    pub fn locations_operations_delete(
1233        &self,
1234        name: &str,
1235    ) -> ProjectLocationOperationDeleteCall<'a, C> {
1236        ProjectLocationOperationDeleteCall {
1237            hub: self.hub,
1238            _name: name.to_string(),
1239            _delegate: Default::default(),
1240            _additional_params: Default::default(),
1241            _scopes: Default::default(),
1242        }
1243    }
1244
1245    /// Create a builder to help you perform the following task:
1246    ///
1247    /// 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.
1248    ///
1249    /// # Arguments
1250    ///
1251    /// * `name` - The name of the operation resource.
1252    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1253        ProjectLocationOperationGetCall {
1254            hub: self.hub,
1255            _name: name.to_string(),
1256            _delegate: Default::default(),
1257            _additional_params: Default::default(),
1258            _scopes: Default::default(),
1259        }
1260    }
1261
1262    /// Create a builder to help you perform the following task:
1263    ///
1264    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1265    ///
1266    /// # Arguments
1267    ///
1268    /// * `name` - The name of the operation's parent resource.
1269    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1270        ProjectLocationOperationListCall {
1271            hub: self.hub,
1272            _name: name.to_string(),
1273            _page_token: Default::default(),
1274            _page_size: Default::default(),
1275            _filter: Default::default(),
1276            _delegate: Default::default(),
1277            _additional_params: Default::default(),
1278            _scopes: Default::default(),
1279        }
1280    }
1281
1282    /// Create a builder to help you perform the following task:
1283    ///
1284    /// Lists possible versions for Data Fusion instances in the specified project and location.
1285    ///
1286    /// # Arguments
1287    ///
1288    /// * `parent` - Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
1289    pub fn locations_versions_list(&self, parent: &str) -> ProjectLocationVersionListCall<'a, C> {
1290        ProjectLocationVersionListCall {
1291            hub: self.hub,
1292            _parent: parent.to_string(),
1293            _page_token: Default::default(),
1294            _page_size: Default::default(),
1295            _latest_patch_only: Default::default(),
1296            _delegate: Default::default(),
1297            _additional_params: Default::default(),
1298            _scopes: Default::default(),
1299        }
1300    }
1301
1302    /// Create a builder to help you perform the following task:
1303    ///
1304    /// Gets information about a location.
1305    ///
1306    /// # Arguments
1307    ///
1308    /// * `name` - Resource name for the location.
1309    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1310        ProjectLocationGetCall {
1311            hub: self.hub,
1312            _name: name.to_string(),
1313            _delegate: Default::default(),
1314            _additional_params: Default::default(),
1315            _scopes: Default::default(),
1316        }
1317    }
1318
1319    /// Create a builder to help you perform the following task:
1320    ///
1321    /// Lists information about the supported locations for this service.
1322    ///
1323    /// # Arguments
1324    ///
1325    /// * `name` - The resource that owns the locations collection, if applicable.
1326    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1327        ProjectLocationListCall {
1328            hub: self.hub,
1329            _name: name.to_string(),
1330            _page_token: Default::default(),
1331            _page_size: Default::default(),
1332            _filter: Default::default(),
1333            _delegate: Default::default(),
1334            _additional_params: Default::default(),
1335            _scopes: Default::default(),
1336        }
1337    }
1338}
1339
1340// ###################
1341// CallBuilders   ###
1342// #################
1343
1344/// Creates DNS peering on the given resource.
1345///
1346/// A builder for the *locations.instances.dnsPeerings.create* method supported by a *project* resource.
1347/// It is not used directly, but through a [`ProjectMethods`] instance.
1348///
1349/// # Example
1350///
1351/// Instantiate a resource method builder
1352///
1353/// ```test_harness,no_run
1354/// # extern crate hyper;
1355/// # extern crate hyper_rustls;
1356/// # extern crate google_datafusion1 as datafusion1;
1357/// use datafusion1::api::DnsPeering;
1358/// # async fn dox() {
1359/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1360///
1361/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1362/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1363/// #     secret,
1364/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1365/// # ).build().await.unwrap();
1366///
1367/// # let client = hyper_util::client::legacy::Client::builder(
1368/// #     hyper_util::rt::TokioExecutor::new()
1369/// # )
1370/// # .build(
1371/// #     hyper_rustls::HttpsConnectorBuilder::new()
1372/// #         .with_native_roots()
1373/// #         .unwrap()
1374/// #         .https_or_http()
1375/// #         .enable_http1()
1376/// #         .build()
1377/// # );
1378/// # let mut hub = DataFusion::new(client, auth);
1379/// // As the method needs a request, you would usually fill it with the desired information
1380/// // into the respective structure. Some of the parts shown here might not be applicable !
1381/// // Values shown here are possibly random and not representative !
1382/// let mut req = DnsPeering::default();
1383///
1384/// // You can configure optional parameters by calling the respective setters at will, and
1385/// // execute the final call using `doit()`.
1386/// // Values shown here are possibly random and not representative !
1387/// let result = hub.projects().locations_instances_dns_peerings_create(req, "parent")
1388///              .dns_peering_id("sed")
1389///              .doit().await;
1390/// # }
1391/// ```
1392pub struct ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1393where
1394    C: 'a,
1395{
1396    hub: &'a DataFusion<C>,
1397    _request: DnsPeering,
1398    _parent: String,
1399    _dns_peering_id: Option<String>,
1400    _delegate: Option<&'a mut dyn common::Delegate>,
1401    _additional_params: HashMap<String, String>,
1402    _scopes: BTreeSet<String>,
1403}
1404
1405impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {}
1406
1407impl<'a, C> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1408where
1409    C: common::Connector,
1410{
1411    /// Perform the operation you have build so far.
1412    pub async fn doit(mut self) -> common::Result<(common::Response, DnsPeering)> {
1413        use std::borrow::Cow;
1414        use std::io::{Read, Seek};
1415
1416        use common::{url::Params, ToParts};
1417        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1418
1419        let mut dd = common::DefaultDelegate;
1420        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1421        dlg.begin(common::MethodInfo {
1422            id: "datafusion.projects.locations.instances.dnsPeerings.create",
1423            http_method: hyper::Method::POST,
1424        });
1425
1426        for &field in ["alt", "parent", "dnsPeeringId"].iter() {
1427            if self._additional_params.contains_key(field) {
1428                dlg.finished(false);
1429                return Err(common::Error::FieldClash(field));
1430            }
1431        }
1432
1433        let mut params = Params::with_capacity(5 + self._additional_params.len());
1434        params.push("parent", self._parent);
1435        if let Some(value) = self._dns_peering_id.as_ref() {
1436            params.push("dnsPeeringId", value);
1437        }
1438
1439        params.extend(self._additional_params.iter());
1440
1441        params.push("alt", "json");
1442        let mut url = self.hub._base_url.clone() + "v1/{+parent}/dnsPeerings";
1443        if self._scopes.is_empty() {
1444            self._scopes
1445                .insert(Scope::CloudPlatform.as_ref().to_string());
1446        }
1447
1448        #[allow(clippy::single_element_loop)]
1449        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1450            url = params.uri_replacement(url, param_name, find_this, true);
1451        }
1452        {
1453            let to_remove = ["parent"];
1454            params.remove_params(&to_remove);
1455        }
1456
1457        let url = params.parse_with_url(&url);
1458
1459        let mut json_mime_type = mime::APPLICATION_JSON;
1460        let mut request_value_reader = {
1461            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1462            common::remove_json_null_values(&mut value);
1463            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1464            serde_json::to_writer(&mut dst, &value).unwrap();
1465            dst
1466        };
1467        let request_size = request_value_reader
1468            .seek(std::io::SeekFrom::End(0))
1469            .unwrap();
1470        request_value_reader
1471            .seek(std::io::SeekFrom::Start(0))
1472            .unwrap();
1473
1474        loop {
1475            let token = match self
1476                .hub
1477                .auth
1478                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1479                .await
1480            {
1481                Ok(token) => token,
1482                Err(e) => match dlg.token(e) {
1483                    Ok(token) => token,
1484                    Err(e) => {
1485                        dlg.finished(false);
1486                        return Err(common::Error::MissingToken(e));
1487                    }
1488                },
1489            };
1490            request_value_reader
1491                .seek(std::io::SeekFrom::Start(0))
1492                .unwrap();
1493            let mut req_result = {
1494                let client = &self.hub.client;
1495                dlg.pre_request();
1496                let mut req_builder = hyper::Request::builder()
1497                    .method(hyper::Method::POST)
1498                    .uri(url.as_str())
1499                    .header(USER_AGENT, self.hub._user_agent.clone());
1500
1501                if let Some(token) = token.as_ref() {
1502                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1503                }
1504
1505                let request = req_builder
1506                    .header(CONTENT_TYPE, json_mime_type.to_string())
1507                    .header(CONTENT_LENGTH, request_size as u64)
1508                    .body(common::to_body(
1509                        request_value_reader.get_ref().clone().into(),
1510                    ));
1511
1512                client.request(request.unwrap()).await
1513            };
1514
1515            match req_result {
1516                Err(err) => {
1517                    if let common::Retry::After(d) = dlg.http_error(&err) {
1518                        sleep(d).await;
1519                        continue;
1520                    }
1521                    dlg.finished(false);
1522                    return Err(common::Error::HttpError(err));
1523                }
1524                Ok(res) => {
1525                    let (mut parts, body) = res.into_parts();
1526                    let mut body = common::Body::new(body);
1527                    if !parts.status.is_success() {
1528                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1529                        let error = serde_json::from_str(&common::to_string(&bytes));
1530                        let response = common::to_response(parts, bytes.into());
1531
1532                        if let common::Retry::After(d) =
1533                            dlg.http_failure(&response, error.as_ref().ok())
1534                        {
1535                            sleep(d).await;
1536                            continue;
1537                        }
1538
1539                        dlg.finished(false);
1540
1541                        return Err(match error {
1542                            Ok(value) => common::Error::BadRequest(value),
1543                            _ => common::Error::Failure(response),
1544                        });
1545                    }
1546                    let response = {
1547                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1548                        let encoded = common::to_string(&bytes);
1549                        match serde_json::from_str(&encoded) {
1550                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1551                            Err(error) => {
1552                                dlg.response_json_decode_error(&encoded, &error);
1553                                return Err(common::Error::JsonDecodeError(
1554                                    encoded.to_string(),
1555                                    error,
1556                                ));
1557                            }
1558                        }
1559                    };
1560
1561                    dlg.finished(true);
1562                    return Ok(response);
1563                }
1564            }
1565        }
1566    }
1567
1568    ///
1569    /// Sets the *request* property to the given value.
1570    ///
1571    /// Even though the property as already been set when instantiating this call,
1572    /// we provide this method for API completeness.
1573    pub fn request(
1574        mut self,
1575        new_value: DnsPeering,
1576    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1577        self._request = new_value;
1578        self
1579    }
1580    /// Required. The resource on which DNS peering will be created.
1581    ///
1582    /// Sets the *parent* path property to the given value.
1583    ///
1584    /// Even though the property as already been set when instantiating this call,
1585    /// we provide this method for API completeness.
1586    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1587        self._parent = new_value.to_string();
1588        self
1589    }
1590    /// Required. The name of the peering to create.
1591    ///
1592    /// Sets the *dns peering id* query property to the given value.
1593    pub fn dns_peering_id(
1594        mut self,
1595        new_value: &str,
1596    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1597        self._dns_peering_id = Some(new_value.to_string());
1598        self
1599    }
1600    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1601    /// while executing the actual API request.
1602    ///
1603    /// ````text
1604    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1605    /// ````
1606    ///
1607    /// Sets the *delegate* property to the given value.
1608    pub fn delegate(
1609        mut self,
1610        new_value: &'a mut dyn common::Delegate,
1611    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1612        self._delegate = Some(new_value);
1613        self
1614    }
1615
1616    /// Set any additional parameter of the query string used in the request.
1617    /// It should be used to set parameters which are not yet available through their own
1618    /// setters.
1619    ///
1620    /// Please note that this method must not be used to set any of the known parameters
1621    /// which have their own setter method. If done anyway, the request will fail.
1622    ///
1623    /// # Additional Parameters
1624    ///
1625    /// * *$.xgafv* (query-string) - V1 error format.
1626    /// * *access_token* (query-string) - OAuth access token.
1627    /// * *alt* (query-string) - Data format for response.
1628    /// * *callback* (query-string) - JSONP
1629    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1630    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1631    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1632    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1633    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1634    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1635    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1636    pub fn param<T>(
1637        mut self,
1638        name: T,
1639        value: T,
1640    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1641    where
1642        T: AsRef<str>,
1643    {
1644        self._additional_params
1645            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1646        self
1647    }
1648
1649    /// Identifies the authorization scope for the method you are building.
1650    ///
1651    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1652    /// [`Scope::CloudPlatform`].
1653    ///
1654    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1655    /// tokens for more than one scope.
1656    ///
1657    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1658    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1659    /// sufficient, a read-write scope will do as well.
1660    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1661    where
1662        St: AsRef<str>,
1663    {
1664        self._scopes.insert(String::from(scope.as_ref()));
1665        self
1666    }
1667    /// Identifies the authorization scope(s) for the method you are building.
1668    ///
1669    /// See [`Self::add_scope()`] for details.
1670    pub fn add_scopes<I, St>(
1671        mut self,
1672        scopes: I,
1673    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1674    where
1675        I: IntoIterator<Item = St>,
1676        St: AsRef<str>,
1677    {
1678        self._scopes
1679            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1680        self
1681    }
1682
1683    /// Removes all scopes, and no default scope will be used either.
1684    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1685    /// for details).
1686    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1687        self._scopes.clear();
1688        self
1689    }
1690}
1691
1692/// Deletes DNS peering on the given resource.
1693///
1694/// A builder for the *locations.instances.dnsPeerings.delete* method supported by a *project* resource.
1695/// It is not used directly, but through a [`ProjectMethods`] instance.
1696///
1697/// # Example
1698///
1699/// Instantiate a resource method builder
1700///
1701/// ```test_harness,no_run
1702/// # extern crate hyper;
1703/// # extern crate hyper_rustls;
1704/// # extern crate google_datafusion1 as datafusion1;
1705/// # async fn dox() {
1706/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1707///
1708/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1709/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1710/// #     secret,
1711/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1712/// # ).build().await.unwrap();
1713///
1714/// # let client = hyper_util::client::legacy::Client::builder(
1715/// #     hyper_util::rt::TokioExecutor::new()
1716/// # )
1717/// # .build(
1718/// #     hyper_rustls::HttpsConnectorBuilder::new()
1719/// #         .with_native_roots()
1720/// #         .unwrap()
1721/// #         .https_or_http()
1722/// #         .enable_http1()
1723/// #         .build()
1724/// # );
1725/// # let mut hub = DataFusion::new(client, auth);
1726/// // You can configure optional parameters by calling the respective setters at will, and
1727/// // execute the final call using `doit()`.
1728/// // Values shown here are possibly random and not representative !
1729/// let result = hub.projects().locations_instances_dns_peerings_delete("name")
1730///              .doit().await;
1731/// # }
1732/// ```
1733pub struct ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1734where
1735    C: 'a,
1736{
1737    hub: &'a DataFusion<C>,
1738    _name: String,
1739    _delegate: Option<&'a mut dyn common::Delegate>,
1740    _additional_params: HashMap<String, String>,
1741    _scopes: BTreeSet<String>,
1742}
1743
1744impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {}
1745
1746impl<'a, C> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1747where
1748    C: common::Connector,
1749{
1750    /// Perform the operation you have build so far.
1751    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
1752        use std::borrow::Cow;
1753        use std::io::{Read, Seek};
1754
1755        use common::{url::Params, ToParts};
1756        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1757
1758        let mut dd = common::DefaultDelegate;
1759        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1760        dlg.begin(common::MethodInfo {
1761            id: "datafusion.projects.locations.instances.dnsPeerings.delete",
1762            http_method: hyper::Method::DELETE,
1763        });
1764
1765        for &field in ["alt", "name"].iter() {
1766            if self._additional_params.contains_key(field) {
1767                dlg.finished(false);
1768                return Err(common::Error::FieldClash(field));
1769            }
1770        }
1771
1772        let mut params = Params::with_capacity(3 + self._additional_params.len());
1773        params.push("name", self._name);
1774
1775        params.extend(self._additional_params.iter());
1776
1777        params.push("alt", "json");
1778        let mut url = self.hub._base_url.clone() + "v1/{+name}";
1779        if self._scopes.is_empty() {
1780            self._scopes
1781                .insert(Scope::CloudPlatform.as_ref().to_string());
1782        }
1783
1784        #[allow(clippy::single_element_loop)]
1785        for &(find_this, param_name) in [("{+name}", "name")].iter() {
1786            url = params.uri_replacement(url, param_name, find_this, true);
1787        }
1788        {
1789            let to_remove = ["name"];
1790            params.remove_params(&to_remove);
1791        }
1792
1793        let url = params.parse_with_url(&url);
1794
1795        loop {
1796            let token = match self
1797                .hub
1798                .auth
1799                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1800                .await
1801            {
1802                Ok(token) => token,
1803                Err(e) => match dlg.token(e) {
1804                    Ok(token) => token,
1805                    Err(e) => {
1806                        dlg.finished(false);
1807                        return Err(common::Error::MissingToken(e));
1808                    }
1809                },
1810            };
1811            let mut req_result = {
1812                let client = &self.hub.client;
1813                dlg.pre_request();
1814                let mut req_builder = hyper::Request::builder()
1815                    .method(hyper::Method::DELETE)
1816                    .uri(url.as_str())
1817                    .header(USER_AGENT, self.hub._user_agent.clone());
1818
1819                if let Some(token) = token.as_ref() {
1820                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1821                }
1822
1823                let request = req_builder
1824                    .header(CONTENT_LENGTH, 0_u64)
1825                    .body(common::to_body::<String>(None));
1826
1827                client.request(request.unwrap()).await
1828            };
1829
1830            match req_result {
1831                Err(err) => {
1832                    if let common::Retry::After(d) = dlg.http_error(&err) {
1833                        sleep(d).await;
1834                        continue;
1835                    }
1836                    dlg.finished(false);
1837                    return Err(common::Error::HttpError(err));
1838                }
1839                Ok(res) => {
1840                    let (mut parts, body) = res.into_parts();
1841                    let mut body = common::Body::new(body);
1842                    if !parts.status.is_success() {
1843                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1844                        let error = serde_json::from_str(&common::to_string(&bytes));
1845                        let response = common::to_response(parts, bytes.into());
1846
1847                        if let common::Retry::After(d) =
1848                            dlg.http_failure(&response, error.as_ref().ok())
1849                        {
1850                            sleep(d).await;
1851                            continue;
1852                        }
1853
1854                        dlg.finished(false);
1855
1856                        return Err(match error {
1857                            Ok(value) => common::Error::BadRequest(value),
1858                            _ => common::Error::Failure(response),
1859                        });
1860                    }
1861                    let response = {
1862                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1863                        let encoded = common::to_string(&bytes);
1864                        match serde_json::from_str(&encoded) {
1865                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1866                            Err(error) => {
1867                                dlg.response_json_decode_error(&encoded, &error);
1868                                return Err(common::Error::JsonDecodeError(
1869                                    encoded.to_string(),
1870                                    error,
1871                                ));
1872                            }
1873                        }
1874                    };
1875
1876                    dlg.finished(true);
1877                    return Ok(response);
1878                }
1879            }
1880        }
1881    }
1882
1883    /// Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
1884    ///
1885    /// Sets the *name* path property to the given value.
1886    ///
1887    /// Even though the property as already been set when instantiating this call,
1888    /// we provide this method for API completeness.
1889    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
1890        self._name = new_value.to_string();
1891        self
1892    }
1893    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1894    /// while executing the actual API request.
1895    ///
1896    /// ````text
1897    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1898    /// ````
1899    ///
1900    /// Sets the *delegate* property to the given value.
1901    pub fn delegate(
1902        mut self,
1903        new_value: &'a mut dyn common::Delegate,
1904    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
1905        self._delegate = Some(new_value);
1906        self
1907    }
1908
1909    /// Set any additional parameter of the query string used in the request.
1910    /// It should be used to set parameters which are not yet available through their own
1911    /// setters.
1912    ///
1913    /// Please note that this method must not be used to set any of the known parameters
1914    /// which have their own setter method. If done anyway, the request will fail.
1915    ///
1916    /// # Additional Parameters
1917    ///
1918    /// * *$.xgafv* (query-string) - V1 error format.
1919    /// * *access_token* (query-string) - OAuth access token.
1920    /// * *alt* (query-string) - Data format for response.
1921    /// * *callback* (query-string) - JSONP
1922    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1923    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1924    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1925    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1926    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1927    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1928    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1929    pub fn param<T>(
1930        mut self,
1931        name: T,
1932        value: T,
1933    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1934    where
1935        T: AsRef<str>,
1936    {
1937        self._additional_params
1938            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1939        self
1940    }
1941
1942    /// Identifies the authorization scope for the method you are building.
1943    ///
1944    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1945    /// [`Scope::CloudPlatform`].
1946    ///
1947    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1948    /// tokens for more than one scope.
1949    ///
1950    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1951    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1952    /// sufficient, a read-write scope will do as well.
1953    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1954    where
1955        St: AsRef<str>,
1956    {
1957        self._scopes.insert(String::from(scope.as_ref()));
1958        self
1959    }
1960    /// Identifies the authorization scope(s) for the method you are building.
1961    ///
1962    /// See [`Self::add_scope()`] for details.
1963    pub fn add_scopes<I, St>(
1964        mut self,
1965        scopes: I,
1966    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1967    where
1968        I: IntoIterator<Item = St>,
1969        St: AsRef<str>,
1970    {
1971        self._scopes
1972            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1973        self
1974    }
1975
1976    /// Removes all scopes, and no default scope will be used either.
1977    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1978    /// for details).
1979    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
1980        self._scopes.clear();
1981        self
1982    }
1983}
1984
1985/// Lists DNS peerings for a given resource.
1986///
1987/// A builder for the *locations.instances.dnsPeerings.list* method supported by a *project* resource.
1988/// It is not used directly, but through a [`ProjectMethods`] instance.
1989///
1990/// # Example
1991///
1992/// Instantiate a resource method builder
1993///
1994/// ```test_harness,no_run
1995/// # extern crate hyper;
1996/// # extern crate hyper_rustls;
1997/// # extern crate google_datafusion1 as datafusion1;
1998/// # async fn dox() {
1999/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2000///
2001/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2002/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2003/// #     secret,
2004/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2005/// # ).build().await.unwrap();
2006///
2007/// # let client = hyper_util::client::legacy::Client::builder(
2008/// #     hyper_util::rt::TokioExecutor::new()
2009/// # )
2010/// # .build(
2011/// #     hyper_rustls::HttpsConnectorBuilder::new()
2012/// #         .with_native_roots()
2013/// #         .unwrap()
2014/// #         .https_or_http()
2015/// #         .enable_http1()
2016/// #         .build()
2017/// # );
2018/// # let mut hub = DataFusion::new(client, auth);
2019/// // You can configure optional parameters by calling the respective setters at will, and
2020/// // execute the final call using `doit()`.
2021/// // Values shown here are possibly random and not representative !
2022/// let result = hub.projects().locations_instances_dns_peerings_list("parent")
2023///              .page_token("amet.")
2024///              .page_size(-20)
2025///              .doit().await;
2026/// # }
2027/// ```
2028pub struct ProjectLocationInstanceDnsPeeringListCall<'a, C>
2029where
2030    C: 'a,
2031{
2032    hub: &'a DataFusion<C>,
2033    _parent: String,
2034    _page_token: Option<String>,
2035    _page_size: Option<i32>,
2036    _delegate: Option<&'a mut dyn common::Delegate>,
2037    _additional_params: HashMap<String, String>,
2038    _scopes: BTreeSet<String>,
2039}
2040
2041impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringListCall<'a, C> {}
2042
2043impl<'a, C> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2044where
2045    C: common::Connector,
2046{
2047    /// Perform the operation you have build so far.
2048    pub async fn doit(mut self) -> common::Result<(common::Response, ListDnsPeeringsResponse)> {
2049        use std::borrow::Cow;
2050        use std::io::{Read, Seek};
2051
2052        use common::{url::Params, ToParts};
2053        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2054
2055        let mut dd = common::DefaultDelegate;
2056        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2057        dlg.begin(common::MethodInfo {
2058            id: "datafusion.projects.locations.instances.dnsPeerings.list",
2059            http_method: hyper::Method::GET,
2060        });
2061
2062        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2063            if self._additional_params.contains_key(field) {
2064                dlg.finished(false);
2065                return Err(common::Error::FieldClash(field));
2066            }
2067        }
2068
2069        let mut params = Params::with_capacity(5 + self._additional_params.len());
2070        params.push("parent", self._parent);
2071        if let Some(value) = self._page_token.as_ref() {
2072            params.push("pageToken", value);
2073        }
2074        if let Some(value) = self._page_size.as_ref() {
2075            params.push("pageSize", value.to_string());
2076        }
2077
2078        params.extend(self._additional_params.iter());
2079
2080        params.push("alt", "json");
2081        let mut url = self.hub._base_url.clone() + "v1/{+parent}/dnsPeerings";
2082        if self._scopes.is_empty() {
2083            self._scopes
2084                .insert(Scope::CloudPlatform.as_ref().to_string());
2085        }
2086
2087        #[allow(clippy::single_element_loop)]
2088        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2089            url = params.uri_replacement(url, param_name, find_this, true);
2090        }
2091        {
2092            let to_remove = ["parent"];
2093            params.remove_params(&to_remove);
2094        }
2095
2096        let url = params.parse_with_url(&url);
2097
2098        loop {
2099            let token = match self
2100                .hub
2101                .auth
2102                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2103                .await
2104            {
2105                Ok(token) => token,
2106                Err(e) => match dlg.token(e) {
2107                    Ok(token) => token,
2108                    Err(e) => {
2109                        dlg.finished(false);
2110                        return Err(common::Error::MissingToken(e));
2111                    }
2112                },
2113            };
2114            let mut req_result = {
2115                let client = &self.hub.client;
2116                dlg.pre_request();
2117                let mut req_builder = hyper::Request::builder()
2118                    .method(hyper::Method::GET)
2119                    .uri(url.as_str())
2120                    .header(USER_AGENT, self.hub._user_agent.clone());
2121
2122                if let Some(token) = token.as_ref() {
2123                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2124                }
2125
2126                let request = req_builder
2127                    .header(CONTENT_LENGTH, 0_u64)
2128                    .body(common::to_body::<String>(None));
2129
2130                client.request(request.unwrap()).await
2131            };
2132
2133            match req_result {
2134                Err(err) => {
2135                    if let common::Retry::After(d) = dlg.http_error(&err) {
2136                        sleep(d).await;
2137                        continue;
2138                    }
2139                    dlg.finished(false);
2140                    return Err(common::Error::HttpError(err));
2141                }
2142                Ok(res) => {
2143                    let (mut parts, body) = res.into_parts();
2144                    let mut body = common::Body::new(body);
2145                    if !parts.status.is_success() {
2146                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2147                        let error = serde_json::from_str(&common::to_string(&bytes));
2148                        let response = common::to_response(parts, bytes.into());
2149
2150                        if let common::Retry::After(d) =
2151                            dlg.http_failure(&response, error.as_ref().ok())
2152                        {
2153                            sleep(d).await;
2154                            continue;
2155                        }
2156
2157                        dlg.finished(false);
2158
2159                        return Err(match error {
2160                            Ok(value) => common::Error::BadRequest(value),
2161                            _ => common::Error::Failure(response),
2162                        });
2163                    }
2164                    let response = {
2165                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2166                        let encoded = common::to_string(&bytes);
2167                        match serde_json::from_str(&encoded) {
2168                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2169                            Err(error) => {
2170                                dlg.response_json_decode_error(&encoded, &error);
2171                                return Err(common::Error::JsonDecodeError(
2172                                    encoded.to_string(),
2173                                    error,
2174                                ));
2175                            }
2176                        }
2177                    };
2178
2179                    dlg.finished(true);
2180                    return Ok(response);
2181                }
2182            }
2183        }
2184    }
2185
2186    /// Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
2187    ///
2188    /// Sets the *parent* path property to the given value.
2189    ///
2190    /// Even though the property as already been set when instantiating this call,
2191    /// we provide this method for API completeness.
2192    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2193        self._parent = new_value.to_string();
2194        self
2195    }
2196    /// A page token, received from a previous `ListDnsPeerings` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListDnsPeerings` must match the call that provided the page token.
2197    ///
2198    /// Sets the *page token* query property to the given value.
2199    pub fn page_token(
2200        mut self,
2201        new_value: &str,
2202    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2203        self._page_token = Some(new_value.to_string());
2204        self
2205    }
2206    /// The maximum number of dns peerings to return. The service may return fewer than this value. If unspecified, at most 50 dns peerings will be returned. The maximum value is 200; values above 200 will be coerced to 200.
2207    ///
2208    /// Sets the *page size* query property to the given value.
2209    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2210        self._page_size = Some(new_value);
2211        self
2212    }
2213    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2214    /// while executing the actual API request.
2215    ///
2216    /// ````text
2217    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2218    /// ````
2219    ///
2220    /// Sets the *delegate* property to the given value.
2221    pub fn delegate(
2222        mut self,
2223        new_value: &'a mut dyn common::Delegate,
2224    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2225        self._delegate = Some(new_value);
2226        self
2227    }
2228
2229    /// Set any additional parameter of the query string used in the request.
2230    /// It should be used to set parameters which are not yet available through their own
2231    /// setters.
2232    ///
2233    /// Please note that this method must not be used to set any of the known parameters
2234    /// which have their own setter method. If done anyway, the request will fail.
2235    ///
2236    /// # Additional Parameters
2237    ///
2238    /// * *$.xgafv* (query-string) - V1 error format.
2239    /// * *access_token* (query-string) - OAuth access token.
2240    /// * *alt* (query-string) - Data format for response.
2241    /// * *callback* (query-string) - JSONP
2242    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2243    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2244    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2245    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2246    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2247    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2248    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2249    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2250    where
2251        T: AsRef<str>,
2252    {
2253        self._additional_params
2254            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2255        self
2256    }
2257
2258    /// Identifies the authorization scope for the method you are building.
2259    ///
2260    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2261    /// [`Scope::CloudPlatform`].
2262    ///
2263    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2264    /// tokens for more than one scope.
2265    ///
2266    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2267    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2268    /// sufficient, a read-write scope will do as well.
2269    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2270    where
2271        St: AsRef<str>,
2272    {
2273        self._scopes.insert(String::from(scope.as_ref()));
2274        self
2275    }
2276    /// Identifies the authorization scope(s) for the method you are building.
2277    ///
2278    /// See [`Self::add_scope()`] for details.
2279    pub fn add_scopes<I, St>(
2280        mut self,
2281        scopes: I,
2282    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2283    where
2284        I: IntoIterator<Item = St>,
2285        St: AsRef<str>,
2286    {
2287        self._scopes
2288            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2289        self
2290    }
2291
2292    /// Removes all scopes, and no default scope will be used either.
2293    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2294    /// for details).
2295    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2296        self._scopes.clear();
2297        self
2298    }
2299}
2300
2301/// Creates a new Data Fusion instance in the specified project and location.
2302///
2303/// A builder for the *locations.instances.create* method supported by a *project* resource.
2304/// It is not used directly, but through a [`ProjectMethods`] instance.
2305///
2306/// # Example
2307///
2308/// Instantiate a resource method builder
2309///
2310/// ```test_harness,no_run
2311/// # extern crate hyper;
2312/// # extern crate hyper_rustls;
2313/// # extern crate google_datafusion1 as datafusion1;
2314/// use datafusion1::api::Instance;
2315/// # async fn dox() {
2316/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2317///
2318/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2319/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2320/// #     secret,
2321/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2322/// # ).build().await.unwrap();
2323///
2324/// # let client = hyper_util::client::legacy::Client::builder(
2325/// #     hyper_util::rt::TokioExecutor::new()
2326/// # )
2327/// # .build(
2328/// #     hyper_rustls::HttpsConnectorBuilder::new()
2329/// #         .with_native_roots()
2330/// #         .unwrap()
2331/// #         .https_or_http()
2332/// #         .enable_http1()
2333/// #         .build()
2334/// # );
2335/// # let mut hub = DataFusion::new(client, auth);
2336/// // As the method needs a request, you would usually fill it with the desired information
2337/// // into the respective structure. Some of the parts shown here might not be applicable !
2338/// // Values shown here are possibly random and not representative !
2339/// let mut req = Instance::default();
2340///
2341/// // You can configure optional parameters by calling the respective setters at will, and
2342/// // execute the final call using `doit()`.
2343/// // Values shown here are possibly random and not representative !
2344/// let result = hub.projects().locations_instances_create(req, "parent")
2345///              .instance_id("gubergren")
2346///              .doit().await;
2347/// # }
2348/// ```
2349pub struct ProjectLocationInstanceCreateCall<'a, C>
2350where
2351    C: 'a,
2352{
2353    hub: &'a DataFusion<C>,
2354    _request: Instance,
2355    _parent: String,
2356    _instance_id: Option<String>,
2357    _delegate: Option<&'a mut dyn common::Delegate>,
2358    _additional_params: HashMap<String, String>,
2359    _scopes: BTreeSet<String>,
2360}
2361
2362impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
2363
2364impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
2365where
2366    C: common::Connector,
2367{
2368    /// Perform the operation you have build so far.
2369    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2370        use std::borrow::Cow;
2371        use std::io::{Read, Seek};
2372
2373        use common::{url::Params, ToParts};
2374        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2375
2376        let mut dd = common::DefaultDelegate;
2377        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2378        dlg.begin(common::MethodInfo {
2379            id: "datafusion.projects.locations.instances.create",
2380            http_method: hyper::Method::POST,
2381        });
2382
2383        for &field in ["alt", "parent", "instanceId"].iter() {
2384            if self._additional_params.contains_key(field) {
2385                dlg.finished(false);
2386                return Err(common::Error::FieldClash(field));
2387            }
2388        }
2389
2390        let mut params = Params::with_capacity(5 + self._additional_params.len());
2391        params.push("parent", self._parent);
2392        if let Some(value) = self._instance_id.as_ref() {
2393            params.push("instanceId", value);
2394        }
2395
2396        params.extend(self._additional_params.iter());
2397
2398        params.push("alt", "json");
2399        let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances";
2400        if self._scopes.is_empty() {
2401            self._scopes
2402                .insert(Scope::CloudPlatform.as_ref().to_string());
2403        }
2404
2405        #[allow(clippy::single_element_loop)]
2406        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2407            url = params.uri_replacement(url, param_name, find_this, true);
2408        }
2409        {
2410            let to_remove = ["parent"];
2411            params.remove_params(&to_remove);
2412        }
2413
2414        let url = params.parse_with_url(&url);
2415
2416        let mut json_mime_type = mime::APPLICATION_JSON;
2417        let mut request_value_reader = {
2418            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2419            common::remove_json_null_values(&mut value);
2420            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2421            serde_json::to_writer(&mut dst, &value).unwrap();
2422            dst
2423        };
2424        let request_size = request_value_reader
2425            .seek(std::io::SeekFrom::End(0))
2426            .unwrap();
2427        request_value_reader
2428            .seek(std::io::SeekFrom::Start(0))
2429            .unwrap();
2430
2431        loop {
2432            let token = match self
2433                .hub
2434                .auth
2435                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2436                .await
2437            {
2438                Ok(token) => token,
2439                Err(e) => match dlg.token(e) {
2440                    Ok(token) => token,
2441                    Err(e) => {
2442                        dlg.finished(false);
2443                        return Err(common::Error::MissingToken(e));
2444                    }
2445                },
2446            };
2447            request_value_reader
2448                .seek(std::io::SeekFrom::Start(0))
2449                .unwrap();
2450            let mut req_result = {
2451                let client = &self.hub.client;
2452                dlg.pre_request();
2453                let mut req_builder = hyper::Request::builder()
2454                    .method(hyper::Method::POST)
2455                    .uri(url.as_str())
2456                    .header(USER_AGENT, self.hub._user_agent.clone());
2457
2458                if let Some(token) = token.as_ref() {
2459                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2460                }
2461
2462                let request = req_builder
2463                    .header(CONTENT_TYPE, json_mime_type.to_string())
2464                    .header(CONTENT_LENGTH, request_size as u64)
2465                    .body(common::to_body(
2466                        request_value_reader.get_ref().clone().into(),
2467                    ));
2468
2469                client.request(request.unwrap()).await
2470            };
2471
2472            match req_result {
2473                Err(err) => {
2474                    if let common::Retry::After(d) = dlg.http_error(&err) {
2475                        sleep(d).await;
2476                        continue;
2477                    }
2478                    dlg.finished(false);
2479                    return Err(common::Error::HttpError(err));
2480                }
2481                Ok(res) => {
2482                    let (mut parts, body) = res.into_parts();
2483                    let mut body = common::Body::new(body);
2484                    if !parts.status.is_success() {
2485                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2486                        let error = serde_json::from_str(&common::to_string(&bytes));
2487                        let response = common::to_response(parts, bytes.into());
2488
2489                        if let common::Retry::After(d) =
2490                            dlg.http_failure(&response, error.as_ref().ok())
2491                        {
2492                            sleep(d).await;
2493                            continue;
2494                        }
2495
2496                        dlg.finished(false);
2497
2498                        return Err(match error {
2499                            Ok(value) => common::Error::BadRequest(value),
2500                            _ => common::Error::Failure(response),
2501                        });
2502                    }
2503                    let response = {
2504                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2505                        let encoded = common::to_string(&bytes);
2506                        match serde_json::from_str(&encoded) {
2507                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2508                            Err(error) => {
2509                                dlg.response_json_decode_error(&encoded, &error);
2510                                return Err(common::Error::JsonDecodeError(
2511                                    encoded.to_string(),
2512                                    error,
2513                                ));
2514                            }
2515                        }
2516                    };
2517
2518                    dlg.finished(true);
2519                    return Ok(response);
2520                }
2521            }
2522        }
2523    }
2524
2525    ///
2526    /// Sets the *request* property to the given value.
2527    ///
2528    /// Even though the property as already been set when instantiating this call,
2529    /// we provide this method for API completeness.
2530    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
2531        self._request = new_value;
2532        self
2533    }
2534    /// Required. The instance's project and location in the format projects/{project}/locations/{location}.
2535    ///
2536    /// Sets the *parent* path property to the given value.
2537    ///
2538    /// Even though the property as already been set when instantiating this call,
2539    /// we provide this method for API completeness.
2540    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
2541        self._parent = new_value.to_string();
2542        self
2543    }
2544    /// Required. The name of the instance to create. Instance name can only contain lowercase alphanumeric characters and hyphens. It must start with a letter and must not end with a hyphen. It can have a maximum of 30 characters.
2545    ///
2546    /// Sets the *instance id* query property to the given value.
2547    pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
2548        self._instance_id = Some(new_value.to_string());
2549        self
2550    }
2551    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2552    /// while executing the actual API request.
2553    ///
2554    /// ````text
2555    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2556    /// ````
2557    ///
2558    /// Sets the *delegate* property to the given value.
2559    pub fn delegate(
2560        mut self,
2561        new_value: &'a mut dyn common::Delegate,
2562    ) -> ProjectLocationInstanceCreateCall<'a, C> {
2563        self._delegate = Some(new_value);
2564        self
2565    }
2566
2567    /// Set any additional parameter of the query string used in the request.
2568    /// It should be used to set parameters which are not yet available through their own
2569    /// setters.
2570    ///
2571    /// Please note that this method must not be used to set any of the known parameters
2572    /// which have their own setter method. If done anyway, the request will fail.
2573    ///
2574    /// # Additional Parameters
2575    ///
2576    /// * *$.xgafv* (query-string) - V1 error format.
2577    /// * *access_token* (query-string) - OAuth access token.
2578    /// * *alt* (query-string) - Data format for response.
2579    /// * *callback* (query-string) - JSONP
2580    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2581    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2582    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2583    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2584    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2585    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2586    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2587    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
2588    where
2589        T: AsRef<str>,
2590    {
2591        self._additional_params
2592            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2593        self
2594    }
2595
2596    /// Identifies the authorization scope for the method you are building.
2597    ///
2598    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2599    /// [`Scope::CloudPlatform`].
2600    ///
2601    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2602    /// tokens for more than one scope.
2603    ///
2604    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2605    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2606    /// sufficient, a read-write scope will do as well.
2607    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
2608    where
2609        St: AsRef<str>,
2610    {
2611        self._scopes.insert(String::from(scope.as_ref()));
2612        self
2613    }
2614    /// Identifies the authorization scope(s) for the method you are building.
2615    ///
2616    /// See [`Self::add_scope()`] for details.
2617    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
2618    where
2619        I: IntoIterator<Item = St>,
2620        St: AsRef<str>,
2621    {
2622        self._scopes
2623            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2624        self
2625    }
2626
2627    /// Removes all scopes, and no default scope will be used either.
2628    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2629    /// for details).
2630    pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
2631        self._scopes.clear();
2632        self
2633    }
2634}
2635
2636/// Deletes a single Date Fusion instance.
2637///
2638/// A builder for the *locations.instances.delete* method supported by a *project* resource.
2639/// It is not used directly, but through a [`ProjectMethods`] instance.
2640///
2641/// # Example
2642///
2643/// Instantiate a resource method builder
2644///
2645/// ```test_harness,no_run
2646/// # extern crate hyper;
2647/// # extern crate hyper_rustls;
2648/// # extern crate google_datafusion1 as datafusion1;
2649/// # async fn dox() {
2650/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2651///
2652/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2653/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2654/// #     secret,
2655/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2656/// # ).build().await.unwrap();
2657///
2658/// # let client = hyper_util::client::legacy::Client::builder(
2659/// #     hyper_util::rt::TokioExecutor::new()
2660/// # )
2661/// # .build(
2662/// #     hyper_rustls::HttpsConnectorBuilder::new()
2663/// #         .with_native_roots()
2664/// #         .unwrap()
2665/// #         .https_or_http()
2666/// #         .enable_http1()
2667/// #         .build()
2668/// # );
2669/// # let mut hub = DataFusion::new(client, auth);
2670/// // You can configure optional parameters by calling the respective setters at will, and
2671/// // execute the final call using `doit()`.
2672/// // Values shown here are possibly random and not representative !
2673/// let result = hub.projects().locations_instances_delete("name")
2674///              .doit().await;
2675/// # }
2676/// ```
2677pub struct ProjectLocationInstanceDeleteCall<'a, C>
2678where
2679    C: 'a,
2680{
2681    hub: &'a DataFusion<C>,
2682    _name: String,
2683    _delegate: Option<&'a mut dyn common::Delegate>,
2684    _additional_params: HashMap<String, String>,
2685    _scopes: BTreeSet<String>,
2686}
2687
2688impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
2689
2690impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
2691where
2692    C: common::Connector,
2693{
2694    /// Perform the operation you have build so far.
2695    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2696        use std::borrow::Cow;
2697        use std::io::{Read, Seek};
2698
2699        use common::{url::Params, ToParts};
2700        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2701
2702        let mut dd = common::DefaultDelegate;
2703        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2704        dlg.begin(common::MethodInfo {
2705            id: "datafusion.projects.locations.instances.delete",
2706            http_method: hyper::Method::DELETE,
2707        });
2708
2709        for &field in ["alt", "name"].iter() {
2710            if self._additional_params.contains_key(field) {
2711                dlg.finished(false);
2712                return Err(common::Error::FieldClash(field));
2713            }
2714        }
2715
2716        let mut params = Params::with_capacity(3 + self._additional_params.len());
2717        params.push("name", self._name);
2718
2719        params.extend(self._additional_params.iter());
2720
2721        params.push("alt", "json");
2722        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2723        if self._scopes.is_empty() {
2724            self._scopes
2725                .insert(Scope::CloudPlatform.as_ref().to_string());
2726        }
2727
2728        #[allow(clippy::single_element_loop)]
2729        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2730            url = params.uri_replacement(url, param_name, find_this, true);
2731        }
2732        {
2733            let to_remove = ["name"];
2734            params.remove_params(&to_remove);
2735        }
2736
2737        let url = params.parse_with_url(&url);
2738
2739        loop {
2740            let token = match self
2741                .hub
2742                .auth
2743                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2744                .await
2745            {
2746                Ok(token) => token,
2747                Err(e) => match dlg.token(e) {
2748                    Ok(token) => token,
2749                    Err(e) => {
2750                        dlg.finished(false);
2751                        return Err(common::Error::MissingToken(e));
2752                    }
2753                },
2754            };
2755            let mut req_result = {
2756                let client = &self.hub.client;
2757                dlg.pre_request();
2758                let mut req_builder = hyper::Request::builder()
2759                    .method(hyper::Method::DELETE)
2760                    .uri(url.as_str())
2761                    .header(USER_AGENT, self.hub._user_agent.clone());
2762
2763                if let Some(token) = token.as_ref() {
2764                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2765                }
2766
2767                let request = req_builder
2768                    .header(CONTENT_LENGTH, 0_u64)
2769                    .body(common::to_body::<String>(None));
2770
2771                client.request(request.unwrap()).await
2772            };
2773
2774            match req_result {
2775                Err(err) => {
2776                    if let common::Retry::After(d) = dlg.http_error(&err) {
2777                        sleep(d).await;
2778                        continue;
2779                    }
2780                    dlg.finished(false);
2781                    return Err(common::Error::HttpError(err));
2782                }
2783                Ok(res) => {
2784                    let (mut parts, body) = res.into_parts();
2785                    let mut body = common::Body::new(body);
2786                    if !parts.status.is_success() {
2787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2788                        let error = serde_json::from_str(&common::to_string(&bytes));
2789                        let response = common::to_response(parts, bytes.into());
2790
2791                        if let common::Retry::After(d) =
2792                            dlg.http_failure(&response, error.as_ref().ok())
2793                        {
2794                            sleep(d).await;
2795                            continue;
2796                        }
2797
2798                        dlg.finished(false);
2799
2800                        return Err(match error {
2801                            Ok(value) => common::Error::BadRequest(value),
2802                            _ => common::Error::Failure(response),
2803                        });
2804                    }
2805                    let response = {
2806                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2807                        let encoded = common::to_string(&bytes);
2808                        match serde_json::from_str(&encoded) {
2809                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2810                            Err(error) => {
2811                                dlg.response_json_decode_error(&encoded, &error);
2812                                return Err(common::Error::JsonDecodeError(
2813                                    encoded.to_string(),
2814                                    error,
2815                                ));
2816                            }
2817                        }
2818                    };
2819
2820                    dlg.finished(true);
2821                    return Ok(response);
2822                }
2823            }
2824        }
2825    }
2826
2827    /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
2828    ///
2829    /// Sets the *name* path property to the given value.
2830    ///
2831    /// Even though the property as already been set when instantiating this call,
2832    /// we provide this method for API completeness.
2833    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
2834        self._name = new_value.to_string();
2835        self
2836    }
2837    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2838    /// while executing the actual API request.
2839    ///
2840    /// ````text
2841    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2842    /// ````
2843    ///
2844    /// Sets the *delegate* property to the given value.
2845    pub fn delegate(
2846        mut self,
2847        new_value: &'a mut dyn common::Delegate,
2848    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
2849        self._delegate = Some(new_value);
2850        self
2851    }
2852
2853    /// Set any additional parameter of the query string used in the request.
2854    /// It should be used to set parameters which are not yet available through their own
2855    /// setters.
2856    ///
2857    /// Please note that this method must not be used to set any of the known parameters
2858    /// which have their own setter method. If done anyway, the request will fail.
2859    ///
2860    /// # Additional Parameters
2861    ///
2862    /// * *$.xgafv* (query-string) - V1 error format.
2863    /// * *access_token* (query-string) - OAuth access token.
2864    /// * *alt* (query-string) - Data format for response.
2865    /// * *callback* (query-string) - JSONP
2866    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2867    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2868    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2869    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2870    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2871    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2872    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2873    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
2874    where
2875        T: AsRef<str>,
2876    {
2877        self._additional_params
2878            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2879        self
2880    }
2881
2882    /// Identifies the authorization scope for the method you are building.
2883    ///
2884    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2885    /// [`Scope::CloudPlatform`].
2886    ///
2887    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2888    /// tokens for more than one scope.
2889    ///
2890    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2891    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2892    /// sufficient, a read-write scope will do as well.
2893    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
2894    where
2895        St: AsRef<str>,
2896    {
2897        self._scopes.insert(String::from(scope.as_ref()));
2898        self
2899    }
2900    /// Identifies the authorization scope(s) for the method you are building.
2901    ///
2902    /// See [`Self::add_scope()`] for details.
2903    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
2904    where
2905        I: IntoIterator<Item = St>,
2906        St: AsRef<str>,
2907    {
2908        self._scopes
2909            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2910        self
2911    }
2912
2913    /// Removes all scopes, and no default scope will be used either.
2914    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2915    /// for details).
2916    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
2917        self._scopes.clear();
2918        self
2919    }
2920}
2921
2922/// Gets details of a single Data Fusion instance.
2923///
2924/// A builder for the *locations.instances.get* method supported by a *project* resource.
2925/// It is not used directly, but through a [`ProjectMethods`] instance.
2926///
2927/// # Example
2928///
2929/// Instantiate a resource method builder
2930///
2931/// ```test_harness,no_run
2932/// # extern crate hyper;
2933/// # extern crate hyper_rustls;
2934/// # extern crate google_datafusion1 as datafusion1;
2935/// # async fn dox() {
2936/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2937///
2938/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2939/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2940/// #     secret,
2941/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2942/// # ).build().await.unwrap();
2943///
2944/// # let client = hyper_util::client::legacy::Client::builder(
2945/// #     hyper_util::rt::TokioExecutor::new()
2946/// # )
2947/// # .build(
2948/// #     hyper_rustls::HttpsConnectorBuilder::new()
2949/// #         .with_native_roots()
2950/// #         .unwrap()
2951/// #         .https_or_http()
2952/// #         .enable_http1()
2953/// #         .build()
2954/// # );
2955/// # let mut hub = DataFusion::new(client, auth);
2956/// // You can configure optional parameters by calling the respective setters at will, and
2957/// // execute the final call using `doit()`.
2958/// // Values shown here are possibly random and not representative !
2959/// let result = hub.projects().locations_instances_get("name")
2960///              .doit().await;
2961/// # }
2962/// ```
2963pub struct ProjectLocationInstanceGetCall<'a, C>
2964where
2965    C: 'a,
2966{
2967    hub: &'a DataFusion<C>,
2968    _name: String,
2969    _delegate: Option<&'a mut dyn common::Delegate>,
2970    _additional_params: HashMap<String, String>,
2971    _scopes: BTreeSet<String>,
2972}
2973
2974impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
2975
2976impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
2977where
2978    C: common::Connector,
2979{
2980    /// Perform the operation you have build so far.
2981    pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
2982        use std::borrow::Cow;
2983        use std::io::{Read, Seek};
2984
2985        use common::{url::Params, ToParts};
2986        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2987
2988        let mut dd = common::DefaultDelegate;
2989        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2990        dlg.begin(common::MethodInfo {
2991            id: "datafusion.projects.locations.instances.get",
2992            http_method: hyper::Method::GET,
2993        });
2994
2995        for &field in ["alt", "name"].iter() {
2996            if self._additional_params.contains_key(field) {
2997                dlg.finished(false);
2998                return Err(common::Error::FieldClash(field));
2999            }
3000        }
3001
3002        let mut params = Params::with_capacity(3 + self._additional_params.len());
3003        params.push("name", self._name);
3004
3005        params.extend(self._additional_params.iter());
3006
3007        params.push("alt", "json");
3008        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3009        if self._scopes.is_empty() {
3010            self._scopes
3011                .insert(Scope::CloudPlatform.as_ref().to_string());
3012        }
3013
3014        #[allow(clippy::single_element_loop)]
3015        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3016            url = params.uri_replacement(url, param_name, find_this, true);
3017        }
3018        {
3019            let to_remove = ["name"];
3020            params.remove_params(&to_remove);
3021        }
3022
3023        let url = params.parse_with_url(&url);
3024
3025        loop {
3026            let token = match self
3027                .hub
3028                .auth
3029                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3030                .await
3031            {
3032                Ok(token) => token,
3033                Err(e) => match dlg.token(e) {
3034                    Ok(token) => token,
3035                    Err(e) => {
3036                        dlg.finished(false);
3037                        return Err(common::Error::MissingToken(e));
3038                    }
3039                },
3040            };
3041            let mut req_result = {
3042                let client = &self.hub.client;
3043                dlg.pre_request();
3044                let mut req_builder = hyper::Request::builder()
3045                    .method(hyper::Method::GET)
3046                    .uri(url.as_str())
3047                    .header(USER_AGENT, self.hub._user_agent.clone());
3048
3049                if let Some(token) = token.as_ref() {
3050                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3051                }
3052
3053                let request = req_builder
3054                    .header(CONTENT_LENGTH, 0_u64)
3055                    .body(common::to_body::<String>(None));
3056
3057                client.request(request.unwrap()).await
3058            };
3059
3060            match req_result {
3061                Err(err) => {
3062                    if let common::Retry::After(d) = dlg.http_error(&err) {
3063                        sleep(d).await;
3064                        continue;
3065                    }
3066                    dlg.finished(false);
3067                    return Err(common::Error::HttpError(err));
3068                }
3069                Ok(res) => {
3070                    let (mut parts, body) = res.into_parts();
3071                    let mut body = common::Body::new(body);
3072                    if !parts.status.is_success() {
3073                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3074                        let error = serde_json::from_str(&common::to_string(&bytes));
3075                        let response = common::to_response(parts, bytes.into());
3076
3077                        if let common::Retry::After(d) =
3078                            dlg.http_failure(&response, error.as_ref().ok())
3079                        {
3080                            sleep(d).await;
3081                            continue;
3082                        }
3083
3084                        dlg.finished(false);
3085
3086                        return Err(match error {
3087                            Ok(value) => common::Error::BadRequest(value),
3088                            _ => common::Error::Failure(response),
3089                        });
3090                    }
3091                    let response = {
3092                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3093                        let encoded = common::to_string(&bytes);
3094                        match serde_json::from_str(&encoded) {
3095                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3096                            Err(error) => {
3097                                dlg.response_json_decode_error(&encoded, &error);
3098                                return Err(common::Error::JsonDecodeError(
3099                                    encoded.to_string(),
3100                                    error,
3101                                ));
3102                            }
3103                        }
3104                    };
3105
3106                    dlg.finished(true);
3107                    return Ok(response);
3108                }
3109            }
3110        }
3111    }
3112
3113    /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
3114    ///
3115    /// Sets the *name* path property to the given value.
3116    ///
3117    /// Even though the property as already been set when instantiating this call,
3118    /// we provide this method for API completeness.
3119    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
3120        self._name = new_value.to_string();
3121        self
3122    }
3123    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3124    /// while executing the actual API request.
3125    ///
3126    /// ````text
3127    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3128    /// ````
3129    ///
3130    /// Sets the *delegate* property to the given value.
3131    pub fn delegate(
3132        mut self,
3133        new_value: &'a mut dyn common::Delegate,
3134    ) -> ProjectLocationInstanceGetCall<'a, C> {
3135        self._delegate = Some(new_value);
3136        self
3137    }
3138
3139    /// Set any additional parameter of the query string used in the request.
3140    /// It should be used to set parameters which are not yet available through their own
3141    /// setters.
3142    ///
3143    /// Please note that this method must not be used to set any of the known parameters
3144    /// which have their own setter method. If done anyway, the request will fail.
3145    ///
3146    /// # Additional Parameters
3147    ///
3148    /// * *$.xgafv* (query-string) - V1 error format.
3149    /// * *access_token* (query-string) - OAuth access token.
3150    /// * *alt* (query-string) - Data format for response.
3151    /// * *callback* (query-string) - JSONP
3152    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3153    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3154    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3155    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3156    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3157    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3158    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3159    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
3160    where
3161        T: AsRef<str>,
3162    {
3163        self._additional_params
3164            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3165        self
3166    }
3167
3168    /// Identifies the authorization scope for the method you are building.
3169    ///
3170    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3171    /// [`Scope::CloudPlatform`].
3172    ///
3173    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3174    /// tokens for more than one scope.
3175    ///
3176    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3177    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3178    /// sufficient, a read-write scope will do as well.
3179    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
3180    where
3181        St: AsRef<str>,
3182    {
3183        self._scopes.insert(String::from(scope.as_ref()));
3184        self
3185    }
3186    /// Identifies the authorization scope(s) for the method you are building.
3187    ///
3188    /// See [`Self::add_scope()`] for details.
3189    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
3190    where
3191        I: IntoIterator<Item = St>,
3192        St: AsRef<str>,
3193    {
3194        self._scopes
3195            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3196        self
3197    }
3198
3199    /// Removes all scopes, and no default scope will be used either.
3200    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3201    /// for details).
3202    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
3203        self._scopes.clear();
3204        self
3205    }
3206}
3207
3208/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3209///
3210/// A builder for the *locations.instances.getIamPolicy* method supported by a *project* resource.
3211/// It is not used directly, but through a [`ProjectMethods`] instance.
3212///
3213/// # Example
3214///
3215/// Instantiate a resource method builder
3216///
3217/// ```test_harness,no_run
3218/// # extern crate hyper;
3219/// # extern crate hyper_rustls;
3220/// # extern crate google_datafusion1 as datafusion1;
3221/// # async fn dox() {
3222/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3223///
3224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3225/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3226/// #     secret,
3227/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3228/// # ).build().await.unwrap();
3229///
3230/// # let client = hyper_util::client::legacy::Client::builder(
3231/// #     hyper_util::rt::TokioExecutor::new()
3232/// # )
3233/// # .build(
3234/// #     hyper_rustls::HttpsConnectorBuilder::new()
3235/// #         .with_native_roots()
3236/// #         .unwrap()
3237/// #         .https_or_http()
3238/// #         .enable_http1()
3239/// #         .build()
3240/// # );
3241/// # let mut hub = DataFusion::new(client, auth);
3242/// // You can configure optional parameters by calling the respective setters at will, and
3243/// // execute the final call using `doit()`.
3244/// // Values shown here are possibly random and not representative !
3245/// let result = hub.projects().locations_instances_get_iam_policy("resource")
3246///              .options_requested_policy_version(-4)
3247///              .doit().await;
3248/// # }
3249/// ```
3250pub struct ProjectLocationInstanceGetIamPolicyCall<'a, C>
3251where
3252    C: 'a,
3253{
3254    hub: &'a DataFusion<C>,
3255    _resource: String,
3256    _options_requested_policy_version: Option<i32>,
3257    _delegate: Option<&'a mut dyn common::Delegate>,
3258    _additional_params: HashMap<String, String>,
3259    _scopes: BTreeSet<String>,
3260}
3261
3262impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetIamPolicyCall<'a, C> {}
3263
3264impl<'a, C> ProjectLocationInstanceGetIamPolicyCall<'a, C>
3265where
3266    C: common::Connector,
3267{
3268    /// Perform the operation you have build so far.
3269    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3270        use std::borrow::Cow;
3271        use std::io::{Read, Seek};
3272
3273        use common::{url::Params, ToParts};
3274        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3275
3276        let mut dd = common::DefaultDelegate;
3277        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3278        dlg.begin(common::MethodInfo {
3279            id: "datafusion.projects.locations.instances.getIamPolicy",
3280            http_method: hyper::Method::GET,
3281        });
3282
3283        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
3284            if self._additional_params.contains_key(field) {
3285                dlg.finished(false);
3286                return Err(common::Error::FieldClash(field));
3287            }
3288        }
3289
3290        let mut params = Params::with_capacity(4 + self._additional_params.len());
3291        params.push("resource", self._resource);
3292        if let Some(value) = self._options_requested_policy_version.as_ref() {
3293            params.push("options.requestedPolicyVersion", value.to_string());
3294        }
3295
3296        params.extend(self._additional_params.iter());
3297
3298        params.push("alt", "json");
3299        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
3300        if self._scopes.is_empty() {
3301            self._scopes
3302                .insert(Scope::CloudPlatform.as_ref().to_string());
3303        }
3304
3305        #[allow(clippy::single_element_loop)]
3306        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3307            url = params.uri_replacement(url, param_name, find_this, true);
3308        }
3309        {
3310            let to_remove = ["resource"];
3311            params.remove_params(&to_remove);
3312        }
3313
3314        let url = params.parse_with_url(&url);
3315
3316        loop {
3317            let token = match self
3318                .hub
3319                .auth
3320                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3321                .await
3322            {
3323                Ok(token) => token,
3324                Err(e) => match dlg.token(e) {
3325                    Ok(token) => token,
3326                    Err(e) => {
3327                        dlg.finished(false);
3328                        return Err(common::Error::MissingToken(e));
3329                    }
3330                },
3331            };
3332            let mut req_result = {
3333                let client = &self.hub.client;
3334                dlg.pre_request();
3335                let mut req_builder = hyper::Request::builder()
3336                    .method(hyper::Method::GET)
3337                    .uri(url.as_str())
3338                    .header(USER_AGENT, self.hub._user_agent.clone());
3339
3340                if let Some(token) = token.as_ref() {
3341                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3342                }
3343
3344                let request = req_builder
3345                    .header(CONTENT_LENGTH, 0_u64)
3346                    .body(common::to_body::<String>(None));
3347
3348                client.request(request.unwrap()).await
3349            };
3350
3351            match req_result {
3352                Err(err) => {
3353                    if let common::Retry::After(d) = dlg.http_error(&err) {
3354                        sleep(d).await;
3355                        continue;
3356                    }
3357                    dlg.finished(false);
3358                    return Err(common::Error::HttpError(err));
3359                }
3360                Ok(res) => {
3361                    let (mut parts, body) = res.into_parts();
3362                    let mut body = common::Body::new(body);
3363                    if !parts.status.is_success() {
3364                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3365                        let error = serde_json::from_str(&common::to_string(&bytes));
3366                        let response = common::to_response(parts, bytes.into());
3367
3368                        if let common::Retry::After(d) =
3369                            dlg.http_failure(&response, error.as_ref().ok())
3370                        {
3371                            sleep(d).await;
3372                            continue;
3373                        }
3374
3375                        dlg.finished(false);
3376
3377                        return Err(match error {
3378                            Ok(value) => common::Error::BadRequest(value),
3379                            _ => common::Error::Failure(response),
3380                        });
3381                    }
3382                    let response = {
3383                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3384                        let encoded = common::to_string(&bytes);
3385                        match serde_json::from_str(&encoded) {
3386                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3387                            Err(error) => {
3388                                dlg.response_json_decode_error(&encoded, &error);
3389                                return Err(common::Error::JsonDecodeError(
3390                                    encoded.to_string(),
3391                                    error,
3392                                ));
3393                            }
3394                        }
3395                    };
3396
3397                    dlg.finished(true);
3398                    return Ok(response);
3399                }
3400            }
3401        }
3402    }
3403
3404    /// 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.
3405    ///
3406    /// Sets the *resource* path property to the given value.
3407    ///
3408    /// Even though the property as already been set when instantiating this call,
3409    /// we provide this method for API completeness.
3410    pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
3411        self._resource = new_value.to_string();
3412        self
3413    }
3414    /// 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).
3415    ///
3416    /// Sets the *options.requested policy version* query property to the given value.
3417    pub fn options_requested_policy_version(
3418        mut self,
3419        new_value: i32,
3420    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
3421        self._options_requested_policy_version = Some(new_value);
3422        self
3423    }
3424    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3425    /// while executing the actual API request.
3426    ///
3427    /// ````text
3428    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3429    /// ````
3430    ///
3431    /// Sets the *delegate* property to the given value.
3432    pub fn delegate(
3433        mut self,
3434        new_value: &'a mut dyn common::Delegate,
3435    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
3436        self._delegate = Some(new_value);
3437        self
3438    }
3439
3440    /// Set any additional parameter of the query string used in the request.
3441    /// It should be used to set parameters which are not yet available through their own
3442    /// setters.
3443    ///
3444    /// Please note that this method must not be used to set any of the known parameters
3445    /// which have their own setter method. If done anyway, the request will fail.
3446    ///
3447    /// # Additional Parameters
3448    ///
3449    /// * *$.xgafv* (query-string) - V1 error format.
3450    /// * *access_token* (query-string) - OAuth access token.
3451    /// * *alt* (query-string) - Data format for response.
3452    /// * *callback* (query-string) - JSONP
3453    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3454    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3455    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3456    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3457    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3458    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3459    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3460    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
3461    where
3462        T: AsRef<str>,
3463    {
3464        self._additional_params
3465            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3466        self
3467    }
3468
3469    /// Identifies the authorization scope for the method you are building.
3470    ///
3471    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3472    /// [`Scope::CloudPlatform`].
3473    ///
3474    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3475    /// tokens for more than one scope.
3476    ///
3477    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3478    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3479    /// sufficient, a read-write scope will do as well.
3480    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
3481    where
3482        St: AsRef<str>,
3483    {
3484        self._scopes.insert(String::from(scope.as_ref()));
3485        self
3486    }
3487    /// Identifies the authorization scope(s) for the method you are building.
3488    ///
3489    /// See [`Self::add_scope()`] for details.
3490    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
3491    where
3492        I: IntoIterator<Item = St>,
3493        St: AsRef<str>,
3494    {
3495        self._scopes
3496            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3497        self
3498    }
3499
3500    /// Removes all scopes, and no default scope will be used either.
3501    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3502    /// for details).
3503    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
3504        self._scopes.clear();
3505        self
3506    }
3507}
3508
3509/// Lists Data Fusion instances in the specified project and location.
3510///
3511/// A builder for the *locations.instances.list* method supported by a *project* resource.
3512/// It is not used directly, but through a [`ProjectMethods`] instance.
3513///
3514/// # Example
3515///
3516/// Instantiate a resource method builder
3517///
3518/// ```test_harness,no_run
3519/// # extern crate hyper;
3520/// # extern crate hyper_rustls;
3521/// # extern crate google_datafusion1 as datafusion1;
3522/// # async fn dox() {
3523/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3524///
3525/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3526/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3527/// #     secret,
3528/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3529/// # ).build().await.unwrap();
3530///
3531/// # let client = hyper_util::client::legacy::Client::builder(
3532/// #     hyper_util::rt::TokioExecutor::new()
3533/// # )
3534/// # .build(
3535/// #     hyper_rustls::HttpsConnectorBuilder::new()
3536/// #         .with_native_roots()
3537/// #         .unwrap()
3538/// #         .https_or_http()
3539/// #         .enable_http1()
3540/// #         .build()
3541/// # );
3542/// # let mut hub = DataFusion::new(client, auth);
3543/// // You can configure optional parameters by calling the respective setters at will, and
3544/// // execute the final call using `doit()`.
3545/// // Values shown here are possibly random and not representative !
3546/// let result = hub.projects().locations_instances_list("parent")
3547///              .page_token("ipsum")
3548///              .page_size(-88)
3549///              .order_by("amet")
3550///              .filter("duo")
3551///              .doit().await;
3552/// # }
3553/// ```
3554pub struct ProjectLocationInstanceListCall<'a, C>
3555where
3556    C: 'a,
3557{
3558    hub: &'a DataFusion<C>,
3559    _parent: String,
3560    _page_token: Option<String>,
3561    _page_size: Option<i32>,
3562    _order_by: Option<String>,
3563    _filter: Option<String>,
3564    _delegate: Option<&'a mut dyn common::Delegate>,
3565    _additional_params: HashMap<String, String>,
3566    _scopes: BTreeSet<String>,
3567}
3568
3569impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
3570
3571impl<'a, C> ProjectLocationInstanceListCall<'a, C>
3572where
3573    C: common::Connector,
3574{
3575    /// Perform the operation you have build so far.
3576    pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
3577        use std::borrow::Cow;
3578        use std::io::{Read, Seek};
3579
3580        use common::{url::Params, ToParts};
3581        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3582
3583        let mut dd = common::DefaultDelegate;
3584        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3585        dlg.begin(common::MethodInfo {
3586            id: "datafusion.projects.locations.instances.list",
3587            http_method: hyper::Method::GET,
3588        });
3589
3590        for &field in [
3591            "alt",
3592            "parent",
3593            "pageToken",
3594            "pageSize",
3595            "orderBy",
3596            "filter",
3597        ]
3598        .iter()
3599        {
3600            if self._additional_params.contains_key(field) {
3601                dlg.finished(false);
3602                return Err(common::Error::FieldClash(field));
3603            }
3604        }
3605
3606        let mut params = Params::with_capacity(7 + self._additional_params.len());
3607        params.push("parent", self._parent);
3608        if let Some(value) = self._page_token.as_ref() {
3609            params.push("pageToken", value);
3610        }
3611        if let Some(value) = self._page_size.as_ref() {
3612            params.push("pageSize", value.to_string());
3613        }
3614        if let Some(value) = self._order_by.as_ref() {
3615            params.push("orderBy", value);
3616        }
3617        if let Some(value) = self._filter.as_ref() {
3618            params.push("filter", value);
3619        }
3620
3621        params.extend(self._additional_params.iter());
3622
3623        params.push("alt", "json");
3624        let mut url = self.hub._base_url.clone() + "v1/{+parent}/instances";
3625        if self._scopes.is_empty() {
3626            self._scopes
3627                .insert(Scope::CloudPlatform.as_ref().to_string());
3628        }
3629
3630        #[allow(clippy::single_element_loop)]
3631        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3632            url = params.uri_replacement(url, param_name, find_this, true);
3633        }
3634        {
3635            let to_remove = ["parent"];
3636            params.remove_params(&to_remove);
3637        }
3638
3639        let url = params.parse_with_url(&url);
3640
3641        loop {
3642            let token = match self
3643                .hub
3644                .auth
3645                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3646                .await
3647            {
3648                Ok(token) => token,
3649                Err(e) => match dlg.token(e) {
3650                    Ok(token) => token,
3651                    Err(e) => {
3652                        dlg.finished(false);
3653                        return Err(common::Error::MissingToken(e));
3654                    }
3655                },
3656            };
3657            let mut req_result = {
3658                let client = &self.hub.client;
3659                dlg.pre_request();
3660                let mut req_builder = hyper::Request::builder()
3661                    .method(hyper::Method::GET)
3662                    .uri(url.as_str())
3663                    .header(USER_AGENT, self.hub._user_agent.clone());
3664
3665                if let Some(token) = token.as_ref() {
3666                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3667                }
3668
3669                let request = req_builder
3670                    .header(CONTENT_LENGTH, 0_u64)
3671                    .body(common::to_body::<String>(None));
3672
3673                client.request(request.unwrap()).await
3674            };
3675
3676            match req_result {
3677                Err(err) => {
3678                    if let common::Retry::After(d) = dlg.http_error(&err) {
3679                        sleep(d).await;
3680                        continue;
3681                    }
3682                    dlg.finished(false);
3683                    return Err(common::Error::HttpError(err));
3684                }
3685                Ok(res) => {
3686                    let (mut parts, body) = res.into_parts();
3687                    let mut body = common::Body::new(body);
3688                    if !parts.status.is_success() {
3689                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3690                        let error = serde_json::from_str(&common::to_string(&bytes));
3691                        let response = common::to_response(parts, bytes.into());
3692
3693                        if let common::Retry::After(d) =
3694                            dlg.http_failure(&response, error.as_ref().ok())
3695                        {
3696                            sleep(d).await;
3697                            continue;
3698                        }
3699
3700                        dlg.finished(false);
3701
3702                        return Err(match error {
3703                            Ok(value) => common::Error::BadRequest(value),
3704                            _ => common::Error::Failure(response),
3705                        });
3706                    }
3707                    let response = {
3708                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3709                        let encoded = common::to_string(&bytes);
3710                        match serde_json::from_str(&encoded) {
3711                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3712                            Err(error) => {
3713                                dlg.response_json_decode_error(&encoded, &error);
3714                                return Err(common::Error::JsonDecodeError(
3715                                    encoded.to_string(),
3716                                    error,
3717                                ));
3718                            }
3719                        }
3720                    };
3721
3722                    dlg.finished(true);
3723                    return Ok(response);
3724                }
3725            }
3726        }
3727    }
3728
3729    /// Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}. If the location is specified as '-' (wildcard), then all regions available to the project are queried, and the results are aggregated.
3730    ///
3731    /// Sets the *parent* path property to the given value.
3732    ///
3733    /// Even though the property as already been set when instantiating this call,
3734    /// we provide this method for API completeness.
3735    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
3736        self._parent = new_value.to_string();
3737        self
3738    }
3739    /// The next_page_token value to use if there are additional results to retrieve for this list request.
3740    ///
3741    /// Sets the *page token* query property to the given value.
3742    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
3743        self._page_token = Some(new_value.to_string());
3744        self
3745    }
3746    /// The maximum number of items to return.
3747    ///
3748    /// Sets the *page size* query property to the given value.
3749    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
3750        self._page_size = Some(new_value);
3751        self
3752    }
3753    /// Sort results. Supported values are "name", "name desc", or "" (unsorted).
3754    ///
3755    /// Sets the *order by* query property to the given value.
3756    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
3757        self._order_by = Some(new_value.to_string());
3758        self
3759    }
3760    /// List filter.
3761    ///
3762    /// Sets the *filter* query property to the given value.
3763    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
3764        self._filter = Some(new_value.to_string());
3765        self
3766    }
3767    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3768    /// while executing the actual API request.
3769    ///
3770    /// ````text
3771    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3772    /// ````
3773    ///
3774    /// Sets the *delegate* property to the given value.
3775    pub fn delegate(
3776        mut self,
3777        new_value: &'a mut dyn common::Delegate,
3778    ) -> ProjectLocationInstanceListCall<'a, C> {
3779        self._delegate = Some(new_value);
3780        self
3781    }
3782
3783    /// Set any additional parameter of the query string used in the request.
3784    /// It should be used to set parameters which are not yet available through their own
3785    /// setters.
3786    ///
3787    /// Please note that this method must not be used to set any of the known parameters
3788    /// which have their own setter method. If done anyway, the request will fail.
3789    ///
3790    /// # Additional Parameters
3791    ///
3792    /// * *$.xgafv* (query-string) - V1 error format.
3793    /// * *access_token* (query-string) - OAuth access token.
3794    /// * *alt* (query-string) - Data format for response.
3795    /// * *callback* (query-string) - JSONP
3796    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3797    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3798    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3799    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3800    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3801    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3802    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3803    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
3804    where
3805        T: AsRef<str>,
3806    {
3807        self._additional_params
3808            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3809        self
3810    }
3811
3812    /// Identifies the authorization scope for the method you are building.
3813    ///
3814    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3815    /// [`Scope::CloudPlatform`].
3816    ///
3817    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3818    /// tokens for more than one scope.
3819    ///
3820    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3821    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3822    /// sufficient, a read-write scope will do as well.
3823    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
3824    where
3825        St: AsRef<str>,
3826    {
3827        self._scopes.insert(String::from(scope.as_ref()));
3828        self
3829    }
3830    /// Identifies the authorization scope(s) for the method you are building.
3831    ///
3832    /// See [`Self::add_scope()`] for details.
3833    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
3834    where
3835        I: IntoIterator<Item = St>,
3836        St: AsRef<str>,
3837    {
3838        self._scopes
3839            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3840        self
3841    }
3842
3843    /// Removes all scopes, and no default scope will be used either.
3844    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3845    /// for details).
3846    pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
3847        self._scopes.clear();
3848        self
3849    }
3850}
3851
3852/// Updates a single Data Fusion instance.
3853///
3854/// A builder for the *locations.instances.patch* method supported by a *project* resource.
3855/// It is not used directly, but through a [`ProjectMethods`] instance.
3856///
3857/// # Example
3858///
3859/// Instantiate a resource method builder
3860///
3861/// ```test_harness,no_run
3862/// # extern crate hyper;
3863/// # extern crate hyper_rustls;
3864/// # extern crate google_datafusion1 as datafusion1;
3865/// use datafusion1::api::Instance;
3866/// # async fn dox() {
3867/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3868///
3869/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3870/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3871/// #     secret,
3872/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
3884/// #         .build()
3885/// # );
3886/// # let mut hub = DataFusion::new(client, auth);
3887/// // As the method needs a request, you would usually fill it with the desired information
3888/// // into the respective structure. Some of the parts shown here might not be applicable !
3889/// // Values shown here are possibly random and not representative !
3890/// let mut req = Instance::default();
3891///
3892/// // You can configure optional parameters by calling the respective setters at will, and
3893/// // execute the final call using `doit()`.
3894/// // Values shown here are possibly random and not representative !
3895/// let result = hub.projects().locations_instances_patch(req, "name")
3896///              .update_mask(FieldMask::new::<&str>(&[]))
3897///              .doit().await;
3898/// # }
3899/// ```
3900pub struct ProjectLocationInstancePatchCall<'a, C>
3901where
3902    C: 'a,
3903{
3904    hub: &'a DataFusion<C>,
3905    _request: Instance,
3906    _name: String,
3907    _update_mask: Option<common::FieldMask>,
3908    _delegate: Option<&'a mut dyn common::Delegate>,
3909    _additional_params: HashMap<String, String>,
3910    _scopes: BTreeSet<String>,
3911}
3912
3913impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
3914
3915impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
3916where
3917    C: common::Connector,
3918{
3919    /// Perform the operation you have build so far.
3920    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3921        use std::borrow::Cow;
3922        use std::io::{Read, Seek};
3923
3924        use common::{url::Params, ToParts};
3925        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3926
3927        let mut dd = common::DefaultDelegate;
3928        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3929        dlg.begin(common::MethodInfo {
3930            id: "datafusion.projects.locations.instances.patch",
3931            http_method: hyper::Method::PATCH,
3932        });
3933
3934        for &field in ["alt", "name", "updateMask"].iter() {
3935            if self._additional_params.contains_key(field) {
3936                dlg.finished(false);
3937                return Err(common::Error::FieldClash(field));
3938            }
3939        }
3940
3941        let mut params = Params::with_capacity(5 + self._additional_params.len());
3942        params.push("name", self._name);
3943        if let Some(value) = self._update_mask.as_ref() {
3944            params.push("updateMask", value.to_string());
3945        }
3946
3947        params.extend(self._additional_params.iter());
3948
3949        params.push("alt", "json");
3950        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3951        if self._scopes.is_empty() {
3952            self._scopes
3953                .insert(Scope::CloudPlatform.as_ref().to_string());
3954        }
3955
3956        #[allow(clippy::single_element_loop)]
3957        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3958            url = params.uri_replacement(url, param_name, find_this, true);
3959        }
3960        {
3961            let to_remove = ["name"];
3962            params.remove_params(&to_remove);
3963        }
3964
3965        let url = params.parse_with_url(&url);
3966
3967        let mut json_mime_type = mime::APPLICATION_JSON;
3968        let mut request_value_reader = {
3969            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3970            common::remove_json_null_values(&mut value);
3971            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3972            serde_json::to_writer(&mut dst, &value).unwrap();
3973            dst
3974        };
3975        let request_size = request_value_reader
3976            .seek(std::io::SeekFrom::End(0))
3977            .unwrap();
3978        request_value_reader
3979            .seek(std::io::SeekFrom::Start(0))
3980            .unwrap();
3981
3982        loop {
3983            let token = match self
3984                .hub
3985                .auth
3986                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3987                .await
3988            {
3989                Ok(token) => token,
3990                Err(e) => match dlg.token(e) {
3991                    Ok(token) => token,
3992                    Err(e) => {
3993                        dlg.finished(false);
3994                        return Err(common::Error::MissingToken(e));
3995                    }
3996                },
3997            };
3998            request_value_reader
3999                .seek(std::io::SeekFrom::Start(0))
4000                .unwrap();
4001            let mut req_result = {
4002                let client = &self.hub.client;
4003                dlg.pre_request();
4004                let mut req_builder = hyper::Request::builder()
4005                    .method(hyper::Method::PATCH)
4006                    .uri(url.as_str())
4007                    .header(USER_AGENT, self.hub._user_agent.clone());
4008
4009                if let Some(token) = token.as_ref() {
4010                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4011                }
4012
4013                let request = req_builder
4014                    .header(CONTENT_TYPE, json_mime_type.to_string())
4015                    .header(CONTENT_LENGTH, request_size as u64)
4016                    .body(common::to_body(
4017                        request_value_reader.get_ref().clone().into(),
4018                    ));
4019
4020                client.request(request.unwrap()).await
4021            };
4022
4023            match req_result {
4024                Err(err) => {
4025                    if let common::Retry::After(d) = dlg.http_error(&err) {
4026                        sleep(d).await;
4027                        continue;
4028                    }
4029                    dlg.finished(false);
4030                    return Err(common::Error::HttpError(err));
4031                }
4032                Ok(res) => {
4033                    let (mut parts, body) = res.into_parts();
4034                    let mut body = common::Body::new(body);
4035                    if !parts.status.is_success() {
4036                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4037                        let error = serde_json::from_str(&common::to_string(&bytes));
4038                        let response = common::to_response(parts, bytes.into());
4039
4040                        if let common::Retry::After(d) =
4041                            dlg.http_failure(&response, error.as_ref().ok())
4042                        {
4043                            sleep(d).await;
4044                            continue;
4045                        }
4046
4047                        dlg.finished(false);
4048
4049                        return Err(match error {
4050                            Ok(value) => common::Error::BadRequest(value),
4051                            _ => common::Error::Failure(response),
4052                        });
4053                    }
4054                    let response = {
4055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4056                        let encoded = common::to_string(&bytes);
4057                        match serde_json::from_str(&encoded) {
4058                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4059                            Err(error) => {
4060                                dlg.response_json_decode_error(&encoded, &error);
4061                                return Err(common::Error::JsonDecodeError(
4062                                    encoded.to_string(),
4063                                    error,
4064                                ));
4065                            }
4066                        }
4067                    };
4068
4069                    dlg.finished(true);
4070                    return Ok(response);
4071                }
4072            }
4073        }
4074    }
4075
4076    ///
4077    /// Sets the *request* property to the given value.
4078    ///
4079    /// Even though the property as already been set when instantiating this call,
4080    /// we provide this method for API completeness.
4081    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
4082        self._request = new_value;
4083        self
4084    }
4085    /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
4086    ///
4087    /// Sets the *name* path property to the given value.
4088    ///
4089    /// Even though the property as already been set when instantiating this call,
4090    /// we provide this method for API completeness.
4091    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
4092        self._name = new_value.to_string();
4093        self
4094    }
4095    /// Field mask is used to specify the fields that the update will overwrite in an instance resource. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask, the label field will be overwritten.
4096    ///
4097    /// Sets the *update mask* query property to the given value.
4098    pub fn update_mask(
4099        mut self,
4100        new_value: common::FieldMask,
4101    ) -> ProjectLocationInstancePatchCall<'a, C> {
4102        self._update_mask = Some(new_value);
4103        self
4104    }
4105    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4106    /// while executing the actual API request.
4107    ///
4108    /// ````text
4109    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4110    /// ````
4111    ///
4112    /// Sets the *delegate* property to the given value.
4113    pub fn delegate(
4114        mut self,
4115        new_value: &'a mut dyn common::Delegate,
4116    ) -> ProjectLocationInstancePatchCall<'a, C> {
4117        self._delegate = Some(new_value);
4118        self
4119    }
4120
4121    /// Set any additional parameter of the query string used in the request.
4122    /// It should be used to set parameters which are not yet available through their own
4123    /// setters.
4124    ///
4125    /// Please note that this method must not be used to set any of the known parameters
4126    /// which have their own setter method. If done anyway, the request will fail.
4127    ///
4128    /// # Additional Parameters
4129    ///
4130    /// * *$.xgafv* (query-string) - V1 error format.
4131    /// * *access_token* (query-string) - OAuth access token.
4132    /// * *alt* (query-string) - Data format for response.
4133    /// * *callback* (query-string) - JSONP
4134    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4135    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4136    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4137    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4138    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4139    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4140    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4141    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
4142    where
4143        T: AsRef<str>,
4144    {
4145        self._additional_params
4146            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4147        self
4148    }
4149
4150    /// Identifies the authorization scope for the method you are building.
4151    ///
4152    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4153    /// [`Scope::CloudPlatform`].
4154    ///
4155    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4156    /// tokens for more than one scope.
4157    ///
4158    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4159    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4160    /// sufficient, a read-write scope will do as well.
4161    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
4162    where
4163        St: AsRef<str>,
4164    {
4165        self._scopes.insert(String::from(scope.as_ref()));
4166        self
4167    }
4168    /// Identifies the authorization scope(s) for the method you are building.
4169    ///
4170    /// See [`Self::add_scope()`] for details.
4171    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
4172    where
4173        I: IntoIterator<Item = St>,
4174        St: AsRef<str>,
4175    {
4176        self._scopes
4177            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4178        self
4179    }
4180
4181    /// Removes all scopes, and no default scope will be used either.
4182    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4183    /// for details).
4184    pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
4185        self._scopes.clear();
4186        self
4187    }
4188}
4189
4190/// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
4191///
4192/// A builder for the *locations.instances.restart* method supported by a *project* resource.
4193/// It is not used directly, but through a [`ProjectMethods`] instance.
4194///
4195/// # Example
4196///
4197/// Instantiate a resource method builder
4198///
4199/// ```test_harness,no_run
4200/// # extern crate hyper;
4201/// # extern crate hyper_rustls;
4202/// # extern crate google_datafusion1 as datafusion1;
4203/// use datafusion1::api::RestartInstanceRequest;
4204/// # async fn dox() {
4205/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4206///
4207/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4208/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4209/// #     secret,
4210/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4211/// # ).build().await.unwrap();
4212///
4213/// # let client = hyper_util::client::legacy::Client::builder(
4214/// #     hyper_util::rt::TokioExecutor::new()
4215/// # )
4216/// # .build(
4217/// #     hyper_rustls::HttpsConnectorBuilder::new()
4218/// #         .with_native_roots()
4219/// #         .unwrap()
4220/// #         .https_or_http()
4221/// #         .enable_http1()
4222/// #         .build()
4223/// # );
4224/// # let mut hub = DataFusion::new(client, auth);
4225/// // As the method needs a request, you would usually fill it with the desired information
4226/// // into the respective structure. Some of the parts shown here might not be applicable !
4227/// // Values shown here are possibly random and not representative !
4228/// let mut req = RestartInstanceRequest::default();
4229///
4230/// // You can configure optional parameters by calling the respective setters at will, and
4231/// // execute the final call using `doit()`.
4232/// // Values shown here are possibly random and not representative !
4233/// let result = hub.projects().locations_instances_restart(req, "name")
4234///              .doit().await;
4235/// # }
4236/// ```
4237pub struct ProjectLocationInstanceRestartCall<'a, C>
4238where
4239    C: 'a,
4240{
4241    hub: &'a DataFusion<C>,
4242    _request: RestartInstanceRequest,
4243    _name: String,
4244    _delegate: Option<&'a mut dyn common::Delegate>,
4245    _additional_params: HashMap<String, String>,
4246    _scopes: BTreeSet<String>,
4247}
4248
4249impl<'a, C> common::CallBuilder for ProjectLocationInstanceRestartCall<'a, C> {}
4250
4251impl<'a, C> ProjectLocationInstanceRestartCall<'a, C>
4252where
4253    C: common::Connector,
4254{
4255    /// Perform the operation you have build so far.
4256    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4257        use std::borrow::Cow;
4258        use std::io::{Read, Seek};
4259
4260        use common::{url::Params, ToParts};
4261        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4262
4263        let mut dd = common::DefaultDelegate;
4264        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4265        dlg.begin(common::MethodInfo {
4266            id: "datafusion.projects.locations.instances.restart",
4267            http_method: hyper::Method::POST,
4268        });
4269
4270        for &field in ["alt", "name"].iter() {
4271            if self._additional_params.contains_key(field) {
4272                dlg.finished(false);
4273                return Err(common::Error::FieldClash(field));
4274            }
4275        }
4276
4277        let mut params = Params::with_capacity(4 + self._additional_params.len());
4278        params.push("name", self._name);
4279
4280        params.extend(self._additional_params.iter());
4281
4282        params.push("alt", "json");
4283        let mut url = self.hub._base_url.clone() + "v1/{+name}:restart";
4284        if self._scopes.is_empty() {
4285            self._scopes
4286                .insert(Scope::CloudPlatform.as_ref().to_string());
4287        }
4288
4289        #[allow(clippy::single_element_loop)]
4290        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4291            url = params.uri_replacement(url, param_name, find_this, true);
4292        }
4293        {
4294            let to_remove = ["name"];
4295            params.remove_params(&to_remove);
4296        }
4297
4298        let url = params.parse_with_url(&url);
4299
4300        let mut json_mime_type = mime::APPLICATION_JSON;
4301        let mut request_value_reader = {
4302            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4303            common::remove_json_null_values(&mut value);
4304            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4305            serde_json::to_writer(&mut dst, &value).unwrap();
4306            dst
4307        };
4308        let request_size = request_value_reader
4309            .seek(std::io::SeekFrom::End(0))
4310            .unwrap();
4311        request_value_reader
4312            .seek(std::io::SeekFrom::Start(0))
4313            .unwrap();
4314
4315        loop {
4316            let token = match self
4317                .hub
4318                .auth
4319                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4320                .await
4321            {
4322                Ok(token) => token,
4323                Err(e) => match dlg.token(e) {
4324                    Ok(token) => token,
4325                    Err(e) => {
4326                        dlg.finished(false);
4327                        return Err(common::Error::MissingToken(e));
4328                    }
4329                },
4330            };
4331            request_value_reader
4332                .seek(std::io::SeekFrom::Start(0))
4333                .unwrap();
4334            let mut req_result = {
4335                let client = &self.hub.client;
4336                dlg.pre_request();
4337                let mut req_builder = hyper::Request::builder()
4338                    .method(hyper::Method::POST)
4339                    .uri(url.as_str())
4340                    .header(USER_AGENT, self.hub._user_agent.clone());
4341
4342                if let Some(token) = token.as_ref() {
4343                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4344                }
4345
4346                let request = req_builder
4347                    .header(CONTENT_TYPE, json_mime_type.to_string())
4348                    .header(CONTENT_LENGTH, request_size as u64)
4349                    .body(common::to_body(
4350                        request_value_reader.get_ref().clone().into(),
4351                    ));
4352
4353                client.request(request.unwrap()).await
4354            };
4355
4356            match req_result {
4357                Err(err) => {
4358                    if let common::Retry::After(d) = dlg.http_error(&err) {
4359                        sleep(d).await;
4360                        continue;
4361                    }
4362                    dlg.finished(false);
4363                    return Err(common::Error::HttpError(err));
4364                }
4365                Ok(res) => {
4366                    let (mut parts, body) = res.into_parts();
4367                    let mut body = common::Body::new(body);
4368                    if !parts.status.is_success() {
4369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4370                        let error = serde_json::from_str(&common::to_string(&bytes));
4371                        let response = common::to_response(parts, bytes.into());
4372
4373                        if let common::Retry::After(d) =
4374                            dlg.http_failure(&response, error.as_ref().ok())
4375                        {
4376                            sleep(d).await;
4377                            continue;
4378                        }
4379
4380                        dlg.finished(false);
4381
4382                        return Err(match error {
4383                            Ok(value) => common::Error::BadRequest(value),
4384                            _ => common::Error::Failure(response),
4385                        });
4386                    }
4387                    let response = {
4388                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4389                        let encoded = common::to_string(&bytes);
4390                        match serde_json::from_str(&encoded) {
4391                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4392                            Err(error) => {
4393                                dlg.response_json_decode_error(&encoded, &error);
4394                                return Err(common::Error::JsonDecodeError(
4395                                    encoded.to_string(),
4396                                    error,
4397                                ));
4398                            }
4399                        }
4400                    };
4401
4402                    dlg.finished(true);
4403                    return Ok(response);
4404                }
4405            }
4406        }
4407    }
4408
4409    ///
4410    /// Sets the *request* property to the given value.
4411    ///
4412    /// Even though the property as already been set when instantiating this call,
4413    /// we provide this method for API completeness.
4414    pub fn request(
4415        mut self,
4416        new_value: RestartInstanceRequest,
4417    ) -> ProjectLocationInstanceRestartCall<'a, C> {
4418        self._request = new_value;
4419        self
4420    }
4421    /// Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
4422    ///
4423    /// Sets the *name* path property to the given value.
4424    ///
4425    /// Even though the property as already been set when instantiating this call,
4426    /// we provide this method for API completeness.
4427    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRestartCall<'a, C> {
4428        self._name = new_value.to_string();
4429        self
4430    }
4431    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4432    /// while executing the actual API request.
4433    ///
4434    /// ````text
4435    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4436    /// ````
4437    ///
4438    /// Sets the *delegate* property to the given value.
4439    pub fn delegate(
4440        mut self,
4441        new_value: &'a mut dyn common::Delegate,
4442    ) -> ProjectLocationInstanceRestartCall<'a, C> {
4443        self._delegate = Some(new_value);
4444        self
4445    }
4446
4447    /// Set any additional parameter of the query string used in the request.
4448    /// It should be used to set parameters which are not yet available through their own
4449    /// setters.
4450    ///
4451    /// Please note that this method must not be used to set any of the known parameters
4452    /// which have their own setter method. If done anyway, the request will fail.
4453    ///
4454    /// # Additional Parameters
4455    ///
4456    /// * *$.xgafv* (query-string) - V1 error format.
4457    /// * *access_token* (query-string) - OAuth access token.
4458    /// * *alt* (query-string) - Data format for response.
4459    /// * *callback* (query-string) - JSONP
4460    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4461    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4462    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4463    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4464    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4465    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4466    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4467    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRestartCall<'a, C>
4468    where
4469        T: AsRef<str>,
4470    {
4471        self._additional_params
4472            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4473        self
4474    }
4475
4476    /// Identifies the authorization scope for the method you are building.
4477    ///
4478    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4479    /// [`Scope::CloudPlatform`].
4480    ///
4481    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4482    /// tokens for more than one scope.
4483    ///
4484    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4485    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4486    /// sufficient, a read-write scope will do as well.
4487    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRestartCall<'a, C>
4488    where
4489        St: AsRef<str>,
4490    {
4491        self._scopes.insert(String::from(scope.as_ref()));
4492        self
4493    }
4494    /// Identifies the authorization scope(s) for the method you are building.
4495    ///
4496    /// See [`Self::add_scope()`] for details.
4497    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRestartCall<'a, C>
4498    where
4499        I: IntoIterator<Item = St>,
4500        St: AsRef<str>,
4501    {
4502        self._scopes
4503            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4504        self
4505    }
4506
4507    /// Removes all scopes, and no default scope will be used either.
4508    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4509    /// for details).
4510    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRestartCall<'a, C> {
4511        self._scopes.clear();
4512        self
4513    }
4514}
4515
4516/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4517///
4518/// A builder for the *locations.instances.setIamPolicy* method supported by a *project* resource.
4519/// It is not used directly, but through a [`ProjectMethods`] instance.
4520///
4521/// # Example
4522///
4523/// Instantiate a resource method builder
4524///
4525/// ```test_harness,no_run
4526/// # extern crate hyper;
4527/// # extern crate hyper_rustls;
4528/// # extern crate google_datafusion1 as datafusion1;
4529/// use datafusion1::api::SetIamPolicyRequest;
4530/// # async fn dox() {
4531/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4532///
4533/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4534/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4535/// #     secret,
4536/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4537/// # ).build().await.unwrap();
4538///
4539/// # let client = hyper_util::client::legacy::Client::builder(
4540/// #     hyper_util::rt::TokioExecutor::new()
4541/// # )
4542/// # .build(
4543/// #     hyper_rustls::HttpsConnectorBuilder::new()
4544/// #         .with_native_roots()
4545/// #         .unwrap()
4546/// #         .https_or_http()
4547/// #         .enable_http1()
4548/// #         .build()
4549/// # );
4550/// # let mut hub = DataFusion::new(client, auth);
4551/// // As the method needs a request, you would usually fill it with the desired information
4552/// // into the respective structure. Some of the parts shown here might not be applicable !
4553/// // Values shown here are possibly random and not representative !
4554/// let mut req = SetIamPolicyRequest::default();
4555///
4556/// // You can configure optional parameters by calling the respective setters at will, and
4557/// // execute the final call using `doit()`.
4558/// // Values shown here are possibly random and not representative !
4559/// let result = hub.projects().locations_instances_set_iam_policy(req, "resource")
4560///              .doit().await;
4561/// # }
4562/// ```
4563pub struct ProjectLocationInstanceSetIamPolicyCall<'a, C>
4564where
4565    C: 'a,
4566{
4567    hub: &'a DataFusion<C>,
4568    _request: SetIamPolicyRequest,
4569    _resource: String,
4570    _delegate: Option<&'a mut dyn common::Delegate>,
4571    _additional_params: HashMap<String, String>,
4572    _scopes: BTreeSet<String>,
4573}
4574
4575impl<'a, C> common::CallBuilder for ProjectLocationInstanceSetIamPolicyCall<'a, C> {}
4576
4577impl<'a, C> ProjectLocationInstanceSetIamPolicyCall<'a, C>
4578where
4579    C: common::Connector,
4580{
4581    /// Perform the operation you have build so far.
4582    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4583        use std::borrow::Cow;
4584        use std::io::{Read, Seek};
4585
4586        use common::{url::Params, ToParts};
4587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4588
4589        let mut dd = common::DefaultDelegate;
4590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4591        dlg.begin(common::MethodInfo {
4592            id: "datafusion.projects.locations.instances.setIamPolicy",
4593            http_method: hyper::Method::POST,
4594        });
4595
4596        for &field in ["alt", "resource"].iter() {
4597            if self._additional_params.contains_key(field) {
4598                dlg.finished(false);
4599                return Err(common::Error::FieldClash(field));
4600            }
4601        }
4602
4603        let mut params = Params::with_capacity(4 + self._additional_params.len());
4604        params.push("resource", self._resource);
4605
4606        params.extend(self._additional_params.iter());
4607
4608        params.push("alt", "json");
4609        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
4610        if self._scopes.is_empty() {
4611            self._scopes
4612                .insert(Scope::CloudPlatform.as_ref().to_string());
4613        }
4614
4615        #[allow(clippy::single_element_loop)]
4616        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4617            url = params.uri_replacement(url, param_name, find_this, true);
4618        }
4619        {
4620            let to_remove = ["resource"];
4621            params.remove_params(&to_remove);
4622        }
4623
4624        let url = params.parse_with_url(&url);
4625
4626        let mut json_mime_type = mime::APPLICATION_JSON;
4627        let mut request_value_reader = {
4628            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4629            common::remove_json_null_values(&mut value);
4630            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4631            serde_json::to_writer(&mut dst, &value).unwrap();
4632            dst
4633        };
4634        let request_size = request_value_reader
4635            .seek(std::io::SeekFrom::End(0))
4636            .unwrap();
4637        request_value_reader
4638            .seek(std::io::SeekFrom::Start(0))
4639            .unwrap();
4640
4641        loop {
4642            let token = match self
4643                .hub
4644                .auth
4645                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4646                .await
4647            {
4648                Ok(token) => token,
4649                Err(e) => match dlg.token(e) {
4650                    Ok(token) => token,
4651                    Err(e) => {
4652                        dlg.finished(false);
4653                        return Err(common::Error::MissingToken(e));
4654                    }
4655                },
4656            };
4657            request_value_reader
4658                .seek(std::io::SeekFrom::Start(0))
4659                .unwrap();
4660            let mut req_result = {
4661                let client = &self.hub.client;
4662                dlg.pre_request();
4663                let mut req_builder = hyper::Request::builder()
4664                    .method(hyper::Method::POST)
4665                    .uri(url.as_str())
4666                    .header(USER_AGENT, self.hub._user_agent.clone());
4667
4668                if let Some(token) = token.as_ref() {
4669                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4670                }
4671
4672                let request = req_builder
4673                    .header(CONTENT_TYPE, json_mime_type.to_string())
4674                    .header(CONTENT_LENGTH, request_size as u64)
4675                    .body(common::to_body(
4676                        request_value_reader.get_ref().clone().into(),
4677                    ));
4678
4679                client.request(request.unwrap()).await
4680            };
4681
4682            match req_result {
4683                Err(err) => {
4684                    if let common::Retry::After(d) = dlg.http_error(&err) {
4685                        sleep(d).await;
4686                        continue;
4687                    }
4688                    dlg.finished(false);
4689                    return Err(common::Error::HttpError(err));
4690                }
4691                Ok(res) => {
4692                    let (mut parts, body) = res.into_parts();
4693                    let mut body = common::Body::new(body);
4694                    if !parts.status.is_success() {
4695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4696                        let error = serde_json::from_str(&common::to_string(&bytes));
4697                        let response = common::to_response(parts, bytes.into());
4698
4699                        if let common::Retry::After(d) =
4700                            dlg.http_failure(&response, error.as_ref().ok())
4701                        {
4702                            sleep(d).await;
4703                            continue;
4704                        }
4705
4706                        dlg.finished(false);
4707
4708                        return Err(match error {
4709                            Ok(value) => common::Error::BadRequest(value),
4710                            _ => common::Error::Failure(response),
4711                        });
4712                    }
4713                    let response = {
4714                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4715                        let encoded = common::to_string(&bytes);
4716                        match serde_json::from_str(&encoded) {
4717                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4718                            Err(error) => {
4719                                dlg.response_json_decode_error(&encoded, &error);
4720                                return Err(common::Error::JsonDecodeError(
4721                                    encoded.to_string(),
4722                                    error,
4723                                ));
4724                            }
4725                        }
4726                    };
4727
4728                    dlg.finished(true);
4729                    return Ok(response);
4730                }
4731            }
4732        }
4733    }
4734
4735    ///
4736    /// Sets the *request* property to the given value.
4737    ///
4738    /// Even though the property as already been set when instantiating this call,
4739    /// we provide this method for API completeness.
4740    pub fn request(
4741        mut self,
4742        new_value: SetIamPolicyRequest,
4743    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
4744        self._request = new_value;
4745        self
4746    }
4747    /// 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.
4748    ///
4749    /// Sets the *resource* path property to the given value.
4750    ///
4751    /// Even though the property as already been set when instantiating this call,
4752    /// we provide this method for API completeness.
4753    pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
4754        self._resource = new_value.to_string();
4755        self
4756    }
4757    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4758    /// while executing the actual API request.
4759    ///
4760    /// ````text
4761    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4762    /// ````
4763    ///
4764    /// Sets the *delegate* property to the given value.
4765    pub fn delegate(
4766        mut self,
4767        new_value: &'a mut dyn common::Delegate,
4768    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
4769        self._delegate = Some(new_value);
4770        self
4771    }
4772
4773    /// Set any additional parameter of the query string used in the request.
4774    /// It should be used to set parameters which are not yet available through their own
4775    /// setters.
4776    ///
4777    /// Please note that this method must not be used to set any of the known parameters
4778    /// which have their own setter method. If done anyway, the request will fail.
4779    ///
4780    /// # Additional Parameters
4781    ///
4782    /// * *$.xgafv* (query-string) - V1 error format.
4783    /// * *access_token* (query-string) - OAuth access token.
4784    /// * *alt* (query-string) - Data format for response.
4785    /// * *callback* (query-string) - JSONP
4786    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4787    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4788    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4789    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4790    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4791    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4792    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4793    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
4794    where
4795        T: AsRef<str>,
4796    {
4797        self._additional_params
4798            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4799        self
4800    }
4801
4802    /// Identifies the authorization scope for the method you are building.
4803    ///
4804    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4805    /// [`Scope::CloudPlatform`].
4806    ///
4807    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4808    /// tokens for more than one scope.
4809    ///
4810    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4811    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4812    /// sufficient, a read-write scope will do as well.
4813    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
4814    where
4815        St: AsRef<str>,
4816    {
4817        self._scopes.insert(String::from(scope.as_ref()));
4818        self
4819    }
4820    /// Identifies the authorization scope(s) for the method you are building.
4821    ///
4822    /// See [`Self::add_scope()`] for details.
4823    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
4824    where
4825        I: IntoIterator<Item = St>,
4826        St: AsRef<str>,
4827    {
4828        self._scopes
4829            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4830        self
4831    }
4832
4833    /// Removes all scopes, and no default scope will be used either.
4834    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4835    /// for details).
4836    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
4837        self._scopes.clear();
4838        self
4839    }
4840}
4841
4842/// 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.
4843///
4844/// A builder for the *locations.instances.testIamPermissions* method supported by a *project* resource.
4845/// It is not used directly, but through a [`ProjectMethods`] instance.
4846///
4847/// # Example
4848///
4849/// Instantiate a resource method builder
4850///
4851/// ```test_harness,no_run
4852/// # extern crate hyper;
4853/// # extern crate hyper_rustls;
4854/// # extern crate google_datafusion1 as datafusion1;
4855/// use datafusion1::api::TestIamPermissionsRequest;
4856/// # async fn dox() {
4857/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4858///
4859/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4860/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4861/// #     secret,
4862/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4863/// # ).build().await.unwrap();
4864///
4865/// # let client = hyper_util::client::legacy::Client::builder(
4866/// #     hyper_util::rt::TokioExecutor::new()
4867/// # )
4868/// # .build(
4869/// #     hyper_rustls::HttpsConnectorBuilder::new()
4870/// #         .with_native_roots()
4871/// #         .unwrap()
4872/// #         .https_or_http()
4873/// #         .enable_http1()
4874/// #         .build()
4875/// # );
4876/// # let mut hub = DataFusion::new(client, auth);
4877/// // As the method needs a request, you would usually fill it with the desired information
4878/// // into the respective structure. Some of the parts shown here might not be applicable !
4879/// // Values shown here are possibly random and not representative !
4880/// let mut req = TestIamPermissionsRequest::default();
4881///
4882/// // You can configure optional parameters by calling the respective setters at will, and
4883/// // execute the final call using `doit()`.
4884/// // Values shown here are possibly random and not representative !
4885/// let result = hub.projects().locations_instances_test_iam_permissions(req, "resource")
4886///              .doit().await;
4887/// # }
4888/// ```
4889pub struct ProjectLocationInstanceTestIamPermissionCall<'a, C>
4890where
4891    C: 'a,
4892{
4893    hub: &'a DataFusion<C>,
4894    _request: TestIamPermissionsRequest,
4895    _resource: String,
4896    _delegate: Option<&'a mut dyn common::Delegate>,
4897    _additional_params: HashMap<String, String>,
4898    _scopes: BTreeSet<String>,
4899}
4900
4901impl<'a, C> common::CallBuilder for ProjectLocationInstanceTestIamPermissionCall<'a, C> {}
4902
4903impl<'a, C> ProjectLocationInstanceTestIamPermissionCall<'a, C>
4904where
4905    C: common::Connector,
4906{
4907    /// Perform the operation you have build so far.
4908    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
4909        use std::borrow::Cow;
4910        use std::io::{Read, Seek};
4911
4912        use common::{url::Params, ToParts};
4913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4914
4915        let mut dd = common::DefaultDelegate;
4916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4917        dlg.begin(common::MethodInfo {
4918            id: "datafusion.projects.locations.instances.testIamPermissions",
4919            http_method: hyper::Method::POST,
4920        });
4921
4922        for &field in ["alt", "resource"].iter() {
4923            if self._additional_params.contains_key(field) {
4924                dlg.finished(false);
4925                return Err(common::Error::FieldClash(field));
4926            }
4927        }
4928
4929        let mut params = Params::with_capacity(4 + self._additional_params.len());
4930        params.push("resource", self._resource);
4931
4932        params.extend(self._additional_params.iter());
4933
4934        params.push("alt", "json");
4935        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
4936        if self._scopes.is_empty() {
4937            self._scopes
4938                .insert(Scope::CloudPlatform.as_ref().to_string());
4939        }
4940
4941        #[allow(clippy::single_element_loop)]
4942        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4943            url = params.uri_replacement(url, param_name, find_this, true);
4944        }
4945        {
4946            let to_remove = ["resource"];
4947            params.remove_params(&to_remove);
4948        }
4949
4950        let url = params.parse_with_url(&url);
4951
4952        let mut json_mime_type = mime::APPLICATION_JSON;
4953        let mut request_value_reader = {
4954            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4955            common::remove_json_null_values(&mut value);
4956            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4957            serde_json::to_writer(&mut dst, &value).unwrap();
4958            dst
4959        };
4960        let request_size = request_value_reader
4961            .seek(std::io::SeekFrom::End(0))
4962            .unwrap();
4963        request_value_reader
4964            .seek(std::io::SeekFrom::Start(0))
4965            .unwrap();
4966
4967        loop {
4968            let token = match self
4969                .hub
4970                .auth
4971                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4972                .await
4973            {
4974                Ok(token) => token,
4975                Err(e) => match dlg.token(e) {
4976                    Ok(token) => token,
4977                    Err(e) => {
4978                        dlg.finished(false);
4979                        return Err(common::Error::MissingToken(e));
4980                    }
4981                },
4982            };
4983            request_value_reader
4984                .seek(std::io::SeekFrom::Start(0))
4985                .unwrap();
4986            let mut req_result = {
4987                let client = &self.hub.client;
4988                dlg.pre_request();
4989                let mut req_builder = hyper::Request::builder()
4990                    .method(hyper::Method::POST)
4991                    .uri(url.as_str())
4992                    .header(USER_AGENT, self.hub._user_agent.clone());
4993
4994                if let Some(token) = token.as_ref() {
4995                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4996                }
4997
4998                let request = req_builder
4999                    .header(CONTENT_TYPE, json_mime_type.to_string())
5000                    .header(CONTENT_LENGTH, request_size as u64)
5001                    .body(common::to_body(
5002                        request_value_reader.get_ref().clone().into(),
5003                    ));
5004
5005                client.request(request.unwrap()).await
5006            };
5007
5008            match req_result {
5009                Err(err) => {
5010                    if let common::Retry::After(d) = dlg.http_error(&err) {
5011                        sleep(d).await;
5012                        continue;
5013                    }
5014                    dlg.finished(false);
5015                    return Err(common::Error::HttpError(err));
5016                }
5017                Ok(res) => {
5018                    let (mut parts, body) = res.into_parts();
5019                    let mut body = common::Body::new(body);
5020                    if !parts.status.is_success() {
5021                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5022                        let error = serde_json::from_str(&common::to_string(&bytes));
5023                        let response = common::to_response(parts, bytes.into());
5024
5025                        if let common::Retry::After(d) =
5026                            dlg.http_failure(&response, error.as_ref().ok())
5027                        {
5028                            sleep(d).await;
5029                            continue;
5030                        }
5031
5032                        dlg.finished(false);
5033
5034                        return Err(match error {
5035                            Ok(value) => common::Error::BadRequest(value),
5036                            _ => common::Error::Failure(response),
5037                        });
5038                    }
5039                    let response = {
5040                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5041                        let encoded = common::to_string(&bytes);
5042                        match serde_json::from_str(&encoded) {
5043                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5044                            Err(error) => {
5045                                dlg.response_json_decode_error(&encoded, &error);
5046                                return Err(common::Error::JsonDecodeError(
5047                                    encoded.to_string(),
5048                                    error,
5049                                ));
5050                            }
5051                        }
5052                    };
5053
5054                    dlg.finished(true);
5055                    return Ok(response);
5056                }
5057            }
5058        }
5059    }
5060
5061    ///
5062    /// Sets the *request* property to the given value.
5063    ///
5064    /// Even though the property as already been set when instantiating this call,
5065    /// we provide this method for API completeness.
5066    pub fn request(
5067        mut self,
5068        new_value: TestIamPermissionsRequest,
5069    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
5070        self._request = new_value;
5071        self
5072    }
5073    /// 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.
5074    ///
5075    /// Sets the *resource* path property to the given value.
5076    ///
5077    /// Even though the property as already been set when instantiating this call,
5078    /// we provide this method for API completeness.
5079    pub fn resource(
5080        mut self,
5081        new_value: &str,
5082    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
5083        self._resource = new_value.to_string();
5084        self
5085    }
5086    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5087    /// while executing the actual API request.
5088    ///
5089    /// ````text
5090    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5091    /// ````
5092    ///
5093    /// Sets the *delegate* property to the given value.
5094    pub fn delegate(
5095        mut self,
5096        new_value: &'a mut dyn common::Delegate,
5097    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
5098        self._delegate = Some(new_value);
5099        self
5100    }
5101
5102    /// Set any additional parameter of the query string used in the request.
5103    /// It should be used to set parameters which are not yet available through their own
5104    /// setters.
5105    ///
5106    /// Please note that this method must not be used to set any of the known parameters
5107    /// which have their own setter method. If done anyway, the request will fail.
5108    ///
5109    /// # Additional Parameters
5110    ///
5111    /// * *$.xgafv* (query-string) - V1 error format.
5112    /// * *access_token* (query-string) - OAuth access token.
5113    /// * *alt* (query-string) - Data format for response.
5114    /// * *callback* (query-string) - JSONP
5115    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5116    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5117    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5118    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5119    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5120    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5121    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5122    pub fn param<T>(
5123        mut self,
5124        name: T,
5125        value: T,
5126    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
5127    where
5128        T: AsRef<str>,
5129    {
5130        self._additional_params
5131            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5132        self
5133    }
5134
5135    /// Identifies the authorization scope for the method you are building.
5136    ///
5137    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5138    /// [`Scope::CloudPlatform`].
5139    ///
5140    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5141    /// tokens for more than one scope.
5142    ///
5143    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5144    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5145    /// sufficient, a read-write scope will do as well.
5146    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
5147    where
5148        St: AsRef<str>,
5149    {
5150        self._scopes.insert(String::from(scope.as_ref()));
5151        self
5152    }
5153    /// Identifies the authorization scope(s) for the method you are building.
5154    ///
5155    /// See [`Self::add_scope()`] for details.
5156    pub fn add_scopes<I, St>(
5157        mut self,
5158        scopes: I,
5159    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
5160    where
5161        I: IntoIterator<Item = St>,
5162        St: AsRef<str>,
5163    {
5164        self._scopes
5165            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5166        self
5167    }
5168
5169    /// Removes all scopes, and no default scope will be used either.
5170    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5171    /// for details).
5172    pub fn clear_scopes(mut self) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
5173        self._scopes.clear();
5174        self
5175    }
5176}
5177
5178/// 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`.
5179///
5180/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
5181/// It is not used directly, but through a [`ProjectMethods`] instance.
5182///
5183/// # Example
5184///
5185/// Instantiate a resource method builder
5186///
5187/// ```test_harness,no_run
5188/// # extern crate hyper;
5189/// # extern crate hyper_rustls;
5190/// # extern crate google_datafusion1 as datafusion1;
5191/// use datafusion1::api::CancelOperationRequest;
5192/// # async fn dox() {
5193/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5194///
5195/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5196/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5197/// #     secret,
5198/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5199/// # ).build().await.unwrap();
5200///
5201/// # let client = hyper_util::client::legacy::Client::builder(
5202/// #     hyper_util::rt::TokioExecutor::new()
5203/// # )
5204/// # .build(
5205/// #     hyper_rustls::HttpsConnectorBuilder::new()
5206/// #         .with_native_roots()
5207/// #         .unwrap()
5208/// #         .https_or_http()
5209/// #         .enable_http1()
5210/// #         .build()
5211/// # );
5212/// # let mut hub = DataFusion::new(client, auth);
5213/// // As the method needs a request, you would usually fill it with the desired information
5214/// // into the respective structure. Some of the parts shown here might not be applicable !
5215/// // Values shown here are possibly random and not representative !
5216/// let mut req = CancelOperationRequest::default();
5217///
5218/// // You can configure optional parameters by calling the respective setters at will, and
5219/// // execute the final call using `doit()`.
5220/// // Values shown here are possibly random and not representative !
5221/// let result = hub.projects().locations_operations_cancel(req, "name")
5222///              .doit().await;
5223/// # }
5224/// ```
5225pub struct ProjectLocationOperationCancelCall<'a, C>
5226where
5227    C: 'a,
5228{
5229    hub: &'a DataFusion<C>,
5230    _request: CancelOperationRequest,
5231    _name: String,
5232    _delegate: Option<&'a mut dyn common::Delegate>,
5233    _additional_params: HashMap<String, String>,
5234    _scopes: BTreeSet<String>,
5235}
5236
5237impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
5238
5239impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
5240where
5241    C: common::Connector,
5242{
5243    /// Perform the operation you have build so far.
5244    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5245        use std::borrow::Cow;
5246        use std::io::{Read, Seek};
5247
5248        use common::{url::Params, ToParts};
5249        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5250
5251        let mut dd = common::DefaultDelegate;
5252        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5253        dlg.begin(common::MethodInfo {
5254            id: "datafusion.projects.locations.operations.cancel",
5255            http_method: hyper::Method::POST,
5256        });
5257
5258        for &field in ["alt", "name"].iter() {
5259            if self._additional_params.contains_key(field) {
5260                dlg.finished(false);
5261                return Err(common::Error::FieldClash(field));
5262            }
5263        }
5264
5265        let mut params = Params::with_capacity(4 + self._additional_params.len());
5266        params.push("name", self._name);
5267
5268        params.extend(self._additional_params.iter());
5269
5270        params.push("alt", "json");
5271        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
5272        if self._scopes.is_empty() {
5273            self._scopes
5274                .insert(Scope::CloudPlatform.as_ref().to_string());
5275        }
5276
5277        #[allow(clippy::single_element_loop)]
5278        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5279            url = params.uri_replacement(url, param_name, find_this, true);
5280        }
5281        {
5282            let to_remove = ["name"];
5283            params.remove_params(&to_remove);
5284        }
5285
5286        let url = params.parse_with_url(&url);
5287
5288        let mut json_mime_type = mime::APPLICATION_JSON;
5289        let mut request_value_reader = {
5290            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5291            common::remove_json_null_values(&mut value);
5292            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5293            serde_json::to_writer(&mut dst, &value).unwrap();
5294            dst
5295        };
5296        let request_size = request_value_reader
5297            .seek(std::io::SeekFrom::End(0))
5298            .unwrap();
5299        request_value_reader
5300            .seek(std::io::SeekFrom::Start(0))
5301            .unwrap();
5302
5303        loop {
5304            let token = match self
5305                .hub
5306                .auth
5307                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5308                .await
5309            {
5310                Ok(token) => token,
5311                Err(e) => match dlg.token(e) {
5312                    Ok(token) => token,
5313                    Err(e) => {
5314                        dlg.finished(false);
5315                        return Err(common::Error::MissingToken(e));
5316                    }
5317                },
5318            };
5319            request_value_reader
5320                .seek(std::io::SeekFrom::Start(0))
5321                .unwrap();
5322            let mut req_result = {
5323                let client = &self.hub.client;
5324                dlg.pre_request();
5325                let mut req_builder = hyper::Request::builder()
5326                    .method(hyper::Method::POST)
5327                    .uri(url.as_str())
5328                    .header(USER_AGENT, self.hub._user_agent.clone());
5329
5330                if let Some(token) = token.as_ref() {
5331                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5332                }
5333
5334                let request = req_builder
5335                    .header(CONTENT_TYPE, json_mime_type.to_string())
5336                    .header(CONTENT_LENGTH, request_size as u64)
5337                    .body(common::to_body(
5338                        request_value_reader.get_ref().clone().into(),
5339                    ));
5340
5341                client.request(request.unwrap()).await
5342            };
5343
5344            match req_result {
5345                Err(err) => {
5346                    if let common::Retry::After(d) = dlg.http_error(&err) {
5347                        sleep(d).await;
5348                        continue;
5349                    }
5350                    dlg.finished(false);
5351                    return Err(common::Error::HttpError(err));
5352                }
5353                Ok(res) => {
5354                    let (mut parts, body) = res.into_parts();
5355                    let mut body = common::Body::new(body);
5356                    if !parts.status.is_success() {
5357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5358                        let error = serde_json::from_str(&common::to_string(&bytes));
5359                        let response = common::to_response(parts, bytes.into());
5360
5361                        if let common::Retry::After(d) =
5362                            dlg.http_failure(&response, error.as_ref().ok())
5363                        {
5364                            sleep(d).await;
5365                            continue;
5366                        }
5367
5368                        dlg.finished(false);
5369
5370                        return Err(match error {
5371                            Ok(value) => common::Error::BadRequest(value),
5372                            _ => common::Error::Failure(response),
5373                        });
5374                    }
5375                    let response = {
5376                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5377                        let encoded = common::to_string(&bytes);
5378                        match serde_json::from_str(&encoded) {
5379                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5380                            Err(error) => {
5381                                dlg.response_json_decode_error(&encoded, &error);
5382                                return Err(common::Error::JsonDecodeError(
5383                                    encoded.to_string(),
5384                                    error,
5385                                ));
5386                            }
5387                        }
5388                    };
5389
5390                    dlg.finished(true);
5391                    return Ok(response);
5392                }
5393            }
5394        }
5395    }
5396
5397    ///
5398    /// Sets the *request* property to the given value.
5399    ///
5400    /// Even though the property as already been set when instantiating this call,
5401    /// we provide this method for API completeness.
5402    pub fn request(
5403        mut self,
5404        new_value: CancelOperationRequest,
5405    ) -> ProjectLocationOperationCancelCall<'a, C> {
5406        self._request = new_value;
5407        self
5408    }
5409    /// The name of the operation resource to be cancelled.
5410    ///
5411    /// Sets the *name* path property to the given value.
5412    ///
5413    /// Even though the property as already been set when instantiating this call,
5414    /// we provide this method for API completeness.
5415    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
5416        self._name = new_value.to_string();
5417        self
5418    }
5419    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5420    /// while executing the actual API request.
5421    ///
5422    /// ````text
5423    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5424    /// ````
5425    ///
5426    /// Sets the *delegate* property to the given value.
5427    pub fn delegate(
5428        mut self,
5429        new_value: &'a mut dyn common::Delegate,
5430    ) -> ProjectLocationOperationCancelCall<'a, C> {
5431        self._delegate = Some(new_value);
5432        self
5433    }
5434
5435    /// Set any additional parameter of the query string used in the request.
5436    /// It should be used to set parameters which are not yet available through their own
5437    /// setters.
5438    ///
5439    /// Please note that this method must not be used to set any of the known parameters
5440    /// which have their own setter method. If done anyway, the request will fail.
5441    ///
5442    /// # Additional Parameters
5443    ///
5444    /// * *$.xgafv* (query-string) - V1 error format.
5445    /// * *access_token* (query-string) - OAuth access token.
5446    /// * *alt* (query-string) - Data format for response.
5447    /// * *callback* (query-string) - JSONP
5448    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5449    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5450    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5451    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5452    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5453    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5454    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5455    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
5456    where
5457        T: AsRef<str>,
5458    {
5459        self._additional_params
5460            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5461        self
5462    }
5463
5464    /// Identifies the authorization scope for the method you are building.
5465    ///
5466    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5467    /// [`Scope::CloudPlatform`].
5468    ///
5469    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5470    /// tokens for more than one scope.
5471    ///
5472    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5473    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5474    /// sufficient, a read-write scope will do as well.
5475    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
5476    where
5477        St: AsRef<str>,
5478    {
5479        self._scopes.insert(String::from(scope.as_ref()));
5480        self
5481    }
5482    /// Identifies the authorization scope(s) for the method you are building.
5483    ///
5484    /// See [`Self::add_scope()`] for details.
5485    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
5486    where
5487        I: IntoIterator<Item = St>,
5488        St: AsRef<str>,
5489    {
5490        self._scopes
5491            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5492        self
5493    }
5494
5495    /// Removes all scopes, and no default scope will be used either.
5496    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5497    /// for details).
5498    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
5499        self._scopes.clear();
5500        self
5501    }
5502}
5503
5504/// 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`.
5505///
5506/// A builder for the *locations.operations.delete* method supported by a *project* resource.
5507/// It is not used directly, but through a [`ProjectMethods`] instance.
5508///
5509/// # Example
5510///
5511/// Instantiate a resource method builder
5512///
5513/// ```test_harness,no_run
5514/// # extern crate hyper;
5515/// # extern crate hyper_rustls;
5516/// # extern crate google_datafusion1 as datafusion1;
5517/// # async fn dox() {
5518/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5519///
5520/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5521/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5522/// #     secret,
5523/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5524/// # ).build().await.unwrap();
5525///
5526/// # let client = hyper_util::client::legacy::Client::builder(
5527/// #     hyper_util::rt::TokioExecutor::new()
5528/// # )
5529/// # .build(
5530/// #     hyper_rustls::HttpsConnectorBuilder::new()
5531/// #         .with_native_roots()
5532/// #         .unwrap()
5533/// #         .https_or_http()
5534/// #         .enable_http1()
5535/// #         .build()
5536/// # );
5537/// # let mut hub = DataFusion::new(client, auth);
5538/// // You can configure optional parameters by calling the respective setters at will, and
5539/// // execute the final call using `doit()`.
5540/// // Values shown here are possibly random and not representative !
5541/// let result = hub.projects().locations_operations_delete("name")
5542///              .doit().await;
5543/// # }
5544/// ```
5545pub struct ProjectLocationOperationDeleteCall<'a, C>
5546where
5547    C: 'a,
5548{
5549    hub: &'a DataFusion<C>,
5550    _name: String,
5551    _delegate: Option<&'a mut dyn common::Delegate>,
5552    _additional_params: HashMap<String, String>,
5553    _scopes: BTreeSet<String>,
5554}
5555
5556impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
5557
5558impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
5559where
5560    C: common::Connector,
5561{
5562    /// Perform the operation you have build so far.
5563    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5564        use std::borrow::Cow;
5565        use std::io::{Read, Seek};
5566
5567        use common::{url::Params, ToParts};
5568        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5569
5570        let mut dd = common::DefaultDelegate;
5571        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5572        dlg.begin(common::MethodInfo {
5573            id: "datafusion.projects.locations.operations.delete",
5574            http_method: hyper::Method::DELETE,
5575        });
5576
5577        for &field in ["alt", "name"].iter() {
5578            if self._additional_params.contains_key(field) {
5579                dlg.finished(false);
5580                return Err(common::Error::FieldClash(field));
5581            }
5582        }
5583
5584        let mut params = Params::with_capacity(3 + self._additional_params.len());
5585        params.push("name", self._name);
5586
5587        params.extend(self._additional_params.iter());
5588
5589        params.push("alt", "json");
5590        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5591        if self._scopes.is_empty() {
5592            self._scopes
5593                .insert(Scope::CloudPlatform.as_ref().to_string());
5594        }
5595
5596        #[allow(clippy::single_element_loop)]
5597        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5598            url = params.uri_replacement(url, param_name, find_this, true);
5599        }
5600        {
5601            let to_remove = ["name"];
5602            params.remove_params(&to_remove);
5603        }
5604
5605        let url = params.parse_with_url(&url);
5606
5607        loop {
5608            let token = match self
5609                .hub
5610                .auth
5611                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5612                .await
5613            {
5614                Ok(token) => token,
5615                Err(e) => match dlg.token(e) {
5616                    Ok(token) => token,
5617                    Err(e) => {
5618                        dlg.finished(false);
5619                        return Err(common::Error::MissingToken(e));
5620                    }
5621                },
5622            };
5623            let mut req_result = {
5624                let client = &self.hub.client;
5625                dlg.pre_request();
5626                let mut req_builder = hyper::Request::builder()
5627                    .method(hyper::Method::DELETE)
5628                    .uri(url.as_str())
5629                    .header(USER_AGENT, self.hub._user_agent.clone());
5630
5631                if let Some(token) = token.as_ref() {
5632                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5633                }
5634
5635                let request = req_builder
5636                    .header(CONTENT_LENGTH, 0_u64)
5637                    .body(common::to_body::<String>(None));
5638
5639                client.request(request.unwrap()).await
5640            };
5641
5642            match req_result {
5643                Err(err) => {
5644                    if let common::Retry::After(d) = dlg.http_error(&err) {
5645                        sleep(d).await;
5646                        continue;
5647                    }
5648                    dlg.finished(false);
5649                    return Err(common::Error::HttpError(err));
5650                }
5651                Ok(res) => {
5652                    let (mut parts, body) = res.into_parts();
5653                    let mut body = common::Body::new(body);
5654                    if !parts.status.is_success() {
5655                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5656                        let error = serde_json::from_str(&common::to_string(&bytes));
5657                        let response = common::to_response(parts, bytes.into());
5658
5659                        if let common::Retry::After(d) =
5660                            dlg.http_failure(&response, error.as_ref().ok())
5661                        {
5662                            sleep(d).await;
5663                            continue;
5664                        }
5665
5666                        dlg.finished(false);
5667
5668                        return Err(match error {
5669                            Ok(value) => common::Error::BadRequest(value),
5670                            _ => common::Error::Failure(response),
5671                        });
5672                    }
5673                    let response = {
5674                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5675                        let encoded = common::to_string(&bytes);
5676                        match serde_json::from_str(&encoded) {
5677                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5678                            Err(error) => {
5679                                dlg.response_json_decode_error(&encoded, &error);
5680                                return Err(common::Error::JsonDecodeError(
5681                                    encoded.to_string(),
5682                                    error,
5683                                ));
5684                            }
5685                        }
5686                    };
5687
5688                    dlg.finished(true);
5689                    return Ok(response);
5690                }
5691            }
5692        }
5693    }
5694
5695    /// The name of the operation resource to be deleted.
5696    ///
5697    /// Sets the *name* path property to the given value.
5698    ///
5699    /// Even though the property as already been set when instantiating this call,
5700    /// we provide this method for API completeness.
5701    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
5702        self._name = new_value.to_string();
5703        self
5704    }
5705    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5706    /// while executing the actual API request.
5707    ///
5708    /// ````text
5709    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5710    /// ````
5711    ///
5712    /// Sets the *delegate* property to the given value.
5713    pub fn delegate(
5714        mut self,
5715        new_value: &'a mut dyn common::Delegate,
5716    ) -> ProjectLocationOperationDeleteCall<'a, C> {
5717        self._delegate = Some(new_value);
5718        self
5719    }
5720
5721    /// Set any additional parameter of the query string used in the request.
5722    /// It should be used to set parameters which are not yet available through their own
5723    /// setters.
5724    ///
5725    /// Please note that this method must not be used to set any of the known parameters
5726    /// which have their own setter method. If done anyway, the request will fail.
5727    ///
5728    /// # Additional Parameters
5729    ///
5730    /// * *$.xgafv* (query-string) - V1 error format.
5731    /// * *access_token* (query-string) - OAuth access token.
5732    /// * *alt* (query-string) - Data format for response.
5733    /// * *callback* (query-string) - JSONP
5734    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5735    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5736    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5737    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5738    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5739    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5740    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5741    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
5742    where
5743        T: AsRef<str>,
5744    {
5745        self._additional_params
5746            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5747        self
5748    }
5749
5750    /// Identifies the authorization scope for the method you are building.
5751    ///
5752    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5753    /// [`Scope::CloudPlatform`].
5754    ///
5755    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5756    /// tokens for more than one scope.
5757    ///
5758    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5759    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5760    /// sufficient, a read-write scope will do as well.
5761    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
5762    where
5763        St: AsRef<str>,
5764    {
5765        self._scopes.insert(String::from(scope.as_ref()));
5766        self
5767    }
5768    /// Identifies the authorization scope(s) for the method you are building.
5769    ///
5770    /// See [`Self::add_scope()`] for details.
5771    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
5772    where
5773        I: IntoIterator<Item = St>,
5774        St: AsRef<str>,
5775    {
5776        self._scopes
5777            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5778        self
5779    }
5780
5781    /// Removes all scopes, and no default scope will be used either.
5782    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5783    /// for details).
5784    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
5785        self._scopes.clear();
5786        self
5787    }
5788}
5789
5790/// 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.
5791///
5792/// A builder for the *locations.operations.get* method supported by a *project* resource.
5793/// It is not used directly, but through a [`ProjectMethods`] instance.
5794///
5795/// # Example
5796///
5797/// Instantiate a resource method builder
5798///
5799/// ```test_harness,no_run
5800/// # extern crate hyper;
5801/// # extern crate hyper_rustls;
5802/// # extern crate google_datafusion1 as datafusion1;
5803/// # async fn dox() {
5804/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5805///
5806/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5808/// #     secret,
5809/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5810/// # ).build().await.unwrap();
5811///
5812/// # let client = hyper_util::client::legacy::Client::builder(
5813/// #     hyper_util::rt::TokioExecutor::new()
5814/// # )
5815/// # .build(
5816/// #     hyper_rustls::HttpsConnectorBuilder::new()
5817/// #         .with_native_roots()
5818/// #         .unwrap()
5819/// #         .https_or_http()
5820/// #         .enable_http1()
5821/// #         .build()
5822/// # );
5823/// # let mut hub = DataFusion::new(client, auth);
5824/// // You can configure optional parameters by calling the respective setters at will, and
5825/// // execute the final call using `doit()`.
5826/// // Values shown here are possibly random and not representative !
5827/// let result = hub.projects().locations_operations_get("name")
5828///              .doit().await;
5829/// # }
5830/// ```
5831pub struct ProjectLocationOperationGetCall<'a, C>
5832where
5833    C: 'a,
5834{
5835    hub: &'a DataFusion<C>,
5836    _name: String,
5837    _delegate: Option<&'a mut dyn common::Delegate>,
5838    _additional_params: HashMap<String, String>,
5839    _scopes: BTreeSet<String>,
5840}
5841
5842impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
5843
5844impl<'a, C> ProjectLocationOperationGetCall<'a, C>
5845where
5846    C: common::Connector,
5847{
5848    /// Perform the operation you have build so far.
5849    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5850        use std::borrow::Cow;
5851        use std::io::{Read, Seek};
5852
5853        use common::{url::Params, ToParts};
5854        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5855
5856        let mut dd = common::DefaultDelegate;
5857        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5858        dlg.begin(common::MethodInfo {
5859            id: "datafusion.projects.locations.operations.get",
5860            http_method: hyper::Method::GET,
5861        });
5862
5863        for &field in ["alt", "name"].iter() {
5864            if self._additional_params.contains_key(field) {
5865                dlg.finished(false);
5866                return Err(common::Error::FieldClash(field));
5867            }
5868        }
5869
5870        let mut params = Params::with_capacity(3 + self._additional_params.len());
5871        params.push("name", self._name);
5872
5873        params.extend(self._additional_params.iter());
5874
5875        params.push("alt", "json");
5876        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5877        if self._scopes.is_empty() {
5878            self._scopes
5879                .insert(Scope::CloudPlatform.as_ref().to_string());
5880        }
5881
5882        #[allow(clippy::single_element_loop)]
5883        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5884            url = params.uri_replacement(url, param_name, find_this, true);
5885        }
5886        {
5887            let to_remove = ["name"];
5888            params.remove_params(&to_remove);
5889        }
5890
5891        let url = params.parse_with_url(&url);
5892
5893        loop {
5894            let token = match self
5895                .hub
5896                .auth
5897                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5898                .await
5899            {
5900                Ok(token) => token,
5901                Err(e) => match dlg.token(e) {
5902                    Ok(token) => token,
5903                    Err(e) => {
5904                        dlg.finished(false);
5905                        return Err(common::Error::MissingToken(e));
5906                    }
5907                },
5908            };
5909            let mut req_result = {
5910                let client = &self.hub.client;
5911                dlg.pre_request();
5912                let mut req_builder = hyper::Request::builder()
5913                    .method(hyper::Method::GET)
5914                    .uri(url.as_str())
5915                    .header(USER_AGENT, self.hub._user_agent.clone());
5916
5917                if let Some(token) = token.as_ref() {
5918                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5919                }
5920
5921                let request = req_builder
5922                    .header(CONTENT_LENGTH, 0_u64)
5923                    .body(common::to_body::<String>(None));
5924
5925                client.request(request.unwrap()).await
5926            };
5927
5928            match req_result {
5929                Err(err) => {
5930                    if let common::Retry::After(d) = dlg.http_error(&err) {
5931                        sleep(d).await;
5932                        continue;
5933                    }
5934                    dlg.finished(false);
5935                    return Err(common::Error::HttpError(err));
5936                }
5937                Ok(res) => {
5938                    let (mut parts, body) = res.into_parts();
5939                    let mut body = common::Body::new(body);
5940                    if !parts.status.is_success() {
5941                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5942                        let error = serde_json::from_str(&common::to_string(&bytes));
5943                        let response = common::to_response(parts, bytes.into());
5944
5945                        if let common::Retry::After(d) =
5946                            dlg.http_failure(&response, error.as_ref().ok())
5947                        {
5948                            sleep(d).await;
5949                            continue;
5950                        }
5951
5952                        dlg.finished(false);
5953
5954                        return Err(match error {
5955                            Ok(value) => common::Error::BadRequest(value),
5956                            _ => common::Error::Failure(response),
5957                        });
5958                    }
5959                    let response = {
5960                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5961                        let encoded = common::to_string(&bytes);
5962                        match serde_json::from_str(&encoded) {
5963                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5964                            Err(error) => {
5965                                dlg.response_json_decode_error(&encoded, &error);
5966                                return Err(common::Error::JsonDecodeError(
5967                                    encoded.to_string(),
5968                                    error,
5969                                ));
5970                            }
5971                        }
5972                    };
5973
5974                    dlg.finished(true);
5975                    return Ok(response);
5976                }
5977            }
5978        }
5979    }
5980
5981    /// The name of the operation resource.
5982    ///
5983    /// Sets the *name* path property to the given value.
5984    ///
5985    /// Even though the property as already been set when instantiating this call,
5986    /// we provide this method for API completeness.
5987    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
5988        self._name = new_value.to_string();
5989        self
5990    }
5991    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5992    /// while executing the actual API request.
5993    ///
5994    /// ````text
5995    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5996    /// ````
5997    ///
5998    /// Sets the *delegate* property to the given value.
5999    pub fn delegate(
6000        mut self,
6001        new_value: &'a mut dyn common::Delegate,
6002    ) -> ProjectLocationOperationGetCall<'a, C> {
6003        self._delegate = Some(new_value);
6004        self
6005    }
6006
6007    /// Set any additional parameter of the query string used in the request.
6008    /// It should be used to set parameters which are not yet available through their own
6009    /// setters.
6010    ///
6011    /// Please note that this method must not be used to set any of the known parameters
6012    /// which have their own setter method. If done anyway, the request will fail.
6013    ///
6014    /// # Additional Parameters
6015    ///
6016    /// * *$.xgafv* (query-string) - V1 error format.
6017    /// * *access_token* (query-string) - OAuth access token.
6018    /// * *alt* (query-string) - Data format for response.
6019    /// * *callback* (query-string) - JSONP
6020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6021    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6024    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6027    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
6028    where
6029        T: AsRef<str>,
6030    {
6031        self._additional_params
6032            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6033        self
6034    }
6035
6036    /// Identifies the authorization scope for the method you are building.
6037    ///
6038    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6039    /// [`Scope::CloudPlatform`].
6040    ///
6041    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6042    /// tokens for more than one scope.
6043    ///
6044    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6045    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6046    /// sufficient, a read-write scope will do as well.
6047    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
6048    where
6049        St: AsRef<str>,
6050    {
6051        self._scopes.insert(String::from(scope.as_ref()));
6052        self
6053    }
6054    /// Identifies the authorization scope(s) for the method you are building.
6055    ///
6056    /// See [`Self::add_scope()`] for details.
6057    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
6058    where
6059        I: IntoIterator<Item = St>,
6060        St: AsRef<str>,
6061    {
6062        self._scopes
6063            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6064        self
6065    }
6066
6067    /// Removes all scopes, and no default scope will be used either.
6068    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6069    /// for details).
6070    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
6071        self._scopes.clear();
6072        self
6073    }
6074}
6075
6076/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
6077///
6078/// A builder for the *locations.operations.list* method supported by a *project* resource.
6079/// It is not used directly, but through a [`ProjectMethods`] instance.
6080///
6081/// # Example
6082///
6083/// Instantiate a resource method builder
6084///
6085/// ```test_harness,no_run
6086/// # extern crate hyper;
6087/// # extern crate hyper_rustls;
6088/// # extern crate google_datafusion1 as datafusion1;
6089/// # async fn dox() {
6090/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6091///
6092/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6093/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6094/// #     secret,
6095/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6096/// # ).build().await.unwrap();
6097///
6098/// # let client = hyper_util::client::legacy::Client::builder(
6099/// #     hyper_util::rt::TokioExecutor::new()
6100/// # )
6101/// # .build(
6102/// #     hyper_rustls::HttpsConnectorBuilder::new()
6103/// #         .with_native_roots()
6104/// #         .unwrap()
6105/// #         .https_or_http()
6106/// #         .enable_http1()
6107/// #         .build()
6108/// # );
6109/// # let mut hub = DataFusion::new(client, auth);
6110/// // You can configure optional parameters by calling the respective setters at will, and
6111/// // execute the final call using `doit()`.
6112/// // Values shown here are possibly random and not representative !
6113/// let result = hub.projects().locations_operations_list("name")
6114///              .page_token("est")
6115///              .page_size(-62)
6116///              .filter("ea")
6117///              .doit().await;
6118/// # }
6119/// ```
6120pub struct ProjectLocationOperationListCall<'a, C>
6121where
6122    C: 'a,
6123{
6124    hub: &'a DataFusion<C>,
6125    _name: String,
6126    _page_token: Option<String>,
6127    _page_size: Option<i32>,
6128    _filter: Option<String>,
6129    _delegate: Option<&'a mut dyn common::Delegate>,
6130    _additional_params: HashMap<String, String>,
6131    _scopes: BTreeSet<String>,
6132}
6133
6134impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
6135
6136impl<'a, C> ProjectLocationOperationListCall<'a, C>
6137where
6138    C: common::Connector,
6139{
6140    /// Perform the operation you have build so far.
6141    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
6142        use std::borrow::Cow;
6143        use std::io::{Read, Seek};
6144
6145        use common::{url::Params, ToParts};
6146        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6147
6148        let mut dd = common::DefaultDelegate;
6149        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6150        dlg.begin(common::MethodInfo {
6151            id: "datafusion.projects.locations.operations.list",
6152            http_method: hyper::Method::GET,
6153        });
6154
6155        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
6156            if self._additional_params.contains_key(field) {
6157                dlg.finished(false);
6158                return Err(common::Error::FieldClash(field));
6159            }
6160        }
6161
6162        let mut params = Params::with_capacity(6 + self._additional_params.len());
6163        params.push("name", self._name);
6164        if let Some(value) = self._page_token.as_ref() {
6165            params.push("pageToken", value);
6166        }
6167        if let Some(value) = self._page_size.as_ref() {
6168            params.push("pageSize", value.to_string());
6169        }
6170        if let Some(value) = self._filter.as_ref() {
6171            params.push("filter", value);
6172        }
6173
6174        params.extend(self._additional_params.iter());
6175
6176        params.push("alt", "json");
6177        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
6178        if self._scopes.is_empty() {
6179            self._scopes
6180                .insert(Scope::CloudPlatform.as_ref().to_string());
6181        }
6182
6183        #[allow(clippy::single_element_loop)]
6184        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6185            url = params.uri_replacement(url, param_name, find_this, true);
6186        }
6187        {
6188            let to_remove = ["name"];
6189            params.remove_params(&to_remove);
6190        }
6191
6192        let url = params.parse_with_url(&url);
6193
6194        loop {
6195            let token = match self
6196                .hub
6197                .auth
6198                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6199                .await
6200            {
6201                Ok(token) => token,
6202                Err(e) => match dlg.token(e) {
6203                    Ok(token) => token,
6204                    Err(e) => {
6205                        dlg.finished(false);
6206                        return Err(common::Error::MissingToken(e));
6207                    }
6208                },
6209            };
6210            let mut req_result = {
6211                let client = &self.hub.client;
6212                dlg.pre_request();
6213                let mut req_builder = hyper::Request::builder()
6214                    .method(hyper::Method::GET)
6215                    .uri(url.as_str())
6216                    .header(USER_AGENT, self.hub._user_agent.clone());
6217
6218                if let Some(token) = token.as_ref() {
6219                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6220                }
6221
6222                let request = req_builder
6223                    .header(CONTENT_LENGTH, 0_u64)
6224                    .body(common::to_body::<String>(None));
6225
6226                client.request(request.unwrap()).await
6227            };
6228
6229            match req_result {
6230                Err(err) => {
6231                    if let common::Retry::After(d) = dlg.http_error(&err) {
6232                        sleep(d).await;
6233                        continue;
6234                    }
6235                    dlg.finished(false);
6236                    return Err(common::Error::HttpError(err));
6237                }
6238                Ok(res) => {
6239                    let (mut parts, body) = res.into_parts();
6240                    let mut body = common::Body::new(body);
6241                    if !parts.status.is_success() {
6242                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6243                        let error = serde_json::from_str(&common::to_string(&bytes));
6244                        let response = common::to_response(parts, bytes.into());
6245
6246                        if let common::Retry::After(d) =
6247                            dlg.http_failure(&response, error.as_ref().ok())
6248                        {
6249                            sleep(d).await;
6250                            continue;
6251                        }
6252
6253                        dlg.finished(false);
6254
6255                        return Err(match error {
6256                            Ok(value) => common::Error::BadRequest(value),
6257                            _ => common::Error::Failure(response),
6258                        });
6259                    }
6260                    let response = {
6261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6262                        let encoded = common::to_string(&bytes);
6263                        match serde_json::from_str(&encoded) {
6264                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6265                            Err(error) => {
6266                                dlg.response_json_decode_error(&encoded, &error);
6267                                return Err(common::Error::JsonDecodeError(
6268                                    encoded.to_string(),
6269                                    error,
6270                                ));
6271                            }
6272                        }
6273                    };
6274
6275                    dlg.finished(true);
6276                    return Ok(response);
6277                }
6278            }
6279        }
6280    }
6281
6282    /// The name of the operation's parent resource.
6283    ///
6284    /// Sets the *name* path property to the given value.
6285    ///
6286    /// Even though the property as already been set when instantiating this call,
6287    /// we provide this method for API completeness.
6288    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6289        self._name = new_value.to_string();
6290        self
6291    }
6292    /// The standard list page token.
6293    ///
6294    /// Sets the *page token* query property to the given value.
6295    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6296        self._page_token = Some(new_value.to_string());
6297        self
6298    }
6299    /// The standard list page size.
6300    ///
6301    /// Sets the *page size* query property to the given value.
6302    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
6303        self._page_size = Some(new_value);
6304        self
6305    }
6306    /// The standard list filter.
6307    ///
6308    /// Sets the *filter* query property to the given value.
6309    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
6310        self._filter = Some(new_value.to_string());
6311        self
6312    }
6313    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6314    /// while executing the actual API request.
6315    ///
6316    /// ````text
6317    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6318    /// ````
6319    ///
6320    /// Sets the *delegate* property to the given value.
6321    pub fn delegate(
6322        mut self,
6323        new_value: &'a mut dyn common::Delegate,
6324    ) -> ProjectLocationOperationListCall<'a, C> {
6325        self._delegate = Some(new_value);
6326        self
6327    }
6328
6329    /// Set any additional parameter of the query string used in the request.
6330    /// It should be used to set parameters which are not yet available through their own
6331    /// setters.
6332    ///
6333    /// Please note that this method must not be used to set any of the known parameters
6334    /// which have their own setter method. If done anyway, the request will fail.
6335    ///
6336    /// # Additional Parameters
6337    ///
6338    /// * *$.xgafv* (query-string) - V1 error format.
6339    /// * *access_token* (query-string) - OAuth access token.
6340    /// * *alt* (query-string) - Data format for response.
6341    /// * *callback* (query-string) - JSONP
6342    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6343    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6344    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6345    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6346    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6347    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6348    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6349    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
6350    where
6351        T: AsRef<str>,
6352    {
6353        self._additional_params
6354            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6355        self
6356    }
6357
6358    /// Identifies the authorization scope for the method you are building.
6359    ///
6360    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6361    /// [`Scope::CloudPlatform`].
6362    ///
6363    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6364    /// tokens for more than one scope.
6365    ///
6366    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6367    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6368    /// sufficient, a read-write scope will do as well.
6369    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
6370    where
6371        St: AsRef<str>,
6372    {
6373        self._scopes.insert(String::from(scope.as_ref()));
6374        self
6375    }
6376    /// Identifies the authorization scope(s) for the method you are building.
6377    ///
6378    /// See [`Self::add_scope()`] for details.
6379    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
6380    where
6381        I: IntoIterator<Item = St>,
6382        St: AsRef<str>,
6383    {
6384        self._scopes
6385            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6386        self
6387    }
6388
6389    /// Removes all scopes, and no default scope will be used either.
6390    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6391    /// for details).
6392    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
6393        self._scopes.clear();
6394        self
6395    }
6396}
6397
6398/// Lists possible versions for Data Fusion instances in the specified project and location.
6399///
6400/// A builder for the *locations.versions.list* method supported by a *project* resource.
6401/// It is not used directly, but through a [`ProjectMethods`] instance.
6402///
6403/// # Example
6404///
6405/// Instantiate a resource method builder
6406///
6407/// ```test_harness,no_run
6408/// # extern crate hyper;
6409/// # extern crate hyper_rustls;
6410/// # extern crate google_datafusion1 as datafusion1;
6411/// # async fn dox() {
6412/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6413///
6414/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6416/// #     secret,
6417/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6418/// # ).build().await.unwrap();
6419///
6420/// # let client = hyper_util::client::legacy::Client::builder(
6421/// #     hyper_util::rt::TokioExecutor::new()
6422/// # )
6423/// # .build(
6424/// #     hyper_rustls::HttpsConnectorBuilder::new()
6425/// #         .with_native_roots()
6426/// #         .unwrap()
6427/// #         .https_or_http()
6428/// #         .enable_http1()
6429/// #         .build()
6430/// # );
6431/// # let mut hub = DataFusion::new(client, auth);
6432/// // You can configure optional parameters by calling the respective setters at will, and
6433/// // execute the final call using `doit()`.
6434/// // Values shown here are possibly random and not representative !
6435/// let result = hub.projects().locations_versions_list("parent")
6436///              .page_token("Lorem")
6437///              .page_size(-25)
6438///              .latest_patch_only(false)
6439///              .doit().await;
6440/// # }
6441/// ```
6442pub struct ProjectLocationVersionListCall<'a, C>
6443where
6444    C: 'a,
6445{
6446    hub: &'a DataFusion<C>,
6447    _parent: String,
6448    _page_token: Option<String>,
6449    _page_size: Option<i32>,
6450    _latest_patch_only: Option<bool>,
6451    _delegate: Option<&'a mut dyn common::Delegate>,
6452    _additional_params: HashMap<String, String>,
6453    _scopes: BTreeSet<String>,
6454}
6455
6456impl<'a, C> common::CallBuilder for ProjectLocationVersionListCall<'a, C> {}
6457
6458impl<'a, C> ProjectLocationVersionListCall<'a, C>
6459where
6460    C: common::Connector,
6461{
6462    /// Perform the operation you have build so far.
6463    pub async fn doit(
6464        mut self,
6465    ) -> common::Result<(common::Response, ListAvailableVersionsResponse)> {
6466        use std::borrow::Cow;
6467        use std::io::{Read, Seek};
6468
6469        use common::{url::Params, ToParts};
6470        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6471
6472        let mut dd = common::DefaultDelegate;
6473        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6474        dlg.begin(common::MethodInfo {
6475            id: "datafusion.projects.locations.versions.list",
6476            http_method: hyper::Method::GET,
6477        });
6478
6479        for &field in ["alt", "parent", "pageToken", "pageSize", "latestPatchOnly"].iter() {
6480            if self._additional_params.contains_key(field) {
6481                dlg.finished(false);
6482                return Err(common::Error::FieldClash(field));
6483            }
6484        }
6485
6486        let mut params = Params::with_capacity(6 + self._additional_params.len());
6487        params.push("parent", self._parent);
6488        if let Some(value) = self._page_token.as_ref() {
6489            params.push("pageToken", value);
6490        }
6491        if let Some(value) = self._page_size.as_ref() {
6492            params.push("pageSize", value.to_string());
6493        }
6494        if let Some(value) = self._latest_patch_only.as_ref() {
6495            params.push("latestPatchOnly", value.to_string());
6496        }
6497
6498        params.extend(self._additional_params.iter());
6499
6500        params.push("alt", "json");
6501        let mut url = self.hub._base_url.clone() + "v1/{+parent}/versions";
6502        if self._scopes.is_empty() {
6503            self._scopes
6504                .insert(Scope::CloudPlatform.as_ref().to_string());
6505        }
6506
6507        #[allow(clippy::single_element_loop)]
6508        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6509            url = params.uri_replacement(url, param_name, find_this, true);
6510        }
6511        {
6512            let to_remove = ["parent"];
6513            params.remove_params(&to_remove);
6514        }
6515
6516        let url = params.parse_with_url(&url);
6517
6518        loop {
6519            let token = match self
6520                .hub
6521                .auth
6522                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6523                .await
6524            {
6525                Ok(token) => token,
6526                Err(e) => match dlg.token(e) {
6527                    Ok(token) => token,
6528                    Err(e) => {
6529                        dlg.finished(false);
6530                        return Err(common::Error::MissingToken(e));
6531                    }
6532                },
6533            };
6534            let mut req_result = {
6535                let client = &self.hub.client;
6536                dlg.pre_request();
6537                let mut req_builder = hyper::Request::builder()
6538                    .method(hyper::Method::GET)
6539                    .uri(url.as_str())
6540                    .header(USER_AGENT, self.hub._user_agent.clone());
6541
6542                if let Some(token) = token.as_ref() {
6543                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6544                }
6545
6546                let request = req_builder
6547                    .header(CONTENT_LENGTH, 0_u64)
6548                    .body(common::to_body::<String>(None));
6549
6550                client.request(request.unwrap()).await
6551            };
6552
6553            match req_result {
6554                Err(err) => {
6555                    if let common::Retry::After(d) = dlg.http_error(&err) {
6556                        sleep(d).await;
6557                        continue;
6558                    }
6559                    dlg.finished(false);
6560                    return Err(common::Error::HttpError(err));
6561                }
6562                Ok(res) => {
6563                    let (mut parts, body) = res.into_parts();
6564                    let mut body = common::Body::new(body);
6565                    if !parts.status.is_success() {
6566                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6567                        let error = serde_json::from_str(&common::to_string(&bytes));
6568                        let response = common::to_response(parts, bytes.into());
6569
6570                        if let common::Retry::After(d) =
6571                            dlg.http_failure(&response, error.as_ref().ok())
6572                        {
6573                            sleep(d).await;
6574                            continue;
6575                        }
6576
6577                        dlg.finished(false);
6578
6579                        return Err(match error {
6580                            Ok(value) => common::Error::BadRequest(value),
6581                            _ => common::Error::Failure(response),
6582                        });
6583                    }
6584                    let response = {
6585                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6586                        let encoded = common::to_string(&bytes);
6587                        match serde_json::from_str(&encoded) {
6588                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6589                            Err(error) => {
6590                                dlg.response_json_decode_error(&encoded, &error);
6591                                return Err(common::Error::JsonDecodeError(
6592                                    encoded.to_string(),
6593                                    error,
6594                                ));
6595                            }
6596                        }
6597                    };
6598
6599                    dlg.finished(true);
6600                    return Ok(response);
6601                }
6602            }
6603        }
6604    }
6605
6606    /// Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
6607    ///
6608    /// Sets the *parent* path property to the given value.
6609    ///
6610    /// Even though the property as already been set when instantiating this call,
6611    /// we provide this method for API completeness.
6612    pub fn parent(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
6613        self._parent = new_value.to_string();
6614        self
6615    }
6616    /// The next_page_token value to use if there are additional results to retrieve for this list request.
6617    ///
6618    /// Sets the *page token* query property to the given value.
6619    pub fn page_token(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
6620        self._page_token = Some(new_value.to_string());
6621        self
6622    }
6623    /// The maximum number of items to return.
6624    ///
6625    /// Sets the *page size* query property to the given value.
6626    pub fn page_size(mut self, new_value: i32) -> ProjectLocationVersionListCall<'a, C> {
6627        self._page_size = Some(new_value);
6628        self
6629    }
6630    /// Whether or not to return the latest patch of every available minor version. If true, only the latest patch will be returned. Ex. if allowed versions is [6.1.1, 6.1.2, 6.2.0] then response will be [6.1.2, 6.2.0]
6631    ///
6632    /// Sets the *latest patch only* query property to the given value.
6633    pub fn latest_patch_only(mut self, new_value: bool) -> ProjectLocationVersionListCall<'a, C> {
6634        self._latest_patch_only = Some(new_value);
6635        self
6636    }
6637    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6638    /// while executing the actual API request.
6639    ///
6640    /// ````text
6641    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6642    /// ````
6643    ///
6644    /// Sets the *delegate* property to the given value.
6645    pub fn delegate(
6646        mut self,
6647        new_value: &'a mut dyn common::Delegate,
6648    ) -> ProjectLocationVersionListCall<'a, C> {
6649        self._delegate = Some(new_value);
6650        self
6651    }
6652
6653    /// Set any additional parameter of the query string used in the request.
6654    /// It should be used to set parameters which are not yet available through their own
6655    /// setters.
6656    ///
6657    /// Please note that this method must not be used to set any of the known parameters
6658    /// which have their own setter method. If done anyway, the request will fail.
6659    ///
6660    /// # Additional Parameters
6661    ///
6662    /// * *$.xgafv* (query-string) - V1 error format.
6663    /// * *access_token* (query-string) - OAuth access token.
6664    /// * *alt* (query-string) - Data format for response.
6665    /// * *callback* (query-string) - JSONP
6666    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6667    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6668    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6669    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6670    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6671    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6672    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6673    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVersionListCall<'a, C>
6674    where
6675        T: AsRef<str>,
6676    {
6677        self._additional_params
6678            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6679        self
6680    }
6681
6682    /// Identifies the authorization scope for the method you are building.
6683    ///
6684    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6685    /// [`Scope::CloudPlatform`].
6686    ///
6687    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6688    /// tokens for more than one scope.
6689    ///
6690    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6691    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6692    /// sufficient, a read-write scope will do as well.
6693    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVersionListCall<'a, C>
6694    where
6695        St: AsRef<str>,
6696    {
6697        self._scopes.insert(String::from(scope.as_ref()));
6698        self
6699    }
6700    /// Identifies the authorization scope(s) for the method you are building.
6701    ///
6702    /// See [`Self::add_scope()`] for details.
6703    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationVersionListCall<'a, C>
6704    where
6705        I: IntoIterator<Item = St>,
6706        St: AsRef<str>,
6707    {
6708        self._scopes
6709            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6710        self
6711    }
6712
6713    /// Removes all scopes, and no default scope will be used either.
6714    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6715    /// for details).
6716    pub fn clear_scopes(mut self) -> ProjectLocationVersionListCall<'a, C> {
6717        self._scopes.clear();
6718        self
6719    }
6720}
6721
6722/// Gets information about a location.
6723///
6724/// A builder for the *locations.get* method supported by a *project* resource.
6725/// It is not used directly, but through a [`ProjectMethods`] instance.
6726///
6727/// # Example
6728///
6729/// Instantiate a resource method builder
6730///
6731/// ```test_harness,no_run
6732/// # extern crate hyper;
6733/// # extern crate hyper_rustls;
6734/// # extern crate google_datafusion1 as datafusion1;
6735/// # async fn dox() {
6736/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6737///
6738/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6740/// #     secret,
6741/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6742/// # ).build().await.unwrap();
6743///
6744/// # let client = hyper_util::client::legacy::Client::builder(
6745/// #     hyper_util::rt::TokioExecutor::new()
6746/// # )
6747/// # .build(
6748/// #     hyper_rustls::HttpsConnectorBuilder::new()
6749/// #         .with_native_roots()
6750/// #         .unwrap()
6751/// #         .https_or_http()
6752/// #         .enable_http1()
6753/// #         .build()
6754/// # );
6755/// # let mut hub = DataFusion::new(client, auth);
6756/// // You can configure optional parameters by calling the respective setters at will, and
6757/// // execute the final call using `doit()`.
6758/// // Values shown here are possibly random and not representative !
6759/// let result = hub.projects().locations_get("name")
6760///              .doit().await;
6761/// # }
6762/// ```
6763pub struct ProjectLocationGetCall<'a, C>
6764where
6765    C: 'a,
6766{
6767    hub: &'a DataFusion<C>,
6768    _name: String,
6769    _delegate: Option<&'a mut dyn common::Delegate>,
6770    _additional_params: HashMap<String, String>,
6771    _scopes: BTreeSet<String>,
6772}
6773
6774impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
6775
6776impl<'a, C> ProjectLocationGetCall<'a, C>
6777where
6778    C: common::Connector,
6779{
6780    /// Perform the operation you have build so far.
6781    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
6782        use std::borrow::Cow;
6783        use std::io::{Read, Seek};
6784
6785        use common::{url::Params, ToParts};
6786        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6787
6788        let mut dd = common::DefaultDelegate;
6789        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6790        dlg.begin(common::MethodInfo {
6791            id: "datafusion.projects.locations.get",
6792            http_method: hyper::Method::GET,
6793        });
6794
6795        for &field in ["alt", "name"].iter() {
6796            if self._additional_params.contains_key(field) {
6797                dlg.finished(false);
6798                return Err(common::Error::FieldClash(field));
6799            }
6800        }
6801
6802        let mut params = Params::with_capacity(3 + self._additional_params.len());
6803        params.push("name", self._name);
6804
6805        params.extend(self._additional_params.iter());
6806
6807        params.push("alt", "json");
6808        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6809        if self._scopes.is_empty() {
6810            self._scopes
6811                .insert(Scope::CloudPlatform.as_ref().to_string());
6812        }
6813
6814        #[allow(clippy::single_element_loop)]
6815        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6816            url = params.uri_replacement(url, param_name, find_this, true);
6817        }
6818        {
6819            let to_remove = ["name"];
6820            params.remove_params(&to_remove);
6821        }
6822
6823        let url = params.parse_with_url(&url);
6824
6825        loop {
6826            let token = match self
6827                .hub
6828                .auth
6829                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6830                .await
6831            {
6832                Ok(token) => token,
6833                Err(e) => match dlg.token(e) {
6834                    Ok(token) => token,
6835                    Err(e) => {
6836                        dlg.finished(false);
6837                        return Err(common::Error::MissingToken(e));
6838                    }
6839                },
6840            };
6841            let mut req_result = {
6842                let client = &self.hub.client;
6843                dlg.pre_request();
6844                let mut req_builder = hyper::Request::builder()
6845                    .method(hyper::Method::GET)
6846                    .uri(url.as_str())
6847                    .header(USER_AGENT, self.hub._user_agent.clone());
6848
6849                if let Some(token) = token.as_ref() {
6850                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6851                }
6852
6853                let request = req_builder
6854                    .header(CONTENT_LENGTH, 0_u64)
6855                    .body(common::to_body::<String>(None));
6856
6857                client.request(request.unwrap()).await
6858            };
6859
6860            match req_result {
6861                Err(err) => {
6862                    if let common::Retry::After(d) = dlg.http_error(&err) {
6863                        sleep(d).await;
6864                        continue;
6865                    }
6866                    dlg.finished(false);
6867                    return Err(common::Error::HttpError(err));
6868                }
6869                Ok(res) => {
6870                    let (mut parts, body) = res.into_parts();
6871                    let mut body = common::Body::new(body);
6872                    if !parts.status.is_success() {
6873                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6874                        let error = serde_json::from_str(&common::to_string(&bytes));
6875                        let response = common::to_response(parts, bytes.into());
6876
6877                        if let common::Retry::After(d) =
6878                            dlg.http_failure(&response, error.as_ref().ok())
6879                        {
6880                            sleep(d).await;
6881                            continue;
6882                        }
6883
6884                        dlg.finished(false);
6885
6886                        return Err(match error {
6887                            Ok(value) => common::Error::BadRequest(value),
6888                            _ => common::Error::Failure(response),
6889                        });
6890                    }
6891                    let response = {
6892                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6893                        let encoded = common::to_string(&bytes);
6894                        match serde_json::from_str(&encoded) {
6895                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6896                            Err(error) => {
6897                                dlg.response_json_decode_error(&encoded, &error);
6898                                return Err(common::Error::JsonDecodeError(
6899                                    encoded.to_string(),
6900                                    error,
6901                                ));
6902                            }
6903                        }
6904                    };
6905
6906                    dlg.finished(true);
6907                    return Ok(response);
6908                }
6909            }
6910        }
6911    }
6912
6913    /// Resource name for the location.
6914    ///
6915    /// Sets the *name* path property to the given value.
6916    ///
6917    /// Even though the property as already been set when instantiating this call,
6918    /// we provide this method for API completeness.
6919    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
6920        self._name = new_value.to_string();
6921        self
6922    }
6923    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6924    /// while executing the actual API request.
6925    ///
6926    /// ````text
6927    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6928    /// ````
6929    ///
6930    /// Sets the *delegate* property to the given value.
6931    pub fn delegate(
6932        mut self,
6933        new_value: &'a mut dyn common::Delegate,
6934    ) -> ProjectLocationGetCall<'a, C> {
6935        self._delegate = Some(new_value);
6936        self
6937    }
6938
6939    /// Set any additional parameter of the query string used in the request.
6940    /// It should be used to set parameters which are not yet available through their own
6941    /// setters.
6942    ///
6943    /// Please note that this method must not be used to set any of the known parameters
6944    /// which have their own setter method. If done anyway, the request will fail.
6945    ///
6946    /// # Additional Parameters
6947    ///
6948    /// * *$.xgafv* (query-string) - V1 error format.
6949    /// * *access_token* (query-string) - OAuth access token.
6950    /// * *alt* (query-string) - Data format for response.
6951    /// * *callback* (query-string) - JSONP
6952    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6953    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6954    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6955    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6956    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6957    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6958    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6959    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
6960    where
6961        T: AsRef<str>,
6962    {
6963        self._additional_params
6964            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6965        self
6966    }
6967
6968    /// Identifies the authorization scope for the method you are building.
6969    ///
6970    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6971    /// [`Scope::CloudPlatform`].
6972    ///
6973    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6974    /// tokens for more than one scope.
6975    ///
6976    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6977    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6978    /// sufficient, a read-write scope will do as well.
6979    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
6980    where
6981        St: AsRef<str>,
6982    {
6983        self._scopes.insert(String::from(scope.as_ref()));
6984        self
6985    }
6986    /// Identifies the authorization scope(s) for the method you are building.
6987    ///
6988    /// See [`Self::add_scope()`] for details.
6989    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
6990    where
6991        I: IntoIterator<Item = St>,
6992        St: AsRef<str>,
6993    {
6994        self._scopes
6995            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6996        self
6997    }
6998
6999    /// Removes all scopes, and no default scope will be used either.
7000    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7001    /// for details).
7002    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
7003        self._scopes.clear();
7004        self
7005    }
7006}
7007
7008/// Lists information about the supported locations for this service.
7009///
7010/// A builder for the *locations.list* method supported by a *project* resource.
7011/// It is not used directly, but through a [`ProjectMethods`] instance.
7012///
7013/// # Example
7014///
7015/// Instantiate a resource method builder
7016///
7017/// ```test_harness,no_run
7018/// # extern crate hyper;
7019/// # extern crate hyper_rustls;
7020/// # extern crate google_datafusion1 as datafusion1;
7021/// # async fn dox() {
7022/// # use datafusion1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7023///
7024/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7025/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7026/// #     secret,
7027/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7028/// # ).build().await.unwrap();
7029///
7030/// # let client = hyper_util::client::legacy::Client::builder(
7031/// #     hyper_util::rt::TokioExecutor::new()
7032/// # )
7033/// # .build(
7034/// #     hyper_rustls::HttpsConnectorBuilder::new()
7035/// #         .with_native_roots()
7036/// #         .unwrap()
7037/// #         .https_or_http()
7038/// #         .enable_http1()
7039/// #         .build()
7040/// # );
7041/// # let mut hub = DataFusion::new(client, auth);
7042/// // You can configure optional parameters by calling the respective setters at will, and
7043/// // execute the final call using `doit()`.
7044/// // Values shown here are possibly random and not representative !
7045/// let result = hub.projects().locations_list("name")
7046///              .page_token("sed")
7047///              .page_size(-61)
7048///              .filter("Stet")
7049///              .doit().await;
7050/// # }
7051/// ```
7052pub struct ProjectLocationListCall<'a, C>
7053where
7054    C: 'a,
7055{
7056    hub: &'a DataFusion<C>,
7057    _name: String,
7058    _page_token: Option<String>,
7059    _page_size: Option<i32>,
7060    _filter: Option<String>,
7061    _delegate: Option<&'a mut dyn common::Delegate>,
7062    _additional_params: HashMap<String, String>,
7063    _scopes: BTreeSet<String>,
7064}
7065
7066impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
7067
7068impl<'a, C> ProjectLocationListCall<'a, C>
7069where
7070    C: common::Connector,
7071{
7072    /// Perform the operation you have build so far.
7073    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
7074        use std::borrow::Cow;
7075        use std::io::{Read, Seek};
7076
7077        use common::{url::Params, ToParts};
7078        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7079
7080        let mut dd = common::DefaultDelegate;
7081        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7082        dlg.begin(common::MethodInfo {
7083            id: "datafusion.projects.locations.list",
7084            http_method: hyper::Method::GET,
7085        });
7086
7087        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
7088            if self._additional_params.contains_key(field) {
7089                dlg.finished(false);
7090                return Err(common::Error::FieldClash(field));
7091            }
7092        }
7093
7094        let mut params = Params::with_capacity(6 + self._additional_params.len());
7095        params.push("name", self._name);
7096        if let Some(value) = self._page_token.as_ref() {
7097            params.push("pageToken", value);
7098        }
7099        if let Some(value) = self._page_size.as_ref() {
7100            params.push("pageSize", value.to_string());
7101        }
7102        if let Some(value) = self._filter.as_ref() {
7103            params.push("filter", value);
7104        }
7105
7106        params.extend(self._additional_params.iter());
7107
7108        params.push("alt", "json");
7109        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
7110        if self._scopes.is_empty() {
7111            self._scopes
7112                .insert(Scope::CloudPlatform.as_ref().to_string());
7113        }
7114
7115        #[allow(clippy::single_element_loop)]
7116        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7117            url = params.uri_replacement(url, param_name, find_this, true);
7118        }
7119        {
7120            let to_remove = ["name"];
7121            params.remove_params(&to_remove);
7122        }
7123
7124        let url = params.parse_with_url(&url);
7125
7126        loop {
7127            let token = match self
7128                .hub
7129                .auth
7130                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7131                .await
7132            {
7133                Ok(token) => token,
7134                Err(e) => match dlg.token(e) {
7135                    Ok(token) => token,
7136                    Err(e) => {
7137                        dlg.finished(false);
7138                        return Err(common::Error::MissingToken(e));
7139                    }
7140                },
7141            };
7142            let mut req_result = {
7143                let client = &self.hub.client;
7144                dlg.pre_request();
7145                let mut req_builder = hyper::Request::builder()
7146                    .method(hyper::Method::GET)
7147                    .uri(url.as_str())
7148                    .header(USER_AGENT, self.hub._user_agent.clone());
7149
7150                if let Some(token) = token.as_ref() {
7151                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7152                }
7153
7154                let request = req_builder
7155                    .header(CONTENT_LENGTH, 0_u64)
7156                    .body(common::to_body::<String>(None));
7157
7158                client.request(request.unwrap()).await
7159            };
7160
7161            match req_result {
7162                Err(err) => {
7163                    if let common::Retry::After(d) = dlg.http_error(&err) {
7164                        sleep(d).await;
7165                        continue;
7166                    }
7167                    dlg.finished(false);
7168                    return Err(common::Error::HttpError(err));
7169                }
7170                Ok(res) => {
7171                    let (mut parts, body) = res.into_parts();
7172                    let mut body = common::Body::new(body);
7173                    if !parts.status.is_success() {
7174                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7175                        let error = serde_json::from_str(&common::to_string(&bytes));
7176                        let response = common::to_response(parts, bytes.into());
7177
7178                        if let common::Retry::After(d) =
7179                            dlg.http_failure(&response, error.as_ref().ok())
7180                        {
7181                            sleep(d).await;
7182                            continue;
7183                        }
7184
7185                        dlg.finished(false);
7186
7187                        return Err(match error {
7188                            Ok(value) => common::Error::BadRequest(value),
7189                            _ => common::Error::Failure(response),
7190                        });
7191                    }
7192                    let response = {
7193                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7194                        let encoded = common::to_string(&bytes);
7195                        match serde_json::from_str(&encoded) {
7196                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7197                            Err(error) => {
7198                                dlg.response_json_decode_error(&encoded, &error);
7199                                return Err(common::Error::JsonDecodeError(
7200                                    encoded.to_string(),
7201                                    error,
7202                                ));
7203                            }
7204                        }
7205                    };
7206
7207                    dlg.finished(true);
7208                    return Ok(response);
7209                }
7210            }
7211        }
7212    }
7213
7214    /// The resource that owns the locations collection, if applicable.
7215    ///
7216    /// Sets the *name* path property to the given value.
7217    ///
7218    /// Even though the property as already been set when instantiating this call,
7219    /// we provide this method for API completeness.
7220    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
7221        self._name = new_value.to_string();
7222        self
7223    }
7224    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
7225    ///
7226    /// Sets the *page token* query property to the given value.
7227    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
7228        self._page_token = Some(new_value.to_string());
7229        self
7230    }
7231    /// The maximum number of results to return. If not set, the service selects a default.
7232    ///
7233    /// Sets the *page size* query property to the given value.
7234    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
7235        self._page_size = Some(new_value);
7236        self
7237    }
7238    /// 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).
7239    ///
7240    /// Sets the *filter* query property to the given value.
7241    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
7242        self._filter = Some(new_value.to_string());
7243        self
7244    }
7245    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7246    /// while executing the actual API request.
7247    ///
7248    /// ````text
7249    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7250    /// ````
7251    ///
7252    /// Sets the *delegate* property to the given value.
7253    pub fn delegate(
7254        mut self,
7255        new_value: &'a mut dyn common::Delegate,
7256    ) -> ProjectLocationListCall<'a, C> {
7257        self._delegate = Some(new_value);
7258        self
7259    }
7260
7261    /// Set any additional parameter of the query string used in the request.
7262    /// It should be used to set parameters which are not yet available through their own
7263    /// setters.
7264    ///
7265    /// Please note that this method must not be used to set any of the known parameters
7266    /// which have their own setter method. If done anyway, the request will fail.
7267    ///
7268    /// # Additional Parameters
7269    ///
7270    /// * *$.xgafv* (query-string) - V1 error format.
7271    /// * *access_token* (query-string) - OAuth access token.
7272    /// * *alt* (query-string) - Data format for response.
7273    /// * *callback* (query-string) - JSONP
7274    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7275    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7276    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7277    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7278    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7279    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7280    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7281    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
7282    where
7283        T: AsRef<str>,
7284    {
7285        self._additional_params
7286            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7287        self
7288    }
7289
7290    /// Identifies the authorization scope for the method you are building.
7291    ///
7292    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7293    /// [`Scope::CloudPlatform`].
7294    ///
7295    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7296    /// tokens for more than one scope.
7297    ///
7298    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7299    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7300    /// sufficient, a read-write scope will do as well.
7301    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
7302    where
7303        St: AsRef<str>,
7304    {
7305        self._scopes.insert(String::from(scope.as_ref()));
7306        self
7307    }
7308    /// Identifies the authorization scope(s) for the method you are building.
7309    ///
7310    /// See [`Self::add_scope()`] for details.
7311    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
7312    where
7313        I: IntoIterator<Item = St>,
7314        St: AsRef<str>,
7315    {
7316        self._scopes
7317            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7318        self
7319    }
7320
7321    /// Removes all scopes, and no default scope will be used either.
7322    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7323    /// for details).
7324    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
7325        self._scopes.clear();
7326        self
7327    }
7328}