google_datafusion1_beta1/
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_beta1 as datafusion1_beta1;
49/// use datafusion1_beta1::api::Instance;
50/// use datafusion1_beta1::{Result, Error};
51/// # async fn dox() {
52/// use datafusion1_beta1::{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 Cloud 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/// IAMPolicy encapsulates the IAM policy name, definition and status of policy fetching.
351///
352/// This type is not used in any activity, and only used as *part* of another schema.
353///
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct IAMPolicy {
358    /// Policy definition if IAM policy fetching is successful, otherwise empty.
359    pub policy: Option<Policy>,
360    /// Status of iam policy fetching.
361    pub status: Option<Status>,
362}
363
364impl common::Part for IAMPolicy {}
365
366/// Represents a Data Fusion instance.
367///
368/// # Activities
369///
370/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
371/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
372///
373/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
374/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
375/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
377#[serde_with::serde_as]
378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
379pub struct Instance {
380    /// Output only. List of accelerators enabled for this CDF instance.
381    pub accelerators: Option<Vec<Accelerator>>,
382    /// Output only. Endpoint on which the REST APIs is accessible.
383    #[serde(rename = "apiEndpoint")]
384    pub api_endpoint: Option<String>,
385    /// Output only. Available versions that the instance can be upgraded to using UpdateInstanceRequest.
386    #[serde(rename = "availableVersion")]
387    pub available_version: Option<Vec<Version>>,
388    /// Output only. The time the instance was created.
389    #[serde(rename = "createTime")]
390    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
391    /// The crypto key configuration. This field is used by the Customer-Managed Encryption Keys (CMEK) feature.
392    #[serde(rename = "cryptoKeyConfig")]
393    pub crypto_key_config: Option<CryptoKeyConfig>,
394    /// Optional. Option to enable the Dataplex Lineage Integration feature.
395    #[serde(rename = "dataplexDataLineageIntegrationEnabled")]
396    pub dataplex_data_lineage_integration_enabled: Option<bool>,
397    /// 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.
398    #[serde(rename = "dataprocServiceAccount")]
399    pub dataproc_service_account: Option<String>,
400    /// A description of this instance.
401    pub description: Option<String>,
402    /// Output only. If the instance state is DISABLED, the reason for disabling the instance.
403    #[serde(rename = "disabledReason")]
404    pub disabled_reason: Option<Vec<String>>,
405    /// Display name for an instance.
406    #[serde(rename = "displayName")]
407    pub display_name: Option<String>,
408    /// Option to enable granular role-based access control.
409    #[serde(rename = "enableRbac")]
410    pub enable_rbac: Option<bool>,
411    /// Option to enable Stackdriver Logging.
412    #[serde(rename = "enableStackdriverLogging")]
413    pub enable_stackdriver_logging: Option<bool>,
414    /// Option to enable Stackdriver Monitoring.
415    #[serde(rename = "enableStackdriverMonitoring")]
416    pub enable_stackdriver_monitoring: Option<bool>,
417    /// Option to enable zone separation.
418    #[serde(rename = "enableZoneSeparation")]
419    pub enable_zone_separation: Option<bool>,
420    /// Option to enable and pass metadata for event publishing.
421    #[serde(rename = "eventPublishConfig")]
422    pub event_publish_config: Option<EventPublishConfig>,
423    /// Output only. Cloud Storage bucket generated by Data Fusion in the customer project.
424    #[serde(rename = "gcsBucket")]
425    pub gcs_bucket: Option<String>,
426    /// 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.
427    pub labels: Option<HashMap<String, String>>,
428    /// Optional. Configure the maintenance policy for this instance.
429    #[serde(rename = "maintenancePolicy")]
430    pub maintenance_policy: Option<MaintenancePolicy>,
431    /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
432    pub name: Option<String>,
433    /// Network configuration options. These are required when a private Data Fusion instance is to be created.
434    #[serde(rename = "networkConfig")]
435    pub network_config: Option<NetworkConfig>,
436    /// Map of additional options used to configure the behavior of Data Fusion instance.
437    pub options: Option<HashMap<String, String>>,
438    /// Output only. Service agent for the customer project.
439    #[serde(rename = "p4ServiceAccount")]
440    pub p4_service_account: Option<String>,
441    /// Optional. Current patch revision of the Data Fusion.
442    #[serde(rename = "patchRevision")]
443    pub patch_revision: Option<String>,
444    /// 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.
445    #[serde(rename = "privateInstance")]
446    pub private_instance: Option<bool>,
447    /// Output only. Reserved for future use.
448    #[serde(rename = "satisfiesPzs")]
449    pub satisfies_pzs: Option<bool>,
450    /// Output only. Deprecated. Use tenant_project_id instead to extract the tenant project ID.
451    #[serde(rename = "serviceAccount")]
452    pub service_account: Option<String>,
453    /// Output only. Endpoint on which the Data Fusion UI is accessible.
454    #[serde(rename = "serviceEndpoint")]
455    pub service_endpoint: Option<String>,
456    /// Output only. The current state of this Data Fusion instance.
457    pub state: Option<String>,
458    /// Output only. Additional information about the current state of this Data Fusion instance if available.
459    #[serde(rename = "stateMessage")]
460    pub state_message: Option<String>,
461    /// Output only. The name of the tenant project.
462    #[serde(rename = "tenantProjectId")]
463    pub tenant_project_id: Option<String>,
464    /// Required. Instance type.
465    #[serde(rename = "type")]
466    pub type_: Option<String>,
467    /// Output only. The time the instance was last updated.
468    #[serde(rename = "updateTime")]
469    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
470    /// Current version of Data Fusion.
471    pub version: Option<String>,
472    /// Output only. Endpoint on which the Data Fusion UI is accessible to third-party users.
473    #[serde(rename = "workforceIdentityServiceEndpoint")]
474    pub workforce_identity_service_endpoint: Option<String>,
475    /// Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field.
476    pub zone: Option<String>,
477}
478
479impl common::RequestValue for Instance {}
480impl common::ResponseResult for Instance {}
481
482/// Response message for the list available versions request.
483///
484/// # Activities
485///
486/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
487/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
488///
489/// * [locations versions list projects](ProjectLocationVersionListCall) (response)
490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
491#[serde_with::serde_as]
492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
493pub struct ListAvailableVersionsResponse {
494    /// Represents a list of versions that are supported.
495    #[serde(rename = "availableVersions")]
496    pub available_versions: Option<Vec<Version>>,
497    /// Token to retrieve the next page of results or empty if there are no more results in the list.
498    #[serde(rename = "nextPageToken")]
499    pub next_page_token: Option<String>,
500}
501
502impl common::ResponseResult for ListAvailableVersionsResponse {}
503
504/// Response message for list DNS peerings.
505///
506/// # Activities
507///
508/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
509/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
510///
511/// * [locations instances dns peerings list projects](ProjectLocationInstanceDnsPeeringListCall) (response)
512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
513#[serde_with::serde_as]
514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
515pub struct ListDnsPeeringsResponse {
516    /// List of dns peering.
517    #[serde(rename = "dnsPeerings")]
518    pub dns_peerings: Option<Vec<DnsPeering>>,
519    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
520    #[serde(rename = "nextPageToken")]
521    pub next_page_token: Option<String>,
522}
523
524impl common::ResponseResult for ListDnsPeeringsResponse {}
525
526/// Response message for the list instance request.
527///
528/// # Activities
529///
530/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
531/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
532///
533/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
534#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
535#[serde_with::serde_as]
536#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
537pub struct ListInstancesResponse {
538    /// Represents a list of Data Fusion instances.
539    pub instances: Option<Vec<Instance>>,
540    /// Token to retrieve the next page of results or empty if there are no more results in the list.
541    #[serde(rename = "nextPageToken")]
542    pub next_page_token: Option<String>,
543    /// Locations that could not be reached.
544    pub unreachable: Option<Vec<String>>,
545}
546
547impl common::ResponseResult for ListInstancesResponse {}
548
549/// The response message for Locations.ListLocations.
550///
551/// # Activities
552///
553/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
554/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
555///
556/// * [locations list projects](ProjectLocationListCall) (response)
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct ListLocationsResponse {
561    /// A list of locations that matches the specified filter in the request.
562    pub locations: Option<Vec<Location>>,
563    /// The standard List next-page token.
564    #[serde(rename = "nextPageToken")]
565    pub next_page_token: Option<String>,
566}
567
568impl common::ResponseResult for ListLocationsResponse {}
569
570/// List namespaces response.
571///
572/// # Activities
573///
574/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
575/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
576///
577/// * [locations instances namespaces list projects](ProjectLocationInstanceNamespaceListCall) (response)
578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
579#[serde_with::serde_as]
580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
581pub struct ListNamespacesResponse {
582    /// List of namespaces
583    pub namespaces: Option<Vec<Namespace>>,
584    /// Token to retrieve the next page of results or empty if there are no more results in the list.
585    #[serde(rename = "nextPageToken")]
586    pub next_page_token: Option<String>,
587}
588
589impl common::ResponseResult for ListNamespacesResponse {}
590
591/// The response message for Operations.ListOperations.
592///
593/// # Activities
594///
595/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
596/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
597///
598/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
600#[serde_with::serde_as]
601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
602pub struct ListOperationsResponse {
603    /// The standard List next-page token.
604    #[serde(rename = "nextPageToken")]
605    pub next_page_token: Option<String>,
606    /// A list of operations that matches the specified filter in the request.
607    pub operations: Option<Vec<Operation>>,
608}
609
610impl common::ResponseResult for ListOperationsResponse {}
611
612/// A resource that represents a Google Cloud location.
613///
614/// # Activities
615///
616/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
617/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
618///
619/// * [locations get projects](ProjectLocationGetCall) (response)
620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
621#[serde_with::serde_as]
622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
623pub struct Location {
624    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
625    #[serde(rename = "displayName")]
626    pub display_name: Option<String>,
627    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
628    pub labels: Option<HashMap<String, String>>,
629    /// The canonical id for this location. For example: `"us-east1"`.
630    #[serde(rename = "locationId")]
631    pub location_id: Option<String>,
632    /// Service-specific metadata. For example the available capacity at the given location.
633    pub metadata: Option<HashMap<String, serde_json::Value>>,
634    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
635    pub name: Option<String>,
636}
637
638impl common::ResponseResult for Location {}
639
640/// Maintenance policy of the instance.
641///
642/// This type is not used in any activity, and only used as *part* of another schema.
643///
644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
645#[serde_with::serde_as]
646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
647pub struct MaintenancePolicy {
648    /// Optional. The maintenance exclusion window of the instance.
649    #[serde(rename = "maintenanceExclusionWindow")]
650    pub maintenance_exclusion_window: Option<TimeWindow>,
651    /// Optional. The maintenance window of the instance.
652    #[serde(rename = "maintenanceWindow")]
653    pub maintenance_window: Option<MaintenanceWindow>,
654}
655
656impl common::Part for MaintenancePolicy {}
657
658/// Maintenance window of the instance.
659///
660/// This type is not used in any activity, and only used as *part* of another schema.
661///
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct MaintenanceWindow {
666    /// Required. The recurring time window of the maintenance window.
667    #[serde(rename = "recurringTimeWindow")]
668    pub recurring_time_window: Option<RecurringTimeWindow>,
669}
670
671impl common::Part for MaintenanceWindow {}
672
673/// Represents the information of a namespace
674///
675/// This type is not used in any activity, and only used as *part* of another schema.
676///
677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
678#[serde_with::serde_as]
679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
680pub struct Namespace {
681    /// IAM policy associated with this namespace.
682    #[serde(rename = "iamPolicy")]
683    pub iam_policy: Option<IAMPolicy>,
684    /// Name of the given namespace.
685    pub name: Option<String>,
686}
687
688impl common::Part for Namespace {}
689
690/// 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.
691///
692/// This type is not used in any activity, and only used as *part* of another schema.
693///
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct NetworkConfig {
698    /// 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.
699    #[serde(rename = "connectionType")]
700    pub connection_type: Option<String>,
701    /// 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
702    #[serde(rename = "ipAllocation")]
703    pub ip_allocation: Option<String>,
704    /// 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.
705    pub network: Option<String>,
706    /// Optional. Configuration for Private Service Connect. This is required only when using connection type PRIVATE_SERVICE_CONNECT_INTERFACES.
707    #[serde(rename = "privateServiceConnectConfig")]
708    pub private_service_connect_config: Option<PrivateServiceConnectConfig>,
709}
710
711impl common::Part for NetworkConfig {}
712
713/// This resource represents a long-running operation that is the result of a network API call.
714///
715/// # Activities
716///
717/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
718/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
719///
720/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
721/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
722/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
723/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (response)
724/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (response)
725/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct Operation {
730    /// 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.
731    pub done: Option<bool>,
732    /// The error result of the operation in case of failure or cancellation.
733    pub error: Option<Status>,
734    /// 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.
735    pub metadata: Option<HashMap<String, serde_json::Value>>,
736    /// 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}`.
737    pub name: Option<String>,
738    /// 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`.
739    pub response: Option<HashMap<String, serde_json::Value>>,
740}
741
742impl common::ResponseResult for Operation {}
743
744/// 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/).
745///
746/// # Activities
747///
748/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
749/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
750///
751/// * [locations instances namespaces get iam policy projects](ProjectLocationInstanceNamespaceGetIamPolicyCall) (response)
752/// * [locations instances namespaces set iam policy projects](ProjectLocationInstanceNamespaceSetIamPolicyCall) (response)
753/// * [locations instances get iam policy projects](ProjectLocationInstanceGetIamPolicyCall) (response)
754/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (response)
755#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
756#[serde_with::serde_as]
757#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
758pub struct Policy {
759    /// Specifies cloud audit logging configuration for this policy.
760    #[serde(rename = "auditConfigs")]
761    pub audit_configs: Option<Vec<AuditConfig>>,
762    /// 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`.
763    pub bindings: Option<Vec<Binding>>,
764    /// `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.
765    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
766    pub etag: Option<Vec<u8>>,
767    /// 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).
768    pub version: Option<i32>,
769}
770
771impl common::ResponseResult for Policy {}
772
773/// Configuration for using Private Service Connect to establish connectivity between the Data Fusion consumer project and the corresponding tenant project.
774///
775/// This type is not used in any activity, and only used as *part* of another schema.
776///
777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
778#[serde_with::serde_as]
779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
780pub struct PrivateServiceConnectConfig {
781    /// 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
782    #[serde(rename = "effectiveUnreachableCidrBlock")]
783    pub effective_unreachable_cidr_block: Option<String>,
784    /// 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}.
785    #[serde(rename = "networkAttachment")]
786    pub network_attachment: Option<String>,
787    /// 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
788    #[serde(rename = "unreachableCidrBlock")]
789    pub unreachable_cidr_block: Option<String>,
790}
791
792impl common::Part for PrivateServiceConnectConfig {}
793
794/// Represents an arbitrary window of time that recurs.
795///
796/// This type is not used in any activity, and only used as *part* of another schema.
797///
798#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
799#[serde_with::serde_as]
800#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
801pub struct RecurringTimeWindow {
802    /// 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 ```
803    pub recurrence: Option<String>,
804    /// 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.
805    pub window: Option<TimeWindow>,
806}
807
808impl common::Part for RecurringTimeWindow {}
809
810/// Request message for RemoveIamPolicy method.
811///
812/// # Activities
813///
814/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
815/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
816///
817/// * [locations remove iam policy projects](ProjectLocationRemoveIamPolicyCall) (request)
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct RemoveIamPolicyRequest {
822    _never_set: Option<bool>,
823}
824
825impl common::RequestValue for RemoveIamPolicyRequest {}
826
827/// Response message for RemoveIamPolicy 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 remove iam policy projects](ProjectLocationRemoveIamPolicyCall) (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 RemoveIamPolicyResponse {
839    _never_set: Option<bool>,
840}
841
842impl common::ResponseResult for RemoveIamPolicyResponse {}
843
844/// Request message for restarting a Data Fusion instance.
845///
846/// # Activities
847///
848/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
849/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
850///
851/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (request)
852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
853#[serde_with::serde_as]
854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
855pub struct RestartInstanceRequest {
856    _never_set: Option<bool>,
857}
858
859impl common::RequestValue for RestartInstanceRequest {}
860
861/// Request message for `SetIamPolicy` method.
862///
863/// # Activities
864///
865/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
866/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
867///
868/// * [locations instances namespaces set iam policy projects](ProjectLocationInstanceNamespaceSetIamPolicyCall) (request)
869/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (request)
870#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
871#[serde_with::serde_as]
872#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
873pub struct SetIamPolicyRequest {
874    /// 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.
875    pub policy: Option<Policy>,
876    /// 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"`
877    #[serde(rename = "updateMask")]
878    pub update_mask: Option<common::FieldMask>,
879}
880
881impl common::RequestValue for SetIamPolicyRequest {}
882
883/// 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).
884///
885/// This type is not used in any activity, and only used as *part* of another schema.
886///
887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
888#[serde_with::serde_as]
889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
890pub struct Status {
891    /// The status code, which should be an enum value of google.rpc.Code.
892    pub code: Option<i32>,
893    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
894    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
895    /// 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.
896    pub message: Option<String>,
897}
898
899impl common::Part for Status {}
900
901/// Request message for `TestIamPermissions` method.
902///
903/// # Activities
904///
905/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
906/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
907///
908/// * [locations instances namespaces test iam permissions projects](ProjectLocationInstanceNamespaceTestIamPermissionCall) (request)
909/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (request)
910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
911#[serde_with::serde_as]
912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
913pub struct TestIamPermissionsRequest {
914    /// 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).
915    pub permissions: Option<Vec<String>>,
916}
917
918impl common::RequestValue for TestIamPermissionsRequest {}
919
920/// Response message for `TestIamPermissions` method.
921///
922/// # Activities
923///
924/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
925/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
926///
927/// * [locations instances namespaces test iam permissions projects](ProjectLocationInstanceNamespaceTestIamPermissionCall) (response)
928/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (response)
929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
930#[serde_with::serde_as]
931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
932pub struct TestIamPermissionsResponse {
933    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
934    pub permissions: Option<Vec<String>>,
935}
936
937impl common::ResponseResult for TestIamPermissionsResponse {}
938
939/// Represents an arbitrary window of time.
940///
941/// This type is not used in any activity, and only used as *part* of another schema.
942///
943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
944#[serde_with::serde_as]
945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
946pub struct TimeWindow {
947    /// 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"
948    #[serde(rename = "endTime")]
949    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
950    /// 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"
951    #[serde(rename = "startTime")]
952    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
953}
954
955impl common::Part for TimeWindow {}
956
957/// Request message for upgrading a Data Fusion instance. To change the instance properties, instance update should be used.
958///
959/// # Activities
960///
961/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
962/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
963///
964/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (request)
965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
966#[serde_with::serde_as]
967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
968pub struct UpgradeInstanceRequest {
969    _never_set: Option<bool>,
970}
971
972impl common::RequestValue for UpgradeInstanceRequest {}
973
974/// The Data Fusion version.
975///
976/// This type is not used in any activity, and only used as *part* of another schema.
977///
978#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
979#[serde_with::serde_as]
980#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
981pub struct Version {
982    /// Represents a list of available feature names for a given version.
983    #[serde(rename = "availableFeatures")]
984    pub available_features: Option<Vec<String>>,
985    /// Whether this is currently the default version for Cloud Data Fusion
986    #[serde(rename = "defaultVersion")]
987    pub default_version: Option<bool>,
988    /// Type represents the release availability of the version
989    #[serde(rename = "type")]
990    pub type_: Option<String>,
991    /// The version number of the Data Fusion instance, such as '6.0.1.0'.
992    #[serde(rename = "versionNumber")]
993    pub version_number: Option<String>,
994}
995
996impl common::Part for Version {}
997
998// ###################
999// MethodBuilders ###
1000// #################
1001
1002/// A builder providing access to all methods supported on *project* resources.
1003/// It is not used directly, but through the [`DataFusion`] hub.
1004///
1005/// # Example
1006///
1007/// Instantiate a resource builder
1008///
1009/// ```test_harness,no_run
1010/// extern crate hyper;
1011/// extern crate hyper_rustls;
1012/// extern crate google_datafusion1_beta1 as datafusion1_beta1;
1013///
1014/// # async fn dox() {
1015/// use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1016///
1017/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1018/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1019///     secret,
1020///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1021/// ).build().await.unwrap();
1022///
1023/// let client = hyper_util::client::legacy::Client::builder(
1024///     hyper_util::rt::TokioExecutor::new()
1025/// )
1026/// .build(
1027///     hyper_rustls::HttpsConnectorBuilder::new()
1028///         .with_native_roots()
1029///         .unwrap()
1030///         .https_or_http()
1031///         .enable_http1()
1032///         .build()
1033/// );
1034/// let mut hub = DataFusion::new(client, auth);
1035/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1036/// // 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_namespaces_get_iam_policy(...)`, `locations_instances_namespaces_list(...)`, `locations_instances_namespaces_set_iam_policy(...)`, `locations_instances_namespaces_test_iam_permissions(...)`, `locations_instances_patch(...)`, `locations_instances_restart(...)`, `locations_instances_set_iam_policy(...)`, `locations_instances_test_iam_permissions(...)`, `locations_instances_upgrade(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_remove_iam_policy(...)` and `locations_versions_list(...)`
1037/// // to build up your call.
1038/// let rb = hub.projects();
1039/// # }
1040/// ```
1041pub struct ProjectMethods<'a, C>
1042where
1043    C: 'a,
1044{
1045    hub: &'a DataFusion<C>,
1046}
1047
1048impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1049
1050impl<'a, C> ProjectMethods<'a, C> {
1051    /// Create a builder to help you perform the following task:
1052    ///
1053    /// Creates DNS peering on the given resource.
1054    ///
1055    /// # Arguments
1056    ///
1057    /// * `request` - No description provided.
1058    /// * `parent` - Required. The resource on which DNS peering will be created.
1059    pub fn locations_instances_dns_peerings_create(
1060        &self,
1061        request: DnsPeering,
1062        parent: &str,
1063    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1064        ProjectLocationInstanceDnsPeeringCreateCall {
1065            hub: self.hub,
1066            _request: request,
1067            _parent: parent.to_string(),
1068            _dns_peering_id: Default::default(),
1069            _delegate: Default::default(),
1070            _additional_params: Default::default(),
1071            _scopes: Default::default(),
1072        }
1073    }
1074
1075    /// Create a builder to help you perform the following task:
1076    ///
1077    /// Deletes DNS peering on the given resource.
1078    ///
1079    /// # Arguments
1080    ///
1081    /// * `name` - Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
1082    pub fn locations_instances_dns_peerings_delete(
1083        &self,
1084        name: &str,
1085    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
1086        ProjectLocationInstanceDnsPeeringDeleteCall {
1087            hub: self.hub,
1088            _name: name.to_string(),
1089            _delegate: Default::default(),
1090            _additional_params: Default::default(),
1091            _scopes: Default::default(),
1092        }
1093    }
1094
1095    /// Create a builder to help you perform the following task:
1096    ///
1097    /// Lists DNS peerings for a given resource.
1098    ///
1099    /// # Arguments
1100    ///
1101    /// * `parent` - Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
1102    pub fn locations_instances_dns_peerings_list(
1103        &self,
1104        parent: &str,
1105    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
1106        ProjectLocationInstanceDnsPeeringListCall {
1107            hub: self.hub,
1108            _parent: parent.to_string(),
1109            _page_token: Default::default(),
1110            _page_size: Default::default(),
1111            _delegate: Default::default(),
1112            _additional_params: Default::default(),
1113            _scopes: Default::default(),
1114        }
1115    }
1116
1117    /// Create a builder to help you perform the following task:
1118    ///
1119    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1120    ///
1121    /// # Arguments
1122    ///
1123    /// * `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.
1124    pub fn locations_instances_namespaces_get_iam_policy(
1125        &self,
1126        resource: &str,
1127    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
1128        ProjectLocationInstanceNamespaceGetIamPolicyCall {
1129            hub: self.hub,
1130            _resource: resource.to_string(),
1131            _options_requested_policy_version: Default::default(),
1132            _delegate: Default::default(),
1133            _additional_params: Default::default(),
1134            _scopes: Default::default(),
1135        }
1136    }
1137
1138    /// Create a builder to help you perform the following task:
1139    ///
1140    /// List namespaces in a given instance
1141    ///
1142    /// # Arguments
1143    ///
1144    /// * `parent` - Required. The instance to list its namespaces.
1145    pub fn locations_instances_namespaces_list(
1146        &self,
1147        parent: &str,
1148    ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
1149        ProjectLocationInstanceNamespaceListCall {
1150            hub: self.hub,
1151            _parent: parent.to_string(),
1152            _view: Default::default(),
1153            _page_token: Default::default(),
1154            _page_size: Default::default(),
1155            _delegate: Default::default(),
1156            _additional_params: Default::default(),
1157            _scopes: Default::default(),
1158        }
1159    }
1160
1161    /// Create a builder to help you perform the following task:
1162    ///
1163    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1164    ///
1165    /// # Arguments
1166    ///
1167    /// * `request` - No description provided.
1168    /// * `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.
1169    pub fn locations_instances_namespaces_set_iam_policy(
1170        &self,
1171        request: SetIamPolicyRequest,
1172        resource: &str,
1173    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
1174        ProjectLocationInstanceNamespaceSetIamPolicyCall {
1175            hub: self.hub,
1176            _request: request,
1177            _resource: resource.to_string(),
1178            _delegate: Default::default(),
1179            _additional_params: Default::default(),
1180            _scopes: Default::default(),
1181        }
1182    }
1183
1184    /// Create a builder to help you perform the following task:
1185    ///
1186    /// 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.
1187    ///
1188    /// # Arguments
1189    ///
1190    /// * `request` - No description provided.
1191    /// * `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.
1192    pub fn locations_instances_namespaces_test_iam_permissions(
1193        &self,
1194        request: TestIamPermissionsRequest,
1195        resource: &str,
1196    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
1197        ProjectLocationInstanceNamespaceTestIamPermissionCall {
1198            hub: self.hub,
1199            _request: request,
1200            _resource: resource.to_string(),
1201            _delegate: Default::default(),
1202            _additional_params: Default::default(),
1203            _scopes: Default::default(),
1204        }
1205    }
1206
1207    /// Create a builder to help you perform the following task:
1208    ///
1209    /// Creates a new Data Fusion instance in the specified project and location.
1210    ///
1211    /// # Arguments
1212    ///
1213    /// * `request` - No description provided.
1214    /// * `parent` - Required. The instance's project and location in the format projects/{project}/locations/{location}.
1215    pub fn locations_instances_create(
1216        &self,
1217        request: Instance,
1218        parent: &str,
1219    ) -> ProjectLocationInstanceCreateCall<'a, C> {
1220        ProjectLocationInstanceCreateCall {
1221            hub: self.hub,
1222            _request: request,
1223            _parent: parent.to_string(),
1224            _instance_id: Default::default(),
1225            _delegate: Default::default(),
1226            _additional_params: Default::default(),
1227            _scopes: Default::default(),
1228        }
1229    }
1230
1231    /// Create a builder to help you perform the following task:
1232    ///
1233    /// Deletes a single Data Fusion instance.
1234    ///
1235    /// # Arguments
1236    ///
1237    /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
1238    pub fn locations_instances_delete(
1239        &self,
1240        name: &str,
1241    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
1242        ProjectLocationInstanceDeleteCall {
1243            hub: self.hub,
1244            _name: name.to_string(),
1245            _delegate: Default::default(),
1246            _additional_params: Default::default(),
1247            _scopes: Default::default(),
1248        }
1249    }
1250
1251    /// Create a builder to help you perform the following task:
1252    ///
1253    /// Gets details of a single Data Fusion instance.
1254    ///
1255    /// # Arguments
1256    ///
1257    /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
1258    pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
1259        ProjectLocationInstanceGetCall {
1260            hub: self.hub,
1261            _name: name.to_string(),
1262            _delegate: Default::default(),
1263            _additional_params: Default::default(),
1264            _scopes: Default::default(),
1265        }
1266    }
1267
1268    /// Create a builder to help you perform the following task:
1269    ///
1270    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1271    ///
1272    /// # Arguments
1273    ///
1274    /// * `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.
1275    pub fn locations_instances_get_iam_policy(
1276        &self,
1277        resource: &str,
1278    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
1279        ProjectLocationInstanceGetIamPolicyCall {
1280            hub: self.hub,
1281            _resource: resource.to_string(),
1282            _options_requested_policy_version: Default::default(),
1283            _delegate: Default::default(),
1284            _additional_params: Default::default(),
1285            _scopes: Default::default(),
1286        }
1287    }
1288
1289    /// Create a builder to help you perform the following task:
1290    ///
1291    /// Lists Data Fusion instances in the specified project and location.
1292    ///
1293    /// # Arguments
1294    ///
1295    /// * `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.
1296    pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
1297        ProjectLocationInstanceListCall {
1298            hub: self.hub,
1299            _parent: parent.to_string(),
1300            _page_token: Default::default(),
1301            _page_size: Default::default(),
1302            _order_by: Default::default(),
1303            _filter: Default::default(),
1304            _delegate: Default::default(),
1305            _additional_params: Default::default(),
1306            _scopes: Default::default(),
1307        }
1308    }
1309
1310    /// Create a builder to help you perform the following task:
1311    ///
1312    /// Updates a single Data Fusion instance.
1313    ///
1314    /// # Arguments
1315    ///
1316    /// * `request` - No description provided.
1317    /// * `name` - Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
1318    pub fn locations_instances_patch(
1319        &self,
1320        request: Instance,
1321        name: &str,
1322    ) -> ProjectLocationInstancePatchCall<'a, C> {
1323        ProjectLocationInstancePatchCall {
1324            hub: self.hub,
1325            _request: request,
1326            _name: name.to_string(),
1327            _update_mask: Default::default(),
1328            _delegate: Default::default(),
1329            _additional_params: Default::default(),
1330            _scopes: Default::default(),
1331        }
1332    }
1333
1334    /// Create a builder to help you perform the following task:
1335    ///
1336    /// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
1337    ///
1338    /// # Arguments
1339    ///
1340    /// * `request` - No description provided.
1341    /// * `name` - Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
1342    pub fn locations_instances_restart(
1343        &self,
1344        request: RestartInstanceRequest,
1345        name: &str,
1346    ) -> ProjectLocationInstanceRestartCall<'a, C> {
1347        ProjectLocationInstanceRestartCall {
1348            hub: self.hub,
1349            _request: request,
1350            _name: name.to_string(),
1351            _delegate: Default::default(),
1352            _additional_params: Default::default(),
1353            _scopes: Default::default(),
1354        }
1355    }
1356
1357    /// Create a builder to help you perform the following task:
1358    ///
1359    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1360    ///
1361    /// # Arguments
1362    ///
1363    /// * `request` - No description provided.
1364    /// * `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.
1365    pub fn locations_instances_set_iam_policy(
1366        &self,
1367        request: SetIamPolicyRequest,
1368        resource: &str,
1369    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
1370        ProjectLocationInstanceSetIamPolicyCall {
1371            hub: self.hub,
1372            _request: request,
1373            _resource: resource.to_string(),
1374            _delegate: Default::default(),
1375            _additional_params: Default::default(),
1376            _scopes: Default::default(),
1377        }
1378    }
1379
1380    /// Create a builder to help you perform the following task:
1381    ///
1382    /// 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.
1383    ///
1384    /// # Arguments
1385    ///
1386    /// * `request` - No description provided.
1387    /// * `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.
1388    pub fn locations_instances_test_iam_permissions(
1389        &self,
1390        request: TestIamPermissionsRequest,
1391        resource: &str,
1392    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
1393        ProjectLocationInstanceTestIamPermissionCall {
1394            hub: self.hub,
1395            _request: request,
1396            _resource: resource.to_string(),
1397            _delegate: Default::default(),
1398            _additional_params: Default::default(),
1399            _scopes: Default::default(),
1400        }
1401    }
1402
1403    /// Create a builder to help you perform the following task:
1404    ///
1405    /// Upgrade a single Data Fusion instance. At the end of an operation instance is fully upgraded.
1406    ///
1407    /// # Arguments
1408    ///
1409    /// * `request` - No description provided.
1410    /// * `name` - Required. Name of the Data Fusion instance which need to be upgraded in the form of projects/{project}/locations/{location}/instances/{instance} Instance will be upgraded with the latest stable version of the Data Fusion.
1411    pub fn locations_instances_upgrade(
1412        &self,
1413        request: UpgradeInstanceRequest,
1414        name: &str,
1415    ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
1416        ProjectLocationInstanceUpgradeCall {
1417            hub: self.hub,
1418            _request: request,
1419            _name: name.to_string(),
1420            _delegate: Default::default(),
1421            _additional_params: Default::default(),
1422            _scopes: Default::default(),
1423        }
1424    }
1425
1426    /// Create a builder to help you perform the following task:
1427    ///
1428    /// 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`.
1429    ///
1430    /// # Arguments
1431    ///
1432    /// * `request` - No description provided.
1433    /// * `name` - The name of the operation resource to be cancelled.
1434    pub fn locations_operations_cancel(
1435        &self,
1436        request: CancelOperationRequest,
1437        name: &str,
1438    ) -> ProjectLocationOperationCancelCall<'a, C> {
1439        ProjectLocationOperationCancelCall {
1440            hub: self.hub,
1441            _request: request,
1442            _name: name.to_string(),
1443            _delegate: Default::default(),
1444            _additional_params: Default::default(),
1445            _scopes: Default::default(),
1446        }
1447    }
1448
1449    /// Create a builder to help you perform the following task:
1450    ///
1451    /// 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`.
1452    ///
1453    /// # Arguments
1454    ///
1455    /// * `name` - The name of the operation resource to be deleted.
1456    pub fn locations_operations_delete(
1457        &self,
1458        name: &str,
1459    ) -> ProjectLocationOperationDeleteCall<'a, C> {
1460        ProjectLocationOperationDeleteCall {
1461            hub: self.hub,
1462            _name: name.to_string(),
1463            _delegate: Default::default(),
1464            _additional_params: Default::default(),
1465            _scopes: Default::default(),
1466        }
1467    }
1468
1469    /// Create a builder to help you perform the following task:
1470    ///
1471    /// 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.
1472    ///
1473    /// # Arguments
1474    ///
1475    /// * `name` - The name of the operation resource.
1476    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1477        ProjectLocationOperationGetCall {
1478            hub: self.hub,
1479            _name: name.to_string(),
1480            _delegate: Default::default(),
1481            _additional_params: Default::default(),
1482            _scopes: Default::default(),
1483        }
1484    }
1485
1486    /// Create a builder to help you perform the following task:
1487    ///
1488    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1489    ///
1490    /// # Arguments
1491    ///
1492    /// * `name` - The name of the operation's parent resource.
1493    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1494        ProjectLocationOperationListCall {
1495            hub: self.hub,
1496            _name: name.to_string(),
1497            _page_token: Default::default(),
1498            _page_size: Default::default(),
1499            _filter: Default::default(),
1500            _delegate: Default::default(),
1501            _additional_params: Default::default(),
1502            _scopes: Default::default(),
1503        }
1504    }
1505
1506    /// Create a builder to help you perform the following task:
1507    ///
1508    /// Lists possible versions for Data Fusion instances in the specified project and location.
1509    ///
1510    /// # Arguments
1511    ///
1512    /// * `parent` - Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
1513    pub fn locations_versions_list(&self, parent: &str) -> ProjectLocationVersionListCall<'a, C> {
1514        ProjectLocationVersionListCall {
1515            hub: self.hub,
1516            _parent: parent.to_string(),
1517            _page_token: Default::default(),
1518            _page_size: Default::default(),
1519            _latest_patch_only: Default::default(),
1520            _delegate: Default::default(),
1521            _additional_params: Default::default(),
1522            _scopes: Default::default(),
1523        }
1524    }
1525
1526    /// Create a builder to help you perform the following task:
1527    ///
1528    /// Gets information about a location.
1529    ///
1530    /// # Arguments
1531    ///
1532    /// * `name` - Resource name for the location.
1533    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1534        ProjectLocationGetCall {
1535            hub: self.hub,
1536            _name: name.to_string(),
1537            _delegate: Default::default(),
1538            _additional_params: Default::default(),
1539            _scopes: Default::default(),
1540        }
1541    }
1542
1543    /// Create a builder to help you perform the following task:
1544    ///
1545    /// Lists information about the supported locations for this service.
1546    ///
1547    /// # Arguments
1548    ///
1549    /// * `name` - The resource that owns the locations collection, if applicable.
1550    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1551        ProjectLocationListCall {
1552            hub: self.hub,
1553            _name: name.to_string(),
1554            _page_token: Default::default(),
1555            _page_size: Default::default(),
1556            _filter: Default::default(),
1557            _delegate: Default::default(),
1558            _additional_params: Default::default(),
1559            _scopes: Default::default(),
1560        }
1561    }
1562
1563    /// Create a builder to help you perform the following task:
1564    ///
1565    /// Remove IAM policy that is currently set on the given resource.
1566    ///
1567    /// # Arguments
1568    ///
1569    /// * `request` - No description provided.
1570    /// * `resource` - Required. The resource on which IAM policy to be removed is attached to.
1571    pub fn locations_remove_iam_policy(
1572        &self,
1573        request: RemoveIamPolicyRequest,
1574        resource: &str,
1575    ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
1576        ProjectLocationRemoveIamPolicyCall {
1577            hub: self.hub,
1578            _request: request,
1579            _resource: resource.to_string(),
1580            _delegate: Default::default(),
1581            _additional_params: Default::default(),
1582            _scopes: Default::default(),
1583        }
1584    }
1585}
1586
1587// ###################
1588// CallBuilders   ###
1589// #################
1590
1591/// Creates DNS peering on the given resource.
1592///
1593/// A builder for the *locations.instances.dnsPeerings.create* method supported by a *project* resource.
1594/// It is not used directly, but through a [`ProjectMethods`] instance.
1595///
1596/// # Example
1597///
1598/// Instantiate a resource method builder
1599///
1600/// ```test_harness,no_run
1601/// # extern crate hyper;
1602/// # extern crate hyper_rustls;
1603/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
1604/// use datafusion1_beta1::api::DnsPeering;
1605/// # async fn dox() {
1606/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1607///
1608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1609/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1610/// #     secret,
1611/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1612/// # ).build().await.unwrap();
1613///
1614/// # let client = hyper_util::client::legacy::Client::builder(
1615/// #     hyper_util::rt::TokioExecutor::new()
1616/// # )
1617/// # .build(
1618/// #     hyper_rustls::HttpsConnectorBuilder::new()
1619/// #         .with_native_roots()
1620/// #         .unwrap()
1621/// #         .https_or_http()
1622/// #         .enable_http1()
1623/// #         .build()
1624/// # );
1625/// # let mut hub = DataFusion::new(client, auth);
1626/// // As the method needs a request, you would usually fill it with the desired information
1627/// // into the respective structure. Some of the parts shown here might not be applicable !
1628/// // Values shown here are possibly random and not representative !
1629/// let mut req = DnsPeering::default();
1630///
1631/// // You can configure optional parameters by calling the respective setters at will, and
1632/// // execute the final call using `doit()`.
1633/// // Values shown here are possibly random and not representative !
1634/// let result = hub.projects().locations_instances_dns_peerings_create(req, "parent")
1635///              .dns_peering_id("sed")
1636///              .doit().await;
1637/// # }
1638/// ```
1639pub struct ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1640where
1641    C: 'a,
1642{
1643    hub: &'a DataFusion<C>,
1644    _request: DnsPeering,
1645    _parent: String,
1646    _dns_peering_id: Option<String>,
1647    _delegate: Option<&'a mut dyn common::Delegate>,
1648    _additional_params: HashMap<String, String>,
1649    _scopes: BTreeSet<String>,
1650}
1651
1652impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {}
1653
1654impl<'a, C> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1655where
1656    C: common::Connector,
1657{
1658    /// Perform the operation you have build so far.
1659    pub async fn doit(mut self) -> common::Result<(common::Response, DnsPeering)> {
1660        use std::borrow::Cow;
1661        use std::io::{Read, Seek};
1662
1663        use common::{url::Params, ToParts};
1664        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1665
1666        let mut dd = common::DefaultDelegate;
1667        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1668        dlg.begin(common::MethodInfo {
1669            id: "datafusion.projects.locations.instances.dnsPeerings.create",
1670            http_method: hyper::Method::POST,
1671        });
1672
1673        for &field in ["alt", "parent", "dnsPeeringId"].iter() {
1674            if self._additional_params.contains_key(field) {
1675                dlg.finished(false);
1676                return Err(common::Error::FieldClash(field));
1677            }
1678        }
1679
1680        let mut params = Params::with_capacity(5 + self._additional_params.len());
1681        params.push("parent", self._parent);
1682        if let Some(value) = self._dns_peering_id.as_ref() {
1683            params.push("dnsPeeringId", value);
1684        }
1685
1686        params.extend(self._additional_params.iter());
1687
1688        params.push("alt", "json");
1689        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dnsPeerings";
1690        if self._scopes.is_empty() {
1691            self._scopes
1692                .insert(Scope::CloudPlatform.as_ref().to_string());
1693        }
1694
1695        #[allow(clippy::single_element_loop)]
1696        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1697            url = params.uri_replacement(url, param_name, find_this, true);
1698        }
1699        {
1700            let to_remove = ["parent"];
1701            params.remove_params(&to_remove);
1702        }
1703
1704        let url = params.parse_with_url(&url);
1705
1706        let mut json_mime_type = mime::APPLICATION_JSON;
1707        let mut request_value_reader = {
1708            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1709            common::remove_json_null_values(&mut value);
1710            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1711            serde_json::to_writer(&mut dst, &value).unwrap();
1712            dst
1713        };
1714        let request_size = request_value_reader
1715            .seek(std::io::SeekFrom::End(0))
1716            .unwrap();
1717        request_value_reader
1718            .seek(std::io::SeekFrom::Start(0))
1719            .unwrap();
1720
1721        loop {
1722            let token = match self
1723                .hub
1724                .auth
1725                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1726                .await
1727            {
1728                Ok(token) => token,
1729                Err(e) => match dlg.token(e) {
1730                    Ok(token) => token,
1731                    Err(e) => {
1732                        dlg.finished(false);
1733                        return Err(common::Error::MissingToken(e));
1734                    }
1735                },
1736            };
1737            request_value_reader
1738                .seek(std::io::SeekFrom::Start(0))
1739                .unwrap();
1740            let mut req_result = {
1741                let client = &self.hub.client;
1742                dlg.pre_request();
1743                let mut req_builder = hyper::Request::builder()
1744                    .method(hyper::Method::POST)
1745                    .uri(url.as_str())
1746                    .header(USER_AGENT, self.hub._user_agent.clone());
1747
1748                if let Some(token) = token.as_ref() {
1749                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1750                }
1751
1752                let request = req_builder
1753                    .header(CONTENT_TYPE, json_mime_type.to_string())
1754                    .header(CONTENT_LENGTH, request_size as u64)
1755                    .body(common::to_body(
1756                        request_value_reader.get_ref().clone().into(),
1757                    ));
1758
1759                client.request(request.unwrap()).await
1760            };
1761
1762            match req_result {
1763                Err(err) => {
1764                    if let common::Retry::After(d) = dlg.http_error(&err) {
1765                        sleep(d).await;
1766                        continue;
1767                    }
1768                    dlg.finished(false);
1769                    return Err(common::Error::HttpError(err));
1770                }
1771                Ok(res) => {
1772                    let (mut parts, body) = res.into_parts();
1773                    let mut body = common::Body::new(body);
1774                    if !parts.status.is_success() {
1775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1776                        let error = serde_json::from_str(&common::to_string(&bytes));
1777                        let response = common::to_response(parts, bytes.into());
1778
1779                        if let common::Retry::After(d) =
1780                            dlg.http_failure(&response, error.as_ref().ok())
1781                        {
1782                            sleep(d).await;
1783                            continue;
1784                        }
1785
1786                        dlg.finished(false);
1787
1788                        return Err(match error {
1789                            Ok(value) => common::Error::BadRequest(value),
1790                            _ => common::Error::Failure(response),
1791                        });
1792                    }
1793                    let response = {
1794                        let bytes = common::to_bytes(body).await.unwrap_or_default();
1795                        let encoded = common::to_string(&bytes);
1796                        match serde_json::from_str(&encoded) {
1797                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1798                            Err(error) => {
1799                                dlg.response_json_decode_error(&encoded, &error);
1800                                return Err(common::Error::JsonDecodeError(
1801                                    encoded.to_string(),
1802                                    error,
1803                                ));
1804                            }
1805                        }
1806                    };
1807
1808                    dlg.finished(true);
1809                    return Ok(response);
1810                }
1811            }
1812        }
1813    }
1814
1815    ///
1816    /// Sets the *request* property to the given value.
1817    ///
1818    /// Even though the property as already been set when instantiating this call,
1819    /// we provide this method for API completeness.
1820    pub fn request(
1821        mut self,
1822        new_value: DnsPeering,
1823    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1824        self._request = new_value;
1825        self
1826    }
1827    /// Required. The resource on which DNS peering will be created.
1828    ///
1829    /// Sets the *parent* path property to the given value.
1830    ///
1831    /// Even though the property as already been set when instantiating this call,
1832    /// we provide this method for API completeness.
1833    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1834        self._parent = new_value.to_string();
1835        self
1836    }
1837    /// Required. The name of the peering to create.
1838    ///
1839    /// Sets the *dns peering id* query property to the given value.
1840    pub fn dns_peering_id(
1841        mut self,
1842        new_value: &str,
1843    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1844        self._dns_peering_id = Some(new_value.to_string());
1845        self
1846    }
1847    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1848    /// while executing the actual API request.
1849    ///
1850    /// ````text
1851    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
1852    /// ````
1853    ///
1854    /// Sets the *delegate* property to the given value.
1855    pub fn delegate(
1856        mut self,
1857        new_value: &'a mut dyn common::Delegate,
1858    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1859        self._delegate = Some(new_value);
1860        self
1861    }
1862
1863    /// Set any additional parameter of the query string used in the request.
1864    /// It should be used to set parameters which are not yet available through their own
1865    /// setters.
1866    ///
1867    /// Please note that this method must not be used to set any of the known parameters
1868    /// which have their own setter method. If done anyway, the request will fail.
1869    ///
1870    /// # Additional Parameters
1871    ///
1872    /// * *$.xgafv* (query-string) - V1 error format.
1873    /// * *access_token* (query-string) - OAuth access token.
1874    /// * *alt* (query-string) - Data format for response.
1875    /// * *callback* (query-string) - JSONP
1876    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1877    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
1878    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1879    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1880    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
1881    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1882    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1883    pub fn param<T>(
1884        mut self,
1885        name: T,
1886        value: T,
1887    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1888    where
1889        T: AsRef<str>,
1890    {
1891        self._additional_params
1892            .insert(name.as_ref().to_string(), value.as_ref().to_string());
1893        self
1894    }
1895
1896    /// Identifies the authorization scope for the method you are building.
1897    ///
1898    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
1899    /// [`Scope::CloudPlatform`].
1900    ///
1901    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
1902    /// tokens for more than one scope.
1903    ///
1904    /// Usually there is more than one suitable scope to authorize an operation, some of which may
1905    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
1906    /// sufficient, a read-write scope will do as well.
1907    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1908    where
1909        St: AsRef<str>,
1910    {
1911        self._scopes.insert(String::from(scope.as_ref()));
1912        self
1913    }
1914    /// Identifies the authorization scope(s) for the method you are building.
1915    ///
1916    /// See [`Self::add_scope()`] for details.
1917    pub fn add_scopes<I, St>(
1918        mut self,
1919        scopes: I,
1920    ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1921    where
1922        I: IntoIterator<Item = St>,
1923        St: AsRef<str>,
1924    {
1925        self._scopes
1926            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
1927        self
1928    }
1929
1930    /// Removes all scopes, and no default scope will be used either.
1931    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
1932    /// for details).
1933    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1934        self._scopes.clear();
1935        self
1936    }
1937}
1938
1939/// Deletes DNS peering on the given resource.
1940///
1941/// A builder for the *locations.instances.dnsPeerings.delete* method supported by a *project* resource.
1942/// It is not used directly, but through a [`ProjectMethods`] instance.
1943///
1944/// # Example
1945///
1946/// Instantiate a resource method builder
1947///
1948/// ```test_harness,no_run
1949/// # extern crate hyper;
1950/// # extern crate hyper_rustls;
1951/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
1952/// # async fn dox() {
1953/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1954///
1955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1956/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1957/// #     secret,
1958/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1959/// # ).build().await.unwrap();
1960///
1961/// # let client = hyper_util::client::legacy::Client::builder(
1962/// #     hyper_util::rt::TokioExecutor::new()
1963/// # )
1964/// # .build(
1965/// #     hyper_rustls::HttpsConnectorBuilder::new()
1966/// #         .with_native_roots()
1967/// #         .unwrap()
1968/// #         .https_or_http()
1969/// #         .enable_http1()
1970/// #         .build()
1971/// # );
1972/// # let mut hub = DataFusion::new(client, auth);
1973/// // You can configure optional parameters by calling the respective setters at will, and
1974/// // execute the final call using `doit()`.
1975/// // Values shown here are possibly random and not representative !
1976/// let result = hub.projects().locations_instances_dns_peerings_delete("name")
1977///              .doit().await;
1978/// # }
1979/// ```
1980pub struct ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1981where
1982    C: 'a,
1983{
1984    hub: &'a DataFusion<C>,
1985    _name: String,
1986    _delegate: Option<&'a mut dyn common::Delegate>,
1987    _additional_params: HashMap<String, String>,
1988    _scopes: BTreeSet<String>,
1989}
1990
1991impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {}
1992
1993impl<'a, C> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
1994where
1995    C: common::Connector,
1996{
1997    /// Perform the operation you have build so far.
1998    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
1999        use std::borrow::Cow;
2000        use std::io::{Read, Seek};
2001
2002        use common::{url::Params, ToParts};
2003        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2004
2005        let mut dd = common::DefaultDelegate;
2006        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2007        dlg.begin(common::MethodInfo {
2008            id: "datafusion.projects.locations.instances.dnsPeerings.delete",
2009            http_method: hyper::Method::DELETE,
2010        });
2011
2012        for &field in ["alt", "name"].iter() {
2013            if self._additional_params.contains_key(field) {
2014                dlg.finished(false);
2015                return Err(common::Error::FieldClash(field));
2016            }
2017        }
2018
2019        let mut params = Params::with_capacity(3 + self._additional_params.len());
2020        params.push("name", self._name);
2021
2022        params.extend(self._additional_params.iter());
2023
2024        params.push("alt", "json");
2025        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2026        if self._scopes.is_empty() {
2027            self._scopes
2028                .insert(Scope::CloudPlatform.as_ref().to_string());
2029        }
2030
2031        #[allow(clippy::single_element_loop)]
2032        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2033            url = params.uri_replacement(url, param_name, find_this, true);
2034        }
2035        {
2036            let to_remove = ["name"];
2037            params.remove_params(&to_remove);
2038        }
2039
2040        let url = params.parse_with_url(&url);
2041
2042        loop {
2043            let token = match self
2044                .hub
2045                .auth
2046                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2047                .await
2048            {
2049                Ok(token) => token,
2050                Err(e) => match dlg.token(e) {
2051                    Ok(token) => token,
2052                    Err(e) => {
2053                        dlg.finished(false);
2054                        return Err(common::Error::MissingToken(e));
2055                    }
2056                },
2057            };
2058            let mut req_result = {
2059                let client = &self.hub.client;
2060                dlg.pre_request();
2061                let mut req_builder = hyper::Request::builder()
2062                    .method(hyper::Method::DELETE)
2063                    .uri(url.as_str())
2064                    .header(USER_AGENT, self.hub._user_agent.clone());
2065
2066                if let Some(token) = token.as_ref() {
2067                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2068                }
2069
2070                let request = req_builder
2071                    .header(CONTENT_LENGTH, 0_u64)
2072                    .body(common::to_body::<String>(None));
2073
2074                client.request(request.unwrap()).await
2075            };
2076
2077            match req_result {
2078                Err(err) => {
2079                    if let common::Retry::After(d) = dlg.http_error(&err) {
2080                        sleep(d).await;
2081                        continue;
2082                    }
2083                    dlg.finished(false);
2084                    return Err(common::Error::HttpError(err));
2085                }
2086                Ok(res) => {
2087                    let (mut parts, body) = res.into_parts();
2088                    let mut body = common::Body::new(body);
2089                    if !parts.status.is_success() {
2090                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2091                        let error = serde_json::from_str(&common::to_string(&bytes));
2092                        let response = common::to_response(parts, bytes.into());
2093
2094                        if let common::Retry::After(d) =
2095                            dlg.http_failure(&response, error.as_ref().ok())
2096                        {
2097                            sleep(d).await;
2098                            continue;
2099                        }
2100
2101                        dlg.finished(false);
2102
2103                        return Err(match error {
2104                            Ok(value) => common::Error::BadRequest(value),
2105                            _ => common::Error::Failure(response),
2106                        });
2107                    }
2108                    let response = {
2109                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2110                        let encoded = common::to_string(&bytes);
2111                        match serde_json::from_str(&encoded) {
2112                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2113                            Err(error) => {
2114                                dlg.response_json_decode_error(&encoded, &error);
2115                                return Err(common::Error::JsonDecodeError(
2116                                    encoded.to_string(),
2117                                    error,
2118                                ));
2119                            }
2120                        }
2121                    };
2122
2123                    dlg.finished(true);
2124                    return Ok(response);
2125                }
2126            }
2127        }
2128    }
2129
2130    /// Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
2131    ///
2132    /// Sets the *name* path property to the given value.
2133    ///
2134    /// Even though the property as already been set when instantiating this call,
2135    /// we provide this method for API completeness.
2136    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2137        self._name = new_value.to_string();
2138        self
2139    }
2140    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2141    /// while executing the actual API request.
2142    ///
2143    /// ````text
2144    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2145    /// ````
2146    ///
2147    /// Sets the *delegate* property to the given value.
2148    pub fn delegate(
2149        mut self,
2150        new_value: &'a mut dyn common::Delegate,
2151    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2152        self._delegate = Some(new_value);
2153        self
2154    }
2155
2156    /// Set any additional parameter of the query string used in the request.
2157    /// It should be used to set parameters which are not yet available through their own
2158    /// setters.
2159    ///
2160    /// Please note that this method must not be used to set any of the known parameters
2161    /// which have their own setter method. If done anyway, the request will fail.
2162    ///
2163    /// # Additional Parameters
2164    ///
2165    /// * *$.xgafv* (query-string) - V1 error format.
2166    /// * *access_token* (query-string) - OAuth access token.
2167    /// * *alt* (query-string) - Data format for response.
2168    /// * *callback* (query-string) - JSONP
2169    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2170    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2171    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2172    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2173    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2174    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2175    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2176    pub fn param<T>(
2177        mut self,
2178        name: T,
2179        value: T,
2180    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2181    where
2182        T: AsRef<str>,
2183    {
2184        self._additional_params
2185            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2186        self
2187    }
2188
2189    /// Identifies the authorization scope for the method you are building.
2190    ///
2191    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2192    /// [`Scope::CloudPlatform`].
2193    ///
2194    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2195    /// tokens for more than one scope.
2196    ///
2197    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2198    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2199    /// sufficient, a read-write scope will do as well.
2200    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2201    where
2202        St: AsRef<str>,
2203    {
2204        self._scopes.insert(String::from(scope.as_ref()));
2205        self
2206    }
2207    /// Identifies the authorization scope(s) for the method you are building.
2208    ///
2209    /// See [`Self::add_scope()`] for details.
2210    pub fn add_scopes<I, St>(
2211        mut self,
2212        scopes: I,
2213    ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2214    where
2215        I: IntoIterator<Item = St>,
2216        St: AsRef<str>,
2217    {
2218        self._scopes
2219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2220        self
2221    }
2222
2223    /// Removes all scopes, and no default scope will be used either.
2224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2225    /// for details).
2226    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2227        self._scopes.clear();
2228        self
2229    }
2230}
2231
2232/// Lists DNS peerings for a given resource.
2233///
2234/// A builder for the *locations.instances.dnsPeerings.list* method supported by a *project* resource.
2235/// It is not used directly, but through a [`ProjectMethods`] instance.
2236///
2237/// # Example
2238///
2239/// Instantiate a resource method builder
2240///
2241/// ```test_harness,no_run
2242/// # extern crate hyper;
2243/// # extern crate hyper_rustls;
2244/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2245/// # async fn dox() {
2246/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2247///
2248/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2249/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2250/// #     secret,
2251/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2252/// # ).build().await.unwrap();
2253///
2254/// # let client = hyper_util::client::legacy::Client::builder(
2255/// #     hyper_util::rt::TokioExecutor::new()
2256/// # )
2257/// # .build(
2258/// #     hyper_rustls::HttpsConnectorBuilder::new()
2259/// #         .with_native_roots()
2260/// #         .unwrap()
2261/// #         .https_or_http()
2262/// #         .enable_http1()
2263/// #         .build()
2264/// # );
2265/// # let mut hub = DataFusion::new(client, auth);
2266/// // You can configure optional parameters by calling the respective setters at will, and
2267/// // execute the final call using `doit()`.
2268/// // Values shown here are possibly random and not representative !
2269/// let result = hub.projects().locations_instances_dns_peerings_list("parent")
2270///              .page_token("amet.")
2271///              .page_size(-20)
2272///              .doit().await;
2273/// # }
2274/// ```
2275pub struct ProjectLocationInstanceDnsPeeringListCall<'a, C>
2276where
2277    C: 'a,
2278{
2279    hub: &'a DataFusion<C>,
2280    _parent: String,
2281    _page_token: Option<String>,
2282    _page_size: Option<i32>,
2283    _delegate: Option<&'a mut dyn common::Delegate>,
2284    _additional_params: HashMap<String, String>,
2285    _scopes: BTreeSet<String>,
2286}
2287
2288impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringListCall<'a, C> {}
2289
2290impl<'a, C> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2291where
2292    C: common::Connector,
2293{
2294    /// Perform the operation you have build so far.
2295    pub async fn doit(mut self) -> common::Result<(common::Response, ListDnsPeeringsResponse)> {
2296        use std::borrow::Cow;
2297        use std::io::{Read, Seek};
2298
2299        use common::{url::Params, ToParts};
2300        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2301
2302        let mut dd = common::DefaultDelegate;
2303        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2304        dlg.begin(common::MethodInfo {
2305            id: "datafusion.projects.locations.instances.dnsPeerings.list",
2306            http_method: hyper::Method::GET,
2307        });
2308
2309        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2310            if self._additional_params.contains_key(field) {
2311                dlg.finished(false);
2312                return Err(common::Error::FieldClash(field));
2313            }
2314        }
2315
2316        let mut params = Params::with_capacity(5 + self._additional_params.len());
2317        params.push("parent", self._parent);
2318        if let Some(value) = self._page_token.as_ref() {
2319            params.push("pageToken", value);
2320        }
2321        if let Some(value) = self._page_size.as_ref() {
2322            params.push("pageSize", value.to_string());
2323        }
2324
2325        params.extend(self._additional_params.iter());
2326
2327        params.push("alt", "json");
2328        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dnsPeerings";
2329        if self._scopes.is_empty() {
2330            self._scopes
2331                .insert(Scope::CloudPlatform.as_ref().to_string());
2332        }
2333
2334        #[allow(clippy::single_element_loop)]
2335        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2336            url = params.uri_replacement(url, param_name, find_this, true);
2337        }
2338        {
2339            let to_remove = ["parent"];
2340            params.remove_params(&to_remove);
2341        }
2342
2343        let url = params.parse_with_url(&url);
2344
2345        loop {
2346            let token = match self
2347                .hub
2348                .auth
2349                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2350                .await
2351            {
2352                Ok(token) => token,
2353                Err(e) => match dlg.token(e) {
2354                    Ok(token) => token,
2355                    Err(e) => {
2356                        dlg.finished(false);
2357                        return Err(common::Error::MissingToken(e));
2358                    }
2359                },
2360            };
2361            let mut req_result = {
2362                let client = &self.hub.client;
2363                dlg.pre_request();
2364                let mut req_builder = hyper::Request::builder()
2365                    .method(hyper::Method::GET)
2366                    .uri(url.as_str())
2367                    .header(USER_AGENT, self.hub._user_agent.clone());
2368
2369                if let Some(token) = token.as_ref() {
2370                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2371                }
2372
2373                let request = req_builder
2374                    .header(CONTENT_LENGTH, 0_u64)
2375                    .body(common::to_body::<String>(None));
2376
2377                client.request(request.unwrap()).await
2378            };
2379
2380            match req_result {
2381                Err(err) => {
2382                    if let common::Retry::After(d) = dlg.http_error(&err) {
2383                        sleep(d).await;
2384                        continue;
2385                    }
2386                    dlg.finished(false);
2387                    return Err(common::Error::HttpError(err));
2388                }
2389                Ok(res) => {
2390                    let (mut parts, body) = res.into_parts();
2391                    let mut body = common::Body::new(body);
2392                    if !parts.status.is_success() {
2393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2394                        let error = serde_json::from_str(&common::to_string(&bytes));
2395                        let response = common::to_response(parts, bytes.into());
2396
2397                        if let common::Retry::After(d) =
2398                            dlg.http_failure(&response, error.as_ref().ok())
2399                        {
2400                            sleep(d).await;
2401                            continue;
2402                        }
2403
2404                        dlg.finished(false);
2405
2406                        return Err(match error {
2407                            Ok(value) => common::Error::BadRequest(value),
2408                            _ => common::Error::Failure(response),
2409                        });
2410                    }
2411                    let response = {
2412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2413                        let encoded = common::to_string(&bytes);
2414                        match serde_json::from_str(&encoded) {
2415                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2416                            Err(error) => {
2417                                dlg.response_json_decode_error(&encoded, &error);
2418                                return Err(common::Error::JsonDecodeError(
2419                                    encoded.to_string(),
2420                                    error,
2421                                ));
2422                            }
2423                        }
2424                    };
2425
2426                    dlg.finished(true);
2427                    return Ok(response);
2428                }
2429            }
2430        }
2431    }
2432
2433    /// Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
2434    ///
2435    /// Sets the *parent* path property to the given value.
2436    ///
2437    /// Even though the property as already been set when instantiating this call,
2438    /// we provide this method for API completeness.
2439    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2440        self._parent = new_value.to_string();
2441        self
2442    }
2443    /// 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.
2444    ///
2445    /// Sets the *page token* query property to the given value.
2446    pub fn page_token(
2447        mut self,
2448        new_value: &str,
2449    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2450        self._page_token = Some(new_value.to_string());
2451        self
2452    }
2453    /// 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.
2454    ///
2455    /// Sets the *page size* query property to the given value.
2456    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2457        self._page_size = Some(new_value);
2458        self
2459    }
2460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2461    /// while executing the actual API request.
2462    ///
2463    /// ````text
2464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2465    /// ````
2466    ///
2467    /// Sets the *delegate* property to the given value.
2468    pub fn delegate(
2469        mut self,
2470        new_value: &'a mut dyn common::Delegate,
2471    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2472        self._delegate = Some(new_value);
2473        self
2474    }
2475
2476    /// Set any additional parameter of the query string used in the request.
2477    /// It should be used to set parameters which are not yet available through their own
2478    /// setters.
2479    ///
2480    /// Please note that this method must not be used to set any of the known parameters
2481    /// which have their own setter method. If done anyway, the request will fail.
2482    ///
2483    /// # Additional Parameters
2484    ///
2485    /// * *$.xgafv* (query-string) - V1 error format.
2486    /// * *access_token* (query-string) - OAuth access token.
2487    /// * *alt* (query-string) - Data format for response.
2488    /// * *callback* (query-string) - JSONP
2489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2490    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2493    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2496    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2497    where
2498        T: AsRef<str>,
2499    {
2500        self._additional_params
2501            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2502        self
2503    }
2504
2505    /// Identifies the authorization scope for the method you are building.
2506    ///
2507    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2508    /// [`Scope::CloudPlatform`].
2509    ///
2510    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2511    /// tokens for more than one scope.
2512    ///
2513    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2514    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2515    /// sufficient, a read-write scope will do as well.
2516    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2517    where
2518        St: AsRef<str>,
2519    {
2520        self._scopes.insert(String::from(scope.as_ref()));
2521        self
2522    }
2523    /// Identifies the authorization scope(s) for the method you are building.
2524    ///
2525    /// See [`Self::add_scope()`] for details.
2526    pub fn add_scopes<I, St>(
2527        mut self,
2528        scopes: I,
2529    ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2530    where
2531        I: IntoIterator<Item = St>,
2532        St: AsRef<str>,
2533    {
2534        self._scopes
2535            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2536        self
2537    }
2538
2539    /// Removes all scopes, and no default scope will be used either.
2540    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2541    /// for details).
2542    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2543        self._scopes.clear();
2544        self
2545    }
2546}
2547
2548/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2549///
2550/// A builder for the *locations.instances.namespaces.getIamPolicy* method supported by a *project* resource.
2551/// It is not used directly, but through a [`ProjectMethods`] instance.
2552///
2553/// # Example
2554///
2555/// Instantiate a resource method builder
2556///
2557/// ```test_harness,no_run
2558/// # extern crate hyper;
2559/// # extern crate hyper_rustls;
2560/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2561/// # async fn dox() {
2562/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2563///
2564/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2565/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2566/// #     secret,
2567/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2568/// # ).build().await.unwrap();
2569///
2570/// # let client = hyper_util::client::legacy::Client::builder(
2571/// #     hyper_util::rt::TokioExecutor::new()
2572/// # )
2573/// # .build(
2574/// #     hyper_rustls::HttpsConnectorBuilder::new()
2575/// #         .with_native_roots()
2576/// #         .unwrap()
2577/// #         .https_or_http()
2578/// #         .enable_http1()
2579/// #         .build()
2580/// # );
2581/// # let mut hub = DataFusion::new(client, auth);
2582/// // You can configure optional parameters by calling the respective setters at will, and
2583/// // execute the final call using `doit()`.
2584/// // Values shown here are possibly random and not representative !
2585/// let result = hub.projects().locations_instances_namespaces_get_iam_policy("resource")
2586///              .options_requested_policy_version(-62)
2587///              .doit().await;
2588/// # }
2589/// ```
2590pub struct ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2591where
2592    C: 'a,
2593{
2594    hub: &'a DataFusion<C>,
2595    _resource: String,
2596    _options_requested_policy_version: Option<i32>,
2597    _delegate: Option<&'a mut dyn common::Delegate>,
2598    _additional_params: HashMap<String, String>,
2599    _scopes: BTreeSet<String>,
2600}
2601
2602impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {}
2603
2604impl<'a, C> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2605where
2606    C: common::Connector,
2607{
2608    /// Perform the operation you have build so far.
2609    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
2610        use std::borrow::Cow;
2611        use std::io::{Read, Seek};
2612
2613        use common::{url::Params, ToParts};
2614        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2615
2616        let mut dd = common::DefaultDelegate;
2617        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2618        dlg.begin(common::MethodInfo {
2619            id: "datafusion.projects.locations.instances.namespaces.getIamPolicy",
2620            http_method: hyper::Method::GET,
2621        });
2622
2623        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
2624            if self._additional_params.contains_key(field) {
2625                dlg.finished(false);
2626                return Err(common::Error::FieldClash(field));
2627            }
2628        }
2629
2630        let mut params = Params::with_capacity(4 + self._additional_params.len());
2631        params.push("resource", self._resource);
2632        if let Some(value) = self._options_requested_policy_version.as_ref() {
2633            params.push("options.requestedPolicyVersion", value.to_string());
2634        }
2635
2636        params.extend(self._additional_params.iter());
2637
2638        params.push("alt", "json");
2639        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
2640        if self._scopes.is_empty() {
2641            self._scopes
2642                .insert(Scope::CloudPlatform.as_ref().to_string());
2643        }
2644
2645        #[allow(clippy::single_element_loop)]
2646        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
2647            url = params.uri_replacement(url, param_name, find_this, true);
2648        }
2649        {
2650            let to_remove = ["resource"];
2651            params.remove_params(&to_remove);
2652        }
2653
2654        let url = params.parse_with_url(&url);
2655
2656        loop {
2657            let token = match self
2658                .hub
2659                .auth
2660                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2661                .await
2662            {
2663                Ok(token) => token,
2664                Err(e) => match dlg.token(e) {
2665                    Ok(token) => token,
2666                    Err(e) => {
2667                        dlg.finished(false);
2668                        return Err(common::Error::MissingToken(e));
2669                    }
2670                },
2671            };
2672            let mut req_result = {
2673                let client = &self.hub.client;
2674                dlg.pre_request();
2675                let mut req_builder = hyper::Request::builder()
2676                    .method(hyper::Method::GET)
2677                    .uri(url.as_str())
2678                    .header(USER_AGENT, self.hub._user_agent.clone());
2679
2680                if let Some(token) = token.as_ref() {
2681                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2682                }
2683
2684                let request = req_builder
2685                    .header(CONTENT_LENGTH, 0_u64)
2686                    .body(common::to_body::<String>(None));
2687
2688                client.request(request.unwrap()).await
2689            };
2690
2691            match req_result {
2692                Err(err) => {
2693                    if let common::Retry::After(d) = dlg.http_error(&err) {
2694                        sleep(d).await;
2695                        continue;
2696                    }
2697                    dlg.finished(false);
2698                    return Err(common::Error::HttpError(err));
2699                }
2700                Ok(res) => {
2701                    let (mut parts, body) = res.into_parts();
2702                    let mut body = common::Body::new(body);
2703                    if !parts.status.is_success() {
2704                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2705                        let error = serde_json::from_str(&common::to_string(&bytes));
2706                        let response = common::to_response(parts, bytes.into());
2707
2708                        if let common::Retry::After(d) =
2709                            dlg.http_failure(&response, error.as_ref().ok())
2710                        {
2711                            sleep(d).await;
2712                            continue;
2713                        }
2714
2715                        dlg.finished(false);
2716
2717                        return Err(match error {
2718                            Ok(value) => common::Error::BadRequest(value),
2719                            _ => common::Error::Failure(response),
2720                        });
2721                    }
2722                    let response = {
2723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2724                        let encoded = common::to_string(&bytes);
2725                        match serde_json::from_str(&encoded) {
2726                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2727                            Err(error) => {
2728                                dlg.response_json_decode_error(&encoded, &error);
2729                                return Err(common::Error::JsonDecodeError(
2730                                    encoded.to_string(),
2731                                    error,
2732                                ));
2733                            }
2734                        }
2735                    };
2736
2737                    dlg.finished(true);
2738                    return Ok(response);
2739                }
2740            }
2741        }
2742    }
2743
2744    /// 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.
2745    ///
2746    /// Sets the *resource* path property to the given value.
2747    ///
2748    /// Even though the property as already been set when instantiating this call,
2749    /// we provide this method for API completeness.
2750    pub fn resource(
2751        mut self,
2752        new_value: &str,
2753    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2754        self._resource = new_value.to_string();
2755        self
2756    }
2757    /// 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).
2758    ///
2759    /// Sets the *options.requested policy version* query property to the given value.
2760    pub fn options_requested_policy_version(
2761        mut self,
2762        new_value: i32,
2763    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2764        self._options_requested_policy_version = Some(new_value);
2765        self
2766    }
2767    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2768    /// while executing the actual API request.
2769    ///
2770    /// ````text
2771    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2772    /// ````
2773    ///
2774    /// Sets the *delegate* property to the given value.
2775    pub fn delegate(
2776        mut self,
2777        new_value: &'a mut dyn common::Delegate,
2778    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2779        self._delegate = Some(new_value);
2780        self
2781    }
2782
2783    /// Set any additional parameter of the query string used in the request.
2784    /// It should be used to set parameters which are not yet available through their own
2785    /// setters.
2786    ///
2787    /// Please note that this method must not be used to set any of the known parameters
2788    /// which have their own setter method. If done anyway, the request will fail.
2789    ///
2790    /// # Additional Parameters
2791    ///
2792    /// * *$.xgafv* (query-string) - V1 error format.
2793    /// * *access_token* (query-string) - OAuth access token.
2794    /// * *alt* (query-string) - Data format for response.
2795    /// * *callback* (query-string) - JSONP
2796    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2797    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2798    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2799    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2800    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2801    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2802    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2803    pub fn param<T>(
2804        mut self,
2805        name: T,
2806        value: T,
2807    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2808    where
2809        T: AsRef<str>,
2810    {
2811        self._additional_params
2812            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2813        self
2814    }
2815
2816    /// Identifies the authorization scope for the method you are building.
2817    ///
2818    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2819    /// [`Scope::CloudPlatform`].
2820    ///
2821    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2822    /// tokens for more than one scope.
2823    ///
2824    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2825    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2826    /// sufficient, a read-write scope will do as well.
2827    pub fn add_scope<St>(
2828        mut self,
2829        scope: St,
2830    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2831    where
2832        St: AsRef<str>,
2833    {
2834        self._scopes.insert(String::from(scope.as_ref()));
2835        self
2836    }
2837    /// Identifies the authorization scope(s) for the method you are building.
2838    ///
2839    /// See [`Self::add_scope()`] for details.
2840    pub fn add_scopes<I, St>(
2841        mut self,
2842        scopes: I,
2843    ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2844    where
2845        I: IntoIterator<Item = St>,
2846        St: AsRef<str>,
2847    {
2848        self._scopes
2849            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2850        self
2851    }
2852
2853    /// Removes all scopes, and no default scope will be used either.
2854    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2855    /// for details).
2856    pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2857        self._scopes.clear();
2858        self
2859    }
2860}
2861
2862/// List namespaces in a given instance
2863///
2864/// A builder for the *locations.instances.namespaces.list* method supported by a *project* resource.
2865/// It is not used directly, but through a [`ProjectMethods`] instance.
2866///
2867/// # Example
2868///
2869/// Instantiate a resource method builder
2870///
2871/// ```test_harness,no_run
2872/// # extern crate hyper;
2873/// # extern crate hyper_rustls;
2874/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2875/// # async fn dox() {
2876/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2877///
2878/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2879/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2880/// #     secret,
2881/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2882/// # ).build().await.unwrap();
2883///
2884/// # let client = hyper_util::client::legacy::Client::builder(
2885/// #     hyper_util::rt::TokioExecutor::new()
2886/// # )
2887/// # .build(
2888/// #     hyper_rustls::HttpsConnectorBuilder::new()
2889/// #         .with_native_roots()
2890/// #         .unwrap()
2891/// #         .https_or_http()
2892/// #         .enable_http1()
2893/// #         .build()
2894/// # );
2895/// # let mut hub = DataFusion::new(client, auth);
2896/// // You can configure optional parameters by calling the respective setters at will, and
2897/// // execute the final call using `doit()`.
2898/// // Values shown here are possibly random and not representative !
2899/// let result = hub.projects().locations_instances_namespaces_list("parent")
2900///              .view("gubergren")
2901///              .page_token("eos")
2902///              .page_size(-4)
2903///              .doit().await;
2904/// # }
2905/// ```
2906pub struct ProjectLocationInstanceNamespaceListCall<'a, C>
2907where
2908    C: 'a,
2909{
2910    hub: &'a DataFusion<C>,
2911    _parent: String,
2912    _view: Option<String>,
2913    _page_token: Option<String>,
2914    _page_size: Option<i32>,
2915    _delegate: Option<&'a mut dyn common::Delegate>,
2916    _additional_params: HashMap<String, String>,
2917    _scopes: BTreeSet<String>,
2918}
2919
2920impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceListCall<'a, C> {}
2921
2922impl<'a, C> ProjectLocationInstanceNamespaceListCall<'a, C>
2923where
2924    C: common::Connector,
2925{
2926    /// Perform the operation you have build so far.
2927    pub async fn doit(mut self) -> common::Result<(common::Response, ListNamespacesResponse)> {
2928        use std::borrow::Cow;
2929        use std::io::{Read, Seek};
2930
2931        use common::{url::Params, ToParts};
2932        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2933
2934        let mut dd = common::DefaultDelegate;
2935        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2936        dlg.begin(common::MethodInfo {
2937            id: "datafusion.projects.locations.instances.namespaces.list",
2938            http_method: hyper::Method::GET,
2939        });
2940
2941        for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
2942            if self._additional_params.contains_key(field) {
2943                dlg.finished(false);
2944                return Err(common::Error::FieldClash(field));
2945            }
2946        }
2947
2948        let mut params = Params::with_capacity(6 + self._additional_params.len());
2949        params.push("parent", self._parent);
2950        if let Some(value) = self._view.as_ref() {
2951            params.push("view", value);
2952        }
2953        if let Some(value) = self._page_token.as_ref() {
2954            params.push("pageToken", value);
2955        }
2956        if let Some(value) = self._page_size.as_ref() {
2957            params.push("pageSize", value.to_string());
2958        }
2959
2960        params.extend(self._additional_params.iter());
2961
2962        params.push("alt", "json");
2963        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/namespaces";
2964        if self._scopes.is_empty() {
2965            self._scopes
2966                .insert(Scope::CloudPlatform.as_ref().to_string());
2967        }
2968
2969        #[allow(clippy::single_element_loop)]
2970        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2971            url = params.uri_replacement(url, param_name, find_this, true);
2972        }
2973        {
2974            let to_remove = ["parent"];
2975            params.remove_params(&to_remove);
2976        }
2977
2978        let url = params.parse_with_url(&url);
2979
2980        loop {
2981            let token = match self
2982                .hub
2983                .auth
2984                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2985                .await
2986            {
2987                Ok(token) => token,
2988                Err(e) => match dlg.token(e) {
2989                    Ok(token) => token,
2990                    Err(e) => {
2991                        dlg.finished(false);
2992                        return Err(common::Error::MissingToken(e));
2993                    }
2994                },
2995            };
2996            let mut req_result = {
2997                let client = &self.hub.client;
2998                dlg.pre_request();
2999                let mut req_builder = hyper::Request::builder()
3000                    .method(hyper::Method::GET)
3001                    .uri(url.as_str())
3002                    .header(USER_AGENT, self.hub._user_agent.clone());
3003
3004                if let Some(token) = token.as_ref() {
3005                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3006                }
3007
3008                let request = req_builder
3009                    .header(CONTENT_LENGTH, 0_u64)
3010                    .body(common::to_body::<String>(None));
3011
3012                client.request(request.unwrap()).await
3013            };
3014
3015            match req_result {
3016                Err(err) => {
3017                    if let common::Retry::After(d) = dlg.http_error(&err) {
3018                        sleep(d).await;
3019                        continue;
3020                    }
3021                    dlg.finished(false);
3022                    return Err(common::Error::HttpError(err));
3023                }
3024                Ok(res) => {
3025                    let (mut parts, body) = res.into_parts();
3026                    let mut body = common::Body::new(body);
3027                    if !parts.status.is_success() {
3028                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3029                        let error = serde_json::from_str(&common::to_string(&bytes));
3030                        let response = common::to_response(parts, bytes.into());
3031
3032                        if let common::Retry::After(d) =
3033                            dlg.http_failure(&response, error.as_ref().ok())
3034                        {
3035                            sleep(d).await;
3036                            continue;
3037                        }
3038
3039                        dlg.finished(false);
3040
3041                        return Err(match error {
3042                            Ok(value) => common::Error::BadRequest(value),
3043                            _ => common::Error::Failure(response),
3044                        });
3045                    }
3046                    let response = {
3047                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3048                        let encoded = common::to_string(&bytes);
3049                        match serde_json::from_str(&encoded) {
3050                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3051                            Err(error) => {
3052                                dlg.response_json_decode_error(&encoded, &error);
3053                                return Err(common::Error::JsonDecodeError(
3054                                    encoded.to_string(),
3055                                    error,
3056                                ));
3057                            }
3058                        }
3059                    };
3060
3061                    dlg.finished(true);
3062                    return Ok(response);
3063                }
3064            }
3065        }
3066    }
3067
3068    /// Required. The instance to list its namespaces.
3069    ///
3070    /// Sets the *parent* path property to the given value.
3071    ///
3072    /// Even though the property as already been set when instantiating this call,
3073    /// we provide this method for API completeness.
3074    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3075        self._parent = new_value.to_string();
3076        self
3077    }
3078    /// By default, only basic information about a namespace is returned (e.g. name). When `NAMESPACE_VIEW_FULL` is specified, additional information associated with a namespace gets returned (e.g. IAM policy set on the namespace)
3079    ///
3080    /// Sets the *view* query property to the given value.
3081    pub fn view(mut self, new_value: &str) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3082        self._view = Some(new_value.to_string());
3083        self
3084    }
3085    /// The next_page_token value to use if there are additional results to retrieve for this list request.
3086    ///
3087    /// Sets the *page token* query property to the given value.
3088    pub fn page_token(
3089        mut self,
3090        new_value: &str,
3091    ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3092        self._page_token = Some(new_value.to_string());
3093        self
3094    }
3095    /// The maximum number of items to return.
3096    ///
3097    /// Sets the *page size* query property to the given value.
3098    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3099        self._page_size = Some(new_value);
3100        self
3101    }
3102    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3103    /// while executing the actual API request.
3104    ///
3105    /// ````text
3106    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3107    /// ````
3108    ///
3109    /// Sets the *delegate* property to the given value.
3110    pub fn delegate(
3111        mut self,
3112        new_value: &'a mut dyn common::Delegate,
3113    ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3114        self._delegate = Some(new_value);
3115        self
3116    }
3117
3118    /// Set any additional parameter of the query string used in the request.
3119    /// It should be used to set parameters which are not yet available through their own
3120    /// setters.
3121    ///
3122    /// Please note that this method must not be used to set any of the known parameters
3123    /// which have their own setter method. If done anyway, the request will fail.
3124    ///
3125    /// # Additional Parameters
3126    ///
3127    /// * *$.xgafv* (query-string) - V1 error format.
3128    /// * *access_token* (query-string) - OAuth access token.
3129    /// * *alt* (query-string) - Data format for response.
3130    /// * *callback* (query-string) - JSONP
3131    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3132    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3133    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3134    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3135    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3136    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3137    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3138    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3139    where
3140        T: AsRef<str>,
3141    {
3142        self._additional_params
3143            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3144        self
3145    }
3146
3147    /// Identifies the authorization scope for the method you are building.
3148    ///
3149    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3150    /// [`Scope::CloudPlatform`].
3151    ///
3152    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3153    /// tokens for more than one scope.
3154    ///
3155    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3156    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3157    /// sufficient, a read-write scope will do as well.
3158    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3159    where
3160        St: AsRef<str>,
3161    {
3162        self._scopes.insert(String::from(scope.as_ref()));
3163        self
3164    }
3165    /// Identifies the authorization scope(s) for the method you are building.
3166    ///
3167    /// See [`Self::add_scope()`] for details.
3168    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3169    where
3170        I: IntoIterator<Item = St>,
3171        St: AsRef<str>,
3172    {
3173        self._scopes
3174            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3175        self
3176    }
3177
3178    /// Removes all scopes, and no default scope will be used either.
3179    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3180    /// for details).
3181    pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3182        self._scopes.clear();
3183        self
3184    }
3185}
3186
3187/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3188///
3189/// A builder for the *locations.instances.namespaces.setIamPolicy* method supported by a *project* resource.
3190/// It is not used directly, but through a [`ProjectMethods`] instance.
3191///
3192/// # Example
3193///
3194/// Instantiate a resource method builder
3195///
3196/// ```test_harness,no_run
3197/// # extern crate hyper;
3198/// # extern crate hyper_rustls;
3199/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3200/// use datafusion1_beta1::api::SetIamPolicyRequest;
3201/// # async fn dox() {
3202/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3203///
3204/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3205/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3206/// #     secret,
3207/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3208/// # ).build().await.unwrap();
3209///
3210/// # let client = hyper_util::client::legacy::Client::builder(
3211/// #     hyper_util::rt::TokioExecutor::new()
3212/// # )
3213/// # .build(
3214/// #     hyper_rustls::HttpsConnectorBuilder::new()
3215/// #         .with_native_roots()
3216/// #         .unwrap()
3217/// #         .https_or_http()
3218/// #         .enable_http1()
3219/// #         .build()
3220/// # );
3221/// # let mut hub = DataFusion::new(client, auth);
3222/// // As the method needs a request, you would usually fill it with the desired information
3223/// // into the respective structure. Some of the parts shown here might not be applicable !
3224/// // Values shown here are possibly random and not representative !
3225/// let mut req = SetIamPolicyRequest::default();
3226///
3227/// // You can configure optional parameters by calling the respective setters at will, and
3228/// // execute the final call using `doit()`.
3229/// // Values shown here are possibly random and not representative !
3230/// let result = hub.projects().locations_instances_namespaces_set_iam_policy(req, "resource")
3231///              .doit().await;
3232/// # }
3233/// ```
3234pub struct ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3235where
3236    C: 'a,
3237{
3238    hub: &'a DataFusion<C>,
3239    _request: SetIamPolicyRequest,
3240    _resource: String,
3241    _delegate: Option<&'a mut dyn common::Delegate>,
3242    _additional_params: HashMap<String, String>,
3243    _scopes: BTreeSet<String>,
3244}
3245
3246impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {}
3247
3248impl<'a, C> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3249where
3250    C: common::Connector,
3251{
3252    /// Perform the operation you have build so far.
3253    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3254        use std::borrow::Cow;
3255        use std::io::{Read, Seek};
3256
3257        use common::{url::Params, ToParts};
3258        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3259
3260        let mut dd = common::DefaultDelegate;
3261        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3262        dlg.begin(common::MethodInfo {
3263            id: "datafusion.projects.locations.instances.namespaces.setIamPolicy",
3264            http_method: hyper::Method::POST,
3265        });
3266
3267        for &field in ["alt", "resource"].iter() {
3268            if self._additional_params.contains_key(field) {
3269                dlg.finished(false);
3270                return Err(common::Error::FieldClash(field));
3271            }
3272        }
3273
3274        let mut params = Params::with_capacity(4 + self._additional_params.len());
3275        params.push("resource", self._resource);
3276
3277        params.extend(self._additional_params.iter());
3278
3279        params.push("alt", "json");
3280        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
3281        if self._scopes.is_empty() {
3282            self._scopes
3283                .insert(Scope::CloudPlatform.as_ref().to_string());
3284        }
3285
3286        #[allow(clippy::single_element_loop)]
3287        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3288            url = params.uri_replacement(url, param_name, find_this, true);
3289        }
3290        {
3291            let to_remove = ["resource"];
3292            params.remove_params(&to_remove);
3293        }
3294
3295        let url = params.parse_with_url(&url);
3296
3297        let mut json_mime_type = mime::APPLICATION_JSON;
3298        let mut request_value_reader = {
3299            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3300            common::remove_json_null_values(&mut value);
3301            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3302            serde_json::to_writer(&mut dst, &value).unwrap();
3303            dst
3304        };
3305        let request_size = request_value_reader
3306            .seek(std::io::SeekFrom::End(0))
3307            .unwrap();
3308        request_value_reader
3309            .seek(std::io::SeekFrom::Start(0))
3310            .unwrap();
3311
3312        loop {
3313            let token = match self
3314                .hub
3315                .auth
3316                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3317                .await
3318            {
3319                Ok(token) => token,
3320                Err(e) => match dlg.token(e) {
3321                    Ok(token) => token,
3322                    Err(e) => {
3323                        dlg.finished(false);
3324                        return Err(common::Error::MissingToken(e));
3325                    }
3326                },
3327            };
3328            request_value_reader
3329                .seek(std::io::SeekFrom::Start(0))
3330                .unwrap();
3331            let mut req_result = {
3332                let client = &self.hub.client;
3333                dlg.pre_request();
3334                let mut req_builder = hyper::Request::builder()
3335                    .method(hyper::Method::POST)
3336                    .uri(url.as_str())
3337                    .header(USER_AGENT, self.hub._user_agent.clone());
3338
3339                if let Some(token) = token.as_ref() {
3340                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3341                }
3342
3343                let request = req_builder
3344                    .header(CONTENT_TYPE, json_mime_type.to_string())
3345                    .header(CONTENT_LENGTH, request_size as u64)
3346                    .body(common::to_body(
3347                        request_value_reader.get_ref().clone().into(),
3348                    ));
3349
3350                client.request(request.unwrap()).await
3351            };
3352
3353            match req_result {
3354                Err(err) => {
3355                    if let common::Retry::After(d) = dlg.http_error(&err) {
3356                        sleep(d).await;
3357                        continue;
3358                    }
3359                    dlg.finished(false);
3360                    return Err(common::Error::HttpError(err));
3361                }
3362                Ok(res) => {
3363                    let (mut parts, body) = res.into_parts();
3364                    let mut body = common::Body::new(body);
3365                    if !parts.status.is_success() {
3366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3367                        let error = serde_json::from_str(&common::to_string(&bytes));
3368                        let response = common::to_response(parts, bytes.into());
3369
3370                        if let common::Retry::After(d) =
3371                            dlg.http_failure(&response, error.as_ref().ok())
3372                        {
3373                            sleep(d).await;
3374                            continue;
3375                        }
3376
3377                        dlg.finished(false);
3378
3379                        return Err(match error {
3380                            Ok(value) => common::Error::BadRequest(value),
3381                            _ => common::Error::Failure(response),
3382                        });
3383                    }
3384                    let response = {
3385                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3386                        let encoded = common::to_string(&bytes);
3387                        match serde_json::from_str(&encoded) {
3388                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3389                            Err(error) => {
3390                                dlg.response_json_decode_error(&encoded, &error);
3391                                return Err(common::Error::JsonDecodeError(
3392                                    encoded.to_string(),
3393                                    error,
3394                                ));
3395                            }
3396                        }
3397                    };
3398
3399                    dlg.finished(true);
3400                    return Ok(response);
3401                }
3402            }
3403        }
3404    }
3405
3406    ///
3407    /// Sets the *request* property to the given value.
3408    ///
3409    /// Even though the property as already been set when instantiating this call,
3410    /// we provide this method for API completeness.
3411    pub fn request(
3412        mut self,
3413        new_value: SetIamPolicyRequest,
3414    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3415        self._request = new_value;
3416        self
3417    }
3418    /// 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.
3419    ///
3420    /// Sets the *resource* path property to the given value.
3421    ///
3422    /// Even though the property as already been set when instantiating this call,
3423    /// we provide this method for API completeness.
3424    pub fn resource(
3425        mut self,
3426        new_value: &str,
3427    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3428        self._resource = new_value.to_string();
3429        self
3430    }
3431    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3432    /// while executing the actual API request.
3433    ///
3434    /// ````text
3435    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3436    /// ````
3437    ///
3438    /// Sets the *delegate* property to the given value.
3439    pub fn delegate(
3440        mut self,
3441        new_value: &'a mut dyn common::Delegate,
3442    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3443        self._delegate = Some(new_value);
3444        self
3445    }
3446
3447    /// Set any additional parameter of the query string used in the request.
3448    /// It should be used to set parameters which are not yet available through their own
3449    /// setters.
3450    ///
3451    /// Please note that this method must not be used to set any of the known parameters
3452    /// which have their own setter method. If done anyway, the request will fail.
3453    ///
3454    /// # Additional Parameters
3455    ///
3456    /// * *$.xgafv* (query-string) - V1 error format.
3457    /// * *access_token* (query-string) - OAuth access token.
3458    /// * *alt* (query-string) - Data format for response.
3459    /// * *callback* (query-string) - JSONP
3460    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3461    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3462    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3463    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3464    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3465    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3466    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3467    pub fn param<T>(
3468        mut self,
3469        name: T,
3470        value: T,
3471    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3472    where
3473        T: AsRef<str>,
3474    {
3475        self._additional_params
3476            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3477        self
3478    }
3479
3480    /// Identifies the authorization scope for the method you are building.
3481    ///
3482    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3483    /// [`Scope::CloudPlatform`].
3484    ///
3485    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3486    /// tokens for more than one scope.
3487    ///
3488    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3489    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3490    /// sufficient, a read-write scope will do as well.
3491    pub fn add_scope<St>(
3492        mut self,
3493        scope: St,
3494    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3495    where
3496        St: AsRef<str>,
3497    {
3498        self._scopes.insert(String::from(scope.as_ref()));
3499        self
3500    }
3501    /// Identifies the authorization scope(s) for the method you are building.
3502    ///
3503    /// See [`Self::add_scope()`] for details.
3504    pub fn add_scopes<I, St>(
3505        mut self,
3506        scopes: I,
3507    ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3508    where
3509        I: IntoIterator<Item = St>,
3510        St: AsRef<str>,
3511    {
3512        self._scopes
3513            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3514        self
3515    }
3516
3517    /// Removes all scopes, and no default scope will be used either.
3518    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3519    /// for details).
3520    pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3521        self._scopes.clear();
3522        self
3523    }
3524}
3525
3526/// 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.
3527///
3528/// A builder for the *locations.instances.namespaces.testIamPermissions* method supported by a *project* resource.
3529/// It is not used directly, but through a [`ProjectMethods`] instance.
3530///
3531/// # Example
3532///
3533/// Instantiate a resource method builder
3534///
3535/// ```test_harness,no_run
3536/// # extern crate hyper;
3537/// # extern crate hyper_rustls;
3538/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3539/// use datafusion1_beta1::api::TestIamPermissionsRequest;
3540/// # async fn dox() {
3541/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3542///
3543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3545/// #     secret,
3546/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3547/// # ).build().await.unwrap();
3548///
3549/// # let client = hyper_util::client::legacy::Client::builder(
3550/// #     hyper_util::rt::TokioExecutor::new()
3551/// # )
3552/// # .build(
3553/// #     hyper_rustls::HttpsConnectorBuilder::new()
3554/// #         .with_native_roots()
3555/// #         .unwrap()
3556/// #         .https_or_http()
3557/// #         .enable_http1()
3558/// #         .build()
3559/// # );
3560/// # let mut hub = DataFusion::new(client, auth);
3561/// // As the method needs a request, you would usually fill it with the desired information
3562/// // into the respective structure. Some of the parts shown here might not be applicable !
3563/// // Values shown here are possibly random and not representative !
3564/// let mut req = TestIamPermissionsRequest::default();
3565///
3566/// // You can configure optional parameters by calling the respective setters at will, and
3567/// // execute the final call using `doit()`.
3568/// // Values shown here are possibly random and not representative !
3569/// let result = hub.projects().locations_instances_namespaces_test_iam_permissions(req, "resource")
3570///              .doit().await;
3571/// # }
3572/// ```
3573pub struct ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3574where
3575    C: 'a,
3576{
3577    hub: &'a DataFusion<C>,
3578    _request: TestIamPermissionsRequest,
3579    _resource: String,
3580    _delegate: Option<&'a mut dyn common::Delegate>,
3581    _additional_params: HashMap<String, String>,
3582    _scopes: BTreeSet<String>,
3583}
3584
3585impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {}
3586
3587impl<'a, C> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3588where
3589    C: common::Connector,
3590{
3591    /// Perform the operation you have build so far.
3592    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
3593        use std::borrow::Cow;
3594        use std::io::{Read, Seek};
3595
3596        use common::{url::Params, ToParts};
3597        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3598
3599        let mut dd = common::DefaultDelegate;
3600        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3601        dlg.begin(common::MethodInfo {
3602            id: "datafusion.projects.locations.instances.namespaces.testIamPermissions",
3603            http_method: hyper::Method::POST,
3604        });
3605
3606        for &field in ["alt", "resource"].iter() {
3607            if self._additional_params.contains_key(field) {
3608                dlg.finished(false);
3609                return Err(common::Error::FieldClash(field));
3610            }
3611        }
3612
3613        let mut params = Params::with_capacity(4 + self._additional_params.len());
3614        params.push("resource", self._resource);
3615
3616        params.extend(self._additional_params.iter());
3617
3618        params.push("alt", "json");
3619        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
3620        if self._scopes.is_empty() {
3621            self._scopes
3622                .insert(Scope::CloudPlatform.as_ref().to_string());
3623        }
3624
3625        #[allow(clippy::single_element_loop)]
3626        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3627            url = params.uri_replacement(url, param_name, find_this, true);
3628        }
3629        {
3630            let to_remove = ["resource"];
3631            params.remove_params(&to_remove);
3632        }
3633
3634        let url = params.parse_with_url(&url);
3635
3636        let mut json_mime_type = mime::APPLICATION_JSON;
3637        let mut request_value_reader = {
3638            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3639            common::remove_json_null_values(&mut value);
3640            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3641            serde_json::to_writer(&mut dst, &value).unwrap();
3642            dst
3643        };
3644        let request_size = request_value_reader
3645            .seek(std::io::SeekFrom::End(0))
3646            .unwrap();
3647        request_value_reader
3648            .seek(std::io::SeekFrom::Start(0))
3649            .unwrap();
3650
3651        loop {
3652            let token = match self
3653                .hub
3654                .auth
3655                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3656                .await
3657            {
3658                Ok(token) => token,
3659                Err(e) => match dlg.token(e) {
3660                    Ok(token) => token,
3661                    Err(e) => {
3662                        dlg.finished(false);
3663                        return Err(common::Error::MissingToken(e));
3664                    }
3665                },
3666            };
3667            request_value_reader
3668                .seek(std::io::SeekFrom::Start(0))
3669                .unwrap();
3670            let mut req_result = {
3671                let client = &self.hub.client;
3672                dlg.pre_request();
3673                let mut req_builder = hyper::Request::builder()
3674                    .method(hyper::Method::POST)
3675                    .uri(url.as_str())
3676                    .header(USER_AGENT, self.hub._user_agent.clone());
3677
3678                if let Some(token) = token.as_ref() {
3679                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3680                }
3681
3682                let request = req_builder
3683                    .header(CONTENT_TYPE, json_mime_type.to_string())
3684                    .header(CONTENT_LENGTH, request_size as u64)
3685                    .body(common::to_body(
3686                        request_value_reader.get_ref().clone().into(),
3687                    ));
3688
3689                client.request(request.unwrap()).await
3690            };
3691
3692            match req_result {
3693                Err(err) => {
3694                    if let common::Retry::After(d) = dlg.http_error(&err) {
3695                        sleep(d).await;
3696                        continue;
3697                    }
3698                    dlg.finished(false);
3699                    return Err(common::Error::HttpError(err));
3700                }
3701                Ok(res) => {
3702                    let (mut parts, body) = res.into_parts();
3703                    let mut body = common::Body::new(body);
3704                    if !parts.status.is_success() {
3705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3706                        let error = serde_json::from_str(&common::to_string(&bytes));
3707                        let response = common::to_response(parts, bytes.into());
3708
3709                        if let common::Retry::After(d) =
3710                            dlg.http_failure(&response, error.as_ref().ok())
3711                        {
3712                            sleep(d).await;
3713                            continue;
3714                        }
3715
3716                        dlg.finished(false);
3717
3718                        return Err(match error {
3719                            Ok(value) => common::Error::BadRequest(value),
3720                            _ => common::Error::Failure(response),
3721                        });
3722                    }
3723                    let response = {
3724                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3725                        let encoded = common::to_string(&bytes);
3726                        match serde_json::from_str(&encoded) {
3727                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3728                            Err(error) => {
3729                                dlg.response_json_decode_error(&encoded, &error);
3730                                return Err(common::Error::JsonDecodeError(
3731                                    encoded.to_string(),
3732                                    error,
3733                                ));
3734                            }
3735                        }
3736                    };
3737
3738                    dlg.finished(true);
3739                    return Ok(response);
3740                }
3741            }
3742        }
3743    }
3744
3745    ///
3746    /// Sets the *request* property to the given value.
3747    ///
3748    /// Even though the property as already been set when instantiating this call,
3749    /// we provide this method for API completeness.
3750    pub fn request(
3751        mut self,
3752        new_value: TestIamPermissionsRequest,
3753    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3754        self._request = new_value;
3755        self
3756    }
3757    /// 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.
3758    ///
3759    /// Sets the *resource* path property to the given value.
3760    ///
3761    /// Even though the property as already been set when instantiating this call,
3762    /// we provide this method for API completeness.
3763    pub fn resource(
3764        mut self,
3765        new_value: &str,
3766    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3767        self._resource = new_value.to_string();
3768        self
3769    }
3770    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3771    /// while executing the actual API request.
3772    ///
3773    /// ````text
3774    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3775    /// ````
3776    ///
3777    /// Sets the *delegate* property to the given value.
3778    pub fn delegate(
3779        mut self,
3780        new_value: &'a mut dyn common::Delegate,
3781    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3782        self._delegate = Some(new_value);
3783        self
3784    }
3785
3786    /// Set any additional parameter of the query string used in the request.
3787    /// It should be used to set parameters which are not yet available through their own
3788    /// setters.
3789    ///
3790    /// Please note that this method must not be used to set any of the known parameters
3791    /// which have their own setter method. If done anyway, the request will fail.
3792    ///
3793    /// # Additional Parameters
3794    ///
3795    /// * *$.xgafv* (query-string) - V1 error format.
3796    /// * *access_token* (query-string) - OAuth access token.
3797    /// * *alt* (query-string) - Data format for response.
3798    /// * *callback* (query-string) - JSONP
3799    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3800    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3801    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3802    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3803    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3804    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3805    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3806    pub fn param<T>(
3807        mut self,
3808        name: T,
3809        value: T,
3810    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3811    where
3812        T: AsRef<str>,
3813    {
3814        self._additional_params
3815            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3816        self
3817    }
3818
3819    /// Identifies the authorization scope for the method you are building.
3820    ///
3821    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3822    /// [`Scope::CloudPlatform`].
3823    ///
3824    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3825    /// tokens for more than one scope.
3826    ///
3827    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3828    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3829    /// sufficient, a read-write scope will do as well.
3830    pub fn add_scope<St>(
3831        mut self,
3832        scope: St,
3833    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3834    where
3835        St: AsRef<str>,
3836    {
3837        self._scopes.insert(String::from(scope.as_ref()));
3838        self
3839    }
3840    /// Identifies the authorization scope(s) for the method you are building.
3841    ///
3842    /// See [`Self::add_scope()`] for details.
3843    pub fn add_scopes<I, St>(
3844        mut self,
3845        scopes: I,
3846    ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3847    where
3848        I: IntoIterator<Item = St>,
3849        St: AsRef<str>,
3850    {
3851        self._scopes
3852            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3853        self
3854    }
3855
3856    /// Removes all scopes, and no default scope will be used either.
3857    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3858    /// for details).
3859    pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3860        self._scopes.clear();
3861        self
3862    }
3863}
3864
3865/// Creates a new Data Fusion instance in the specified project and location.
3866///
3867/// A builder for the *locations.instances.create* method supported by a *project* resource.
3868/// It is not used directly, but through a [`ProjectMethods`] instance.
3869///
3870/// # Example
3871///
3872/// Instantiate a resource method builder
3873///
3874/// ```test_harness,no_run
3875/// # extern crate hyper;
3876/// # extern crate hyper_rustls;
3877/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3878/// use datafusion1_beta1::api::Instance;
3879/// # async fn dox() {
3880/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3881///
3882/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3883/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3884/// #     secret,
3885/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3886/// # ).build().await.unwrap();
3887///
3888/// # let client = hyper_util::client::legacy::Client::builder(
3889/// #     hyper_util::rt::TokioExecutor::new()
3890/// # )
3891/// # .build(
3892/// #     hyper_rustls::HttpsConnectorBuilder::new()
3893/// #         .with_native_roots()
3894/// #         .unwrap()
3895/// #         .https_or_http()
3896/// #         .enable_http1()
3897/// #         .build()
3898/// # );
3899/// # let mut hub = DataFusion::new(client, auth);
3900/// // As the method needs a request, you would usually fill it with the desired information
3901/// // into the respective structure. Some of the parts shown here might not be applicable !
3902/// // Values shown here are possibly random and not representative !
3903/// let mut req = Instance::default();
3904///
3905/// // You can configure optional parameters by calling the respective setters at will, and
3906/// // execute the final call using `doit()`.
3907/// // Values shown here are possibly random and not representative !
3908/// let result = hub.projects().locations_instances_create(req, "parent")
3909///              .instance_id("amet")
3910///              .doit().await;
3911/// # }
3912/// ```
3913pub struct ProjectLocationInstanceCreateCall<'a, C>
3914where
3915    C: 'a,
3916{
3917    hub: &'a DataFusion<C>,
3918    _request: Instance,
3919    _parent: String,
3920    _instance_id: Option<String>,
3921    _delegate: Option<&'a mut dyn common::Delegate>,
3922    _additional_params: HashMap<String, String>,
3923    _scopes: BTreeSet<String>,
3924}
3925
3926impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
3927
3928impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
3929where
3930    C: common::Connector,
3931{
3932    /// Perform the operation you have build so far.
3933    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3934        use std::borrow::Cow;
3935        use std::io::{Read, Seek};
3936
3937        use common::{url::Params, ToParts};
3938        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3939
3940        let mut dd = common::DefaultDelegate;
3941        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3942        dlg.begin(common::MethodInfo {
3943            id: "datafusion.projects.locations.instances.create",
3944            http_method: hyper::Method::POST,
3945        });
3946
3947        for &field in ["alt", "parent", "instanceId"].iter() {
3948            if self._additional_params.contains_key(field) {
3949                dlg.finished(false);
3950                return Err(common::Error::FieldClash(field));
3951            }
3952        }
3953
3954        let mut params = Params::with_capacity(5 + self._additional_params.len());
3955        params.push("parent", self._parent);
3956        if let Some(value) = self._instance_id.as_ref() {
3957            params.push("instanceId", value);
3958        }
3959
3960        params.extend(self._additional_params.iter());
3961
3962        params.push("alt", "json");
3963        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
3964        if self._scopes.is_empty() {
3965            self._scopes
3966                .insert(Scope::CloudPlatform.as_ref().to_string());
3967        }
3968
3969        #[allow(clippy::single_element_loop)]
3970        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3971            url = params.uri_replacement(url, param_name, find_this, true);
3972        }
3973        {
3974            let to_remove = ["parent"];
3975            params.remove_params(&to_remove);
3976        }
3977
3978        let url = params.parse_with_url(&url);
3979
3980        let mut json_mime_type = mime::APPLICATION_JSON;
3981        let mut request_value_reader = {
3982            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3983            common::remove_json_null_values(&mut value);
3984            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3985            serde_json::to_writer(&mut dst, &value).unwrap();
3986            dst
3987        };
3988        let request_size = request_value_reader
3989            .seek(std::io::SeekFrom::End(0))
3990            .unwrap();
3991        request_value_reader
3992            .seek(std::io::SeekFrom::Start(0))
3993            .unwrap();
3994
3995        loop {
3996            let token = match self
3997                .hub
3998                .auth
3999                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4000                .await
4001            {
4002                Ok(token) => token,
4003                Err(e) => match dlg.token(e) {
4004                    Ok(token) => token,
4005                    Err(e) => {
4006                        dlg.finished(false);
4007                        return Err(common::Error::MissingToken(e));
4008                    }
4009                },
4010            };
4011            request_value_reader
4012                .seek(std::io::SeekFrom::Start(0))
4013                .unwrap();
4014            let mut req_result = {
4015                let client = &self.hub.client;
4016                dlg.pre_request();
4017                let mut req_builder = hyper::Request::builder()
4018                    .method(hyper::Method::POST)
4019                    .uri(url.as_str())
4020                    .header(USER_AGENT, self.hub._user_agent.clone());
4021
4022                if let Some(token) = token.as_ref() {
4023                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4024                }
4025
4026                let request = req_builder
4027                    .header(CONTENT_TYPE, json_mime_type.to_string())
4028                    .header(CONTENT_LENGTH, request_size as u64)
4029                    .body(common::to_body(
4030                        request_value_reader.get_ref().clone().into(),
4031                    ));
4032
4033                client.request(request.unwrap()).await
4034            };
4035
4036            match req_result {
4037                Err(err) => {
4038                    if let common::Retry::After(d) = dlg.http_error(&err) {
4039                        sleep(d).await;
4040                        continue;
4041                    }
4042                    dlg.finished(false);
4043                    return Err(common::Error::HttpError(err));
4044                }
4045                Ok(res) => {
4046                    let (mut parts, body) = res.into_parts();
4047                    let mut body = common::Body::new(body);
4048                    if !parts.status.is_success() {
4049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4050                        let error = serde_json::from_str(&common::to_string(&bytes));
4051                        let response = common::to_response(parts, bytes.into());
4052
4053                        if let common::Retry::After(d) =
4054                            dlg.http_failure(&response, error.as_ref().ok())
4055                        {
4056                            sleep(d).await;
4057                            continue;
4058                        }
4059
4060                        dlg.finished(false);
4061
4062                        return Err(match error {
4063                            Ok(value) => common::Error::BadRequest(value),
4064                            _ => common::Error::Failure(response),
4065                        });
4066                    }
4067                    let response = {
4068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4069                        let encoded = common::to_string(&bytes);
4070                        match serde_json::from_str(&encoded) {
4071                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4072                            Err(error) => {
4073                                dlg.response_json_decode_error(&encoded, &error);
4074                                return Err(common::Error::JsonDecodeError(
4075                                    encoded.to_string(),
4076                                    error,
4077                                ));
4078                            }
4079                        }
4080                    };
4081
4082                    dlg.finished(true);
4083                    return Ok(response);
4084                }
4085            }
4086        }
4087    }
4088
4089    ///
4090    /// Sets the *request* property to the given value.
4091    ///
4092    /// Even though the property as already been set when instantiating this call,
4093    /// we provide this method for API completeness.
4094    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
4095        self._request = new_value;
4096        self
4097    }
4098    /// Required. The instance's project and location in the format projects/{project}/locations/{location}.
4099    ///
4100    /// Sets the *parent* path property to the given value.
4101    ///
4102    /// Even though the property as already been set when instantiating this call,
4103    /// we provide this method for API completeness.
4104    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
4105        self._parent = new_value.to_string();
4106        self
4107    }
4108    /// 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.
4109    ///
4110    /// Sets the *instance id* query property to the given value.
4111    pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
4112        self._instance_id = Some(new_value.to_string());
4113        self
4114    }
4115    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4116    /// while executing the actual API request.
4117    ///
4118    /// ````text
4119    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4120    /// ````
4121    ///
4122    /// Sets the *delegate* property to the given value.
4123    pub fn delegate(
4124        mut self,
4125        new_value: &'a mut dyn common::Delegate,
4126    ) -> ProjectLocationInstanceCreateCall<'a, C> {
4127        self._delegate = Some(new_value);
4128        self
4129    }
4130
4131    /// Set any additional parameter of the query string used in the request.
4132    /// It should be used to set parameters which are not yet available through their own
4133    /// setters.
4134    ///
4135    /// Please note that this method must not be used to set any of the known parameters
4136    /// which have their own setter method. If done anyway, the request will fail.
4137    ///
4138    /// # Additional Parameters
4139    ///
4140    /// * *$.xgafv* (query-string) - V1 error format.
4141    /// * *access_token* (query-string) - OAuth access token.
4142    /// * *alt* (query-string) - Data format for response.
4143    /// * *callback* (query-string) - JSONP
4144    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4145    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4146    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4147    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4148    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4149    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4150    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4151    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
4152    where
4153        T: AsRef<str>,
4154    {
4155        self._additional_params
4156            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4157        self
4158    }
4159
4160    /// Identifies the authorization scope for the method you are building.
4161    ///
4162    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4163    /// [`Scope::CloudPlatform`].
4164    ///
4165    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4166    /// tokens for more than one scope.
4167    ///
4168    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4169    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4170    /// sufficient, a read-write scope will do as well.
4171    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
4172    where
4173        St: AsRef<str>,
4174    {
4175        self._scopes.insert(String::from(scope.as_ref()));
4176        self
4177    }
4178    /// Identifies the authorization scope(s) for the method you are building.
4179    ///
4180    /// See [`Self::add_scope()`] for details.
4181    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
4182    where
4183        I: IntoIterator<Item = St>,
4184        St: AsRef<str>,
4185    {
4186        self._scopes
4187            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4188        self
4189    }
4190
4191    /// Removes all scopes, and no default scope will be used either.
4192    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4193    /// for details).
4194    pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
4195        self._scopes.clear();
4196        self
4197    }
4198}
4199
4200/// Deletes a single Data Fusion instance.
4201///
4202/// A builder for the *locations.instances.delete* method supported by a *project* resource.
4203/// It is not used directly, but through a [`ProjectMethods`] instance.
4204///
4205/// # Example
4206///
4207/// Instantiate a resource method builder
4208///
4209/// ```test_harness,no_run
4210/// # extern crate hyper;
4211/// # extern crate hyper_rustls;
4212/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4213/// # async fn dox() {
4214/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4215///
4216/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4217/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4218/// #     secret,
4219/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4220/// # ).build().await.unwrap();
4221///
4222/// # let client = hyper_util::client::legacy::Client::builder(
4223/// #     hyper_util::rt::TokioExecutor::new()
4224/// # )
4225/// # .build(
4226/// #     hyper_rustls::HttpsConnectorBuilder::new()
4227/// #         .with_native_roots()
4228/// #         .unwrap()
4229/// #         .https_or_http()
4230/// #         .enable_http1()
4231/// #         .build()
4232/// # );
4233/// # let mut hub = DataFusion::new(client, auth);
4234/// // You can configure optional parameters by calling the respective setters at will, and
4235/// // execute the final call using `doit()`.
4236/// // Values shown here are possibly random and not representative !
4237/// let result = hub.projects().locations_instances_delete("name")
4238///              .doit().await;
4239/// # }
4240/// ```
4241pub struct ProjectLocationInstanceDeleteCall<'a, C>
4242where
4243    C: 'a,
4244{
4245    hub: &'a DataFusion<C>,
4246    _name: String,
4247    _delegate: Option<&'a mut dyn common::Delegate>,
4248    _additional_params: HashMap<String, String>,
4249    _scopes: BTreeSet<String>,
4250}
4251
4252impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
4253
4254impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
4255where
4256    C: common::Connector,
4257{
4258    /// Perform the operation you have build so far.
4259    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4260        use std::borrow::Cow;
4261        use std::io::{Read, Seek};
4262
4263        use common::{url::Params, ToParts};
4264        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4265
4266        let mut dd = common::DefaultDelegate;
4267        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4268        dlg.begin(common::MethodInfo {
4269            id: "datafusion.projects.locations.instances.delete",
4270            http_method: hyper::Method::DELETE,
4271        });
4272
4273        for &field in ["alt", "name"].iter() {
4274            if self._additional_params.contains_key(field) {
4275                dlg.finished(false);
4276                return Err(common::Error::FieldClash(field));
4277            }
4278        }
4279
4280        let mut params = Params::with_capacity(3 + self._additional_params.len());
4281        params.push("name", self._name);
4282
4283        params.extend(self._additional_params.iter());
4284
4285        params.push("alt", "json");
4286        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4287        if self._scopes.is_empty() {
4288            self._scopes
4289                .insert(Scope::CloudPlatform.as_ref().to_string());
4290        }
4291
4292        #[allow(clippy::single_element_loop)]
4293        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4294            url = params.uri_replacement(url, param_name, find_this, true);
4295        }
4296        {
4297            let to_remove = ["name"];
4298            params.remove_params(&to_remove);
4299        }
4300
4301        let url = params.parse_with_url(&url);
4302
4303        loop {
4304            let token = match self
4305                .hub
4306                .auth
4307                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4308                .await
4309            {
4310                Ok(token) => token,
4311                Err(e) => match dlg.token(e) {
4312                    Ok(token) => token,
4313                    Err(e) => {
4314                        dlg.finished(false);
4315                        return Err(common::Error::MissingToken(e));
4316                    }
4317                },
4318            };
4319            let mut req_result = {
4320                let client = &self.hub.client;
4321                dlg.pre_request();
4322                let mut req_builder = hyper::Request::builder()
4323                    .method(hyper::Method::DELETE)
4324                    .uri(url.as_str())
4325                    .header(USER_AGENT, self.hub._user_agent.clone());
4326
4327                if let Some(token) = token.as_ref() {
4328                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4329                }
4330
4331                let request = req_builder
4332                    .header(CONTENT_LENGTH, 0_u64)
4333                    .body(common::to_body::<String>(None));
4334
4335                client.request(request.unwrap()).await
4336            };
4337
4338            match req_result {
4339                Err(err) => {
4340                    if let common::Retry::After(d) = dlg.http_error(&err) {
4341                        sleep(d).await;
4342                        continue;
4343                    }
4344                    dlg.finished(false);
4345                    return Err(common::Error::HttpError(err));
4346                }
4347                Ok(res) => {
4348                    let (mut parts, body) = res.into_parts();
4349                    let mut body = common::Body::new(body);
4350                    if !parts.status.is_success() {
4351                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4352                        let error = serde_json::from_str(&common::to_string(&bytes));
4353                        let response = common::to_response(parts, bytes.into());
4354
4355                        if let common::Retry::After(d) =
4356                            dlg.http_failure(&response, error.as_ref().ok())
4357                        {
4358                            sleep(d).await;
4359                            continue;
4360                        }
4361
4362                        dlg.finished(false);
4363
4364                        return Err(match error {
4365                            Ok(value) => common::Error::BadRequest(value),
4366                            _ => common::Error::Failure(response),
4367                        });
4368                    }
4369                    let response = {
4370                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4371                        let encoded = common::to_string(&bytes);
4372                        match serde_json::from_str(&encoded) {
4373                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4374                            Err(error) => {
4375                                dlg.response_json_decode_error(&encoded, &error);
4376                                return Err(common::Error::JsonDecodeError(
4377                                    encoded.to_string(),
4378                                    error,
4379                                ));
4380                            }
4381                        }
4382                    };
4383
4384                    dlg.finished(true);
4385                    return Ok(response);
4386                }
4387            }
4388        }
4389    }
4390
4391    /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
4392    ///
4393    /// Sets the *name* path property to the given value.
4394    ///
4395    /// Even though the property as already been set when instantiating this call,
4396    /// we provide this method for API completeness.
4397    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
4398        self._name = new_value.to_string();
4399        self
4400    }
4401    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4402    /// while executing the actual API request.
4403    ///
4404    /// ````text
4405    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4406    /// ````
4407    ///
4408    /// Sets the *delegate* property to the given value.
4409    pub fn delegate(
4410        mut self,
4411        new_value: &'a mut dyn common::Delegate,
4412    ) -> ProjectLocationInstanceDeleteCall<'a, C> {
4413        self._delegate = Some(new_value);
4414        self
4415    }
4416
4417    /// Set any additional parameter of the query string used in the request.
4418    /// It should be used to set parameters which are not yet available through their own
4419    /// setters.
4420    ///
4421    /// Please note that this method must not be used to set any of the known parameters
4422    /// which have their own setter method. If done anyway, the request will fail.
4423    ///
4424    /// # Additional Parameters
4425    ///
4426    /// * *$.xgafv* (query-string) - V1 error format.
4427    /// * *access_token* (query-string) - OAuth access token.
4428    /// * *alt* (query-string) - Data format for response.
4429    /// * *callback* (query-string) - JSONP
4430    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4431    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4432    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4433    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4434    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4435    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4436    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4437    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
4438    where
4439        T: AsRef<str>,
4440    {
4441        self._additional_params
4442            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4443        self
4444    }
4445
4446    /// Identifies the authorization scope for the method you are building.
4447    ///
4448    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4449    /// [`Scope::CloudPlatform`].
4450    ///
4451    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4452    /// tokens for more than one scope.
4453    ///
4454    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4455    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4456    /// sufficient, a read-write scope will do as well.
4457    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
4458    where
4459        St: AsRef<str>,
4460    {
4461        self._scopes.insert(String::from(scope.as_ref()));
4462        self
4463    }
4464    /// Identifies the authorization scope(s) for the method you are building.
4465    ///
4466    /// See [`Self::add_scope()`] for details.
4467    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
4468    where
4469        I: IntoIterator<Item = St>,
4470        St: AsRef<str>,
4471    {
4472        self._scopes
4473            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4474        self
4475    }
4476
4477    /// Removes all scopes, and no default scope will be used either.
4478    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4479    /// for details).
4480    pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
4481        self._scopes.clear();
4482        self
4483    }
4484}
4485
4486/// Gets details of a single Data Fusion instance.
4487///
4488/// A builder for the *locations.instances.get* method supported by a *project* resource.
4489/// It is not used directly, but through a [`ProjectMethods`] instance.
4490///
4491/// # Example
4492///
4493/// Instantiate a resource method builder
4494///
4495/// ```test_harness,no_run
4496/// # extern crate hyper;
4497/// # extern crate hyper_rustls;
4498/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4499/// # async fn dox() {
4500/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4501///
4502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4503/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4504/// #     secret,
4505/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4506/// # ).build().await.unwrap();
4507///
4508/// # let client = hyper_util::client::legacy::Client::builder(
4509/// #     hyper_util::rt::TokioExecutor::new()
4510/// # )
4511/// # .build(
4512/// #     hyper_rustls::HttpsConnectorBuilder::new()
4513/// #         .with_native_roots()
4514/// #         .unwrap()
4515/// #         .https_or_http()
4516/// #         .enable_http1()
4517/// #         .build()
4518/// # );
4519/// # let mut hub = DataFusion::new(client, auth);
4520/// // You can configure optional parameters by calling the respective setters at will, and
4521/// // execute the final call using `doit()`.
4522/// // Values shown here are possibly random and not representative !
4523/// let result = hub.projects().locations_instances_get("name")
4524///              .doit().await;
4525/// # }
4526/// ```
4527pub struct ProjectLocationInstanceGetCall<'a, C>
4528where
4529    C: 'a,
4530{
4531    hub: &'a DataFusion<C>,
4532    _name: String,
4533    _delegate: Option<&'a mut dyn common::Delegate>,
4534    _additional_params: HashMap<String, String>,
4535    _scopes: BTreeSet<String>,
4536}
4537
4538impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
4539
4540impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
4541where
4542    C: common::Connector,
4543{
4544    /// Perform the operation you have build so far.
4545    pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
4546        use std::borrow::Cow;
4547        use std::io::{Read, Seek};
4548
4549        use common::{url::Params, ToParts};
4550        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4551
4552        let mut dd = common::DefaultDelegate;
4553        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4554        dlg.begin(common::MethodInfo {
4555            id: "datafusion.projects.locations.instances.get",
4556            http_method: hyper::Method::GET,
4557        });
4558
4559        for &field in ["alt", "name"].iter() {
4560            if self._additional_params.contains_key(field) {
4561                dlg.finished(false);
4562                return Err(common::Error::FieldClash(field));
4563            }
4564        }
4565
4566        let mut params = Params::with_capacity(3 + self._additional_params.len());
4567        params.push("name", self._name);
4568
4569        params.extend(self._additional_params.iter());
4570
4571        params.push("alt", "json");
4572        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4573        if self._scopes.is_empty() {
4574            self._scopes
4575                .insert(Scope::CloudPlatform.as_ref().to_string());
4576        }
4577
4578        #[allow(clippy::single_element_loop)]
4579        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4580            url = params.uri_replacement(url, param_name, find_this, true);
4581        }
4582        {
4583            let to_remove = ["name"];
4584            params.remove_params(&to_remove);
4585        }
4586
4587        let url = params.parse_with_url(&url);
4588
4589        loop {
4590            let token = match self
4591                .hub
4592                .auth
4593                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4594                .await
4595            {
4596                Ok(token) => token,
4597                Err(e) => match dlg.token(e) {
4598                    Ok(token) => token,
4599                    Err(e) => {
4600                        dlg.finished(false);
4601                        return Err(common::Error::MissingToken(e));
4602                    }
4603                },
4604            };
4605            let mut req_result = {
4606                let client = &self.hub.client;
4607                dlg.pre_request();
4608                let mut req_builder = hyper::Request::builder()
4609                    .method(hyper::Method::GET)
4610                    .uri(url.as_str())
4611                    .header(USER_AGENT, self.hub._user_agent.clone());
4612
4613                if let Some(token) = token.as_ref() {
4614                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4615                }
4616
4617                let request = req_builder
4618                    .header(CONTENT_LENGTH, 0_u64)
4619                    .body(common::to_body::<String>(None));
4620
4621                client.request(request.unwrap()).await
4622            };
4623
4624            match req_result {
4625                Err(err) => {
4626                    if let common::Retry::After(d) = dlg.http_error(&err) {
4627                        sleep(d).await;
4628                        continue;
4629                    }
4630                    dlg.finished(false);
4631                    return Err(common::Error::HttpError(err));
4632                }
4633                Ok(res) => {
4634                    let (mut parts, body) = res.into_parts();
4635                    let mut body = common::Body::new(body);
4636                    if !parts.status.is_success() {
4637                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4638                        let error = serde_json::from_str(&common::to_string(&bytes));
4639                        let response = common::to_response(parts, bytes.into());
4640
4641                        if let common::Retry::After(d) =
4642                            dlg.http_failure(&response, error.as_ref().ok())
4643                        {
4644                            sleep(d).await;
4645                            continue;
4646                        }
4647
4648                        dlg.finished(false);
4649
4650                        return Err(match error {
4651                            Ok(value) => common::Error::BadRequest(value),
4652                            _ => common::Error::Failure(response),
4653                        });
4654                    }
4655                    let response = {
4656                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4657                        let encoded = common::to_string(&bytes);
4658                        match serde_json::from_str(&encoded) {
4659                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4660                            Err(error) => {
4661                                dlg.response_json_decode_error(&encoded, &error);
4662                                return Err(common::Error::JsonDecodeError(
4663                                    encoded.to_string(),
4664                                    error,
4665                                ));
4666                            }
4667                        }
4668                    };
4669
4670                    dlg.finished(true);
4671                    return Ok(response);
4672                }
4673            }
4674        }
4675    }
4676
4677    /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
4678    ///
4679    /// Sets the *name* path property to the given value.
4680    ///
4681    /// Even though the property as already been set when instantiating this call,
4682    /// we provide this method for API completeness.
4683    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
4684        self._name = new_value.to_string();
4685        self
4686    }
4687    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4688    /// while executing the actual API request.
4689    ///
4690    /// ````text
4691    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4692    /// ````
4693    ///
4694    /// Sets the *delegate* property to the given value.
4695    pub fn delegate(
4696        mut self,
4697        new_value: &'a mut dyn common::Delegate,
4698    ) -> ProjectLocationInstanceGetCall<'a, C> {
4699        self._delegate = Some(new_value);
4700        self
4701    }
4702
4703    /// Set any additional parameter of the query string used in the request.
4704    /// It should be used to set parameters which are not yet available through their own
4705    /// setters.
4706    ///
4707    /// Please note that this method must not be used to set any of the known parameters
4708    /// which have their own setter method. If done anyway, the request will fail.
4709    ///
4710    /// # Additional Parameters
4711    ///
4712    /// * *$.xgafv* (query-string) - V1 error format.
4713    /// * *access_token* (query-string) - OAuth access token.
4714    /// * *alt* (query-string) - Data format for response.
4715    /// * *callback* (query-string) - JSONP
4716    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4717    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4718    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4719    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4720    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4721    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4722    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4723    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
4724    where
4725        T: AsRef<str>,
4726    {
4727        self._additional_params
4728            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4729        self
4730    }
4731
4732    /// Identifies the authorization scope for the method you are building.
4733    ///
4734    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4735    /// [`Scope::CloudPlatform`].
4736    ///
4737    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4738    /// tokens for more than one scope.
4739    ///
4740    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4741    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4742    /// sufficient, a read-write scope will do as well.
4743    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
4744    where
4745        St: AsRef<str>,
4746    {
4747        self._scopes.insert(String::from(scope.as_ref()));
4748        self
4749    }
4750    /// Identifies the authorization scope(s) for the method you are building.
4751    ///
4752    /// See [`Self::add_scope()`] for details.
4753    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
4754    where
4755        I: IntoIterator<Item = St>,
4756        St: AsRef<str>,
4757    {
4758        self._scopes
4759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4760        self
4761    }
4762
4763    /// Removes all scopes, and no default scope will be used either.
4764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4765    /// for details).
4766    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
4767        self._scopes.clear();
4768        self
4769    }
4770}
4771
4772/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4773///
4774/// A builder for the *locations.instances.getIamPolicy* method supported by a *project* resource.
4775/// It is not used directly, but through a [`ProjectMethods`] instance.
4776///
4777/// # Example
4778///
4779/// Instantiate a resource method builder
4780///
4781/// ```test_harness,no_run
4782/// # extern crate hyper;
4783/// # extern crate hyper_rustls;
4784/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4785/// # async fn dox() {
4786/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4787///
4788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4789/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4790/// #     secret,
4791/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4792/// # ).build().await.unwrap();
4793///
4794/// # let client = hyper_util::client::legacy::Client::builder(
4795/// #     hyper_util::rt::TokioExecutor::new()
4796/// # )
4797/// # .build(
4798/// #     hyper_rustls::HttpsConnectorBuilder::new()
4799/// #         .with_native_roots()
4800/// #         .unwrap()
4801/// #         .https_or_http()
4802/// #         .enable_http1()
4803/// #         .build()
4804/// # );
4805/// # let mut hub = DataFusion::new(client, auth);
4806/// // You can configure optional parameters by calling the respective setters at will, and
4807/// // execute the final call using `doit()`.
4808/// // Values shown here are possibly random and not representative !
4809/// let result = hub.projects().locations_instances_get_iam_policy("resource")
4810///              .options_requested_policy_version(-37)
4811///              .doit().await;
4812/// # }
4813/// ```
4814pub struct ProjectLocationInstanceGetIamPolicyCall<'a, C>
4815where
4816    C: 'a,
4817{
4818    hub: &'a DataFusion<C>,
4819    _resource: String,
4820    _options_requested_policy_version: Option<i32>,
4821    _delegate: Option<&'a mut dyn common::Delegate>,
4822    _additional_params: HashMap<String, String>,
4823    _scopes: BTreeSet<String>,
4824}
4825
4826impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetIamPolicyCall<'a, C> {}
4827
4828impl<'a, C> ProjectLocationInstanceGetIamPolicyCall<'a, C>
4829where
4830    C: common::Connector,
4831{
4832    /// Perform the operation you have build so far.
4833    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4834        use std::borrow::Cow;
4835        use std::io::{Read, Seek};
4836
4837        use common::{url::Params, ToParts};
4838        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4839
4840        let mut dd = common::DefaultDelegate;
4841        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4842        dlg.begin(common::MethodInfo {
4843            id: "datafusion.projects.locations.instances.getIamPolicy",
4844            http_method: hyper::Method::GET,
4845        });
4846
4847        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
4848            if self._additional_params.contains_key(field) {
4849                dlg.finished(false);
4850                return Err(common::Error::FieldClash(field));
4851            }
4852        }
4853
4854        let mut params = Params::with_capacity(4 + self._additional_params.len());
4855        params.push("resource", self._resource);
4856        if let Some(value) = self._options_requested_policy_version.as_ref() {
4857            params.push("options.requestedPolicyVersion", value.to_string());
4858        }
4859
4860        params.extend(self._additional_params.iter());
4861
4862        params.push("alt", "json");
4863        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
4864        if self._scopes.is_empty() {
4865            self._scopes
4866                .insert(Scope::CloudPlatform.as_ref().to_string());
4867        }
4868
4869        #[allow(clippy::single_element_loop)]
4870        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4871            url = params.uri_replacement(url, param_name, find_this, true);
4872        }
4873        {
4874            let to_remove = ["resource"];
4875            params.remove_params(&to_remove);
4876        }
4877
4878        let url = params.parse_with_url(&url);
4879
4880        loop {
4881            let token = match self
4882                .hub
4883                .auth
4884                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4885                .await
4886            {
4887                Ok(token) => token,
4888                Err(e) => match dlg.token(e) {
4889                    Ok(token) => token,
4890                    Err(e) => {
4891                        dlg.finished(false);
4892                        return Err(common::Error::MissingToken(e));
4893                    }
4894                },
4895            };
4896            let mut req_result = {
4897                let client = &self.hub.client;
4898                dlg.pre_request();
4899                let mut req_builder = hyper::Request::builder()
4900                    .method(hyper::Method::GET)
4901                    .uri(url.as_str())
4902                    .header(USER_AGENT, self.hub._user_agent.clone());
4903
4904                if let Some(token) = token.as_ref() {
4905                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4906                }
4907
4908                let request = req_builder
4909                    .header(CONTENT_LENGTH, 0_u64)
4910                    .body(common::to_body::<String>(None));
4911
4912                client.request(request.unwrap()).await
4913            };
4914
4915            match req_result {
4916                Err(err) => {
4917                    if let common::Retry::After(d) = dlg.http_error(&err) {
4918                        sleep(d).await;
4919                        continue;
4920                    }
4921                    dlg.finished(false);
4922                    return Err(common::Error::HttpError(err));
4923                }
4924                Ok(res) => {
4925                    let (mut parts, body) = res.into_parts();
4926                    let mut body = common::Body::new(body);
4927                    if !parts.status.is_success() {
4928                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4929                        let error = serde_json::from_str(&common::to_string(&bytes));
4930                        let response = common::to_response(parts, bytes.into());
4931
4932                        if let common::Retry::After(d) =
4933                            dlg.http_failure(&response, error.as_ref().ok())
4934                        {
4935                            sleep(d).await;
4936                            continue;
4937                        }
4938
4939                        dlg.finished(false);
4940
4941                        return Err(match error {
4942                            Ok(value) => common::Error::BadRequest(value),
4943                            _ => common::Error::Failure(response),
4944                        });
4945                    }
4946                    let response = {
4947                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4948                        let encoded = common::to_string(&bytes);
4949                        match serde_json::from_str(&encoded) {
4950                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4951                            Err(error) => {
4952                                dlg.response_json_decode_error(&encoded, &error);
4953                                return Err(common::Error::JsonDecodeError(
4954                                    encoded.to_string(),
4955                                    error,
4956                                ));
4957                            }
4958                        }
4959                    };
4960
4961                    dlg.finished(true);
4962                    return Ok(response);
4963                }
4964            }
4965        }
4966    }
4967
4968    /// 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.
4969    ///
4970    /// Sets the *resource* path property to the given value.
4971    ///
4972    /// Even though the property as already been set when instantiating this call,
4973    /// we provide this method for API completeness.
4974    pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
4975        self._resource = new_value.to_string();
4976        self
4977    }
4978    /// 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).
4979    ///
4980    /// Sets the *options.requested policy version* query property to the given value.
4981    pub fn options_requested_policy_version(
4982        mut self,
4983        new_value: i32,
4984    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
4985        self._options_requested_policy_version = Some(new_value);
4986        self
4987    }
4988    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4989    /// while executing the actual API request.
4990    ///
4991    /// ````text
4992    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4993    /// ````
4994    ///
4995    /// Sets the *delegate* property to the given value.
4996    pub fn delegate(
4997        mut self,
4998        new_value: &'a mut dyn common::Delegate,
4999    ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5000        self._delegate = Some(new_value);
5001        self
5002    }
5003
5004    /// Set any additional parameter of the query string used in the request.
5005    /// It should be used to set parameters which are not yet available through their own
5006    /// setters.
5007    ///
5008    /// Please note that this method must not be used to set any of the known parameters
5009    /// which have their own setter method. If done anyway, the request will fail.
5010    ///
5011    /// # Additional Parameters
5012    ///
5013    /// * *$.xgafv* (query-string) - V1 error format.
5014    /// * *access_token* (query-string) - OAuth access token.
5015    /// * *alt* (query-string) - Data format for response.
5016    /// * *callback* (query-string) - JSONP
5017    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5018    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5019    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5020    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5021    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5022    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5023    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5024    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5025    where
5026        T: AsRef<str>,
5027    {
5028        self._additional_params
5029            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5030        self
5031    }
5032
5033    /// Identifies the authorization scope for the method you are building.
5034    ///
5035    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5036    /// [`Scope::CloudPlatform`].
5037    ///
5038    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5039    /// tokens for more than one scope.
5040    ///
5041    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5042    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5043    /// sufficient, a read-write scope will do as well.
5044    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5045    where
5046        St: AsRef<str>,
5047    {
5048        self._scopes.insert(String::from(scope.as_ref()));
5049        self
5050    }
5051    /// Identifies the authorization scope(s) for the method you are building.
5052    ///
5053    /// See [`Self::add_scope()`] for details.
5054    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5055    where
5056        I: IntoIterator<Item = St>,
5057        St: AsRef<str>,
5058    {
5059        self._scopes
5060            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5061        self
5062    }
5063
5064    /// Removes all scopes, and no default scope will be used either.
5065    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5066    /// for details).
5067    pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5068        self._scopes.clear();
5069        self
5070    }
5071}
5072
5073/// Lists Data Fusion instances in the specified project and location.
5074///
5075/// A builder for the *locations.instances.list* method supported by a *project* resource.
5076/// It is not used directly, but through a [`ProjectMethods`] instance.
5077///
5078/// # Example
5079///
5080/// Instantiate a resource method builder
5081///
5082/// ```test_harness,no_run
5083/// # extern crate hyper;
5084/// # extern crate hyper_rustls;
5085/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5086/// # async fn dox() {
5087/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5088///
5089/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5090/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5091/// #     secret,
5092/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5093/// # ).build().await.unwrap();
5094///
5095/// # let client = hyper_util::client::legacy::Client::builder(
5096/// #     hyper_util::rt::TokioExecutor::new()
5097/// # )
5098/// # .build(
5099/// #     hyper_rustls::HttpsConnectorBuilder::new()
5100/// #         .with_native_roots()
5101/// #         .unwrap()
5102/// #         .https_or_http()
5103/// #         .enable_http1()
5104/// #         .build()
5105/// # );
5106/// # let mut hub = DataFusion::new(client, auth);
5107/// // You can configure optional parameters by calling the respective setters at will, and
5108/// // execute the final call using `doit()`.
5109/// // Values shown here are possibly random and not representative !
5110/// let result = hub.projects().locations_instances_list("parent")
5111///              .page_token("rebum.")
5112///              .page_size(-57)
5113///              .order_by("ipsum")
5114///              .filter("ipsum")
5115///              .doit().await;
5116/// # }
5117/// ```
5118pub struct ProjectLocationInstanceListCall<'a, C>
5119where
5120    C: 'a,
5121{
5122    hub: &'a DataFusion<C>,
5123    _parent: String,
5124    _page_token: Option<String>,
5125    _page_size: Option<i32>,
5126    _order_by: Option<String>,
5127    _filter: Option<String>,
5128    _delegate: Option<&'a mut dyn common::Delegate>,
5129    _additional_params: HashMap<String, String>,
5130    _scopes: BTreeSet<String>,
5131}
5132
5133impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
5134
5135impl<'a, C> ProjectLocationInstanceListCall<'a, C>
5136where
5137    C: common::Connector,
5138{
5139    /// Perform the operation you have build so far.
5140    pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
5141        use std::borrow::Cow;
5142        use std::io::{Read, Seek};
5143
5144        use common::{url::Params, ToParts};
5145        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5146
5147        let mut dd = common::DefaultDelegate;
5148        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5149        dlg.begin(common::MethodInfo {
5150            id: "datafusion.projects.locations.instances.list",
5151            http_method: hyper::Method::GET,
5152        });
5153
5154        for &field in [
5155            "alt",
5156            "parent",
5157            "pageToken",
5158            "pageSize",
5159            "orderBy",
5160            "filter",
5161        ]
5162        .iter()
5163        {
5164            if self._additional_params.contains_key(field) {
5165                dlg.finished(false);
5166                return Err(common::Error::FieldClash(field));
5167            }
5168        }
5169
5170        let mut params = Params::with_capacity(7 + self._additional_params.len());
5171        params.push("parent", self._parent);
5172        if let Some(value) = self._page_token.as_ref() {
5173            params.push("pageToken", value);
5174        }
5175        if let Some(value) = self._page_size.as_ref() {
5176            params.push("pageSize", value.to_string());
5177        }
5178        if let Some(value) = self._order_by.as_ref() {
5179            params.push("orderBy", value);
5180        }
5181        if let Some(value) = self._filter.as_ref() {
5182            params.push("filter", value);
5183        }
5184
5185        params.extend(self._additional_params.iter());
5186
5187        params.push("alt", "json");
5188        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
5189        if self._scopes.is_empty() {
5190            self._scopes
5191                .insert(Scope::CloudPlatform.as_ref().to_string());
5192        }
5193
5194        #[allow(clippy::single_element_loop)]
5195        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5196            url = params.uri_replacement(url, param_name, find_this, true);
5197        }
5198        {
5199            let to_remove = ["parent"];
5200            params.remove_params(&to_remove);
5201        }
5202
5203        let url = params.parse_with_url(&url);
5204
5205        loop {
5206            let token = match self
5207                .hub
5208                .auth
5209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5210                .await
5211            {
5212                Ok(token) => token,
5213                Err(e) => match dlg.token(e) {
5214                    Ok(token) => token,
5215                    Err(e) => {
5216                        dlg.finished(false);
5217                        return Err(common::Error::MissingToken(e));
5218                    }
5219                },
5220            };
5221            let mut req_result = {
5222                let client = &self.hub.client;
5223                dlg.pre_request();
5224                let mut req_builder = hyper::Request::builder()
5225                    .method(hyper::Method::GET)
5226                    .uri(url.as_str())
5227                    .header(USER_AGENT, self.hub._user_agent.clone());
5228
5229                if let Some(token) = token.as_ref() {
5230                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5231                }
5232
5233                let request = req_builder
5234                    .header(CONTENT_LENGTH, 0_u64)
5235                    .body(common::to_body::<String>(None));
5236
5237                client.request(request.unwrap()).await
5238            };
5239
5240            match req_result {
5241                Err(err) => {
5242                    if let common::Retry::After(d) = dlg.http_error(&err) {
5243                        sleep(d).await;
5244                        continue;
5245                    }
5246                    dlg.finished(false);
5247                    return Err(common::Error::HttpError(err));
5248                }
5249                Ok(res) => {
5250                    let (mut parts, body) = res.into_parts();
5251                    let mut body = common::Body::new(body);
5252                    if !parts.status.is_success() {
5253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5254                        let error = serde_json::from_str(&common::to_string(&bytes));
5255                        let response = common::to_response(parts, bytes.into());
5256
5257                        if let common::Retry::After(d) =
5258                            dlg.http_failure(&response, error.as_ref().ok())
5259                        {
5260                            sleep(d).await;
5261                            continue;
5262                        }
5263
5264                        dlg.finished(false);
5265
5266                        return Err(match error {
5267                            Ok(value) => common::Error::BadRequest(value),
5268                            _ => common::Error::Failure(response),
5269                        });
5270                    }
5271                    let response = {
5272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5273                        let encoded = common::to_string(&bytes);
5274                        match serde_json::from_str(&encoded) {
5275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5276                            Err(error) => {
5277                                dlg.response_json_decode_error(&encoded, &error);
5278                                return Err(common::Error::JsonDecodeError(
5279                                    encoded.to_string(),
5280                                    error,
5281                                ));
5282                            }
5283                        }
5284                    };
5285
5286                    dlg.finished(true);
5287                    return Ok(response);
5288                }
5289            }
5290        }
5291    }
5292
5293    /// 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.
5294    ///
5295    /// Sets the *parent* path property to the given value.
5296    ///
5297    /// Even though the property as already been set when instantiating this call,
5298    /// we provide this method for API completeness.
5299    pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5300        self._parent = new_value.to_string();
5301        self
5302    }
5303    /// The next_page_token value to use if there are additional results to retrieve for this list request.
5304    ///
5305    /// Sets the *page token* query property to the given value.
5306    pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5307        self._page_token = Some(new_value.to_string());
5308        self
5309    }
5310    /// The maximum number of items to return.
5311    ///
5312    /// Sets the *page size* query property to the given value.
5313    pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
5314        self._page_size = Some(new_value);
5315        self
5316    }
5317    /// Sort results. Supported values are "name", "name desc", or "" (unsorted).
5318    ///
5319    /// Sets the *order by* query property to the given value.
5320    pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5321        self._order_by = Some(new_value.to_string());
5322        self
5323    }
5324    /// List filter.
5325    ///
5326    /// Sets the *filter* query property to the given value.
5327    pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5328        self._filter = Some(new_value.to_string());
5329        self
5330    }
5331    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5332    /// while executing the actual API request.
5333    ///
5334    /// ````text
5335    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5336    /// ````
5337    ///
5338    /// Sets the *delegate* property to the given value.
5339    pub fn delegate(
5340        mut self,
5341        new_value: &'a mut dyn common::Delegate,
5342    ) -> ProjectLocationInstanceListCall<'a, C> {
5343        self._delegate = Some(new_value);
5344        self
5345    }
5346
5347    /// Set any additional parameter of the query string used in the request.
5348    /// It should be used to set parameters which are not yet available through their own
5349    /// setters.
5350    ///
5351    /// Please note that this method must not be used to set any of the known parameters
5352    /// which have their own setter method. If done anyway, the request will fail.
5353    ///
5354    /// # Additional Parameters
5355    ///
5356    /// * *$.xgafv* (query-string) - V1 error format.
5357    /// * *access_token* (query-string) - OAuth access token.
5358    /// * *alt* (query-string) - Data format for response.
5359    /// * *callback* (query-string) - JSONP
5360    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5361    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5362    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5363    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5364    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5365    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5366    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5367    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
5368    where
5369        T: AsRef<str>,
5370    {
5371        self._additional_params
5372            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5373        self
5374    }
5375
5376    /// Identifies the authorization scope for the method you are building.
5377    ///
5378    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5379    /// [`Scope::CloudPlatform`].
5380    ///
5381    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5382    /// tokens for more than one scope.
5383    ///
5384    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5385    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5386    /// sufficient, a read-write scope will do as well.
5387    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
5388    where
5389        St: AsRef<str>,
5390    {
5391        self._scopes.insert(String::from(scope.as_ref()));
5392        self
5393    }
5394    /// Identifies the authorization scope(s) for the method you are building.
5395    ///
5396    /// See [`Self::add_scope()`] for details.
5397    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
5398    where
5399        I: IntoIterator<Item = St>,
5400        St: AsRef<str>,
5401    {
5402        self._scopes
5403            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5404        self
5405    }
5406
5407    /// Removes all scopes, and no default scope will be used either.
5408    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5409    /// for details).
5410    pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
5411        self._scopes.clear();
5412        self
5413    }
5414}
5415
5416/// Updates a single Data Fusion instance.
5417///
5418/// A builder for the *locations.instances.patch* method supported by a *project* resource.
5419/// It is not used directly, but through a [`ProjectMethods`] instance.
5420///
5421/// # Example
5422///
5423/// Instantiate a resource method builder
5424///
5425/// ```test_harness,no_run
5426/// # extern crate hyper;
5427/// # extern crate hyper_rustls;
5428/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5429/// use datafusion1_beta1::api::Instance;
5430/// # async fn dox() {
5431/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5432///
5433/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5434/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5435/// #     secret,
5436/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5437/// # ).build().await.unwrap();
5438///
5439/// # let client = hyper_util::client::legacy::Client::builder(
5440/// #     hyper_util::rt::TokioExecutor::new()
5441/// # )
5442/// # .build(
5443/// #     hyper_rustls::HttpsConnectorBuilder::new()
5444/// #         .with_native_roots()
5445/// #         .unwrap()
5446/// #         .https_or_http()
5447/// #         .enable_http1()
5448/// #         .build()
5449/// # );
5450/// # let mut hub = DataFusion::new(client, auth);
5451/// // As the method needs a request, you would usually fill it with the desired information
5452/// // into the respective structure. Some of the parts shown here might not be applicable !
5453/// // Values shown here are possibly random and not representative !
5454/// let mut req = Instance::default();
5455///
5456/// // You can configure optional parameters by calling the respective setters at will, and
5457/// // execute the final call using `doit()`.
5458/// // Values shown here are possibly random and not representative !
5459/// let result = hub.projects().locations_instances_patch(req, "name")
5460///              .update_mask(FieldMask::new::<&str>(&[]))
5461///              .doit().await;
5462/// # }
5463/// ```
5464pub struct ProjectLocationInstancePatchCall<'a, C>
5465where
5466    C: 'a,
5467{
5468    hub: &'a DataFusion<C>,
5469    _request: Instance,
5470    _name: String,
5471    _update_mask: Option<common::FieldMask>,
5472    _delegate: Option<&'a mut dyn common::Delegate>,
5473    _additional_params: HashMap<String, String>,
5474    _scopes: BTreeSet<String>,
5475}
5476
5477impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
5478
5479impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
5480where
5481    C: common::Connector,
5482{
5483    /// Perform the operation you have build so far.
5484    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5485        use std::borrow::Cow;
5486        use std::io::{Read, Seek};
5487
5488        use common::{url::Params, ToParts};
5489        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5490
5491        let mut dd = common::DefaultDelegate;
5492        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5493        dlg.begin(common::MethodInfo {
5494            id: "datafusion.projects.locations.instances.patch",
5495            http_method: hyper::Method::PATCH,
5496        });
5497
5498        for &field in ["alt", "name", "updateMask"].iter() {
5499            if self._additional_params.contains_key(field) {
5500                dlg.finished(false);
5501                return Err(common::Error::FieldClash(field));
5502            }
5503        }
5504
5505        let mut params = Params::with_capacity(5 + self._additional_params.len());
5506        params.push("name", self._name);
5507        if let Some(value) = self._update_mask.as_ref() {
5508            params.push("updateMask", value.to_string());
5509        }
5510
5511        params.extend(self._additional_params.iter());
5512
5513        params.push("alt", "json");
5514        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5515        if self._scopes.is_empty() {
5516            self._scopes
5517                .insert(Scope::CloudPlatform.as_ref().to_string());
5518        }
5519
5520        #[allow(clippy::single_element_loop)]
5521        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5522            url = params.uri_replacement(url, param_name, find_this, true);
5523        }
5524        {
5525            let to_remove = ["name"];
5526            params.remove_params(&to_remove);
5527        }
5528
5529        let url = params.parse_with_url(&url);
5530
5531        let mut json_mime_type = mime::APPLICATION_JSON;
5532        let mut request_value_reader = {
5533            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5534            common::remove_json_null_values(&mut value);
5535            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5536            serde_json::to_writer(&mut dst, &value).unwrap();
5537            dst
5538        };
5539        let request_size = request_value_reader
5540            .seek(std::io::SeekFrom::End(0))
5541            .unwrap();
5542        request_value_reader
5543            .seek(std::io::SeekFrom::Start(0))
5544            .unwrap();
5545
5546        loop {
5547            let token = match self
5548                .hub
5549                .auth
5550                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5551                .await
5552            {
5553                Ok(token) => token,
5554                Err(e) => match dlg.token(e) {
5555                    Ok(token) => token,
5556                    Err(e) => {
5557                        dlg.finished(false);
5558                        return Err(common::Error::MissingToken(e));
5559                    }
5560                },
5561            };
5562            request_value_reader
5563                .seek(std::io::SeekFrom::Start(0))
5564                .unwrap();
5565            let mut req_result = {
5566                let client = &self.hub.client;
5567                dlg.pre_request();
5568                let mut req_builder = hyper::Request::builder()
5569                    .method(hyper::Method::PATCH)
5570                    .uri(url.as_str())
5571                    .header(USER_AGENT, self.hub._user_agent.clone());
5572
5573                if let Some(token) = token.as_ref() {
5574                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5575                }
5576
5577                let request = req_builder
5578                    .header(CONTENT_TYPE, json_mime_type.to_string())
5579                    .header(CONTENT_LENGTH, request_size as u64)
5580                    .body(common::to_body(
5581                        request_value_reader.get_ref().clone().into(),
5582                    ));
5583
5584                client.request(request.unwrap()).await
5585            };
5586
5587            match req_result {
5588                Err(err) => {
5589                    if let common::Retry::After(d) = dlg.http_error(&err) {
5590                        sleep(d).await;
5591                        continue;
5592                    }
5593                    dlg.finished(false);
5594                    return Err(common::Error::HttpError(err));
5595                }
5596                Ok(res) => {
5597                    let (mut parts, body) = res.into_parts();
5598                    let mut body = common::Body::new(body);
5599                    if !parts.status.is_success() {
5600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5601                        let error = serde_json::from_str(&common::to_string(&bytes));
5602                        let response = common::to_response(parts, bytes.into());
5603
5604                        if let common::Retry::After(d) =
5605                            dlg.http_failure(&response, error.as_ref().ok())
5606                        {
5607                            sleep(d).await;
5608                            continue;
5609                        }
5610
5611                        dlg.finished(false);
5612
5613                        return Err(match error {
5614                            Ok(value) => common::Error::BadRequest(value),
5615                            _ => common::Error::Failure(response),
5616                        });
5617                    }
5618                    let response = {
5619                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5620                        let encoded = common::to_string(&bytes);
5621                        match serde_json::from_str(&encoded) {
5622                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5623                            Err(error) => {
5624                                dlg.response_json_decode_error(&encoded, &error);
5625                                return Err(common::Error::JsonDecodeError(
5626                                    encoded.to_string(),
5627                                    error,
5628                                ));
5629                            }
5630                        }
5631                    };
5632
5633                    dlg.finished(true);
5634                    return Ok(response);
5635                }
5636            }
5637        }
5638    }
5639
5640    ///
5641    /// Sets the *request* property to the given value.
5642    ///
5643    /// Even though the property as already been set when instantiating this call,
5644    /// we provide this method for API completeness.
5645    pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
5646        self._request = new_value;
5647        self
5648    }
5649    /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
5650    ///
5651    /// Sets the *name* path property to the given value.
5652    ///
5653    /// Even though the property as already been set when instantiating this call,
5654    /// we provide this method for API completeness.
5655    pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
5656        self._name = new_value.to_string();
5657        self
5658    }
5659    /// 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, all the supported fields (labels and options currently) will be overwritten.
5660    ///
5661    /// Sets the *update mask* query property to the given value.
5662    pub fn update_mask(
5663        mut self,
5664        new_value: common::FieldMask,
5665    ) -> ProjectLocationInstancePatchCall<'a, C> {
5666        self._update_mask = Some(new_value);
5667        self
5668    }
5669    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5670    /// while executing the actual API request.
5671    ///
5672    /// ````text
5673    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5674    /// ````
5675    ///
5676    /// Sets the *delegate* property to the given value.
5677    pub fn delegate(
5678        mut self,
5679        new_value: &'a mut dyn common::Delegate,
5680    ) -> ProjectLocationInstancePatchCall<'a, C> {
5681        self._delegate = Some(new_value);
5682        self
5683    }
5684
5685    /// Set any additional parameter of the query string used in the request.
5686    /// It should be used to set parameters which are not yet available through their own
5687    /// setters.
5688    ///
5689    /// Please note that this method must not be used to set any of the known parameters
5690    /// which have their own setter method. If done anyway, the request will fail.
5691    ///
5692    /// # Additional Parameters
5693    ///
5694    /// * *$.xgafv* (query-string) - V1 error format.
5695    /// * *access_token* (query-string) - OAuth access token.
5696    /// * *alt* (query-string) - Data format for response.
5697    /// * *callback* (query-string) - JSONP
5698    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5699    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5700    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5701    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5702    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5703    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5704    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5705    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
5706    where
5707        T: AsRef<str>,
5708    {
5709        self._additional_params
5710            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5711        self
5712    }
5713
5714    /// Identifies the authorization scope for the method you are building.
5715    ///
5716    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5717    /// [`Scope::CloudPlatform`].
5718    ///
5719    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5720    /// tokens for more than one scope.
5721    ///
5722    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5723    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5724    /// sufficient, a read-write scope will do as well.
5725    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
5726    where
5727        St: AsRef<str>,
5728    {
5729        self._scopes.insert(String::from(scope.as_ref()));
5730        self
5731    }
5732    /// Identifies the authorization scope(s) for the method you are building.
5733    ///
5734    /// See [`Self::add_scope()`] for details.
5735    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
5736    where
5737        I: IntoIterator<Item = St>,
5738        St: AsRef<str>,
5739    {
5740        self._scopes
5741            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5742        self
5743    }
5744
5745    /// Removes all scopes, and no default scope will be used either.
5746    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5747    /// for details).
5748    pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
5749        self._scopes.clear();
5750        self
5751    }
5752}
5753
5754/// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
5755///
5756/// A builder for the *locations.instances.restart* method supported by a *project* resource.
5757/// It is not used directly, but through a [`ProjectMethods`] instance.
5758///
5759/// # Example
5760///
5761/// Instantiate a resource method builder
5762///
5763/// ```test_harness,no_run
5764/// # extern crate hyper;
5765/// # extern crate hyper_rustls;
5766/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5767/// use datafusion1_beta1::api::RestartInstanceRequest;
5768/// # async fn dox() {
5769/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5770///
5771/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5772/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5773/// #     secret,
5774/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5775/// # ).build().await.unwrap();
5776///
5777/// # let client = hyper_util::client::legacy::Client::builder(
5778/// #     hyper_util::rt::TokioExecutor::new()
5779/// # )
5780/// # .build(
5781/// #     hyper_rustls::HttpsConnectorBuilder::new()
5782/// #         .with_native_roots()
5783/// #         .unwrap()
5784/// #         .https_or_http()
5785/// #         .enable_http1()
5786/// #         .build()
5787/// # );
5788/// # let mut hub = DataFusion::new(client, auth);
5789/// // As the method needs a request, you would usually fill it with the desired information
5790/// // into the respective structure. Some of the parts shown here might not be applicable !
5791/// // Values shown here are possibly random and not representative !
5792/// let mut req = RestartInstanceRequest::default();
5793///
5794/// // You can configure optional parameters by calling the respective setters at will, and
5795/// // execute the final call using `doit()`.
5796/// // Values shown here are possibly random and not representative !
5797/// let result = hub.projects().locations_instances_restart(req, "name")
5798///              .doit().await;
5799/// # }
5800/// ```
5801pub struct ProjectLocationInstanceRestartCall<'a, C>
5802where
5803    C: 'a,
5804{
5805    hub: &'a DataFusion<C>,
5806    _request: RestartInstanceRequest,
5807    _name: String,
5808    _delegate: Option<&'a mut dyn common::Delegate>,
5809    _additional_params: HashMap<String, String>,
5810    _scopes: BTreeSet<String>,
5811}
5812
5813impl<'a, C> common::CallBuilder for ProjectLocationInstanceRestartCall<'a, C> {}
5814
5815impl<'a, C> ProjectLocationInstanceRestartCall<'a, C>
5816where
5817    C: common::Connector,
5818{
5819    /// Perform the operation you have build so far.
5820    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5821        use std::borrow::Cow;
5822        use std::io::{Read, Seek};
5823
5824        use common::{url::Params, ToParts};
5825        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5826
5827        let mut dd = common::DefaultDelegate;
5828        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5829        dlg.begin(common::MethodInfo {
5830            id: "datafusion.projects.locations.instances.restart",
5831            http_method: hyper::Method::POST,
5832        });
5833
5834        for &field in ["alt", "name"].iter() {
5835            if self._additional_params.contains_key(field) {
5836                dlg.finished(false);
5837                return Err(common::Error::FieldClash(field));
5838            }
5839        }
5840
5841        let mut params = Params::with_capacity(4 + self._additional_params.len());
5842        params.push("name", self._name);
5843
5844        params.extend(self._additional_params.iter());
5845
5846        params.push("alt", "json");
5847        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:restart";
5848        if self._scopes.is_empty() {
5849            self._scopes
5850                .insert(Scope::CloudPlatform.as_ref().to_string());
5851        }
5852
5853        #[allow(clippy::single_element_loop)]
5854        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5855            url = params.uri_replacement(url, param_name, find_this, true);
5856        }
5857        {
5858            let to_remove = ["name"];
5859            params.remove_params(&to_remove);
5860        }
5861
5862        let url = params.parse_with_url(&url);
5863
5864        let mut json_mime_type = mime::APPLICATION_JSON;
5865        let mut request_value_reader = {
5866            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5867            common::remove_json_null_values(&mut value);
5868            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5869            serde_json::to_writer(&mut dst, &value).unwrap();
5870            dst
5871        };
5872        let request_size = request_value_reader
5873            .seek(std::io::SeekFrom::End(0))
5874            .unwrap();
5875        request_value_reader
5876            .seek(std::io::SeekFrom::Start(0))
5877            .unwrap();
5878
5879        loop {
5880            let token = match self
5881                .hub
5882                .auth
5883                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5884                .await
5885            {
5886                Ok(token) => token,
5887                Err(e) => match dlg.token(e) {
5888                    Ok(token) => token,
5889                    Err(e) => {
5890                        dlg.finished(false);
5891                        return Err(common::Error::MissingToken(e));
5892                    }
5893                },
5894            };
5895            request_value_reader
5896                .seek(std::io::SeekFrom::Start(0))
5897                .unwrap();
5898            let mut req_result = {
5899                let client = &self.hub.client;
5900                dlg.pre_request();
5901                let mut req_builder = hyper::Request::builder()
5902                    .method(hyper::Method::POST)
5903                    .uri(url.as_str())
5904                    .header(USER_AGENT, self.hub._user_agent.clone());
5905
5906                if let Some(token) = token.as_ref() {
5907                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5908                }
5909
5910                let request = req_builder
5911                    .header(CONTENT_TYPE, json_mime_type.to_string())
5912                    .header(CONTENT_LENGTH, request_size as u64)
5913                    .body(common::to_body(
5914                        request_value_reader.get_ref().clone().into(),
5915                    ));
5916
5917                client.request(request.unwrap()).await
5918            };
5919
5920            match req_result {
5921                Err(err) => {
5922                    if let common::Retry::After(d) = dlg.http_error(&err) {
5923                        sleep(d).await;
5924                        continue;
5925                    }
5926                    dlg.finished(false);
5927                    return Err(common::Error::HttpError(err));
5928                }
5929                Ok(res) => {
5930                    let (mut parts, body) = res.into_parts();
5931                    let mut body = common::Body::new(body);
5932                    if !parts.status.is_success() {
5933                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5934                        let error = serde_json::from_str(&common::to_string(&bytes));
5935                        let response = common::to_response(parts, bytes.into());
5936
5937                        if let common::Retry::After(d) =
5938                            dlg.http_failure(&response, error.as_ref().ok())
5939                        {
5940                            sleep(d).await;
5941                            continue;
5942                        }
5943
5944                        dlg.finished(false);
5945
5946                        return Err(match error {
5947                            Ok(value) => common::Error::BadRequest(value),
5948                            _ => common::Error::Failure(response),
5949                        });
5950                    }
5951                    let response = {
5952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5953                        let encoded = common::to_string(&bytes);
5954                        match serde_json::from_str(&encoded) {
5955                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5956                            Err(error) => {
5957                                dlg.response_json_decode_error(&encoded, &error);
5958                                return Err(common::Error::JsonDecodeError(
5959                                    encoded.to_string(),
5960                                    error,
5961                                ));
5962                            }
5963                        }
5964                    };
5965
5966                    dlg.finished(true);
5967                    return Ok(response);
5968                }
5969            }
5970        }
5971    }
5972
5973    ///
5974    /// Sets the *request* property to the given value.
5975    ///
5976    /// Even though the property as already been set when instantiating this call,
5977    /// we provide this method for API completeness.
5978    pub fn request(
5979        mut self,
5980        new_value: RestartInstanceRequest,
5981    ) -> ProjectLocationInstanceRestartCall<'a, C> {
5982        self._request = new_value;
5983        self
5984    }
5985    /// Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
5986    ///
5987    /// Sets the *name* path property to the given value.
5988    ///
5989    /// Even though the property as already been set when instantiating this call,
5990    /// we provide this method for API completeness.
5991    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRestartCall<'a, C> {
5992        self._name = new_value.to_string();
5993        self
5994    }
5995    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5996    /// while executing the actual API request.
5997    ///
5998    /// ````text
5999    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6000    /// ````
6001    ///
6002    /// Sets the *delegate* property to the given value.
6003    pub fn delegate(
6004        mut self,
6005        new_value: &'a mut dyn common::Delegate,
6006    ) -> ProjectLocationInstanceRestartCall<'a, C> {
6007        self._delegate = Some(new_value);
6008        self
6009    }
6010
6011    /// Set any additional parameter of the query string used in the request.
6012    /// It should be used to set parameters which are not yet available through their own
6013    /// setters.
6014    ///
6015    /// Please note that this method must not be used to set any of the known parameters
6016    /// which have their own setter method. If done anyway, the request will fail.
6017    ///
6018    /// # Additional Parameters
6019    ///
6020    /// * *$.xgafv* (query-string) - V1 error format.
6021    /// * *access_token* (query-string) - OAuth access token.
6022    /// * *alt* (query-string) - Data format for response.
6023    /// * *callback* (query-string) - JSONP
6024    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6025    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6026    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6027    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6028    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6029    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6030    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6031    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRestartCall<'a, C>
6032    where
6033        T: AsRef<str>,
6034    {
6035        self._additional_params
6036            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6037        self
6038    }
6039
6040    /// Identifies the authorization scope for the method you are building.
6041    ///
6042    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6043    /// [`Scope::CloudPlatform`].
6044    ///
6045    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6046    /// tokens for more than one scope.
6047    ///
6048    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6049    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6050    /// sufficient, a read-write scope will do as well.
6051    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRestartCall<'a, C>
6052    where
6053        St: AsRef<str>,
6054    {
6055        self._scopes.insert(String::from(scope.as_ref()));
6056        self
6057    }
6058    /// Identifies the authorization scope(s) for the method you are building.
6059    ///
6060    /// See [`Self::add_scope()`] for details.
6061    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRestartCall<'a, C>
6062    where
6063        I: IntoIterator<Item = St>,
6064        St: AsRef<str>,
6065    {
6066        self._scopes
6067            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6068        self
6069    }
6070
6071    /// Removes all scopes, and no default scope will be used either.
6072    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6073    /// for details).
6074    pub fn clear_scopes(mut self) -> ProjectLocationInstanceRestartCall<'a, C> {
6075        self._scopes.clear();
6076        self
6077    }
6078}
6079
6080/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6081///
6082/// A builder for the *locations.instances.setIamPolicy* method supported by a *project* resource.
6083/// It is not used directly, but through a [`ProjectMethods`] instance.
6084///
6085/// # Example
6086///
6087/// Instantiate a resource method builder
6088///
6089/// ```test_harness,no_run
6090/// # extern crate hyper;
6091/// # extern crate hyper_rustls;
6092/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6093/// use datafusion1_beta1::api::SetIamPolicyRequest;
6094/// # async fn dox() {
6095/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6096///
6097/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6098/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6099/// #     secret,
6100/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6101/// # ).build().await.unwrap();
6102///
6103/// # let client = hyper_util::client::legacy::Client::builder(
6104/// #     hyper_util::rt::TokioExecutor::new()
6105/// # )
6106/// # .build(
6107/// #     hyper_rustls::HttpsConnectorBuilder::new()
6108/// #         .with_native_roots()
6109/// #         .unwrap()
6110/// #         .https_or_http()
6111/// #         .enable_http1()
6112/// #         .build()
6113/// # );
6114/// # let mut hub = DataFusion::new(client, auth);
6115/// // As the method needs a request, you would usually fill it with the desired information
6116/// // into the respective structure. Some of the parts shown here might not be applicable !
6117/// // Values shown here are possibly random and not representative !
6118/// let mut req = SetIamPolicyRequest::default();
6119///
6120/// // You can configure optional parameters by calling the respective setters at will, and
6121/// // execute the final call using `doit()`.
6122/// // Values shown here are possibly random and not representative !
6123/// let result = hub.projects().locations_instances_set_iam_policy(req, "resource")
6124///              .doit().await;
6125/// # }
6126/// ```
6127pub struct ProjectLocationInstanceSetIamPolicyCall<'a, C>
6128where
6129    C: 'a,
6130{
6131    hub: &'a DataFusion<C>,
6132    _request: SetIamPolicyRequest,
6133    _resource: String,
6134    _delegate: Option<&'a mut dyn common::Delegate>,
6135    _additional_params: HashMap<String, String>,
6136    _scopes: BTreeSet<String>,
6137}
6138
6139impl<'a, C> common::CallBuilder for ProjectLocationInstanceSetIamPolicyCall<'a, C> {}
6140
6141impl<'a, C> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6142where
6143    C: common::Connector,
6144{
6145    /// Perform the operation you have build so far.
6146    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6147        use std::borrow::Cow;
6148        use std::io::{Read, Seek};
6149
6150        use common::{url::Params, ToParts};
6151        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6152
6153        let mut dd = common::DefaultDelegate;
6154        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6155        dlg.begin(common::MethodInfo {
6156            id: "datafusion.projects.locations.instances.setIamPolicy",
6157            http_method: hyper::Method::POST,
6158        });
6159
6160        for &field in ["alt", "resource"].iter() {
6161            if self._additional_params.contains_key(field) {
6162                dlg.finished(false);
6163                return Err(common::Error::FieldClash(field));
6164            }
6165        }
6166
6167        let mut params = Params::with_capacity(4 + self._additional_params.len());
6168        params.push("resource", self._resource);
6169
6170        params.extend(self._additional_params.iter());
6171
6172        params.push("alt", "json");
6173        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
6174        if self._scopes.is_empty() {
6175            self._scopes
6176                .insert(Scope::CloudPlatform.as_ref().to_string());
6177        }
6178
6179        #[allow(clippy::single_element_loop)]
6180        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6181            url = params.uri_replacement(url, param_name, find_this, true);
6182        }
6183        {
6184            let to_remove = ["resource"];
6185            params.remove_params(&to_remove);
6186        }
6187
6188        let url = params.parse_with_url(&url);
6189
6190        let mut json_mime_type = mime::APPLICATION_JSON;
6191        let mut request_value_reader = {
6192            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6193            common::remove_json_null_values(&mut value);
6194            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6195            serde_json::to_writer(&mut dst, &value).unwrap();
6196            dst
6197        };
6198        let request_size = request_value_reader
6199            .seek(std::io::SeekFrom::End(0))
6200            .unwrap();
6201        request_value_reader
6202            .seek(std::io::SeekFrom::Start(0))
6203            .unwrap();
6204
6205        loop {
6206            let token = match self
6207                .hub
6208                .auth
6209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6210                .await
6211            {
6212                Ok(token) => token,
6213                Err(e) => match dlg.token(e) {
6214                    Ok(token) => token,
6215                    Err(e) => {
6216                        dlg.finished(false);
6217                        return Err(common::Error::MissingToken(e));
6218                    }
6219                },
6220            };
6221            request_value_reader
6222                .seek(std::io::SeekFrom::Start(0))
6223                .unwrap();
6224            let mut req_result = {
6225                let client = &self.hub.client;
6226                dlg.pre_request();
6227                let mut req_builder = hyper::Request::builder()
6228                    .method(hyper::Method::POST)
6229                    .uri(url.as_str())
6230                    .header(USER_AGENT, self.hub._user_agent.clone());
6231
6232                if let Some(token) = token.as_ref() {
6233                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6234                }
6235
6236                let request = req_builder
6237                    .header(CONTENT_TYPE, json_mime_type.to_string())
6238                    .header(CONTENT_LENGTH, request_size as u64)
6239                    .body(common::to_body(
6240                        request_value_reader.get_ref().clone().into(),
6241                    ));
6242
6243                client.request(request.unwrap()).await
6244            };
6245
6246            match req_result {
6247                Err(err) => {
6248                    if let common::Retry::After(d) = dlg.http_error(&err) {
6249                        sleep(d).await;
6250                        continue;
6251                    }
6252                    dlg.finished(false);
6253                    return Err(common::Error::HttpError(err));
6254                }
6255                Ok(res) => {
6256                    let (mut parts, body) = res.into_parts();
6257                    let mut body = common::Body::new(body);
6258                    if !parts.status.is_success() {
6259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6260                        let error = serde_json::from_str(&common::to_string(&bytes));
6261                        let response = common::to_response(parts, bytes.into());
6262
6263                        if let common::Retry::After(d) =
6264                            dlg.http_failure(&response, error.as_ref().ok())
6265                        {
6266                            sleep(d).await;
6267                            continue;
6268                        }
6269
6270                        dlg.finished(false);
6271
6272                        return Err(match error {
6273                            Ok(value) => common::Error::BadRequest(value),
6274                            _ => common::Error::Failure(response),
6275                        });
6276                    }
6277                    let response = {
6278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6279                        let encoded = common::to_string(&bytes);
6280                        match serde_json::from_str(&encoded) {
6281                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6282                            Err(error) => {
6283                                dlg.response_json_decode_error(&encoded, &error);
6284                                return Err(common::Error::JsonDecodeError(
6285                                    encoded.to_string(),
6286                                    error,
6287                                ));
6288                            }
6289                        }
6290                    };
6291
6292                    dlg.finished(true);
6293                    return Ok(response);
6294                }
6295            }
6296        }
6297    }
6298
6299    ///
6300    /// Sets the *request* property to the given value.
6301    ///
6302    /// Even though the property as already been set when instantiating this call,
6303    /// we provide this method for API completeness.
6304    pub fn request(
6305        mut self,
6306        new_value: SetIamPolicyRequest,
6307    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6308        self._request = new_value;
6309        self
6310    }
6311    /// 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.
6312    ///
6313    /// Sets the *resource* path property to the given value.
6314    ///
6315    /// Even though the property as already been set when instantiating this call,
6316    /// we provide this method for API completeness.
6317    pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6318        self._resource = new_value.to_string();
6319        self
6320    }
6321    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6322    /// while executing the actual API request.
6323    ///
6324    /// ````text
6325    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6326    /// ````
6327    ///
6328    /// Sets the *delegate* property to the given value.
6329    pub fn delegate(
6330        mut self,
6331        new_value: &'a mut dyn common::Delegate,
6332    ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6333        self._delegate = Some(new_value);
6334        self
6335    }
6336
6337    /// Set any additional parameter of the query string used in the request.
6338    /// It should be used to set parameters which are not yet available through their own
6339    /// setters.
6340    ///
6341    /// Please note that this method must not be used to set any of the known parameters
6342    /// which have their own setter method. If done anyway, the request will fail.
6343    ///
6344    /// # Additional Parameters
6345    ///
6346    /// * *$.xgafv* (query-string) - V1 error format.
6347    /// * *access_token* (query-string) - OAuth access token.
6348    /// * *alt* (query-string) - Data format for response.
6349    /// * *callback* (query-string) - JSONP
6350    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6351    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6352    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6353    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6354    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6355    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6356    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6357    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6358    where
6359        T: AsRef<str>,
6360    {
6361        self._additional_params
6362            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6363        self
6364    }
6365
6366    /// Identifies the authorization scope for the method you are building.
6367    ///
6368    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6369    /// [`Scope::CloudPlatform`].
6370    ///
6371    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6372    /// tokens for more than one scope.
6373    ///
6374    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6375    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6376    /// sufficient, a read-write scope will do as well.
6377    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6378    where
6379        St: AsRef<str>,
6380    {
6381        self._scopes.insert(String::from(scope.as_ref()));
6382        self
6383    }
6384    /// Identifies the authorization scope(s) for the method you are building.
6385    ///
6386    /// See [`Self::add_scope()`] for details.
6387    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6388    where
6389        I: IntoIterator<Item = St>,
6390        St: AsRef<str>,
6391    {
6392        self._scopes
6393            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6394        self
6395    }
6396
6397    /// Removes all scopes, and no default scope will be used either.
6398    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6399    /// for details).
6400    pub fn clear_scopes(mut self) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6401        self._scopes.clear();
6402        self
6403    }
6404}
6405
6406/// 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.
6407///
6408/// A builder for the *locations.instances.testIamPermissions* method supported by a *project* resource.
6409/// It is not used directly, but through a [`ProjectMethods`] instance.
6410///
6411/// # Example
6412///
6413/// Instantiate a resource method builder
6414///
6415/// ```test_harness,no_run
6416/// # extern crate hyper;
6417/// # extern crate hyper_rustls;
6418/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6419/// use datafusion1_beta1::api::TestIamPermissionsRequest;
6420/// # async fn dox() {
6421/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6422///
6423/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6424/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6425/// #     secret,
6426/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6427/// # ).build().await.unwrap();
6428///
6429/// # let client = hyper_util::client::legacy::Client::builder(
6430/// #     hyper_util::rt::TokioExecutor::new()
6431/// # )
6432/// # .build(
6433/// #     hyper_rustls::HttpsConnectorBuilder::new()
6434/// #         .with_native_roots()
6435/// #         .unwrap()
6436/// #         .https_or_http()
6437/// #         .enable_http1()
6438/// #         .build()
6439/// # );
6440/// # let mut hub = DataFusion::new(client, auth);
6441/// // As the method needs a request, you would usually fill it with the desired information
6442/// // into the respective structure. Some of the parts shown here might not be applicable !
6443/// // Values shown here are possibly random and not representative !
6444/// let mut req = TestIamPermissionsRequest::default();
6445///
6446/// // You can configure optional parameters by calling the respective setters at will, and
6447/// // execute the final call using `doit()`.
6448/// // Values shown here are possibly random and not representative !
6449/// let result = hub.projects().locations_instances_test_iam_permissions(req, "resource")
6450///              .doit().await;
6451/// # }
6452/// ```
6453pub struct ProjectLocationInstanceTestIamPermissionCall<'a, C>
6454where
6455    C: 'a,
6456{
6457    hub: &'a DataFusion<C>,
6458    _request: TestIamPermissionsRequest,
6459    _resource: String,
6460    _delegate: Option<&'a mut dyn common::Delegate>,
6461    _additional_params: HashMap<String, String>,
6462    _scopes: BTreeSet<String>,
6463}
6464
6465impl<'a, C> common::CallBuilder for ProjectLocationInstanceTestIamPermissionCall<'a, C> {}
6466
6467impl<'a, C> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6468where
6469    C: common::Connector,
6470{
6471    /// Perform the operation you have build so far.
6472    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6473        use std::borrow::Cow;
6474        use std::io::{Read, Seek};
6475
6476        use common::{url::Params, ToParts};
6477        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6478
6479        let mut dd = common::DefaultDelegate;
6480        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6481        dlg.begin(common::MethodInfo {
6482            id: "datafusion.projects.locations.instances.testIamPermissions",
6483            http_method: hyper::Method::POST,
6484        });
6485
6486        for &field in ["alt", "resource"].iter() {
6487            if self._additional_params.contains_key(field) {
6488                dlg.finished(false);
6489                return Err(common::Error::FieldClash(field));
6490            }
6491        }
6492
6493        let mut params = Params::with_capacity(4 + self._additional_params.len());
6494        params.push("resource", self._resource);
6495
6496        params.extend(self._additional_params.iter());
6497
6498        params.push("alt", "json");
6499        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
6500        if self._scopes.is_empty() {
6501            self._scopes
6502                .insert(Scope::CloudPlatform.as_ref().to_string());
6503        }
6504
6505        #[allow(clippy::single_element_loop)]
6506        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6507            url = params.uri_replacement(url, param_name, find_this, true);
6508        }
6509        {
6510            let to_remove = ["resource"];
6511            params.remove_params(&to_remove);
6512        }
6513
6514        let url = params.parse_with_url(&url);
6515
6516        let mut json_mime_type = mime::APPLICATION_JSON;
6517        let mut request_value_reader = {
6518            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6519            common::remove_json_null_values(&mut value);
6520            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6521            serde_json::to_writer(&mut dst, &value).unwrap();
6522            dst
6523        };
6524        let request_size = request_value_reader
6525            .seek(std::io::SeekFrom::End(0))
6526            .unwrap();
6527        request_value_reader
6528            .seek(std::io::SeekFrom::Start(0))
6529            .unwrap();
6530
6531        loop {
6532            let token = match self
6533                .hub
6534                .auth
6535                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6536                .await
6537            {
6538                Ok(token) => token,
6539                Err(e) => match dlg.token(e) {
6540                    Ok(token) => token,
6541                    Err(e) => {
6542                        dlg.finished(false);
6543                        return Err(common::Error::MissingToken(e));
6544                    }
6545                },
6546            };
6547            request_value_reader
6548                .seek(std::io::SeekFrom::Start(0))
6549                .unwrap();
6550            let mut req_result = {
6551                let client = &self.hub.client;
6552                dlg.pre_request();
6553                let mut req_builder = hyper::Request::builder()
6554                    .method(hyper::Method::POST)
6555                    .uri(url.as_str())
6556                    .header(USER_AGENT, self.hub._user_agent.clone());
6557
6558                if let Some(token) = token.as_ref() {
6559                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6560                }
6561
6562                let request = req_builder
6563                    .header(CONTENT_TYPE, json_mime_type.to_string())
6564                    .header(CONTENT_LENGTH, request_size as u64)
6565                    .body(common::to_body(
6566                        request_value_reader.get_ref().clone().into(),
6567                    ));
6568
6569                client.request(request.unwrap()).await
6570            };
6571
6572            match req_result {
6573                Err(err) => {
6574                    if let common::Retry::After(d) = dlg.http_error(&err) {
6575                        sleep(d).await;
6576                        continue;
6577                    }
6578                    dlg.finished(false);
6579                    return Err(common::Error::HttpError(err));
6580                }
6581                Ok(res) => {
6582                    let (mut parts, body) = res.into_parts();
6583                    let mut body = common::Body::new(body);
6584                    if !parts.status.is_success() {
6585                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6586                        let error = serde_json::from_str(&common::to_string(&bytes));
6587                        let response = common::to_response(parts, bytes.into());
6588
6589                        if let common::Retry::After(d) =
6590                            dlg.http_failure(&response, error.as_ref().ok())
6591                        {
6592                            sleep(d).await;
6593                            continue;
6594                        }
6595
6596                        dlg.finished(false);
6597
6598                        return Err(match error {
6599                            Ok(value) => common::Error::BadRequest(value),
6600                            _ => common::Error::Failure(response),
6601                        });
6602                    }
6603                    let response = {
6604                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6605                        let encoded = common::to_string(&bytes);
6606                        match serde_json::from_str(&encoded) {
6607                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6608                            Err(error) => {
6609                                dlg.response_json_decode_error(&encoded, &error);
6610                                return Err(common::Error::JsonDecodeError(
6611                                    encoded.to_string(),
6612                                    error,
6613                                ));
6614                            }
6615                        }
6616                    };
6617
6618                    dlg.finished(true);
6619                    return Ok(response);
6620                }
6621            }
6622        }
6623    }
6624
6625    ///
6626    /// Sets the *request* property to the given value.
6627    ///
6628    /// Even though the property as already been set when instantiating this call,
6629    /// we provide this method for API completeness.
6630    pub fn request(
6631        mut self,
6632        new_value: TestIamPermissionsRequest,
6633    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6634        self._request = new_value;
6635        self
6636    }
6637    /// 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.
6638    ///
6639    /// Sets the *resource* path property to the given value.
6640    ///
6641    /// Even though the property as already been set when instantiating this call,
6642    /// we provide this method for API completeness.
6643    pub fn resource(
6644        mut self,
6645        new_value: &str,
6646    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6647        self._resource = new_value.to_string();
6648        self
6649    }
6650    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6651    /// while executing the actual API request.
6652    ///
6653    /// ````text
6654    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6655    /// ````
6656    ///
6657    /// Sets the *delegate* property to the given value.
6658    pub fn delegate(
6659        mut self,
6660        new_value: &'a mut dyn common::Delegate,
6661    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6662        self._delegate = Some(new_value);
6663        self
6664    }
6665
6666    /// Set any additional parameter of the query string used in the request.
6667    /// It should be used to set parameters which are not yet available through their own
6668    /// setters.
6669    ///
6670    /// Please note that this method must not be used to set any of the known parameters
6671    /// which have their own setter method. If done anyway, the request will fail.
6672    ///
6673    /// # Additional Parameters
6674    ///
6675    /// * *$.xgafv* (query-string) - V1 error format.
6676    /// * *access_token* (query-string) - OAuth access token.
6677    /// * *alt* (query-string) - Data format for response.
6678    /// * *callback* (query-string) - JSONP
6679    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6680    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6681    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6682    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6683    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6684    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6685    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6686    pub fn param<T>(
6687        mut self,
6688        name: T,
6689        value: T,
6690    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6691    where
6692        T: AsRef<str>,
6693    {
6694        self._additional_params
6695            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6696        self
6697    }
6698
6699    /// Identifies the authorization scope for the method you are building.
6700    ///
6701    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6702    /// [`Scope::CloudPlatform`].
6703    ///
6704    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6705    /// tokens for more than one scope.
6706    ///
6707    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6708    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6709    /// sufficient, a read-write scope will do as well.
6710    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6711    where
6712        St: AsRef<str>,
6713    {
6714        self._scopes.insert(String::from(scope.as_ref()));
6715        self
6716    }
6717    /// Identifies the authorization scope(s) for the method you are building.
6718    ///
6719    /// See [`Self::add_scope()`] for details.
6720    pub fn add_scopes<I, St>(
6721        mut self,
6722        scopes: I,
6723    ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6724    where
6725        I: IntoIterator<Item = St>,
6726        St: AsRef<str>,
6727    {
6728        self._scopes
6729            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6730        self
6731    }
6732
6733    /// Removes all scopes, and no default scope will be used either.
6734    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6735    /// for details).
6736    pub fn clear_scopes(mut self) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6737        self._scopes.clear();
6738        self
6739    }
6740}
6741
6742/// Upgrade a single Data Fusion instance. At the end of an operation instance is fully upgraded.
6743///
6744/// A builder for the *locations.instances.upgrade* method supported by a *project* resource.
6745/// It is not used directly, but through a [`ProjectMethods`] instance.
6746///
6747/// # Example
6748///
6749/// Instantiate a resource method builder
6750///
6751/// ```test_harness,no_run
6752/// # extern crate hyper;
6753/// # extern crate hyper_rustls;
6754/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6755/// use datafusion1_beta1::api::UpgradeInstanceRequest;
6756/// # async fn dox() {
6757/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6758///
6759/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6760/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6761/// #     secret,
6762/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6763/// # ).build().await.unwrap();
6764///
6765/// # let client = hyper_util::client::legacy::Client::builder(
6766/// #     hyper_util::rt::TokioExecutor::new()
6767/// # )
6768/// # .build(
6769/// #     hyper_rustls::HttpsConnectorBuilder::new()
6770/// #         .with_native_roots()
6771/// #         .unwrap()
6772/// #         .https_or_http()
6773/// #         .enable_http1()
6774/// #         .build()
6775/// # );
6776/// # let mut hub = DataFusion::new(client, auth);
6777/// // As the method needs a request, you would usually fill it with the desired information
6778/// // into the respective structure. Some of the parts shown here might not be applicable !
6779/// // Values shown here are possibly random and not representative !
6780/// let mut req = UpgradeInstanceRequest::default();
6781///
6782/// // You can configure optional parameters by calling the respective setters at will, and
6783/// // execute the final call using `doit()`.
6784/// // Values shown here are possibly random and not representative !
6785/// let result = hub.projects().locations_instances_upgrade(req, "name")
6786///              .doit().await;
6787/// # }
6788/// ```
6789pub struct ProjectLocationInstanceUpgradeCall<'a, C>
6790where
6791    C: 'a,
6792{
6793    hub: &'a DataFusion<C>,
6794    _request: UpgradeInstanceRequest,
6795    _name: String,
6796    _delegate: Option<&'a mut dyn common::Delegate>,
6797    _additional_params: HashMap<String, String>,
6798    _scopes: BTreeSet<String>,
6799}
6800
6801impl<'a, C> common::CallBuilder for ProjectLocationInstanceUpgradeCall<'a, C> {}
6802
6803impl<'a, C> ProjectLocationInstanceUpgradeCall<'a, C>
6804where
6805    C: common::Connector,
6806{
6807    /// Perform the operation you have build so far.
6808    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6809        use std::borrow::Cow;
6810        use std::io::{Read, Seek};
6811
6812        use common::{url::Params, ToParts};
6813        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6814
6815        let mut dd = common::DefaultDelegate;
6816        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6817        dlg.begin(common::MethodInfo {
6818            id: "datafusion.projects.locations.instances.upgrade",
6819            http_method: hyper::Method::POST,
6820        });
6821
6822        for &field in ["alt", "name"].iter() {
6823            if self._additional_params.contains_key(field) {
6824                dlg.finished(false);
6825                return Err(common::Error::FieldClash(field));
6826            }
6827        }
6828
6829        let mut params = Params::with_capacity(4 + self._additional_params.len());
6830        params.push("name", self._name);
6831
6832        params.extend(self._additional_params.iter());
6833
6834        params.push("alt", "json");
6835        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:upgrade";
6836        if self._scopes.is_empty() {
6837            self._scopes
6838                .insert(Scope::CloudPlatform.as_ref().to_string());
6839        }
6840
6841        #[allow(clippy::single_element_loop)]
6842        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6843            url = params.uri_replacement(url, param_name, find_this, true);
6844        }
6845        {
6846            let to_remove = ["name"];
6847            params.remove_params(&to_remove);
6848        }
6849
6850        let url = params.parse_with_url(&url);
6851
6852        let mut json_mime_type = mime::APPLICATION_JSON;
6853        let mut request_value_reader = {
6854            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6855            common::remove_json_null_values(&mut value);
6856            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6857            serde_json::to_writer(&mut dst, &value).unwrap();
6858            dst
6859        };
6860        let request_size = request_value_reader
6861            .seek(std::io::SeekFrom::End(0))
6862            .unwrap();
6863        request_value_reader
6864            .seek(std::io::SeekFrom::Start(0))
6865            .unwrap();
6866
6867        loop {
6868            let token = match self
6869                .hub
6870                .auth
6871                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6872                .await
6873            {
6874                Ok(token) => token,
6875                Err(e) => match dlg.token(e) {
6876                    Ok(token) => token,
6877                    Err(e) => {
6878                        dlg.finished(false);
6879                        return Err(common::Error::MissingToken(e));
6880                    }
6881                },
6882            };
6883            request_value_reader
6884                .seek(std::io::SeekFrom::Start(0))
6885                .unwrap();
6886            let mut req_result = {
6887                let client = &self.hub.client;
6888                dlg.pre_request();
6889                let mut req_builder = hyper::Request::builder()
6890                    .method(hyper::Method::POST)
6891                    .uri(url.as_str())
6892                    .header(USER_AGENT, self.hub._user_agent.clone());
6893
6894                if let Some(token) = token.as_ref() {
6895                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6896                }
6897
6898                let request = req_builder
6899                    .header(CONTENT_TYPE, json_mime_type.to_string())
6900                    .header(CONTENT_LENGTH, request_size as u64)
6901                    .body(common::to_body(
6902                        request_value_reader.get_ref().clone().into(),
6903                    ));
6904
6905                client.request(request.unwrap()).await
6906            };
6907
6908            match req_result {
6909                Err(err) => {
6910                    if let common::Retry::After(d) = dlg.http_error(&err) {
6911                        sleep(d).await;
6912                        continue;
6913                    }
6914                    dlg.finished(false);
6915                    return Err(common::Error::HttpError(err));
6916                }
6917                Ok(res) => {
6918                    let (mut parts, body) = res.into_parts();
6919                    let mut body = common::Body::new(body);
6920                    if !parts.status.is_success() {
6921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6922                        let error = serde_json::from_str(&common::to_string(&bytes));
6923                        let response = common::to_response(parts, bytes.into());
6924
6925                        if let common::Retry::After(d) =
6926                            dlg.http_failure(&response, error.as_ref().ok())
6927                        {
6928                            sleep(d).await;
6929                            continue;
6930                        }
6931
6932                        dlg.finished(false);
6933
6934                        return Err(match error {
6935                            Ok(value) => common::Error::BadRequest(value),
6936                            _ => common::Error::Failure(response),
6937                        });
6938                    }
6939                    let response = {
6940                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6941                        let encoded = common::to_string(&bytes);
6942                        match serde_json::from_str(&encoded) {
6943                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6944                            Err(error) => {
6945                                dlg.response_json_decode_error(&encoded, &error);
6946                                return Err(common::Error::JsonDecodeError(
6947                                    encoded.to_string(),
6948                                    error,
6949                                ));
6950                            }
6951                        }
6952                    };
6953
6954                    dlg.finished(true);
6955                    return Ok(response);
6956                }
6957            }
6958        }
6959    }
6960
6961    ///
6962    /// Sets the *request* property to the given value.
6963    ///
6964    /// Even though the property as already been set when instantiating this call,
6965    /// we provide this method for API completeness.
6966    pub fn request(
6967        mut self,
6968        new_value: UpgradeInstanceRequest,
6969    ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
6970        self._request = new_value;
6971        self
6972    }
6973    /// Required. Name of the Data Fusion instance which need to be upgraded in the form of projects/{project}/locations/{location}/instances/{instance} Instance will be upgraded with the latest stable version of the Data Fusion.
6974    ///
6975    /// Sets the *name* path property to the given value.
6976    ///
6977    /// Even though the property as already been set when instantiating this call,
6978    /// we provide this method for API completeness.
6979    pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceUpgradeCall<'a, C> {
6980        self._name = new_value.to_string();
6981        self
6982    }
6983    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6984    /// while executing the actual API request.
6985    ///
6986    /// ````text
6987    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6988    /// ````
6989    ///
6990    /// Sets the *delegate* property to the given value.
6991    pub fn delegate(
6992        mut self,
6993        new_value: &'a mut dyn common::Delegate,
6994    ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
6995        self._delegate = Some(new_value);
6996        self
6997    }
6998
6999    /// Set any additional parameter of the query string used in the request.
7000    /// It should be used to set parameters which are not yet available through their own
7001    /// setters.
7002    ///
7003    /// Please note that this method must not be used to set any of the known parameters
7004    /// which have their own setter method. If done anyway, the request will fail.
7005    ///
7006    /// # Additional Parameters
7007    ///
7008    /// * *$.xgafv* (query-string) - V1 error format.
7009    /// * *access_token* (query-string) - OAuth access token.
7010    /// * *alt* (query-string) - Data format for response.
7011    /// * *callback* (query-string) - JSONP
7012    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7013    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7014    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7015    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7016    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7017    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7018    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7019    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceUpgradeCall<'a, C>
7020    where
7021        T: AsRef<str>,
7022    {
7023        self._additional_params
7024            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7025        self
7026    }
7027
7028    /// Identifies the authorization scope for the method you are building.
7029    ///
7030    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7031    /// [`Scope::CloudPlatform`].
7032    ///
7033    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7034    /// tokens for more than one scope.
7035    ///
7036    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7037    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7038    /// sufficient, a read-write scope will do as well.
7039    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceUpgradeCall<'a, C>
7040    where
7041        St: AsRef<str>,
7042    {
7043        self._scopes.insert(String::from(scope.as_ref()));
7044        self
7045    }
7046    /// Identifies the authorization scope(s) for the method you are building.
7047    ///
7048    /// See [`Self::add_scope()`] for details.
7049    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceUpgradeCall<'a, C>
7050    where
7051        I: IntoIterator<Item = St>,
7052        St: AsRef<str>,
7053    {
7054        self._scopes
7055            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7056        self
7057    }
7058
7059    /// Removes all scopes, and no default scope will be used either.
7060    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7061    /// for details).
7062    pub fn clear_scopes(mut self) -> ProjectLocationInstanceUpgradeCall<'a, C> {
7063        self._scopes.clear();
7064        self
7065    }
7066}
7067
7068/// 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`.
7069///
7070/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
7071/// It is not used directly, but through a [`ProjectMethods`] instance.
7072///
7073/// # Example
7074///
7075/// Instantiate a resource method builder
7076///
7077/// ```test_harness,no_run
7078/// # extern crate hyper;
7079/// # extern crate hyper_rustls;
7080/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7081/// use datafusion1_beta1::api::CancelOperationRequest;
7082/// # async fn dox() {
7083/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7084///
7085/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7086/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7087/// #     secret,
7088/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7089/// # ).build().await.unwrap();
7090///
7091/// # let client = hyper_util::client::legacy::Client::builder(
7092/// #     hyper_util::rt::TokioExecutor::new()
7093/// # )
7094/// # .build(
7095/// #     hyper_rustls::HttpsConnectorBuilder::new()
7096/// #         .with_native_roots()
7097/// #         .unwrap()
7098/// #         .https_or_http()
7099/// #         .enable_http1()
7100/// #         .build()
7101/// # );
7102/// # let mut hub = DataFusion::new(client, auth);
7103/// // As the method needs a request, you would usually fill it with the desired information
7104/// // into the respective structure. Some of the parts shown here might not be applicable !
7105/// // Values shown here are possibly random and not representative !
7106/// let mut req = CancelOperationRequest::default();
7107///
7108/// // You can configure optional parameters by calling the respective setters at will, and
7109/// // execute the final call using `doit()`.
7110/// // Values shown here are possibly random and not representative !
7111/// let result = hub.projects().locations_operations_cancel(req, "name")
7112///              .doit().await;
7113/// # }
7114/// ```
7115pub struct ProjectLocationOperationCancelCall<'a, C>
7116where
7117    C: 'a,
7118{
7119    hub: &'a DataFusion<C>,
7120    _request: CancelOperationRequest,
7121    _name: String,
7122    _delegate: Option<&'a mut dyn common::Delegate>,
7123    _additional_params: HashMap<String, String>,
7124    _scopes: BTreeSet<String>,
7125}
7126
7127impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
7128
7129impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
7130where
7131    C: common::Connector,
7132{
7133    /// Perform the operation you have build so far.
7134    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7135        use std::borrow::Cow;
7136        use std::io::{Read, Seek};
7137
7138        use common::{url::Params, ToParts};
7139        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7140
7141        let mut dd = common::DefaultDelegate;
7142        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7143        dlg.begin(common::MethodInfo {
7144            id: "datafusion.projects.locations.operations.cancel",
7145            http_method: hyper::Method::POST,
7146        });
7147
7148        for &field in ["alt", "name"].iter() {
7149            if self._additional_params.contains_key(field) {
7150                dlg.finished(false);
7151                return Err(common::Error::FieldClash(field));
7152            }
7153        }
7154
7155        let mut params = Params::with_capacity(4 + self._additional_params.len());
7156        params.push("name", self._name);
7157
7158        params.extend(self._additional_params.iter());
7159
7160        params.push("alt", "json");
7161        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:cancel";
7162        if self._scopes.is_empty() {
7163            self._scopes
7164                .insert(Scope::CloudPlatform.as_ref().to_string());
7165        }
7166
7167        #[allow(clippy::single_element_loop)]
7168        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7169            url = params.uri_replacement(url, param_name, find_this, true);
7170        }
7171        {
7172            let to_remove = ["name"];
7173            params.remove_params(&to_remove);
7174        }
7175
7176        let url = params.parse_with_url(&url);
7177
7178        let mut json_mime_type = mime::APPLICATION_JSON;
7179        let mut request_value_reader = {
7180            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7181            common::remove_json_null_values(&mut value);
7182            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7183            serde_json::to_writer(&mut dst, &value).unwrap();
7184            dst
7185        };
7186        let request_size = request_value_reader
7187            .seek(std::io::SeekFrom::End(0))
7188            .unwrap();
7189        request_value_reader
7190            .seek(std::io::SeekFrom::Start(0))
7191            .unwrap();
7192
7193        loop {
7194            let token = match self
7195                .hub
7196                .auth
7197                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7198                .await
7199            {
7200                Ok(token) => token,
7201                Err(e) => match dlg.token(e) {
7202                    Ok(token) => token,
7203                    Err(e) => {
7204                        dlg.finished(false);
7205                        return Err(common::Error::MissingToken(e));
7206                    }
7207                },
7208            };
7209            request_value_reader
7210                .seek(std::io::SeekFrom::Start(0))
7211                .unwrap();
7212            let mut req_result = {
7213                let client = &self.hub.client;
7214                dlg.pre_request();
7215                let mut req_builder = hyper::Request::builder()
7216                    .method(hyper::Method::POST)
7217                    .uri(url.as_str())
7218                    .header(USER_AGENT, self.hub._user_agent.clone());
7219
7220                if let Some(token) = token.as_ref() {
7221                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7222                }
7223
7224                let request = req_builder
7225                    .header(CONTENT_TYPE, json_mime_type.to_string())
7226                    .header(CONTENT_LENGTH, request_size as u64)
7227                    .body(common::to_body(
7228                        request_value_reader.get_ref().clone().into(),
7229                    ));
7230
7231                client.request(request.unwrap()).await
7232            };
7233
7234            match req_result {
7235                Err(err) => {
7236                    if let common::Retry::After(d) = dlg.http_error(&err) {
7237                        sleep(d).await;
7238                        continue;
7239                    }
7240                    dlg.finished(false);
7241                    return Err(common::Error::HttpError(err));
7242                }
7243                Ok(res) => {
7244                    let (mut parts, body) = res.into_parts();
7245                    let mut body = common::Body::new(body);
7246                    if !parts.status.is_success() {
7247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7248                        let error = serde_json::from_str(&common::to_string(&bytes));
7249                        let response = common::to_response(parts, bytes.into());
7250
7251                        if let common::Retry::After(d) =
7252                            dlg.http_failure(&response, error.as_ref().ok())
7253                        {
7254                            sleep(d).await;
7255                            continue;
7256                        }
7257
7258                        dlg.finished(false);
7259
7260                        return Err(match error {
7261                            Ok(value) => common::Error::BadRequest(value),
7262                            _ => common::Error::Failure(response),
7263                        });
7264                    }
7265                    let response = {
7266                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7267                        let encoded = common::to_string(&bytes);
7268                        match serde_json::from_str(&encoded) {
7269                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7270                            Err(error) => {
7271                                dlg.response_json_decode_error(&encoded, &error);
7272                                return Err(common::Error::JsonDecodeError(
7273                                    encoded.to_string(),
7274                                    error,
7275                                ));
7276                            }
7277                        }
7278                    };
7279
7280                    dlg.finished(true);
7281                    return Ok(response);
7282                }
7283            }
7284        }
7285    }
7286
7287    ///
7288    /// Sets the *request* property to the given value.
7289    ///
7290    /// Even though the property as already been set when instantiating this call,
7291    /// we provide this method for API completeness.
7292    pub fn request(
7293        mut self,
7294        new_value: CancelOperationRequest,
7295    ) -> ProjectLocationOperationCancelCall<'a, C> {
7296        self._request = new_value;
7297        self
7298    }
7299    /// The name of the operation resource to be cancelled.
7300    ///
7301    /// Sets the *name* path property to the given value.
7302    ///
7303    /// Even though the property as already been set when instantiating this call,
7304    /// we provide this method for API completeness.
7305    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
7306        self._name = new_value.to_string();
7307        self
7308    }
7309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7310    /// while executing the actual API request.
7311    ///
7312    /// ````text
7313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7314    /// ````
7315    ///
7316    /// Sets the *delegate* property to the given value.
7317    pub fn delegate(
7318        mut self,
7319        new_value: &'a mut dyn common::Delegate,
7320    ) -> ProjectLocationOperationCancelCall<'a, C> {
7321        self._delegate = Some(new_value);
7322        self
7323    }
7324
7325    /// Set any additional parameter of the query string used in the request.
7326    /// It should be used to set parameters which are not yet available through their own
7327    /// setters.
7328    ///
7329    /// Please note that this method must not be used to set any of the known parameters
7330    /// which have their own setter method. If done anyway, the request will fail.
7331    ///
7332    /// # Additional Parameters
7333    ///
7334    /// * *$.xgafv* (query-string) - V1 error format.
7335    /// * *access_token* (query-string) - OAuth access token.
7336    /// * *alt* (query-string) - Data format for response.
7337    /// * *callback* (query-string) - JSONP
7338    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7339    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7340    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7341    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7342    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7343    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7344    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7345    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
7346    where
7347        T: AsRef<str>,
7348    {
7349        self._additional_params
7350            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7351        self
7352    }
7353
7354    /// Identifies the authorization scope for the method you are building.
7355    ///
7356    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7357    /// [`Scope::CloudPlatform`].
7358    ///
7359    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7360    /// tokens for more than one scope.
7361    ///
7362    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7363    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7364    /// sufficient, a read-write scope will do as well.
7365    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
7366    where
7367        St: AsRef<str>,
7368    {
7369        self._scopes.insert(String::from(scope.as_ref()));
7370        self
7371    }
7372    /// Identifies the authorization scope(s) for the method you are building.
7373    ///
7374    /// See [`Self::add_scope()`] for details.
7375    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
7376    where
7377        I: IntoIterator<Item = St>,
7378        St: AsRef<str>,
7379    {
7380        self._scopes
7381            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7382        self
7383    }
7384
7385    /// Removes all scopes, and no default scope will be used either.
7386    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7387    /// for details).
7388    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
7389        self._scopes.clear();
7390        self
7391    }
7392}
7393
7394/// 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`.
7395///
7396/// A builder for the *locations.operations.delete* method supported by a *project* resource.
7397/// It is not used directly, but through a [`ProjectMethods`] instance.
7398///
7399/// # Example
7400///
7401/// Instantiate a resource method builder
7402///
7403/// ```test_harness,no_run
7404/// # extern crate hyper;
7405/// # extern crate hyper_rustls;
7406/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7407/// # async fn dox() {
7408/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7409///
7410/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7412/// #     secret,
7413/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7414/// # ).build().await.unwrap();
7415///
7416/// # let client = hyper_util::client::legacy::Client::builder(
7417/// #     hyper_util::rt::TokioExecutor::new()
7418/// # )
7419/// # .build(
7420/// #     hyper_rustls::HttpsConnectorBuilder::new()
7421/// #         .with_native_roots()
7422/// #         .unwrap()
7423/// #         .https_or_http()
7424/// #         .enable_http1()
7425/// #         .build()
7426/// # );
7427/// # let mut hub = DataFusion::new(client, auth);
7428/// // You can configure optional parameters by calling the respective setters at will, and
7429/// // execute the final call using `doit()`.
7430/// // Values shown here are possibly random and not representative !
7431/// let result = hub.projects().locations_operations_delete("name")
7432///              .doit().await;
7433/// # }
7434/// ```
7435pub struct ProjectLocationOperationDeleteCall<'a, C>
7436where
7437    C: 'a,
7438{
7439    hub: &'a DataFusion<C>,
7440    _name: String,
7441    _delegate: Option<&'a mut dyn common::Delegate>,
7442    _additional_params: HashMap<String, String>,
7443    _scopes: BTreeSet<String>,
7444}
7445
7446impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
7447
7448impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
7449where
7450    C: common::Connector,
7451{
7452    /// Perform the operation you have build so far.
7453    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7454        use std::borrow::Cow;
7455        use std::io::{Read, Seek};
7456
7457        use common::{url::Params, ToParts};
7458        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7459
7460        let mut dd = common::DefaultDelegate;
7461        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7462        dlg.begin(common::MethodInfo {
7463            id: "datafusion.projects.locations.operations.delete",
7464            http_method: hyper::Method::DELETE,
7465        });
7466
7467        for &field in ["alt", "name"].iter() {
7468            if self._additional_params.contains_key(field) {
7469                dlg.finished(false);
7470                return Err(common::Error::FieldClash(field));
7471            }
7472        }
7473
7474        let mut params = Params::with_capacity(3 + self._additional_params.len());
7475        params.push("name", self._name);
7476
7477        params.extend(self._additional_params.iter());
7478
7479        params.push("alt", "json");
7480        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7481        if self._scopes.is_empty() {
7482            self._scopes
7483                .insert(Scope::CloudPlatform.as_ref().to_string());
7484        }
7485
7486        #[allow(clippy::single_element_loop)]
7487        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7488            url = params.uri_replacement(url, param_name, find_this, true);
7489        }
7490        {
7491            let to_remove = ["name"];
7492            params.remove_params(&to_remove);
7493        }
7494
7495        let url = params.parse_with_url(&url);
7496
7497        loop {
7498            let token = match self
7499                .hub
7500                .auth
7501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7502                .await
7503            {
7504                Ok(token) => token,
7505                Err(e) => match dlg.token(e) {
7506                    Ok(token) => token,
7507                    Err(e) => {
7508                        dlg.finished(false);
7509                        return Err(common::Error::MissingToken(e));
7510                    }
7511                },
7512            };
7513            let mut req_result = {
7514                let client = &self.hub.client;
7515                dlg.pre_request();
7516                let mut req_builder = hyper::Request::builder()
7517                    .method(hyper::Method::DELETE)
7518                    .uri(url.as_str())
7519                    .header(USER_AGENT, self.hub._user_agent.clone());
7520
7521                if let Some(token) = token.as_ref() {
7522                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7523                }
7524
7525                let request = req_builder
7526                    .header(CONTENT_LENGTH, 0_u64)
7527                    .body(common::to_body::<String>(None));
7528
7529                client.request(request.unwrap()).await
7530            };
7531
7532            match req_result {
7533                Err(err) => {
7534                    if let common::Retry::After(d) = dlg.http_error(&err) {
7535                        sleep(d).await;
7536                        continue;
7537                    }
7538                    dlg.finished(false);
7539                    return Err(common::Error::HttpError(err));
7540                }
7541                Ok(res) => {
7542                    let (mut parts, body) = res.into_parts();
7543                    let mut body = common::Body::new(body);
7544                    if !parts.status.is_success() {
7545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7546                        let error = serde_json::from_str(&common::to_string(&bytes));
7547                        let response = common::to_response(parts, bytes.into());
7548
7549                        if let common::Retry::After(d) =
7550                            dlg.http_failure(&response, error.as_ref().ok())
7551                        {
7552                            sleep(d).await;
7553                            continue;
7554                        }
7555
7556                        dlg.finished(false);
7557
7558                        return Err(match error {
7559                            Ok(value) => common::Error::BadRequest(value),
7560                            _ => common::Error::Failure(response),
7561                        });
7562                    }
7563                    let response = {
7564                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7565                        let encoded = common::to_string(&bytes);
7566                        match serde_json::from_str(&encoded) {
7567                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7568                            Err(error) => {
7569                                dlg.response_json_decode_error(&encoded, &error);
7570                                return Err(common::Error::JsonDecodeError(
7571                                    encoded.to_string(),
7572                                    error,
7573                                ));
7574                            }
7575                        }
7576                    };
7577
7578                    dlg.finished(true);
7579                    return Ok(response);
7580                }
7581            }
7582        }
7583    }
7584
7585    /// The name of the operation resource to be deleted.
7586    ///
7587    /// Sets the *name* path property to the given value.
7588    ///
7589    /// Even though the property as already been set when instantiating this call,
7590    /// we provide this method for API completeness.
7591    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
7592        self._name = new_value.to_string();
7593        self
7594    }
7595    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7596    /// while executing the actual API request.
7597    ///
7598    /// ````text
7599    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7600    /// ````
7601    ///
7602    /// Sets the *delegate* property to the given value.
7603    pub fn delegate(
7604        mut self,
7605        new_value: &'a mut dyn common::Delegate,
7606    ) -> ProjectLocationOperationDeleteCall<'a, C> {
7607        self._delegate = Some(new_value);
7608        self
7609    }
7610
7611    /// Set any additional parameter of the query string used in the request.
7612    /// It should be used to set parameters which are not yet available through their own
7613    /// setters.
7614    ///
7615    /// Please note that this method must not be used to set any of the known parameters
7616    /// which have their own setter method. If done anyway, the request will fail.
7617    ///
7618    /// # Additional Parameters
7619    ///
7620    /// * *$.xgafv* (query-string) - V1 error format.
7621    /// * *access_token* (query-string) - OAuth access token.
7622    /// * *alt* (query-string) - Data format for response.
7623    /// * *callback* (query-string) - JSONP
7624    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7625    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7626    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7627    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7628    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7629    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7630    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7631    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
7632    where
7633        T: AsRef<str>,
7634    {
7635        self._additional_params
7636            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7637        self
7638    }
7639
7640    /// Identifies the authorization scope for the method you are building.
7641    ///
7642    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7643    /// [`Scope::CloudPlatform`].
7644    ///
7645    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7646    /// tokens for more than one scope.
7647    ///
7648    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7649    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7650    /// sufficient, a read-write scope will do as well.
7651    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
7652    where
7653        St: AsRef<str>,
7654    {
7655        self._scopes.insert(String::from(scope.as_ref()));
7656        self
7657    }
7658    /// Identifies the authorization scope(s) for the method you are building.
7659    ///
7660    /// See [`Self::add_scope()`] for details.
7661    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
7662    where
7663        I: IntoIterator<Item = St>,
7664        St: AsRef<str>,
7665    {
7666        self._scopes
7667            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7668        self
7669    }
7670
7671    /// Removes all scopes, and no default scope will be used either.
7672    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7673    /// for details).
7674    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
7675        self._scopes.clear();
7676        self
7677    }
7678}
7679
7680/// 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.
7681///
7682/// A builder for the *locations.operations.get* method supported by a *project* resource.
7683/// It is not used directly, but through a [`ProjectMethods`] instance.
7684///
7685/// # Example
7686///
7687/// Instantiate a resource method builder
7688///
7689/// ```test_harness,no_run
7690/// # extern crate hyper;
7691/// # extern crate hyper_rustls;
7692/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7693/// # async fn dox() {
7694/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7695///
7696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7697/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7698/// #     secret,
7699/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7700/// # ).build().await.unwrap();
7701///
7702/// # let client = hyper_util::client::legacy::Client::builder(
7703/// #     hyper_util::rt::TokioExecutor::new()
7704/// # )
7705/// # .build(
7706/// #     hyper_rustls::HttpsConnectorBuilder::new()
7707/// #         .with_native_roots()
7708/// #         .unwrap()
7709/// #         .https_or_http()
7710/// #         .enable_http1()
7711/// #         .build()
7712/// # );
7713/// # let mut hub = DataFusion::new(client, auth);
7714/// // You can configure optional parameters by calling the respective setters at will, and
7715/// // execute the final call using `doit()`.
7716/// // Values shown here are possibly random and not representative !
7717/// let result = hub.projects().locations_operations_get("name")
7718///              .doit().await;
7719/// # }
7720/// ```
7721pub struct ProjectLocationOperationGetCall<'a, C>
7722where
7723    C: 'a,
7724{
7725    hub: &'a DataFusion<C>,
7726    _name: String,
7727    _delegate: Option<&'a mut dyn common::Delegate>,
7728    _additional_params: HashMap<String, String>,
7729    _scopes: BTreeSet<String>,
7730}
7731
7732impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
7733
7734impl<'a, C> ProjectLocationOperationGetCall<'a, C>
7735where
7736    C: common::Connector,
7737{
7738    /// Perform the operation you have build so far.
7739    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7740        use std::borrow::Cow;
7741        use std::io::{Read, Seek};
7742
7743        use common::{url::Params, ToParts};
7744        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7745
7746        let mut dd = common::DefaultDelegate;
7747        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7748        dlg.begin(common::MethodInfo {
7749            id: "datafusion.projects.locations.operations.get",
7750            http_method: hyper::Method::GET,
7751        });
7752
7753        for &field in ["alt", "name"].iter() {
7754            if self._additional_params.contains_key(field) {
7755                dlg.finished(false);
7756                return Err(common::Error::FieldClash(field));
7757            }
7758        }
7759
7760        let mut params = Params::with_capacity(3 + self._additional_params.len());
7761        params.push("name", self._name);
7762
7763        params.extend(self._additional_params.iter());
7764
7765        params.push("alt", "json");
7766        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7767        if self._scopes.is_empty() {
7768            self._scopes
7769                .insert(Scope::CloudPlatform.as_ref().to_string());
7770        }
7771
7772        #[allow(clippy::single_element_loop)]
7773        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7774            url = params.uri_replacement(url, param_name, find_this, true);
7775        }
7776        {
7777            let to_remove = ["name"];
7778            params.remove_params(&to_remove);
7779        }
7780
7781        let url = params.parse_with_url(&url);
7782
7783        loop {
7784            let token = match self
7785                .hub
7786                .auth
7787                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7788                .await
7789            {
7790                Ok(token) => token,
7791                Err(e) => match dlg.token(e) {
7792                    Ok(token) => token,
7793                    Err(e) => {
7794                        dlg.finished(false);
7795                        return Err(common::Error::MissingToken(e));
7796                    }
7797                },
7798            };
7799            let mut req_result = {
7800                let client = &self.hub.client;
7801                dlg.pre_request();
7802                let mut req_builder = hyper::Request::builder()
7803                    .method(hyper::Method::GET)
7804                    .uri(url.as_str())
7805                    .header(USER_AGENT, self.hub._user_agent.clone());
7806
7807                if let Some(token) = token.as_ref() {
7808                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7809                }
7810
7811                let request = req_builder
7812                    .header(CONTENT_LENGTH, 0_u64)
7813                    .body(common::to_body::<String>(None));
7814
7815                client.request(request.unwrap()).await
7816            };
7817
7818            match req_result {
7819                Err(err) => {
7820                    if let common::Retry::After(d) = dlg.http_error(&err) {
7821                        sleep(d).await;
7822                        continue;
7823                    }
7824                    dlg.finished(false);
7825                    return Err(common::Error::HttpError(err));
7826                }
7827                Ok(res) => {
7828                    let (mut parts, body) = res.into_parts();
7829                    let mut body = common::Body::new(body);
7830                    if !parts.status.is_success() {
7831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7832                        let error = serde_json::from_str(&common::to_string(&bytes));
7833                        let response = common::to_response(parts, bytes.into());
7834
7835                        if let common::Retry::After(d) =
7836                            dlg.http_failure(&response, error.as_ref().ok())
7837                        {
7838                            sleep(d).await;
7839                            continue;
7840                        }
7841
7842                        dlg.finished(false);
7843
7844                        return Err(match error {
7845                            Ok(value) => common::Error::BadRequest(value),
7846                            _ => common::Error::Failure(response),
7847                        });
7848                    }
7849                    let response = {
7850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7851                        let encoded = common::to_string(&bytes);
7852                        match serde_json::from_str(&encoded) {
7853                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7854                            Err(error) => {
7855                                dlg.response_json_decode_error(&encoded, &error);
7856                                return Err(common::Error::JsonDecodeError(
7857                                    encoded.to_string(),
7858                                    error,
7859                                ));
7860                            }
7861                        }
7862                    };
7863
7864                    dlg.finished(true);
7865                    return Ok(response);
7866                }
7867            }
7868        }
7869    }
7870
7871    /// The name of the operation resource.
7872    ///
7873    /// Sets the *name* path property to the given value.
7874    ///
7875    /// Even though the property as already been set when instantiating this call,
7876    /// we provide this method for API completeness.
7877    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
7878        self._name = new_value.to_string();
7879        self
7880    }
7881    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7882    /// while executing the actual API request.
7883    ///
7884    /// ````text
7885    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7886    /// ````
7887    ///
7888    /// Sets the *delegate* property to the given value.
7889    pub fn delegate(
7890        mut self,
7891        new_value: &'a mut dyn common::Delegate,
7892    ) -> ProjectLocationOperationGetCall<'a, C> {
7893        self._delegate = Some(new_value);
7894        self
7895    }
7896
7897    /// Set any additional parameter of the query string used in the request.
7898    /// It should be used to set parameters which are not yet available through their own
7899    /// setters.
7900    ///
7901    /// Please note that this method must not be used to set any of the known parameters
7902    /// which have their own setter method. If done anyway, the request will fail.
7903    ///
7904    /// # Additional Parameters
7905    ///
7906    /// * *$.xgafv* (query-string) - V1 error format.
7907    /// * *access_token* (query-string) - OAuth access token.
7908    /// * *alt* (query-string) - Data format for response.
7909    /// * *callback* (query-string) - JSONP
7910    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7911    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7912    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7913    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7914    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7915    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7916    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7917    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
7918    where
7919        T: AsRef<str>,
7920    {
7921        self._additional_params
7922            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7923        self
7924    }
7925
7926    /// Identifies the authorization scope for the method you are building.
7927    ///
7928    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7929    /// [`Scope::CloudPlatform`].
7930    ///
7931    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7932    /// tokens for more than one scope.
7933    ///
7934    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7935    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7936    /// sufficient, a read-write scope will do as well.
7937    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
7938    where
7939        St: AsRef<str>,
7940    {
7941        self._scopes.insert(String::from(scope.as_ref()));
7942        self
7943    }
7944    /// Identifies the authorization scope(s) for the method you are building.
7945    ///
7946    /// See [`Self::add_scope()`] for details.
7947    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
7948    where
7949        I: IntoIterator<Item = St>,
7950        St: AsRef<str>,
7951    {
7952        self._scopes
7953            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7954        self
7955    }
7956
7957    /// Removes all scopes, and no default scope will be used either.
7958    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7959    /// for details).
7960    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
7961        self._scopes.clear();
7962        self
7963    }
7964}
7965
7966/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
7967///
7968/// A builder for the *locations.operations.list* method supported by a *project* resource.
7969/// It is not used directly, but through a [`ProjectMethods`] instance.
7970///
7971/// # Example
7972///
7973/// Instantiate a resource method builder
7974///
7975/// ```test_harness,no_run
7976/// # extern crate hyper;
7977/// # extern crate hyper_rustls;
7978/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7979/// # async fn dox() {
7980/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7981///
7982/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7983/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7984/// #     secret,
7985/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7986/// # ).build().await.unwrap();
7987///
7988/// # let client = hyper_util::client::legacy::Client::builder(
7989/// #     hyper_util::rt::TokioExecutor::new()
7990/// # )
7991/// # .build(
7992/// #     hyper_rustls::HttpsConnectorBuilder::new()
7993/// #         .with_native_roots()
7994/// #         .unwrap()
7995/// #         .https_or_http()
7996/// #         .enable_http1()
7997/// #         .build()
7998/// # );
7999/// # let mut hub = DataFusion::new(client, auth);
8000/// // You can configure optional parameters by calling the respective setters at will, and
8001/// // execute the final call using `doit()`.
8002/// // Values shown here are possibly random and not representative !
8003/// let result = hub.projects().locations_operations_list("name")
8004///              .page_token("sed")
8005///              .page_size(-61)
8006///              .filter("Stet")
8007///              .doit().await;
8008/// # }
8009/// ```
8010pub struct ProjectLocationOperationListCall<'a, C>
8011where
8012    C: 'a,
8013{
8014    hub: &'a DataFusion<C>,
8015    _name: String,
8016    _page_token: Option<String>,
8017    _page_size: Option<i32>,
8018    _filter: Option<String>,
8019    _delegate: Option<&'a mut dyn common::Delegate>,
8020    _additional_params: HashMap<String, String>,
8021    _scopes: BTreeSet<String>,
8022}
8023
8024impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
8025
8026impl<'a, C> ProjectLocationOperationListCall<'a, C>
8027where
8028    C: common::Connector,
8029{
8030    /// Perform the operation you have build so far.
8031    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
8032        use std::borrow::Cow;
8033        use std::io::{Read, Seek};
8034
8035        use common::{url::Params, ToParts};
8036        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8037
8038        let mut dd = common::DefaultDelegate;
8039        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8040        dlg.begin(common::MethodInfo {
8041            id: "datafusion.projects.locations.operations.list",
8042            http_method: hyper::Method::GET,
8043        });
8044
8045        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
8046            if self._additional_params.contains_key(field) {
8047                dlg.finished(false);
8048                return Err(common::Error::FieldClash(field));
8049            }
8050        }
8051
8052        let mut params = Params::with_capacity(6 + self._additional_params.len());
8053        params.push("name", self._name);
8054        if let Some(value) = self._page_token.as_ref() {
8055            params.push("pageToken", value);
8056        }
8057        if let Some(value) = self._page_size.as_ref() {
8058            params.push("pageSize", value.to_string());
8059        }
8060        if let Some(value) = self._filter.as_ref() {
8061            params.push("filter", value);
8062        }
8063
8064        params.extend(self._additional_params.iter());
8065
8066        params.push("alt", "json");
8067        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
8068        if self._scopes.is_empty() {
8069            self._scopes
8070                .insert(Scope::CloudPlatform.as_ref().to_string());
8071        }
8072
8073        #[allow(clippy::single_element_loop)]
8074        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8075            url = params.uri_replacement(url, param_name, find_this, true);
8076        }
8077        {
8078            let to_remove = ["name"];
8079            params.remove_params(&to_remove);
8080        }
8081
8082        let url = params.parse_with_url(&url);
8083
8084        loop {
8085            let token = match self
8086                .hub
8087                .auth
8088                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8089                .await
8090            {
8091                Ok(token) => token,
8092                Err(e) => match dlg.token(e) {
8093                    Ok(token) => token,
8094                    Err(e) => {
8095                        dlg.finished(false);
8096                        return Err(common::Error::MissingToken(e));
8097                    }
8098                },
8099            };
8100            let mut req_result = {
8101                let client = &self.hub.client;
8102                dlg.pre_request();
8103                let mut req_builder = hyper::Request::builder()
8104                    .method(hyper::Method::GET)
8105                    .uri(url.as_str())
8106                    .header(USER_AGENT, self.hub._user_agent.clone());
8107
8108                if let Some(token) = token.as_ref() {
8109                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8110                }
8111
8112                let request = req_builder
8113                    .header(CONTENT_LENGTH, 0_u64)
8114                    .body(common::to_body::<String>(None));
8115
8116                client.request(request.unwrap()).await
8117            };
8118
8119            match req_result {
8120                Err(err) => {
8121                    if let common::Retry::After(d) = dlg.http_error(&err) {
8122                        sleep(d).await;
8123                        continue;
8124                    }
8125                    dlg.finished(false);
8126                    return Err(common::Error::HttpError(err));
8127                }
8128                Ok(res) => {
8129                    let (mut parts, body) = res.into_parts();
8130                    let mut body = common::Body::new(body);
8131                    if !parts.status.is_success() {
8132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8133                        let error = serde_json::from_str(&common::to_string(&bytes));
8134                        let response = common::to_response(parts, bytes.into());
8135
8136                        if let common::Retry::After(d) =
8137                            dlg.http_failure(&response, error.as_ref().ok())
8138                        {
8139                            sleep(d).await;
8140                            continue;
8141                        }
8142
8143                        dlg.finished(false);
8144
8145                        return Err(match error {
8146                            Ok(value) => common::Error::BadRequest(value),
8147                            _ => common::Error::Failure(response),
8148                        });
8149                    }
8150                    let response = {
8151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8152                        let encoded = common::to_string(&bytes);
8153                        match serde_json::from_str(&encoded) {
8154                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8155                            Err(error) => {
8156                                dlg.response_json_decode_error(&encoded, &error);
8157                                return Err(common::Error::JsonDecodeError(
8158                                    encoded.to_string(),
8159                                    error,
8160                                ));
8161                            }
8162                        }
8163                    };
8164
8165                    dlg.finished(true);
8166                    return Ok(response);
8167                }
8168            }
8169        }
8170    }
8171
8172    /// The name of the operation's parent resource.
8173    ///
8174    /// Sets the *name* path property to the given value.
8175    ///
8176    /// Even though the property as already been set when instantiating this call,
8177    /// we provide this method for API completeness.
8178    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8179        self._name = new_value.to_string();
8180        self
8181    }
8182    /// The standard list page token.
8183    ///
8184    /// Sets the *page token* query property to the given value.
8185    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8186        self._page_token = Some(new_value.to_string());
8187        self
8188    }
8189    /// The standard list page size.
8190    ///
8191    /// Sets the *page size* query property to the given value.
8192    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
8193        self._page_size = Some(new_value);
8194        self
8195    }
8196    /// The standard list filter.
8197    ///
8198    /// Sets the *filter* query property to the given value.
8199    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8200        self._filter = Some(new_value.to_string());
8201        self
8202    }
8203    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8204    /// while executing the actual API request.
8205    ///
8206    /// ````text
8207    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8208    /// ````
8209    ///
8210    /// Sets the *delegate* property to the given value.
8211    pub fn delegate(
8212        mut self,
8213        new_value: &'a mut dyn common::Delegate,
8214    ) -> ProjectLocationOperationListCall<'a, C> {
8215        self._delegate = Some(new_value);
8216        self
8217    }
8218
8219    /// Set any additional parameter of the query string used in the request.
8220    /// It should be used to set parameters which are not yet available through their own
8221    /// setters.
8222    ///
8223    /// Please note that this method must not be used to set any of the known parameters
8224    /// which have their own setter method. If done anyway, the request will fail.
8225    ///
8226    /// # Additional Parameters
8227    ///
8228    /// * *$.xgafv* (query-string) - V1 error format.
8229    /// * *access_token* (query-string) - OAuth access token.
8230    /// * *alt* (query-string) - Data format for response.
8231    /// * *callback* (query-string) - JSONP
8232    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8233    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8234    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8235    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8236    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8237    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8238    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8239    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
8240    where
8241        T: AsRef<str>,
8242    {
8243        self._additional_params
8244            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8245        self
8246    }
8247
8248    /// Identifies the authorization scope for the method you are building.
8249    ///
8250    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8251    /// [`Scope::CloudPlatform`].
8252    ///
8253    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8254    /// tokens for more than one scope.
8255    ///
8256    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8257    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8258    /// sufficient, a read-write scope will do as well.
8259    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
8260    where
8261        St: AsRef<str>,
8262    {
8263        self._scopes.insert(String::from(scope.as_ref()));
8264        self
8265    }
8266    /// Identifies the authorization scope(s) for the method you are building.
8267    ///
8268    /// See [`Self::add_scope()`] for details.
8269    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
8270    where
8271        I: IntoIterator<Item = St>,
8272        St: AsRef<str>,
8273    {
8274        self._scopes
8275            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8276        self
8277    }
8278
8279    /// Removes all scopes, and no default scope will be used either.
8280    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8281    /// for details).
8282    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
8283        self._scopes.clear();
8284        self
8285    }
8286}
8287
8288/// Lists possible versions for Data Fusion instances in the specified project and location.
8289///
8290/// A builder for the *locations.versions.list* method supported by a *project* resource.
8291/// It is not used directly, but through a [`ProjectMethods`] instance.
8292///
8293/// # Example
8294///
8295/// Instantiate a resource method builder
8296///
8297/// ```test_harness,no_run
8298/// # extern crate hyper;
8299/// # extern crate hyper_rustls;
8300/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8301/// # async fn dox() {
8302/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8303///
8304/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8306/// #     secret,
8307/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8308/// # ).build().await.unwrap();
8309///
8310/// # let client = hyper_util::client::legacy::Client::builder(
8311/// #     hyper_util::rt::TokioExecutor::new()
8312/// # )
8313/// # .build(
8314/// #     hyper_rustls::HttpsConnectorBuilder::new()
8315/// #         .with_native_roots()
8316/// #         .unwrap()
8317/// #         .https_or_http()
8318/// #         .enable_http1()
8319/// #         .build()
8320/// # );
8321/// # let mut hub = DataFusion::new(client, auth);
8322/// // You can configure optional parameters by calling the respective setters at will, and
8323/// // execute the final call using `doit()`.
8324/// // Values shown here are possibly random and not representative !
8325/// let result = hub.projects().locations_versions_list("parent")
8326///              .page_token("et")
8327///              .page_size(-43)
8328///              .latest_patch_only(true)
8329///              .doit().await;
8330/// # }
8331/// ```
8332pub struct ProjectLocationVersionListCall<'a, C>
8333where
8334    C: 'a,
8335{
8336    hub: &'a DataFusion<C>,
8337    _parent: String,
8338    _page_token: Option<String>,
8339    _page_size: Option<i32>,
8340    _latest_patch_only: Option<bool>,
8341    _delegate: Option<&'a mut dyn common::Delegate>,
8342    _additional_params: HashMap<String, String>,
8343    _scopes: BTreeSet<String>,
8344}
8345
8346impl<'a, C> common::CallBuilder for ProjectLocationVersionListCall<'a, C> {}
8347
8348impl<'a, C> ProjectLocationVersionListCall<'a, C>
8349where
8350    C: common::Connector,
8351{
8352    /// Perform the operation you have build so far.
8353    pub async fn doit(
8354        mut self,
8355    ) -> common::Result<(common::Response, ListAvailableVersionsResponse)> {
8356        use std::borrow::Cow;
8357        use std::io::{Read, Seek};
8358
8359        use common::{url::Params, ToParts};
8360        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8361
8362        let mut dd = common::DefaultDelegate;
8363        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8364        dlg.begin(common::MethodInfo {
8365            id: "datafusion.projects.locations.versions.list",
8366            http_method: hyper::Method::GET,
8367        });
8368
8369        for &field in ["alt", "parent", "pageToken", "pageSize", "latestPatchOnly"].iter() {
8370            if self._additional_params.contains_key(field) {
8371                dlg.finished(false);
8372                return Err(common::Error::FieldClash(field));
8373            }
8374        }
8375
8376        let mut params = Params::with_capacity(6 + self._additional_params.len());
8377        params.push("parent", self._parent);
8378        if let Some(value) = self._page_token.as_ref() {
8379            params.push("pageToken", value);
8380        }
8381        if let Some(value) = self._page_size.as_ref() {
8382            params.push("pageSize", value.to_string());
8383        }
8384        if let Some(value) = self._latest_patch_only.as_ref() {
8385            params.push("latestPatchOnly", value.to_string());
8386        }
8387
8388        params.extend(self._additional_params.iter());
8389
8390        params.push("alt", "json");
8391        let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
8392        if self._scopes.is_empty() {
8393            self._scopes
8394                .insert(Scope::CloudPlatform.as_ref().to_string());
8395        }
8396
8397        #[allow(clippy::single_element_loop)]
8398        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8399            url = params.uri_replacement(url, param_name, find_this, true);
8400        }
8401        {
8402            let to_remove = ["parent"];
8403            params.remove_params(&to_remove);
8404        }
8405
8406        let url = params.parse_with_url(&url);
8407
8408        loop {
8409            let token = match self
8410                .hub
8411                .auth
8412                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8413                .await
8414            {
8415                Ok(token) => token,
8416                Err(e) => match dlg.token(e) {
8417                    Ok(token) => token,
8418                    Err(e) => {
8419                        dlg.finished(false);
8420                        return Err(common::Error::MissingToken(e));
8421                    }
8422                },
8423            };
8424            let mut req_result = {
8425                let client = &self.hub.client;
8426                dlg.pre_request();
8427                let mut req_builder = hyper::Request::builder()
8428                    .method(hyper::Method::GET)
8429                    .uri(url.as_str())
8430                    .header(USER_AGENT, self.hub._user_agent.clone());
8431
8432                if let Some(token) = token.as_ref() {
8433                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8434                }
8435
8436                let request = req_builder
8437                    .header(CONTENT_LENGTH, 0_u64)
8438                    .body(common::to_body::<String>(None));
8439
8440                client.request(request.unwrap()).await
8441            };
8442
8443            match req_result {
8444                Err(err) => {
8445                    if let common::Retry::After(d) = dlg.http_error(&err) {
8446                        sleep(d).await;
8447                        continue;
8448                    }
8449                    dlg.finished(false);
8450                    return Err(common::Error::HttpError(err));
8451                }
8452                Ok(res) => {
8453                    let (mut parts, body) = res.into_parts();
8454                    let mut body = common::Body::new(body);
8455                    if !parts.status.is_success() {
8456                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8457                        let error = serde_json::from_str(&common::to_string(&bytes));
8458                        let response = common::to_response(parts, bytes.into());
8459
8460                        if let common::Retry::After(d) =
8461                            dlg.http_failure(&response, error.as_ref().ok())
8462                        {
8463                            sleep(d).await;
8464                            continue;
8465                        }
8466
8467                        dlg.finished(false);
8468
8469                        return Err(match error {
8470                            Ok(value) => common::Error::BadRequest(value),
8471                            _ => common::Error::Failure(response),
8472                        });
8473                    }
8474                    let response = {
8475                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8476                        let encoded = common::to_string(&bytes);
8477                        match serde_json::from_str(&encoded) {
8478                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8479                            Err(error) => {
8480                                dlg.response_json_decode_error(&encoded, &error);
8481                                return Err(common::Error::JsonDecodeError(
8482                                    encoded.to_string(),
8483                                    error,
8484                                ));
8485                            }
8486                        }
8487                    };
8488
8489                    dlg.finished(true);
8490                    return Ok(response);
8491                }
8492            }
8493        }
8494    }
8495
8496    /// Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
8497    ///
8498    /// Sets the *parent* path property to the given value.
8499    ///
8500    /// Even though the property as already been set when instantiating this call,
8501    /// we provide this method for API completeness.
8502    pub fn parent(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
8503        self._parent = new_value.to_string();
8504        self
8505    }
8506    /// The next_page_token value to use if there are additional results to retrieve for this list request.
8507    ///
8508    /// Sets the *page token* query property to the given value.
8509    pub fn page_token(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
8510        self._page_token = Some(new_value.to_string());
8511        self
8512    }
8513    /// The maximum number of items to return.
8514    ///
8515    /// Sets the *page size* query property to the given value.
8516    pub fn page_size(mut self, new_value: i32) -> ProjectLocationVersionListCall<'a, C> {
8517        self._page_size = Some(new_value);
8518        self
8519    }
8520    /// 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]
8521    ///
8522    /// Sets the *latest patch only* query property to the given value.
8523    pub fn latest_patch_only(mut self, new_value: bool) -> ProjectLocationVersionListCall<'a, C> {
8524        self._latest_patch_only = Some(new_value);
8525        self
8526    }
8527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8528    /// while executing the actual API request.
8529    ///
8530    /// ````text
8531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8532    /// ````
8533    ///
8534    /// Sets the *delegate* property to the given value.
8535    pub fn delegate(
8536        mut self,
8537        new_value: &'a mut dyn common::Delegate,
8538    ) -> ProjectLocationVersionListCall<'a, C> {
8539        self._delegate = Some(new_value);
8540        self
8541    }
8542
8543    /// Set any additional parameter of the query string used in the request.
8544    /// It should be used to set parameters which are not yet available through their own
8545    /// setters.
8546    ///
8547    /// Please note that this method must not be used to set any of the known parameters
8548    /// which have their own setter method. If done anyway, the request will fail.
8549    ///
8550    /// # Additional Parameters
8551    ///
8552    /// * *$.xgafv* (query-string) - V1 error format.
8553    /// * *access_token* (query-string) - OAuth access token.
8554    /// * *alt* (query-string) - Data format for response.
8555    /// * *callback* (query-string) - JSONP
8556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8557    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8560    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8563    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVersionListCall<'a, C>
8564    where
8565        T: AsRef<str>,
8566    {
8567        self._additional_params
8568            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8569        self
8570    }
8571
8572    /// Identifies the authorization scope for the method you are building.
8573    ///
8574    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8575    /// [`Scope::CloudPlatform`].
8576    ///
8577    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8578    /// tokens for more than one scope.
8579    ///
8580    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8581    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8582    /// sufficient, a read-write scope will do as well.
8583    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVersionListCall<'a, C>
8584    where
8585        St: AsRef<str>,
8586    {
8587        self._scopes.insert(String::from(scope.as_ref()));
8588        self
8589    }
8590    /// Identifies the authorization scope(s) for the method you are building.
8591    ///
8592    /// See [`Self::add_scope()`] for details.
8593    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationVersionListCall<'a, C>
8594    where
8595        I: IntoIterator<Item = St>,
8596        St: AsRef<str>,
8597    {
8598        self._scopes
8599            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8600        self
8601    }
8602
8603    /// Removes all scopes, and no default scope will be used either.
8604    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8605    /// for details).
8606    pub fn clear_scopes(mut self) -> ProjectLocationVersionListCall<'a, C> {
8607        self._scopes.clear();
8608        self
8609    }
8610}
8611
8612/// Gets information about a location.
8613///
8614/// A builder for the *locations.get* method supported by a *project* resource.
8615/// It is not used directly, but through a [`ProjectMethods`] instance.
8616///
8617/// # Example
8618///
8619/// Instantiate a resource method builder
8620///
8621/// ```test_harness,no_run
8622/// # extern crate hyper;
8623/// # extern crate hyper_rustls;
8624/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8625/// # async fn dox() {
8626/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8627///
8628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8630/// #     secret,
8631/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8632/// # ).build().await.unwrap();
8633///
8634/// # let client = hyper_util::client::legacy::Client::builder(
8635/// #     hyper_util::rt::TokioExecutor::new()
8636/// # )
8637/// # .build(
8638/// #     hyper_rustls::HttpsConnectorBuilder::new()
8639/// #         .with_native_roots()
8640/// #         .unwrap()
8641/// #         .https_or_http()
8642/// #         .enable_http1()
8643/// #         .build()
8644/// # );
8645/// # let mut hub = DataFusion::new(client, auth);
8646/// // You can configure optional parameters by calling the respective setters at will, and
8647/// // execute the final call using `doit()`.
8648/// // Values shown here are possibly random and not representative !
8649/// let result = hub.projects().locations_get("name")
8650///              .doit().await;
8651/// # }
8652/// ```
8653pub struct ProjectLocationGetCall<'a, C>
8654where
8655    C: 'a,
8656{
8657    hub: &'a DataFusion<C>,
8658    _name: String,
8659    _delegate: Option<&'a mut dyn common::Delegate>,
8660    _additional_params: HashMap<String, String>,
8661    _scopes: BTreeSet<String>,
8662}
8663
8664impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
8665
8666impl<'a, C> ProjectLocationGetCall<'a, C>
8667where
8668    C: common::Connector,
8669{
8670    /// Perform the operation you have build so far.
8671    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
8672        use std::borrow::Cow;
8673        use std::io::{Read, Seek};
8674
8675        use common::{url::Params, ToParts};
8676        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8677
8678        let mut dd = common::DefaultDelegate;
8679        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8680        dlg.begin(common::MethodInfo {
8681            id: "datafusion.projects.locations.get",
8682            http_method: hyper::Method::GET,
8683        });
8684
8685        for &field in ["alt", "name"].iter() {
8686            if self._additional_params.contains_key(field) {
8687                dlg.finished(false);
8688                return Err(common::Error::FieldClash(field));
8689            }
8690        }
8691
8692        let mut params = Params::with_capacity(3 + self._additional_params.len());
8693        params.push("name", self._name);
8694
8695        params.extend(self._additional_params.iter());
8696
8697        params.push("alt", "json");
8698        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8699        if self._scopes.is_empty() {
8700            self._scopes
8701                .insert(Scope::CloudPlatform.as_ref().to_string());
8702        }
8703
8704        #[allow(clippy::single_element_loop)]
8705        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8706            url = params.uri_replacement(url, param_name, find_this, true);
8707        }
8708        {
8709            let to_remove = ["name"];
8710            params.remove_params(&to_remove);
8711        }
8712
8713        let url = params.parse_with_url(&url);
8714
8715        loop {
8716            let token = match self
8717                .hub
8718                .auth
8719                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8720                .await
8721            {
8722                Ok(token) => token,
8723                Err(e) => match dlg.token(e) {
8724                    Ok(token) => token,
8725                    Err(e) => {
8726                        dlg.finished(false);
8727                        return Err(common::Error::MissingToken(e));
8728                    }
8729                },
8730            };
8731            let mut req_result = {
8732                let client = &self.hub.client;
8733                dlg.pre_request();
8734                let mut req_builder = hyper::Request::builder()
8735                    .method(hyper::Method::GET)
8736                    .uri(url.as_str())
8737                    .header(USER_AGENT, self.hub._user_agent.clone());
8738
8739                if let Some(token) = token.as_ref() {
8740                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8741                }
8742
8743                let request = req_builder
8744                    .header(CONTENT_LENGTH, 0_u64)
8745                    .body(common::to_body::<String>(None));
8746
8747                client.request(request.unwrap()).await
8748            };
8749
8750            match req_result {
8751                Err(err) => {
8752                    if let common::Retry::After(d) = dlg.http_error(&err) {
8753                        sleep(d).await;
8754                        continue;
8755                    }
8756                    dlg.finished(false);
8757                    return Err(common::Error::HttpError(err));
8758                }
8759                Ok(res) => {
8760                    let (mut parts, body) = res.into_parts();
8761                    let mut body = common::Body::new(body);
8762                    if !parts.status.is_success() {
8763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8764                        let error = serde_json::from_str(&common::to_string(&bytes));
8765                        let response = common::to_response(parts, bytes.into());
8766
8767                        if let common::Retry::After(d) =
8768                            dlg.http_failure(&response, error.as_ref().ok())
8769                        {
8770                            sleep(d).await;
8771                            continue;
8772                        }
8773
8774                        dlg.finished(false);
8775
8776                        return Err(match error {
8777                            Ok(value) => common::Error::BadRequest(value),
8778                            _ => common::Error::Failure(response),
8779                        });
8780                    }
8781                    let response = {
8782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8783                        let encoded = common::to_string(&bytes);
8784                        match serde_json::from_str(&encoded) {
8785                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8786                            Err(error) => {
8787                                dlg.response_json_decode_error(&encoded, &error);
8788                                return Err(common::Error::JsonDecodeError(
8789                                    encoded.to_string(),
8790                                    error,
8791                                ));
8792                            }
8793                        }
8794                    };
8795
8796                    dlg.finished(true);
8797                    return Ok(response);
8798                }
8799            }
8800        }
8801    }
8802
8803    /// Resource name for the location.
8804    ///
8805    /// Sets the *name* path property to the given value.
8806    ///
8807    /// Even though the property as already been set when instantiating this call,
8808    /// we provide this method for API completeness.
8809    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
8810        self._name = new_value.to_string();
8811        self
8812    }
8813    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8814    /// while executing the actual API request.
8815    ///
8816    /// ````text
8817    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8818    /// ````
8819    ///
8820    /// Sets the *delegate* property to the given value.
8821    pub fn delegate(
8822        mut self,
8823        new_value: &'a mut dyn common::Delegate,
8824    ) -> ProjectLocationGetCall<'a, C> {
8825        self._delegate = Some(new_value);
8826        self
8827    }
8828
8829    /// Set any additional parameter of the query string used in the request.
8830    /// It should be used to set parameters which are not yet available through their own
8831    /// setters.
8832    ///
8833    /// Please note that this method must not be used to set any of the known parameters
8834    /// which have their own setter method. If done anyway, the request will fail.
8835    ///
8836    /// # Additional Parameters
8837    ///
8838    /// * *$.xgafv* (query-string) - V1 error format.
8839    /// * *access_token* (query-string) - OAuth access token.
8840    /// * *alt* (query-string) - Data format for response.
8841    /// * *callback* (query-string) - JSONP
8842    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8843    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8844    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8845    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8846    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8847    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8848    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8849    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
8850    where
8851        T: AsRef<str>,
8852    {
8853        self._additional_params
8854            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8855        self
8856    }
8857
8858    /// Identifies the authorization scope for the method you are building.
8859    ///
8860    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8861    /// [`Scope::CloudPlatform`].
8862    ///
8863    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8864    /// tokens for more than one scope.
8865    ///
8866    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8867    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8868    /// sufficient, a read-write scope will do as well.
8869    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
8870    where
8871        St: AsRef<str>,
8872    {
8873        self._scopes.insert(String::from(scope.as_ref()));
8874        self
8875    }
8876    /// Identifies the authorization scope(s) for the method you are building.
8877    ///
8878    /// See [`Self::add_scope()`] for details.
8879    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
8880    where
8881        I: IntoIterator<Item = St>,
8882        St: AsRef<str>,
8883    {
8884        self._scopes
8885            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8886        self
8887    }
8888
8889    /// Removes all scopes, and no default scope will be used either.
8890    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8891    /// for details).
8892    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
8893        self._scopes.clear();
8894        self
8895    }
8896}
8897
8898/// Lists information about the supported locations for this service.
8899///
8900/// A builder for the *locations.list* method supported by a *project* resource.
8901/// It is not used directly, but through a [`ProjectMethods`] instance.
8902///
8903/// # Example
8904///
8905/// Instantiate a resource method builder
8906///
8907/// ```test_harness,no_run
8908/// # extern crate hyper;
8909/// # extern crate hyper_rustls;
8910/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8911/// # async fn dox() {
8912/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8913///
8914/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8915/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8916/// #     secret,
8917/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8918/// # ).build().await.unwrap();
8919///
8920/// # let client = hyper_util::client::legacy::Client::builder(
8921/// #     hyper_util::rt::TokioExecutor::new()
8922/// # )
8923/// # .build(
8924/// #     hyper_rustls::HttpsConnectorBuilder::new()
8925/// #         .with_native_roots()
8926/// #         .unwrap()
8927/// #         .https_or_http()
8928/// #         .enable_http1()
8929/// #         .build()
8930/// # );
8931/// # let mut hub = DataFusion::new(client, auth);
8932/// // You can configure optional parameters by calling the respective setters at will, and
8933/// // execute the final call using `doit()`.
8934/// // Values shown here are possibly random and not representative !
8935/// let result = hub.projects().locations_list("name")
8936///              .page_token("sed")
8937///              .page_size(-20)
8938///              .filter("dolore")
8939///              .doit().await;
8940/// # }
8941/// ```
8942pub struct ProjectLocationListCall<'a, C>
8943where
8944    C: 'a,
8945{
8946    hub: &'a DataFusion<C>,
8947    _name: String,
8948    _page_token: Option<String>,
8949    _page_size: Option<i32>,
8950    _filter: Option<String>,
8951    _delegate: Option<&'a mut dyn common::Delegate>,
8952    _additional_params: HashMap<String, String>,
8953    _scopes: BTreeSet<String>,
8954}
8955
8956impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
8957
8958impl<'a, C> ProjectLocationListCall<'a, C>
8959where
8960    C: common::Connector,
8961{
8962    /// Perform the operation you have build so far.
8963    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
8964        use std::borrow::Cow;
8965        use std::io::{Read, Seek};
8966
8967        use common::{url::Params, ToParts};
8968        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8969
8970        let mut dd = common::DefaultDelegate;
8971        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8972        dlg.begin(common::MethodInfo {
8973            id: "datafusion.projects.locations.list",
8974            http_method: hyper::Method::GET,
8975        });
8976
8977        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
8978            if self._additional_params.contains_key(field) {
8979                dlg.finished(false);
8980                return Err(common::Error::FieldClash(field));
8981            }
8982        }
8983
8984        let mut params = Params::with_capacity(6 + self._additional_params.len());
8985        params.push("name", self._name);
8986        if let Some(value) = self._page_token.as_ref() {
8987            params.push("pageToken", value);
8988        }
8989        if let Some(value) = self._page_size.as_ref() {
8990            params.push("pageSize", value.to_string());
8991        }
8992        if let Some(value) = self._filter.as_ref() {
8993            params.push("filter", value);
8994        }
8995
8996        params.extend(self._additional_params.iter());
8997
8998        params.push("alt", "json");
8999        let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
9000        if self._scopes.is_empty() {
9001            self._scopes
9002                .insert(Scope::CloudPlatform.as_ref().to_string());
9003        }
9004
9005        #[allow(clippy::single_element_loop)]
9006        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9007            url = params.uri_replacement(url, param_name, find_this, true);
9008        }
9009        {
9010            let to_remove = ["name"];
9011            params.remove_params(&to_remove);
9012        }
9013
9014        let url = params.parse_with_url(&url);
9015
9016        loop {
9017            let token = match self
9018                .hub
9019                .auth
9020                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9021                .await
9022            {
9023                Ok(token) => token,
9024                Err(e) => match dlg.token(e) {
9025                    Ok(token) => token,
9026                    Err(e) => {
9027                        dlg.finished(false);
9028                        return Err(common::Error::MissingToken(e));
9029                    }
9030                },
9031            };
9032            let mut req_result = {
9033                let client = &self.hub.client;
9034                dlg.pre_request();
9035                let mut req_builder = hyper::Request::builder()
9036                    .method(hyper::Method::GET)
9037                    .uri(url.as_str())
9038                    .header(USER_AGENT, self.hub._user_agent.clone());
9039
9040                if let Some(token) = token.as_ref() {
9041                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9042                }
9043
9044                let request = req_builder
9045                    .header(CONTENT_LENGTH, 0_u64)
9046                    .body(common::to_body::<String>(None));
9047
9048                client.request(request.unwrap()).await
9049            };
9050
9051            match req_result {
9052                Err(err) => {
9053                    if let common::Retry::After(d) = dlg.http_error(&err) {
9054                        sleep(d).await;
9055                        continue;
9056                    }
9057                    dlg.finished(false);
9058                    return Err(common::Error::HttpError(err));
9059                }
9060                Ok(res) => {
9061                    let (mut parts, body) = res.into_parts();
9062                    let mut body = common::Body::new(body);
9063                    if !parts.status.is_success() {
9064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9065                        let error = serde_json::from_str(&common::to_string(&bytes));
9066                        let response = common::to_response(parts, bytes.into());
9067
9068                        if let common::Retry::After(d) =
9069                            dlg.http_failure(&response, error.as_ref().ok())
9070                        {
9071                            sleep(d).await;
9072                            continue;
9073                        }
9074
9075                        dlg.finished(false);
9076
9077                        return Err(match error {
9078                            Ok(value) => common::Error::BadRequest(value),
9079                            _ => common::Error::Failure(response),
9080                        });
9081                    }
9082                    let response = {
9083                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9084                        let encoded = common::to_string(&bytes);
9085                        match serde_json::from_str(&encoded) {
9086                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9087                            Err(error) => {
9088                                dlg.response_json_decode_error(&encoded, &error);
9089                                return Err(common::Error::JsonDecodeError(
9090                                    encoded.to_string(),
9091                                    error,
9092                                ));
9093                            }
9094                        }
9095                    };
9096
9097                    dlg.finished(true);
9098                    return Ok(response);
9099                }
9100            }
9101        }
9102    }
9103
9104    /// The resource that owns the locations collection, if applicable.
9105    ///
9106    /// Sets the *name* path property to the given value.
9107    ///
9108    /// Even though the property as already been set when instantiating this call,
9109    /// we provide this method for API completeness.
9110    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9111        self._name = new_value.to_string();
9112        self
9113    }
9114    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
9115    ///
9116    /// Sets the *page token* query property to the given value.
9117    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9118        self._page_token = Some(new_value.to_string());
9119        self
9120    }
9121    /// The maximum number of results to return. If not set, the service selects a default.
9122    ///
9123    /// Sets the *page size* query property to the given value.
9124    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
9125        self._page_size = Some(new_value);
9126        self
9127    }
9128    /// 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).
9129    ///
9130    /// Sets the *filter* query property to the given value.
9131    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9132        self._filter = Some(new_value.to_string());
9133        self
9134    }
9135    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9136    /// while executing the actual API request.
9137    ///
9138    /// ````text
9139    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9140    /// ````
9141    ///
9142    /// Sets the *delegate* property to the given value.
9143    pub fn delegate(
9144        mut self,
9145        new_value: &'a mut dyn common::Delegate,
9146    ) -> ProjectLocationListCall<'a, C> {
9147        self._delegate = Some(new_value);
9148        self
9149    }
9150
9151    /// Set any additional parameter of the query string used in the request.
9152    /// It should be used to set parameters which are not yet available through their own
9153    /// setters.
9154    ///
9155    /// Please note that this method must not be used to set any of the known parameters
9156    /// which have their own setter method. If done anyway, the request will fail.
9157    ///
9158    /// # Additional Parameters
9159    ///
9160    /// * *$.xgafv* (query-string) - V1 error format.
9161    /// * *access_token* (query-string) - OAuth access token.
9162    /// * *alt* (query-string) - Data format for response.
9163    /// * *callback* (query-string) - JSONP
9164    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9165    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9166    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9167    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9168    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9169    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9170    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9171    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
9172    where
9173        T: AsRef<str>,
9174    {
9175        self._additional_params
9176            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9177        self
9178    }
9179
9180    /// Identifies the authorization scope for the method you are building.
9181    ///
9182    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9183    /// [`Scope::CloudPlatform`].
9184    ///
9185    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9186    /// tokens for more than one scope.
9187    ///
9188    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9189    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9190    /// sufficient, a read-write scope will do as well.
9191    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
9192    where
9193        St: AsRef<str>,
9194    {
9195        self._scopes.insert(String::from(scope.as_ref()));
9196        self
9197    }
9198    /// Identifies the authorization scope(s) for the method you are building.
9199    ///
9200    /// See [`Self::add_scope()`] for details.
9201    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
9202    where
9203        I: IntoIterator<Item = St>,
9204        St: AsRef<str>,
9205    {
9206        self._scopes
9207            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9208        self
9209    }
9210
9211    /// Removes all scopes, and no default scope will be used either.
9212    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9213    /// for details).
9214    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
9215        self._scopes.clear();
9216        self
9217    }
9218}
9219
9220/// Remove IAM policy that is currently set on the given resource.
9221///
9222/// A builder for the *locations.removeIamPolicy* method supported by a *project* resource.
9223/// It is not used directly, but through a [`ProjectMethods`] instance.
9224///
9225/// # Example
9226///
9227/// Instantiate a resource method builder
9228///
9229/// ```test_harness,no_run
9230/// # extern crate hyper;
9231/// # extern crate hyper_rustls;
9232/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
9233/// use datafusion1_beta1::api::RemoveIamPolicyRequest;
9234/// # async fn dox() {
9235/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9236///
9237/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9238/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9239/// #     secret,
9240/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9241/// # ).build().await.unwrap();
9242///
9243/// # let client = hyper_util::client::legacy::Client::builder(
9244/// #     hyper_util::rt::TokioExecutor::new()
9245/// # )
9246/// # .build(
9247/// #     hyper_rustls::HttpsConnectorBuilder::new()
9248/// #         .with_native_roots()
9249/// #         .unwrap()
9250/// #         .https_or_http()
9251/// #         .enable_http1()
9252/// #         .build()
9253/// # );
9254/// # let mut hub = DataFusion::new(client, auth);
9255/// // As the method needs a request, you would usually fill it with the desired information
9256/// // into the respective structure. Some of the parts shown here might not be applicable !
9257/// // Values shown here are possibly random and not representative !
9258/// let mut req = RemoveIamPolicyRequest::default();
9259///
9260/// // You can configure optional parameters by calling the respective setters at will, and
9261/// // execute the final call using `doit()`.
9262/// // Values shown here are possibly random and not representative !
9263/// let result = hub.projects().locations_remove_iam_policy(req, "resource")
9264///              .doit().await;
9265/// # }
9266/// ```
9267pub struct ProjectLocationRemoveIamPolicyCall<'a, C>
9268where
9269    C: 'a,
9270{
9271    hub: &'a DataFusion<C>,
9272    _request: RemoveIamPolicyRequest,
9273    _resource: String,
9274    _delegate: Option<&'a mut dyn common::Delegate>,
9275    _additional_params: HashMap<String, String>,
9276    _scopes: BTreeSet<String>,
9277}
9278
9279impl<'a, C> common::CallBuilder for ProjectLocationRemoveIamPolicyCall<'a, C> {}
9280
9281impl<'a, C> ProjectLocationRemoveIamPolicyCall<'a, C>
9282where
9283    C: common::Connector,
9284{
9285    /// Perform the operation you have build so far.
9286    pub async fn doit(mut self) -> common::Result<(common::Response, RemoveIamPolicyResponse)> {
9287        use std::borrow::Cow;
9288        use std::io::{Read, Seek};
9289
9290        use common::{url::Params, ToParts};
9291        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9292
9293        let mut dd = common::DefaultDelegate;
9294        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9295        dlg.begin(common::MethodInfo {
9296            id: "datafusion.projects.locations.removeIamPolicy",
9297            http_method: hyper::Method::POST,
9298        });
9299
9300        for &field in ["alt", "resource"].iter() {
9301            if self._additional_params.contains_key(field) {
9302                dlg.finished(false);
9303                return Err(common::Error::FieldClash(field));
9304            }
9305        }
9306
9307        let mut params = Params::with_capacity(4 + self._additional_params.len());
9308        params.push("resource", self._resource);
9309
9310        params.extend(self._additional_params.iter());
9311
9312        params.push("alt", "json");
9313        let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:removeIamPolicy";
9314        if self._scopes.is_empty() {
9315            self._scopes
9316                .insert(Scope::CloudPlatform.as_ref().to_string());
9317        }
9318
9319        #[allow(clippy::single_element_loop)]
9320        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9321            url = params.uri_replacement(url, param_name, find_this, true);
9322        }
9323        {
9324            let to_remove = ["resource"];
9325            params.remove_params(&to_remove);
9326        }
9327
9328        let url = params.parse_with_url(&url);
9329
9330        let mut json_mime_type = mime::APPLICATION_JSON;
9331        let mut request_value_reader = {
9332            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9333            common::remove_json_null_values(&mut value);
9334            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9335            serde_json::to_writer(&mut dst, &value).unwrap();
9336            dst
9337        };
9338        let request_size = request_value_reader
9339            .seek(std::io::SeekFrom::End(0))
9340            .unwrap();
9341        request_value_reader
9342            .seek(std::io::SeekFrom::Start(0))
9343            .unwrap();
9344
9345        loop {
9346            let token = match self
9347                .hub
9348                .auth
9349                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9350                .await
9351            {
9352                Ok(token) => token,
9353                Err(e) => match dlg.token(e) {
9354                    Ok(token) => token,
9355                    Err(e) => {
9356                        dlg.finished(false);
9357                        return Err(common::Error::MissingToken(e));
9358                    }
9359                },
9360            };
9361            request_value_reader
9362                .seek(std::io::SeekFrom::Start(0))
9363                .unwrap();
9364            let mut req_result = {
9365                let client = &self.hub.client;
9366                dlg.pre_request();
9367                let mut req_builder = hyper::Request::builder()
9368                    .method(hyper::Method::POST)
9369                    .uri(url.as_str())
9370                    .header(USER_AGENT, self.hub._user_agent.clone());
9371
9372                if let Some(token) = token.as_ref() {
9373                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9374                }
9375
9376                let request = req_builder
9377                    .header(CONTENT_TYPE, json_mime_type.to_string())
9378                    .header(CONTENT_LENGTH, request_size as u64)
9379                    .body(common::to_body(
9380                        request_value_reader.get_ref().clone().into(),
9381                    ));
9382
9383                client.request(request.unwrap()).await
9384            };
9385
9386            match req_result {
9387                Err(err) => {
9388                    if let common::Retry::After(d) = dlg.http_error(&err) {
9389                        sleep(d).await;
9390                        continue;
9391                    }
9392                    dlg.finished(false);
9393                    return Err(common::Error::HttpError(err));
9394                }
9395                Ok(res) => {
9396                    let (mut parts, body) = res.into_parts();
9397                    let mut body = common::Body::new(body);
9398                    if !parts.status.is_success() {
9399                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9400                        let error = serde_json::from_str(&common::to_string(&bytes));
9401                        let response = common::to_response(parts, bytes.into());
9402
9403                        if let common::Retry::After(d) =
9404                            dlg.http_failure(&response, error.as_ref().ok())
9405                        {
9406                            sleep(d).await;
9407                            continue;
9408                        }
9409
9410                        dlg.finished(false);
9411
9412                        return Err(match error {
9413                            Ok(value) => common::Error::BadRequest(value),
9414                            _ => common::Error::Failure(response),
9415                        });
9416                    }
9417                    let response = {
9418                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9419                        let encoded = common::to_string(&bytes);
9420                        match serde_json::from_str(&encoded) {
9421                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9422                            Err(error) => {
9423                                dlg.response_json_decode_error(&encoded, &error);
9424                                return Err(common::Error::JsonDecodeError(
9425                                    encoded.to_string(),
9426                                    error,
9427                                ));
9428                            }
9429                        }
9430                    };
9431
9432                    dlg.finished(true);
9433                    return Ok(response);
9434                }
9435            }
9436        }
9437    }
9438
9439    ///
9440    /// Sets the *request* property to the given value.
9441    ///
9442    /// Even though the property as already been set when instantiating this call,
9443    /// we provide this method for API completeness.
9444    pub fn request(
9445        mut self,
9446        new_value: RemoveIamPolicyRequest,
9447    ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9448        self._request = new_value;
9449        self
9450    }
9451    /// Required. The resource on which IAM policy to be removed is attached to.
9452    ///
9453    /// Sets the *resource* path property to the given value.
9454    ///
9455    /// Even though the property as already been set when instantiating this call,
9456    /// we provide this method for API completeness.
9457    pub fn resource(mut self, new_value: &str) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9458        self._resource = new_value.to_string();
9459        self
9460    }
9461    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9462    /// while executing the actual API request.
9463    ///
9464    /// ````text
9465    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9466    /// ````
9467    ///
9468    /// Sets the *delegate* property to the given value.
9469    pub fn delegate(
9470        mut self,
9471        new_value: &'a mut dyn common::Delegate,
9472    ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9473        self._delegate = Some(new_value);
9474        self
9475    }
9476
9477    /// Set any additional parameter of the query string used in the request.
9478    /// It should be used to set parameters which are not yet available through their own
9479    /// setters.
9480    ///
9481    /// Please note that this method must not be used to set any of the known parameters
9482    /// which have their own setter method. If done anyway, the request will fail.
9483    ///
9484    /// # Additional Parameters
9485    ///
9486    /// * *$.xgafv* (query-string) - V1 error format.
9487    /// * *access_token* (query-string) - OAuth access token.
9488    /// * *alt* (query-string) - Data format for response.
9489    /// * *callback* (query-string) - JSONP
9490    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9491    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9492    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9493    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9494    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9495    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9496    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9497    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9498    where
9499        T: AsRef<str>,
9500    {
9501        self._additional_params
9502            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9503        self
9504    }
9505
9506    /// Identifies the authorization scope for the method you are building.
9507    ///
9508    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9509    /// [`Scope::CloudPlatform`].
9510    ///
9511    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9512    /// tokens for more than one scope.
9513    ///
9514    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9515    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9516    /// sufficient, a read-write scope will do as well.
9517    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9518    where
9519        St: AsRef<str>,
9520    {
9521        self._scopes.insert(String::from(scope.as_ref()));
9522        self
9523    }
9524    /// Identifies the authorization scope(s) for the method you are building.
9525    ///
9526    /// See [`Self::add_scope()`] for details.
9527    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9528    where
9529        I: IntoIterator<Item = St>,
9530        St: AsRef<str>,
9531    {
9532        self._scopes
9533            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9534        self
9535    }
9536
9537    /// Removes all scopes, and no default scope will be used either.
9538    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9539    /// for details).
9540    pub fn clear_scopes(mut self) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9541        self._scopes.clear();
9542        self
9543    }
9544}