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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = DataFusion::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Instance::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_instances_create(req, "parent")
99/// .instance_id("At")
100/// .doit().await;
101///
102/// match result {
103/// Err(e) => match e {
104/// // The Error enum provides details about what exactly happened.
105/// // You can also just use its `Debug`, `Display` or `Error` traits
106/// Error::HttpError(_)
107/// |Error::Io(_)
108/// |Error::MissingAPIKey
109/// |Error::MissingToken(_)
110/// |Error::Cancelled
111/// |Error::UploadSizeLimitExceeded(_, _)
112/// |Error::Failure(_)
113/// |Error::BadRequest(_)
114/// |Error::FieldClash(_)
115/// |Error::JsonDecodeError(_, _) => println!("{}", e),
116/// },
117/// Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct DataFusion<C> {
123 pub client: common::Client<C>,
124 pub auth: Box<dyn common::GetToken>,
125 _user_agent: String,
126 _base_url: String,
127 _root_url: String,
128}
129
130impl<C> common::Hub for DataFusion<C> {}
131
132impl<'a, C> DataFusion<C> {
133 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> DataFusion<C> {
134 DataFusion {
135 client,
136 auth: Box::new(auth),
137 _user_agent: "google-api-rust-client/7.0.0".to_string(),
138 _base_url: "https://datafusion.googleapis.com/".to_string(),
139 _root_url: "https://datafusion.googleapis.com/".to_string(),
140 }
141 }
142
143 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
144 ProjectMethods { hub: self }
145 }
146
147 /// Set the user-agent header field to use in all requests to the server.
148 /// It defaults to `google-api-rust-client/7.0.0`.
149 ///
150 /// Returns the previously set user-agent.
151 pub fn user_agent(&mut self, agent_name: String) -> String {
152 std::mem::replace(&mut self._user_agent, agent_name)
153 }
154
155 /// Set the base url to use in all requests to the server.
156 /// It defaults to `https://datafusion.googleapis.com/`.
157 ///
158 /// Returns the previously set base url.
159 pub fn base_url(&mut self, new_base_url: String) -> String {
160 std::mem::replace(&mut self._base_url, new_base_url)
161 }
162
163 /// Set the root url to use in all requests to the server.
164 /// It defaults to `https://datafusion.googleapis.com/`.
165 ///
166 /// Returns the previously set root url.
167 pub fn root_url(&mut self, new_root_url: String) -> String {
168 std::mem::replace(&mut self._root_url, new_root_url)
169 }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// Identifies Cloud Data Fusion accelerators for an instance.
176///
177/// This type is not used in any activity, and only used as *part* of another schema.
178///
179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
180#[serde_with::serde_as]
181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
182pub struct Accelerator {
183 /// Optional. The type of an accelator for a Cloud Data Fusion instance.
184 #[serde(rename = "acceleratorType")]
185 pub accelerator_type: Option<String>,
186 /// Output only. The state of the accelerator.
187 pub state: Option<String>,
188}
189
190impl common::Part for Accelerator {}
191
192/// 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.
193///
194/// This type is not used in any activity, and only used as *part* of another schema.
195///
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct AuditConfig {
200 /// The configuration for logging of each type of permission.
201 #[serde(rename = "auditLogConfigs")]
202 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
203 /// 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.
204 pub service: Option<String>,
205}
206
207impl common::Part for AuditConfig {}
208
209/// 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.
210///
211/// This type is not used in any activity, and only used as *part* of another schema.
212///
213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
214#[serde_with::serde_as]
215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
216pub struct AuditLogConfig {
217 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
218 #[serde(rename = "exemptedMembers")]
219 pub exempted_members: Option<Vec<String>>,
220 /// The log type that this config enables.
221 #[serde(rename = "logType")]
222 pub log_type: Option<String>,
223}
224
225impl common::Part for AuditLogConfig {}
226
227/// Associates `members`, or principals, with a `role`.
228///
229/// This type is not used in any activity, and only used as *part* of another schema.
230///
231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
232#[serde_with::serde_as]
233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
234pub struct Binding {
235 /// 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).
236 pub condition: Option<Expr>,
237 /// 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`.
238 pub members: Option<Vec<String>>,
239 /// 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).
240 pub role: Option<String>,
241}
242
243impl common::Part for Binding {}
244
245/// The request message for Operations.CancelOperation.
246///
247/// # Activities
248///
249/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
250/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
251///
252/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct CancelOperationRequest {
257 _never_set: Option<bool>,
258}
259
260impl common::RequestValue for CancelOperationRequest {}
261
262/// The crypto key configuration. This field is used by the Customer-managed encryption keys (CMEK) feature.
263///
264/// This type is not used in any activity, and only used as *part* of another schema.
265///
266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
267#[serde_with::serde_as]
268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
269pub struct CryptoKeyConfig {
270 /// Optional. 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/*`.
271 #[serde(rename = "keyReference")]
272 pub key_reference: Option<String>,
273}
274
275impl common::Part for CryptoKeyConfig {}
276
277/// DNS peering configuration. These configurations are used to create DNS peering with the customer Cloud DNS.
278///
279/// # Activities
280///
281/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
282/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
283///
284/// * [locations instances dns peerings create projects](ProjectLocationInstanceDnsPeeringCreateCall) (request|response)
285#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
286#[serde_with::serde_as]
287#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
288pub struct DnsPeering {
289 /// Optional. Optional description of the dns zone.
290 pub description: Option<String>,
291 /// Required. The dns name suffix of the zone.
292 pub domain: Option<String>,
293 /// Identifier. The resource name of the dns peering zone. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
294 pub name: Option<String>,
295 /// Optional. Optional target network to which dns peering should happen.
296 #[serde(rename = "targetNetwork")]
297 pub target_network: Option<String>,
298 /// Optional. Optional target project to which dns peering should happen.
299 #[serde(rename = "targetProject")]
300 pub target_project: Option<String>,
301}
302
303impl common::RequestValue for DnsPeering {}
304impl common::ResponseResult for DnsPeering {}
305
306/// 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); }
307///
308/// # Activities
309///
310/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
311/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
312///
313/// * [locations instances dns peerings delete projects](ProjectLocationInstanceDnsPeeringDeleteCall) (response)
314/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
315/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
317#[serde_with::serde_as]
318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
319pub struct Empty {
320 _never_set: Option<bool>,
321}
322
323impl common::ResponseResult for Empty {}
324
325/// Confirguration of PubSubEventWriter.
326///
327/// This type is not used in any activity, and only used as *part* of another schema.
328///
329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
330#[serde_with::serde_as]
331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
332pub struct EventPublishConfig {
333 /// Required. Option to enable Event Publishing.
334 pub enabled: Option<bool>,
335 /// Required. The resource name of the Pub/Sub topic. Format: projects/{project_id}/topics/{topic_id}
336 pub topic: Option<String>,
337}
338
339impl common::Part for EventPublishConfig {}
340
341/// 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.
342///
343/// This type is not used in any activity, and only used as *part* of another schema.
344///
345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
346#[serde_with::serde_as]
347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
348pub struct Expr {
349 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
350 pub description: Option<String>,
351 /// Textual representation of an expression in Common Expression Language syntax.
352 pub expression: Option<String>,
353 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
354 pub location: Option<String>,
355 /// 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.
356 pub title: Option<String>,
357}
358
359impl common::Part for Expr {}
360
361/// IAMPolicy encapsulates the IAM policy name, definition and status of policy fetching.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct IAMPolicy {
369 /// Policy definition if IAM policy fetching is successful, otherwise empty.
370 pub policy: Option<Policy>,
371 /// Status of iam policy fetching.
372 pub status: Option<Status>,
373}
374
375impl common::Part for IAMPolicy {}
376
377/// Represents a Data Fusion instance.
378///
379/// # Activities
380///
381/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
382/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
383///
384/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (request)
385/// * [locations instances get projects](ProjectLocationInstanceGetCall) (response)
386/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (request)
387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
388#[serde_with::serde_as]
389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
390pub struct Instance {
391 /// Output only. List of accelerators enabled for this CDF instance.
392 pub accelerators: Option<Vec<Accelerator>>,
393 /// Output only. Endpoint on which the REST APIs is accessible.
394 #[serde(rename = "apiEndpoint")]
395 pub api_endpoint: Option<String>,
396 /// Output only. Available versions that the instance can be upgraded to using UpdateInstanceRequest.
397 #[serde(rename = "availableVersion")]
398 pub available_version: Option<Vec<Version>>,
399 /// Output only. The time the instance was created.
400 #[serde(rename = "createTime")]
401 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
402 /// Optional. The crypto key configuration. This field is used by the Customer-Managed Encryption Keys (CMEK) feature.
403 #[serde(rename = "cryptoKeyConfig")]
404 pub crypto_key_config: Option<CryptoKeyConfig>,
405 /// Optional. Option to enable the Dataplex Lineage Integration feature.
406 #[serde(rename = "dataplexDataLineageIntegrationEnabled")]
407 pub dataplex_data_lineage_integration_enabled: Option<bool>,
408 /// Optional. 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.
409 #[serde(rename = "dataprocServiceAccount")]
410 pub dataproc_service_account: Option<String>,
411 /// Optional. A description of this instance.
412 pub description: Option<String>,
413 /// Output only. If the instance state is DISABLED, the reason for disabling the instance.
414 #[serde(rename = "disabledReason")]
415 pub disabled_reason: Option<Vec<String>>,
416 /// Optional. Display name for an instance.
417 #[serde(rename = "displayName")]
418 pub display_name: Option<String>,
419 /// Optional. Option to enable granular role-based access control.
420 #[serde(rename = "enableRbac")]
421 pub enable_rbac: Option<bool>,
422 /// Optional. Option to enable Dataproc Stackdriver Logging.
423 #[serde(rename = "enableStackdriverLogging")]
424 pub enable_stackdriver_logging: Option<bool>,
425 /// Optional. Option to enable Stackdriver Monitoring.
426 #[serde(rename = "enableStackdriverMonitoring")]
427 pub enable_stackdriver_monitoring: Option<bool>,
428 /// Output only. Option to enable zone separation.
429 #[serde(rename = "enableZoneSeparation")]
430 pub enable_zone_separation: Option<bool>,
431 /// Optional. Option to enable and pass metadata for event publishing.
432 #[serde(rename = "eventPublishConfig")]
433 pub event_publish_config: Option<EventPublishConfig>,
434 /// Output only. Cloud Storage bucket generated by Data Fusion in the customer project.
435 #[serde(rename = "gcsBucket")]
436 pub gcs_bucket: Option<String>,
437 /// 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.
438 pub labels: Option<HashMap<String, String>>,
439 /// Optional. The logging configuration for this instance. This field is supported only in CDF versions 6.11.0 and above.
440 #[serde(rename = "loggingConfig")]
441 pub logging_config: Option<LoggingConfig>,
442 /// Output only. The maintenance events for this instance.
443 #[serde(rename = "maintenanceEvents")]
444 pub maintenance_events: Option<Vec<MaintenanceEvent>>,
445 /// Optional. Configure the maintenance policy for this instance.
446 #[serde(rename = "maintenancePolicy")]
447 pub maintenance_policy: Option<MaintenancePolicy>,
448 /// Optional. The monitoring configuration for this instance.
449 #[serde(rename = "monitoringConfig")]
450 pub monitoring_config: Option<MonitoringConfig>,
451 /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
452 pub name: Option<String>,
453 /// Optional. Network configuration options. These are required when a private Data Fusion instance is to be created.
454 #[serde(rename = "networkConfig")]
455 pub network_config: Option<NetworkConfig>,
456 /// Optional. Map of additional options used to configure the behavior of Data Fusion instance.
457 pub options: Option<HashMap<String, String>>,
458 /// Output only. Service agent for the customer project.
459 #[serde(rename = "p4ServiceAccount")]
460 pub p4_service_account: Option<String>,
461 /// Optional. Current patch revision of the Data Fusion.
462 #[serde(rename = "patchRevision")]
463 pub patch_revision: Option<String>,
464 /// Optional. 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.
465 #[serde(rename = "privateInstance")]
466 pub private_instance: Option<bool>,
467 /// Output only. Reserved for future use.
468 #[serde(rename = "satisfiesPzi")]
469 pub satisfies_pzi: Option<bool>,
470 /// Output only. Reserved for future use.
471 #[serde(rename = "satisfiesPzs")]
472 pub satisfies_pzs: Option<bool>,
473 /// Output only. Deprecated. Use tenant_project_id instead to extract the tenant project ID.
474 #[serde(rename = "serviceAccount")]
475 pub service_account: Option<String>,
476 /// Output only. Endpoint on which the Data Fusion UI is accessible.
477 #[serde(rename = "serviceEndpoint")]
478 pub service_endpoint: Option<String>,
479 /// Output only. The current state of this Data Fusion instance.
480 pub state: Option<String>,
481 /// Output only. Additional information about the current state of this Data Fusion instance if available.
482 #[serde(rename = "stateMessage")]
483 pub state_message: Option<String>,
484 /// Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
485 pub tags: Option<HashMap<String, String>>,
486 /// Output only. The name of the tenant project.
487 #[serde(rename = "tenantProjectId")]
488 pub tenant_project_id: Option<String>,
489 /// Required. Instance type.
490 #[serde(rename = "type")]
491 pub type_: Option<String>,
492 /// Output only. The time the instance was last updated.
493 #[serde(rename = "updateTime")]
494 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
495 /// Optional. Current version of Data Fusion.
496 pub version: Option<String>,
497 /// Output only. Endpoint on which the Data Fusion UI is accessible to third-party users.
498 #[serde(rename = "workforceIdentityServiceEndpoint")]
499 pub workforce_identity_service_endpoint: Option<String>,
500 /// Optional. Name of the zone in which the Data Fusion instance will be created. Only DEVELOPER instances use this field.
501 pub zone: Option<String>,
502}
503
504impl common::RequestValue for Instance {}
505impl common::ResponseResult for Instance {}
506
507/// Response message for the list available versions request.
508///
509/// # Activities
510///
511/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
512/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
513///
514/// * [locations versions list projects](ProjectLocationVersionListCall) (response)
515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
516#[serde_with::serde_as]
517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
518pub struct ListAvailableVersionsResponse {
519 /// Represents a list of versions that are supported. Deprecated: Use versions field instead.
520 #[serde(rename = "availableVersions")]
521 pub available_versions: Option<Vec<Version>>,
522 /// Token to retrieve the next page of results or empty if there are no more results in the list.
523 #[serde(rename = "nextPageToken")]
524 pub next_page_token: Option<String>,
525 /// Represents a list of all versions.
526 pub versions: Option<Vec<Version>>,
527}
528
529impl common::ResponseResult for ListAvailableVersionsResponse {}
530
531/// Response message for list DNS peerings.
532///
533/// # Activities
534///
535/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
536/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
537///
538/// * [locations instances dns peerings list projects](ProjectLocationInstanceDnsPeeringListCall) (response)
539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
540#[serde_with::serde_as]
541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
542pub struct ListDnsPeeringsResponse {
543 /// List of dns peering.
544 #[serde(rename = "dnsPeerings")]
545 pub dns_peerings: Option<Vec<DnsPeering>>,
546 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
547 #[serde(rename = "nextPageToken")]
548 pub next_page_token: Option<String>,
549}
550
551impl common::ResponseResult for ListDnsPeeringsResponse {}
552
553/// Response message for the list instance request.
554///
555/// # Activities
556///
557/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
558/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
559///
560/// * [locations instances list projects](ProjectLocationInstanceListCall) (response)
561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
562#[serde_with::serde_as]
563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
564pub struct ListInstancesResponse {
565 /// Represents a list of Data Fusion instances.
566 pub instances: Option<Vec<Instance>>,
567 /// Token to retrieve the next page of results or empty if there are no more results in the list.
568 #[serde(rename = "nextPageToken")]
569 pub next_page_token: Option<String>,
570 /// Locations that could not be reached.
571 pub unreachable: Option<Vec<String>>,
572}
573
574impl common::ResponseResult for ListInstancesResponse {}
575
576/// The response message for Locations.ListLocations.
577///
578/// # Activities
579///
580/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
581/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
582///
583/// * [locations list projects](ProjectLocationListCall) (response)
584#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
585#[serde_with::serde_as]
586#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
587pub struct ListLocationsResponse {
588 /// A list of locations that matches the specified filter in the request.
589 pub locations: Option<Vec<Location>>,
590 /// The standard List next-page token.
591 #[serde(rename = "nextPageToken")]
592 pub next_page_token: Option<String>,
593}
594
595impl common::ResponseResult for ListLocationsResponse {}
596
597/// List namespaces response.
598///
599/// # Activities
600///
601/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
602/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
603///
604/// * [locations instances namespaces list projects](ProjectLocationInstanceNamespaceListCall) (response)
605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
606#[serde_with::serde_as]
607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
608pub struct ListNamespacesResponse {
609 /// List of namespaces
610 pub namespaces: Option<Vec<Namespace>>,
611 /// Token to retrieve the next page of results or empty if there are no more results in the list.
612 #[serde(rename = "nextPageToken")]
613 pub next_page_token: Option<String>,
614}
615
616impl common::ResponseResult for ListNamespacesResponse {}
617
618/// The response message for Operations.ListOperations.
619///
620/// # Activities
621///
622/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
623/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
624///
625/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct ListOperationsResponse {
630 /// The standard List next-page token.
631 #[serde(rename = "nextPageToken")]
632 pub next_page_token: Option<String>,
633 /// A list of operations that matches the specified filter in the request.
634 pub operations: Option<Vec<Operation>>,
635 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections e.g. when attempting to list all resources across all supported locations.
636 pub unreachable: Option<Vec<String>>,
637}
638
639impl common::ResponseResult for ListOperationsResponse {}
640
641/// A resource that represents a Google Cloud location.
642///
643/// # Activities
644///
645/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
646/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
647///
648/// * [locations get projects](ProjectLocationGetCall) (response)
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct Location {
653 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
654 #[serde(rename = "displayName")]
655 pub display_name: Option<String>,
656 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
657 pub labels: Option<HashMap<String, String>>,
658 /// The canonical id for this location. For example: `"us-east1"`.
659 #[serde(rename = "locationId")]
660 pub location_id: Option<String>,
661 /// Service-specific metadata. For example the available capacity at the given location.
662 pub metadata: Option<HashMap<String, serde_json::Value>>,
663 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
664 pub name: Option<String>,
665}
666
667impl common::ResponseResult for Location {}
668
669/// Logging configuration for a Data Fusion instance.
670///
671/// This type is not used in any activity, and only used as *part* of another schema.
672///
673#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
674#[serde_with::serde_as]
675#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
676pub struct LoggingConfig {
677 /// Optional. Option to determine whether instance logs should be written to Cloud Logging. By default, instance logs are written to Cloud Logging.
678 #[serde(rename = "instanceCloudLoggingDisabled")]
679 pub instance_cloud_logging_disabled: Option<bool>,
680}
681
682impl common::Part for LoggingConfig {}
683
684/// Represents a maintenance event.
685///
686/// This type is not used in any activity, and only used as *part* of another schema.
687///
688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
689#[serde_with::serde_as]
690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
691pub struct MaintenanceEvent {
692 /// Output only. The end time of the maintenance event provided in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. Example: "2024-01-02T12:04:06-06:00" This field will be empty if the maintenance event is not yet complete.
693 #[serde(rename = "endTime")]
694 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
695 /// Output only. The start time of the maintenance event provided in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. Example: "2024-01-01T12:04:06-04:00"
696 #[serde(rename = "startTime")]
697 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
698 /// Output only. The state of the maintenance event.
699 pub state: Option<String>,
700}
701
702impl common::Part for MaintenanceEvent {}
703
704/// Maintenance policy of the instance.
705///
706/// This type is not used in any activity, and only used as *part* of another schema.
707///
708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
709#[serde_with::serde_as]
710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
711pub struct MaintenancePolicy {
712 /// Optional. The maintenance exclusion window of the instance.
713 #[serde(rename = "maintenanceExclusionWindow")]
714 pub maintenance_exclusion_window: Option<TimeWindow>,
715 /// Optional. The maintenance window of the instance.
716 #[serde(rename = "maintenanceWindow")]
717 pub maintenance_window: Option<MaintenanceWindow>,
718}
719
720impl common::Part for MaintenancePolicy {}
721
722/// Maintenance window of the instance.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct MaintenanceWindow {
730 /// Required. The recurring time window of the maintenance window.
731 #[serde(rename = "recurringTimeWindow")]
732 pub recurring_time_window: Option<RecurringTimeWindow>,
733}
734
735impl common::Part for MaintenanceWindow {}
736
737/// Monitoring configuration for a Data Fusion instance.
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct MonitoringConfig {
745 /// Optional. Option to enable the instance v2 metrics for this instance. This field is supported only in CDF versions 6.11.1.1 and above.
746 #[serde(rename = "enableInstanceV2Metrics")]
747 pub enable_instance_v2_metrics: Option<bool>,
748}
749
750impl common::Part for MonitoringConfig {}
751
752/// Represents the information of a namespace
753///
754/// This type is not used in any activity, and only used as *part* of another schema.
755///
756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
757#[serde_with::serde_as]
758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
759pub struct Namespace {
760 /// IAM policy associated with this namespace.
761 #[serde(rename = "iamPolicy")]
762 pub iam_policy: Option<IAMPolicy>,
763 /// Name of the given namespace.
764 pub name: Option<String>,
765}
766
767impl common::Part for Namespace {}
768
769/// 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.
770///
771/// This type is not used in any activity, and only used as *part* of another schema.
772///
773#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
774#[serde_with::serde_as]
775#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
776pub struct NetworkConfig {
777 /// 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.
778 #[serde(rename = "connectionType")]
779 pub connection_type: Option<String>,
780 /// 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
781 #[serde(rename = "ipAllocation")]
782 pub ip_allocation: Option<String>,
783 /// 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.
784 pub network: Option<String>,
785 /// Optional. Configuration for Private Service Connect. This is required only when using connection type PRIVATE_SERVICE_CONNECT_INTERFACES.
786 #[serde(rename = "privateServiceConnectConfig")]
787 pub private_service_connect_config: Option<PrivateServiceConnectConfig>,
788}
789
790impl common::Part for NetworkConfig {}
791
792/// This resource represents a long-running operation that is the result of a network API call.
793///
794/// # Activities
795///
796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
798///
799/// * [locations instances create projects](ProjectLocationInstanceCreateCall) (response)
800/// * [locations instances delete projects](ProjectLocationInstanceDeleteCall) (response)
801/// * [locations instances patch projects](ProjectLocationInstancePatchCall) (response)
802/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (response)
803/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (response)
804/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
806#[serde_with::serde_as]
807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
808pub struct Operation {
809 /// 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.
810 pub done: Option<bool>,
811 /// The error result of the operation in case of failure or cancellation.
812 pub error: Option<Status>,
813 /// 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.
814 pub metadata: Option<HashMap<String, serde_json::Value>>,
815 /// 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}`.
816 pub name: Option<String>,
817 /// 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`.
818 pub response: Option<HashMap<String, serde_json::Value>>,
819}
820
821impl common::ResponseResult for Operation {}
822
823/// 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/).
824///
825/// # Activities
826///
827/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
828/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
829///
830/// * [locations instances namespaces get iam policy projects](ProjectLocationInstanceNamespaceGetIamPolicyCall) (response)
831/// * [locations instances namespaces set iam policy projects](ProjectLocationInstanceNamespaceSetIamPolicyCall) (response)
832/// * [locations instances get iam policy projects](ProjectLocationInstanceGetIamPolicyCall) (response)
833/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (response)
834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
835#[serde_with::serde_as]
836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
837pub struct Policy {
838 /// Specifies cloud audit logging configuration for this policy.
839 #[serde(rename = "auditConfigs")]
840 pub audit_configs: Option<Vec<AuditConfig>>,
841 /// 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`.
842 pub bindings: Option<Vec<Binding>>,
843 /// `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.
844 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
845 pub etag: Option<Vec<u8>>,
846 /// 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).
847 pub version: Option<i32>,
848}
849
850impl common::ResponseResult for Policy {}
851
852/// Configuration for using Private Service Connect to establish connectivity between the Data Fusion consumer project and the corresponding tenant project.
853///
854/// This type is not used in any activity, and only used as *part* of another schema.
855///
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct PrivateServiceConnectConfig {
860 /// 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
861 #[serde(rename = "effectiveUnreachableCidrBlock")]
862 pub effective_unreachable_cidr_block: Option<String>,
863 /// 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}.
864 #[serde(rename = "networkAttachment")]
865 pub network_attachment: Option<String>,
866 /// 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
867 #[serde(rename = "unreachableCidrBlock")]
868 pub unreachable_cidr_block: Option<String>,
869}
870
871impl common::Part for PrivateServiceConnectConfig {}
872
873/// Represents an arbitrary window of time that recurs.
874///
875/// This type is not used in any activity, and only used as *part* of another schema.
876///
877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
878#[serde_with::serde_as]
879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
880pub struct RecurringTimeWindow {
881 /// 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 ```
882 pub recurrence: Option<String>,
883 /// 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.
884 pub window: Option<TimeWindow>,
885}
886
887impl common::Part for RecurringTimeWindow {}
888
889/// Request message for RemoveIamPolicy method.
890///
891/// # Activities
892///
893/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
894/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
895///
896/// * [locations remove iam policy projects](ProjectLocationRemoveIamPolicyCall) (request)
897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
898#[serde_with::serde_as]
899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct RemoveIamPolicyRequest {
901 _never_set: Option<bool>,
902}
903
904impl common::RequestValue for RemoveIamPolicyRequest {}
905
906/// Response message for RemoveIamPolicy method.
907///
908/// # Activities
909///
910/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
911/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
912///
913/// * [locations remove iam policy projects](ProjectLocationRemoveIamPolicyCall) (response)
914#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
915#[serde_with::serde_as]
916#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
917pub struct RemoveIamPolicyResponse {
918 _never_set: Option<bool>,
919}
920
921impl common::ResponseResult for RemoveIamPolicyResponse {}
922
923/// Request message for restarting a Data Fusion instance.
924///
925/// # Activities
926///
927/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
928/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
929///
930/// * [locations instances restart projects](ProjectLocationInstanceRestartCall) (request)
931#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
932#[serde_with::serde_as]
933#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
934pub struct RestartInstanceRequest {
935 _never_set: Option<bool>,
936}
937
938impl common::RequestValue for RestartInstanceRequest {}
939
940/// Request message for `SetIamPolicy` method.
941///
942/// # Activities
943///
944/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
945/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
946///
947/// * [locations instances namespaces set iam policy projects](ProjectLocationInstanceNamespaceSetIamPolicyCall) (request)
948/// * [locations instances set iam policy projects](ProjectLocationInstanceSetIamPolicyCall) (request)
949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
950#[serde_with::serde_as]
951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
952pub struct SetIamPolicyRequest {
953 /// 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.
954 pub policy: Option<Policy>,
955 /// 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"`
956 #[serde(rename = "updateMask")]
957 pub update_mask: Option<common::FieldMask>,
958}
959
960impl common::RequestValue for SetIamPolicyRequest {}
961
962/// 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).
963///
964/// This type is not used in any activity, and only used as *part* of another schema.
965///
966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
967#[serde_with::serde_as]
968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
969pub struct Status {
970 /// The status code, which should be an enum value of google.rpc.Code.
971 pub code: Option<i32>,
972 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
973 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
974 /// 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.
975 pub message: Option<String>,
976}
977
978impl common::Part for Status {}
979
980/// Request message for `TestIamPermissions` method.
981///
982/// # Activities
983///
984/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
985/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
986///
987/// * [locations instances namespaces test iam permissions projects](ProjectLocationInstanceNamespaceTestIamPermissionCall) (request)
988/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (request)
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct TestIamPermissionsRequest {
993 /// 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).
994 pub permissions: Option<Vec<String>>,
995}
996
997impl common::RequestValue for TestIamPermissionsRequest {}
998
999/// Response message for `TestIamPermissions` method.
1000///
1001/// # Activities
1002///
1003/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1004/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1005///
1006/// * [locations instances namespaces test iam permissions projects](ProjectLocationInstanceNamespaceTestIamPermissionCall) (response)
1007/// * [locations instances test iam permissions projects](ProjectLocationInstanceTestIamPermissionCall) (response)
1008#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1009#[serde_with::serde_as]
1010#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1011pub struct TestIamPermissionsResponse {
1012 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1013 pub permissions: Option<Vec<String>>,
1014}
1015
1016impl common::ResponseResult for TestIamPermissionsResponse {}
1017
1018/// Represents an arbitrary window of time.
1019///
1020/// This type is not used in any activity, and only used as *part* of another schema.
1021///
1022#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1023#[serde_with::serde_as]
1024#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1025pub struct TimeWindow {
1026 /// 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"
1027 #[serde(rename = "endTime")]
1028 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1029 /// 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"
1030 #[serde(rename = "startTime")]
1031 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1032}
1033
1034impl common::Part for TimeWindow {}
1035
1036/// Request message for upgrading a Data Fusion instance. To change the instance properties, instance update should be used.
1037///
1038/// # Activities
1039///
1040/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1041/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1042///
1043/// * [locations instances upgrade projects](ProjectLocationInstanceUpgradeCall) (request)
1044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1045#[serde_with::serde_as]
1046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1047pub struct UpgradeInstanceRequest {
1048 _never_set: Option<bool>,
1049}
1050
1051impl common::RequestValue for UpgradeInstanceRequest {}
1052
1053/// The Data Fusion version.
1054///
1055/// This type is not used in any activity, and only used as *part* of another schema.
1056///
1057#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1058#[serde_with::serde_as]
1059#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1060pub struct Version {
1061 /// Represents a list of available feature names for a given version.
1062 #[serde(rename = "availableFeatures")]
1063 pub available_features: Option<Vec<String>>,
1064 /// Whether this is currently the default version for Cloud Data Fusion
1065 #[serde(rename = "defaultVersion")]
1066 pub default_version: Option<bool>,
1067 /// Type represents the release availability of the version
1068 #[serde(rename = "type")]
1069 pub type_: Option<String>,
1070 /// The version number of the Data Fusion instance, such as '6.0.1.0'.
1071 #[serde(rename = "versionNumber")]
1072 pub version_number: Option<String>,
1073}
1074
1075impl common::Part for Version {}
1076
1077// ###################
1078// MethodBuilders ###
1079// #################
1080
1081/// A builder providing access to all methods supported on *project* resources.
1082/// It is not used directly, but through the [`DataFusion`] hub.
1083///
1084/// # Example
1085///
1086/// Instantiate a resource builder
1087///
1088/// ```test_harness,no_run
1089/// extern crate hyper;
1090/// extern crate hyper_rustls;
1091/// extern crate google_datafusion1_beta1 as datafusion1_beta1;
1092///
1093/// # async fn dox() {
1094/// use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1095///
1096/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1097/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1098/// .with_native_roots()
1099/// .unwrap()
1100/// .https_only()
1101/// .enable_http2()
1102/// .build();
1103///
1104/// let executor = hyper_util::rt::TokioExecutor::new();
1105/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1106/// secret,
1107/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1108/// yup_oauth2::client::CustomHyperClientBuilder::from(
1109/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1110/// ),
1111/// ).build().await.unwrap();
1112///
1113/// let client = hyper_util::client::legacy::Client::builder(
1114/// hyper_util::rt::TokioExecutor::new()
1115/// )
1116/// .build(
1117/// hyper_rustls::HttpsConnectorBuilder::new()
1118/// .with_native_roots()
1119/// .unwrap()
1120/// .https_or_http()
1121/// .enable_http2()
1122/// .build()
1123/// );
1124/// let mut hub = DataFusion::new(client, auth);
1125/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1126/// // 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(...)`
1127/// // to build up your call.
1128/// let rb = hub.projects();
1129/// # }
1130/// ```
1131pub struct ProjectMethods<'a, C>
1132where
1133 C: 'a,
1134{
1135 hub: &'a DataFusion<C>,
1136}
1137
1138impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1139
1140impl<'a, C> ProjectMethods<'a, C> {
1141 /// Create a builder to help you perform the following task:
1142 ///
1143 /// Creates DNS peering on the given resource.
1144 ///
1145 /// # Arguments
1146 ///
1147 /// * `request` - No description provided.
1148 /// * `parent` - Required. The resource on which DNS peering will be created.
1149 pub fn locations_instances_dns_peerings_create(
1150 &self,
1151 request: DnsPeering,
1152 parent: &str,
1153 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1154 ProjectLocationInstanceDnsPeeringCreateCall {
1155 hub: self.hub,
1156 _request: request,
1157 _parent: parent.to_string(),
1158 _dns_peering_id: Default::default(),
1159 _delegate: Default::default(),
1160 _additional_params: Default::default(),
1161 _scopes: Default::default(),
1162 }
1163 }
1164
1165 /// Create a builder to help you perform the following task:
1166 ///
1167 /// Deletes DNS peering on the given resource.
1168 ///
1169 /// # Arguments
1170 ///
1171 /// * `name` - Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
1172 pub fn locations_instances_dns_peerings_delete(
1173 &self,
1174 name: &str,
1175 ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
1176 ProjectLocationInstanceDnsPeeringDeleteCall {
1177 hub: self.hub,
1178 _name: name.to_string(),
1179 _delegate: Default::default(),
1180 _additional_params: Default::default(),
1181 _scopes: Default::default(),
1182 }
1183 }
1184
1185 /// Create a builder to help you perform the following task:
1186 ///
1187 /// Lists DNS peerings for a given resource.
1188 ///
1189 /// # Arguments
1190 ///
1191 /// * `parent` - Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
1192 pub fn locations_instances_dns_peerings_list(
1193 &self,
1194 parent: &str,
1195 ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
1196 ProjectLocationInstanceDnsPeeringListCall {
1197 hub: self.hub,
1198 _parent: parent.to_string(),
1199 _page_token: Default::default(),
1200 _page_size: Default::default(),
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 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1210 ///
1211 /// # Arguments
1212 ///
1213 /// * `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.
1214 pub fn locations_instances_namespaces_get_iam_policy(
1215 &self,
1216 resource: &str,
1217 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
1218 ProjectLocationInstanceNamespaceGetIamPolicyCall {
1219 hub: self.hub,
1220 _resource: resource.to_string(),
1221 _options_requested_policy_version: Default::default(),
1222 _delegate: Default::default(),
1223 _additional_params: Default::default(),
1224 _scopes: Default::default(),
1225 }
1226 }
1227
1228 /// Create a builder to help you perform the following task:
1229 ///
1230 /// List namespaces in a given instance
1231 ///
1232 /// # Arguments
1233 ///
1234 /// * `parent` - Required. The instance to list its namespaces.
1235 pub fn locations_instances_namespaces_list(
1236 &self,
1237 parent: &str,
1238 ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
1239 ProjectLocationInstanceNamespaceListCall {
1240 hub: self.hub,
1241 _parent: parent.to_string(),
1242 _view: Default::default(),
1243 _page_token: Default::default(),
1244 _page_size: Default::default(),
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 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1254 ///
1255 /// # Arguments
1256 ///
1257 /// * `request` - No description provided.
1258 /// * `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.
1259 pub fn locations_instances_namespaces_set_iam_policy(
1260 &self,
1261 request: SetIamPolicyRequest,
1262 resource: &str,
1263 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
1264 ProjectLocationInstanceNamespaceSetIamPolicyCall {
1265 hub: self.hub,
1266 _request: request,
1267 _resource: resource.to_string(),
1268 _delegate: Default::default(),
1269 _additional_params: Default::default(),
1270 _scopes: Default::default(),
1271 }
1272 }
1273
1274 /// Create a builder to help you perform the following task:
1275 ///
1276 /// 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.
1277 ///
1278 /// # Arguments
1279 ///
1280 /// * `request` - No description provided.
1281 /// * `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.
1282 pub fn locations_instances_namespaces_test_iam_permissions(
1283 &self,
1284 request: TestIamPermissionsRequest,
1285 resource: &str,
1286 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
1287 ProjectLocationInstanceNamespaceTestIamPermissionCall {
1288 hub: self.hub,
1289 _request: request,
1290 _resource: resource.to_string(),
1291 _delegate: Default::default(),
1292 _additional_params: Default::default(),
1293 _scopes: Default::default(),
1294 }
1295 }
1296
1297 /// Create a builder to help you perform the following task:
1298 ///
1299 /// Creates a new Data Fusion instance in the specified project and location.
1300 ///
1301 /// # Arguments
1302 ///
1303 /// * `request` - No description provided.
1304 /// * `parent` - Required. The instance's project and location in the format projects/{project}/locations/{location}.
1305 pub fn locations_instances_create(
1306 &self,
1307 request: Instance,
1308 parent: &str,
1309 ) -> ProjectLocationInstanceCreateCall<'a, C> {
1310 ProjectLocationInstanceCreateCall {
1311 hub: self.hub,
1312 _request: request,
1313 _parent: parent.to_string(),
1314 _instance_id: Default::default(),
1315 _delegate: Default::default(),
1316 _additional_params: Default::default(),
1317 _scopes: Default::default(),
1318 }
1319 }
1320
1321 /// Create a builder to help you perform the following task:
1322 ///
1323 /// Deletes a single Data Fusion instance.
1324 ///
1325 /// # Arguments
1326 ///
1327 /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
1328 pub fn locations_instances_delete(
1329 &self,
1330 name: &str,
1331 ) -> ProjectLocationInstanceDeleteCall<'a, C> {
1332 ProjectLocationInstanceDeleteCall {
1333 hub: self.hub,
1334 _name: name.to_string(),
1335 _force: Default::default(),
1336 _delegate: Default::default(),
1337 _additional_params: Default::default(),
1338 _scopes: Default::default(),
1339 }
1340 }
1341
1342 /// Create a builder to help you perform the following task:
1343 ///
1344 /// Gets details of a single Data Fusion instance.
1345 ///
1346 /// # Arguments
1347 ///
1348 /// * `name` - Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
1349 pub fn locations_instances_get(&self, name: &str) -> ProjectLocationInstanceGetCall<'a, C> {
1350 ProjectLocationInstanceGetCall {
1351 hub: self.hub,
1352 _name: name.to_string(),
1353 _delegate: Default::default(),
1354 _additional_params: Default::default(),
1355 _scopes: Default::default(),
1356 }
1357 }
1358
1359 /// Create a builder to help you perform the following task:
1360 ///
1361 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1362 ///
1363 /// # Arguments
1364 ///
1365 /// * `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.
1366 pub fn locations_instances_get_iam_policy(
1367 &self,
1368 resource: &str,
1369 ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
1370 ProjectLocationInstanceGetIamPolicyCall {
1371 hub: self.hub,
1372 _resource: resource.to_string(),
1373 _options_requested_policy_version: Default::default(),
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 /// Lists Data Fusion instances in the specified project and location.
1383 ///
1384 /// # Arguments
1385 ///
1386 /// * `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.
1387 pub fn locations_instances_list(&self, parent: &str) -> ProjectLocationInstanceListCall<'a, C> {
1388 ProjectLocationInstanceListCall {
1389 hub: self.hub,
1390 _parent: parent.to_string(),
1391 _page_token: Default::default(),
1392 _page_size: Default::default(),
1393 _order_by: Default::default(),
1394 _filter: Default::default(),
1395 _delegate: Default::default(),
1396 _additional_params: Default::default(),
1397 _scopes: Default::default(),
1398 }
1399 }
1400
1401 /// Create a builder to help you perform the following task:
1402 ///
1403 /// Updates a single Data Fusion instance.
1404 ///
1405 /// # Arguments
1406 ///
1407 /// * `request` - No description provided.
1408 /// * `name` - Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
1409 pub fn locations_instances_patch(
1410 &self,
1411 request: Instance,
1412 name: &str,
1413 ) -> ProjectLocationInstancePatchCall<'a, C> {
1414 ProjectLocationInstancePatchCall {
1415 hub: self.hub,
1416 _request: request,
1417 _name: name.to_string(),
1418 _update_mask: Default::default(),
1419 _delegate: Default::default(),
1420 _additional_params: Default::default(),
1421 _scopes: Default::default(),
1422 }
1423 }
1424
1425 /// Create a builder to help you perform the following task:
1426 ///
1427 /// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
1428 ///
1429 /// # Arguments
1430 ///
1431 /// * `request` - No description provided.
1432 /// * `name` - Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
1433 pub fn locations_instances_restart(
1434 &self,
1435 request: RestartInstanceRequest,
1436 name: &str,
1437 ) -> ProjectLocationInstanceRestartCall<'a, C> {
1438 ProjectLocationInstanceRestartCall {
1439 hub: self.hub,
1440 _request: request,
1441 _name: name.to_string(),
1442 _delegate: Default::default(),
1443 _additional_params: Default::default(),
1444 _scopes: Default::default(),
1445 }
1446 }
1447
1448 /// Create a builder to help you perform the following task:
1449 ///
1450 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
1451 ///
1452 /// # Arguments
1453 ///
1454 /// * `request` - No description provided.
1455 /// * `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.
1456 pub fn locations_instances_set_iam_policy(
1457 &self,
1458 request: SetIamPolicyRequest,
1459 resource: &str,
1460 ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
1461 ProjectLocationInstanceSetIamPolicyCall {
1462 hub: self.hub,
1463 _request: request,
1464 _resource: resource.to_string(),
1465 _delegate: Default::default(),
1466 _additional_params: Default::default(),
1467 _scopes: Default::default(),
1468 }
1469 }
1470
1471 /// Create a builder to help you perform the following task:
1472 ///
1473 /// 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.
1474 ///
1475 /// # Arguments
1476 ///
1477 /// * `request` - No description provided.
1478 /// * `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.
1479 pub fn locations_instances_test_iam_permissions(
1480 &self,
1481 request: TestIamPermissionsRequest,
1482 resource: &str,
1483 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
1484 ProjectLocationInstanceTestIamPermissionCall {
1485 hub: self.hub,
1486 _request: request,
1487 _resource: resource.to_string(),
1488 _delegate: Default::default(),
1489 _additional_params: Default::default(),
1490 _scopes: Default::default(),
1491 }
1492 }
1493
1494 /// Create a builder to help you perform the following task:
1495 ///
1496 /// Upgrade a single Data Fusion instance. At the end of an operation instance is fully upgraded.
1497 ///
1498 /// # Arguments
1499 ///
1500 /// * `request` - No description provided.
1501 /// * `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.
1502 pub fn locations_instances_upgrade(
1503 &self,
1504 request: UpgradeInstanceRequest,
1505 name: &str,
1506 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
1507 ProjectLocationInstanceUpgradeCall {
1508 hub: self.hub,
1509 _request: request,
1510 _name: name.to_string(),
1511 _delegate: Default::default(),
1512 _additional_params: Default::default(),
1513 _scopes: Default::default(),
1514 }
1515 }
1516
1517 /// Create a builder to help you perform the following task:
1518 ///
1519 /// 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`.
1520 ///
1521 /// # Arguments
1522 ///
1523 /// * `request` - No description provided.
1524 /// * `name` - The name of the operation resource to be cancelled.
1525 pub fn locations_operations_cancel(
1526 &self,
1527 request: CancelOperationRequest,
1528 name: &str,
1529 ) -> ProjectLocationOperationCancelCall<'a, C> {
1530 ProjectLocationOperationCancelCall {
1531 hub: self.hub,
1532 _request: request,
1533 _name: name.to_string(),
1534 _delegate: Default::default(),
1535 _additional_params: Default::default(),
1536 _scopes: Default::default(),
1537 }
1538 }
1539
1540 /// Create a builder to help you perform the following task:
1541 ///
1542 /// 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`.
1543 ///
1544 /// # Arguments
1545 ///
1546 /// * `name` - The name of the operation resource to be deleted.
1547 pub fn locations_operations_delete(
1548 &self,
1549 name: &str,
1550 ) -> ProjectLocationOperationDeleteCall<'a, C> {
1551 ProjectLocationOperationDeleteCall {
1552 hub: self.hub,
1553 _name: name.to_string(),
1554 _delegate: Default::default(),
1555 _additional_params: Default::default(),
1556 _scopes: Default::default(),
1557 }
1558 }
1559
1560 /// Create a builder to help you perform the following task:
1561 ///
1562 /// 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.
1563 ///
1564 /// # Arguments
1565 ///
1566 /// * `name` - The name of the operation resource.
1567 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1568 ProjectLocationOperationGetCall {
1569 hub: self.hub,
1570 _name: name.to_string(),
1571 _delegate: Default::default(),
1572 _additional_params: Default::default(),
1573 _scopes: Default::default(),
1574 }
1575 }
1576
1577 /// Create a builder to help you perform the following task:
1578 ///
1579 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1580 ///
1581 /// # Arguments
1582 ///
1583 /// * `name` - The name of the operation's parent resource.
1584 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1585 ProjectLocationOperationListCall {
1586 hub: self.hub,
1587 _name: name.to_string(),
1588 _return_partial_success: Default::default(),
1589 _page_token: Default::default(),
1590 _page_size: Default::default(),
1591 _filter: Default::default(),
1592 _delegate: Default::default(),
1593 _additional_params: Default::default(),
1594 _scopes: Default::default(),
1595 }
1596 }
1597
1598 /// Create a builder to help you perform the following task:
1599 ///
1600 /// Lists possible versions for Data Fusion instances in the specified project and location.
1601 ///
1602 /// # Arguments
1603 ///
1604 /// * `parent` - Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
1605 pub fn locations_versions_list(&self, parent: &str) -> ProjectLocationVersionListCall<'a, C> {
1606 ProjectLocationVersionListCall {
1607 hub: self.hub,
1608 _parent: parent.to_string(),
1609 _page_token: Default::default(),
1610 _page_size: Default::default(),
1611 _latest_patch_only: Default::default(),
1612 _delegate: Default::default(),
1613 _additional_params: Default::default(),
1614 _scopes: Default::default(),
1615 }
1616 }
1617
1618 /// Create a builder to help you perform the following task:
1619 ///
1620 /// Gets information about a location.
1621 ///
1622 /// # Arguments
1623 ///
1624 /// * `name` - Resource name for the location.
1625 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
1626 ProjectLocationGetCall {
1627 hub: self.hub,
1628 _name: name.to_string(),
1629 _delegate: Default::default(),
1630 _additional_params: Default::default(),
1631 _scopes: Default::default(),
1632 }
1633 }
1634
1635 /// Create a builder to help you perform the following task:
1636 ///
1637 /// Lists information about the supported locations for this service.
1638 ///
1639 /// # Arguments
1640 ///
1641 /// * `name` - The resource that owns the locations collection, if applicable.
1642 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
1643 ProjectLocationListCall {
1644 hub: self.hub,
1645 _name: name.to_string(),
1646 _page_token: Default::default(),
1647 _page_size: Default::default(),
1648 _filter: Default::default(),
1649 _extra_location_types: Default::default(),
1650 _delegate: Default::default(),
1651 _additional_params: Default::default(),
1652 _scopes: Default::default(),
1653 }
1654 }
1655
1656 /// Create a builder to help you perform the following task:
1657 ///
1658 /// Remove IAM policy that is currently set on the given resource.
1659 ///
1660 /// # Arguments
1661 ///
1662 /// * `request` - No description provided.
1663 /// * `resource` - Required. The resource on which IAM policy to be removed is attached to.
1664 pub fn locations_remove_iam_policy(
1665 &self,
1666 request: RemoveIamPolicyRequest,
1667 resource: &str,
1668 ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
1669 ProjectLocationRemoveIamPolicyCall {
1670 hub: self.hub,
1671 _request: request,
1672 _resource: resource.to_string(),
1673 _delegate: Default::default(),
1674 _additional_params: Default::default(),
1675 _scopes: Default::default(),
1676 }
1677 }
1678}
1679
1680// ###################
1681// CallBuilders ###
1682// #################
1683
1684/// Creates DNS peering on the given resource.
1685///
1686/// A builder for the *locations.instances.dnsPeerings.create* method supported by a *project* resource.
1687/// It is not used directly, but through a [`ProjectMethods`] instance.
1688///
1689/// # Example
1690///
1691/// Instantiate a resource method builder
1692///
1693/// ```test_harness,no_run
1694/// # extern crate hyper;
1695/// # extern crate hyper_rustls;
1696/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
1697/// use datafusion1_beta1::api::DnsPeering;
1698/// # async fn dox() {
1699/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1700///
1701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1702/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1703/// # .with_native_roots()
1704/// # .unwrap()
1705/// # .https_only()
1706/// # .enable_http2()
1707/// # .build();
1708///
1709/// # let executor = hyper_util::rt::TokioExecutor::new();
1710/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1711/// # secret,
1712/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1713/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1714/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1715/// # ),
1716/// # ).build().await.unwrap();
1717///
1718/// # let client = hyper_util::client::legacy::Client::builder(
1719/// # hyper_util::rt::TokioExecutor::new()
1720/// # )
1721/// # .build(
1722/// # hyper_rustls::HttpsConnectorBuilder::new()
1723/// # .with_native_roots()
1724/// # .unwrap()
1725/// # .https_or_http()
1726/// # .enable_http2()
1727/// # .build()
1728/// # );
1729/// # let mut hub = DataFusion::new(client, auth);
1730/// // As the method needs a request, you would usually fill it with the desired information
1731/// // into the respective structure. Some of the parts shown here might not be applicable !
1732/// // Values shown here are possibly random and not representative !
1733/// let mut req = DnsPeering::default();
1734///
1735/// // You can configure optional parameters by calling the respective setters at will, and
1736/// // execute the final call using `doit()`.
1737/// // Values shown here are possibly random and not representative !
1738/// let result = hub.projects().locations_instances_dns_peerings_create(req, "parent")
1739/// .dns_peering_id("sed")
1740/// .doit().await;
1741/// # }
1742/// ```
1743pub struct ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1744where
1745 C: 'a,
1746{
1747 hub: &'a DataFusion<C>,
1748 _request: DnsPeering,
1749 _parent: String,
1750 _dns_peering_id: Option<String>,
1751 _delegate: Option<&'a mut dyn common::Delegate>,
1752 _additional_params: HashMap<String, String>,
1753 _scopes: BTreeSet<String>,
1754}
1755
1756impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {}
1757
1758impl<'a, C> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1759where
1760 C: common::Connector,
1761{
1762 /// Perform the operation you have build so far.
1763 pub async fn doit(mut self) -> common::Result<(common::Response, DnsPeering)> {
1764 use std::borrow::Cow;
1765 use std::io::{Read, Seek};
1766
1767 use common::{url::Params, ToParts};
1768 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1769
1770 let mut dd = common::DefaultDelegate;
1771 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1772 dlg.begin(common::MethodInfo {
1773 id: "datafusion.projects.locations.instances.dnsPeerings.create",
1774 http_method: hyper::Method::POST,
1775 });
1776
1777 for &field in ["alt", "parent", "dnsPeeringId"].iter() {
1778 if self._additional_params.contains_key(field) {
1779 dlg.finished(false);
1780 return Err(common::Error::FieldClash(field));
1781 }
1782 }
1783
1784 let mut params = Params::with_capacity(5 + self._additional_params.len());
1785 params.push("parent", self._parent);
1786 if let Some(value) = self._dns_peering_id.as_ref() {
1787 params.push("dnsPeeringId", value);
1788 }
1789
1790 params.extend(self._additional_params.iter());
1791
1792 params.push("alt", "json");
1793 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dnsPeerings";
1794 if self._scopes.is_empty() {
1795 self._scopes
1796 .insert(Scope::CloudPlatform.as_ref().to_string());
1797 }
1798
1799 #[allow(clippy::single_element_loop)]
1800 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1801 url = params.uri_replacement(url, param_name, find_this, true);
1802 }
1803 {
1804 let to_remove = ["parent"];
1805 params.remove_params(&to_remove);
1806 }
1807
1808 let url = params.parse_with_url(&url);
1809
1810 let mut json_mime_type = mime::APPLICATION_JSON;
1811 let mut request_value_reader = {
1812 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1813 common::remove_json_null_values(&mut value);
1814 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1815 serde_json::to_writer(&mut dst, &value).unwrap();
1816 dst
1817 };
1818 let request_size = request_value_reader
1819 .seek(std::io::SeekFrom::End(0))
1820 .unwrap();
1821 request_value_reader
1822 .seek(std::io::SeekFrom::Start(0))
1823 .unwrap();
1824
1825 loop {
1826 let token = match self
1827 .hub
1828 .auth
1829 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1830 .await
1831 {
1832 Ok(token) => token,
1833 Err(e) => match dlg.token(e) {
1834 Ok(token) => token,
1835 Err(e) => {
1836 dlg.finished(false);
1837 return Err(common::Error::MissingToken(e));
1838 }
1839 },
1840 };
1841 request_value_reader
1842 .seek(std::io::SeekFrom::Start(0))
1843 .unwrap();
1844 let mut req_result = {
1845 let client = &self.hub.client;
1846 dlg.pre_request();
1847 let mut req_builder = hyper::Request::builder()
1848 .method(hyper::Method::POST)
1849 .uri(url.as_str())
1850 .header(USER_AGENT, self.hub._user_agent.clone());
1851
1852 if let Some(token) = token.as_ref() {
1853 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1854 }
1855
1856 let request = req_builder
1857 .header(CONTENT_TYPE, json_mime_type.to_string())
1858 .header(CONTENT_LENGTH, request_size as u64)
1859 .body(common::to_body(
1860 request_value_reader.get_ref().clone().into(),
1861 ));
1862
1863 client.request(request.unwrap()).await
1864 };
1865
1866 match req_result {
1867 Err(err) => {
1868 if let common::Retry::After(d) = dlg.http_error(&err) {
1869 sleep(d).await;
1870 continue;
1871 }
1872 dlg.finished(false);
1873 return Err(common::Error::HttpError(err));
1874 }
1875 Ok(res) => {
1876 let (mut parts, body) = res.into_parts();
1877 let mut body = common::Body::new(body);
1878 if !parts.status.is_success() {
1879 let bytes = common::to_bytes(body).await.unwrap_or_default();
1880 let error = serde_json::from_str(&common::to_string(&bytes));
1881 let response = common::to_response(parts, bytes.into());
1882
1883 if let common::Retry::After(d) =
1884 dlg.http_failure(&response, error.as_ref().ok())
1885 {
1886 sleep(d).await;
1887 continue;
1888 }
1889
1890 dlg.finished(false);
1891
1892 return Err(match error {
1893 Ok(value) => common::Error::BadRequest(value),
1894 _ => common::Error::Failure(response),
1895 });
1896 }
1897 let response = {
1898 let bytes = common::to_bytes(body).await.unwrap_or_default();
1899 let encoded = common::to_string(&bytes);
1900 match serde_json::from_str(&encoded) {
1901 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
1902 Err(error) => {
1903 dlg.response_json_decode_error(&encoded, &error);
1904 return Err(common::Error::JsonDecodeError(
1905 encoded.to_string(),
1906 error,
1907 ));
1908 }
1909 }
1910 };
1911
1912 dlg.finished(true);
1913 return Ok(response);
1914 }
1915 }
1916 }
1917 }
1918
1919 ///
1920 /// Sets the *request* property to the given value.
1921 ///
1922 /// Even though the property as already been set when instantiating this call,
1923 /// we provide this method for API completeness.
1924 pub fn request(
1925 mut self,
1926 new_value: DnsPeering,
1927 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1928 self._request = new_value;
1929 self
1930 }
1931 /// Required. The resource on which DNS peering will be created.
1932 ///
1933 /// Sets the *parent* path property to the given value.
1934 ///
1935 /// Even though the property as already been set when instantiating this call,
1936 /// we provide this method for API completeness.
1937 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1938 self._parent = new_value.to_string();
1939 self
1940 }
1941 /// Required. The name of the peering to create.
1942 ///
1943 /// Sets the *dns peering id* query property to the given value.
1944 pub fn dns_peering_id(
1945 mut self,
1946 new_value: &str,
1947 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1948 self._dns_peering_id = Some(new_value.to_string());
1949 self
1950 }
1951 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
1952 /// while executing the actual API request.
1953 ///
1954 /// ````text
1955 /// It should be used to handle progress information, and to implement a certain level of resilience.
1956 /// ````
1957 ///
1958 /// Sets the *delegate* property to the given value.
1959 pub fn delegate(
1960 mut self,
1961 new_value: &'a mut dyn common::Delegate,
1962 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
1963 self._delegate = Some(new_value);
1964 self
1965 }
1966
1967 /// Set any additional parameter of the query string used in the request.
1968 /// It should be used to set parameters which are not yet available through their own
1969 /// setters.
1970 ///
1971 /// Please note that this method must not be used to set any of the known parameters
1972 /// which have their own setter method. If done anyway, the request will fail.
1973 ///
1974 /// # Additional Parameters
1975 ///
1976 /// * *$.xgafv* (query-string) - V1 error format.
1977 /// * *access_token* (query-string) - OAuth access token.
1978 /// * *alt* (query-string) - Data format for response.
1979 /// * *callback* (query-string) - JSONP
1980 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
1981 /// * *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.
1982 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
1983 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
1984 /// * *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.
1985 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
1986 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
1987 pub fn param<T>(
1988 mut self,
1989 name: T,
1990 value: T,
1991 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
1992 where
1993 T: AsRef<str>,
1994 {
1995 self._additional_params
1996 .insert(name.as_ref().to_string(), value.as_ref().to_string());
1997 self
1998 }
1999
2000 /// Identifies the authorization scope for the method you are building.
2001 ///
2002 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2003 /// [`Scope::CloudPlatform`].
2004 ///
2005 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2006 /// tokens for more than one scope.
2007 ///
2008 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2009 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2010 /// sufficient, a read-write scope will do as well.
2011 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
2012 where
2013 St: AsRef<str>,
2014 {
2015 self._scopes.insert(String::from(scope.as_ref()));
2016 self
2017 }
2018 /// Identifies the authorization scope(s) for the method you are building.
2019 ///
2020 /// See [`Self::add_scope()`] for details.
2021 pub fn add_scopes<I, St>(
2022 mut self,
2023 scopes: I,
2024 ) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C>
2025 where
2026 I: IntoIterator<Item = St>,
2027 St: AsRef<str>,
2028 {
2029 self._scopes
2030 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2031 self
2032 }
2033
2034 /// Removes all scopes, and no default scope will be used either.
2035 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2036 /// for details).
2037 pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringCreateCall<'a, C> {
2038 self._scopes.clear();
2039 self
2040 }
2041}
2042
2043/// Deletes DNS peering on the given resource.
2044///
2045/// A builder for the *locations.instances.dnsPeerings.delete* method supported by a *project* resource.
2046/// It is not used directly, but through a [`ProjectMethods`] instance.
2047///
2048/// # Example
2049///
2050/// Instantiate a resource method builder
2051///
2052/// ```test_harness,no_run
2053/// # extern crate hyper;
2054/// # extern crate hyper_rustls;
2055/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2056/// # async fn dox() {
2057/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2058///
2059/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2060/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2061/// # .with_native_roots()
2062/// # .unwrap()
2063/// # .https_only()
2064/// # .enable_http2()
2065/// # .build();
2066///
2067/// # let executor = hyper_util::rt::TokioExecutor::new();
2068/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2069/// # secret,
2070/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2071/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2072/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2073/// # ),
2074/// # ).build().await.unwrap();
2075///
2076/// # let client = hyper_util::client::legacy::Client::builder(
2077/// # hyper_util::rt::TokioExecutor::new()
2078/// # )
2079/// # .build(
2080/// # hyper_rustls::HttpsConnectorBuilder::new()
2081/// # .with_native_roots()
2082/// # .unwrap()
2083/// # .https_or_http()
2084/// # .enable_http2()
2085/// # .build()
2086/// # );
2087/// # let mut hub = DataFusion::new(client, auth);
2088/// // You can configure optional parameters by calling the respective setters at will, and
2089/// // execute the final call using `doit()`.
2090/// // Values shown here are possibly random and not representative !
2091/// let result = hub.projects().locations_instances_dns_peerings_delete("name")
2092/// .doit().await;
2093/// # }
2094/// ```
2095pub struct ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2096where
2097 C: 'a,
2098{
2099 hub: &'a DataFusion<C>,
2100 _name: String,
2101 _delegate: Option<&'a mut dyn common::Delegate>,
2102 _additional_params: HashMap<String, String>,
2103 _scopes: BTreeSet<String>,
2104}
2105
2106impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {}
2107
2108impl<'a, C> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2109where
2110 C: common::Connector,
2111{
2112 /// Perform the operation you have build so far.
2113 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2114 use std::borrow::Cow;
2115 use std::io::{Read, Seek};
2116
2117 use common::{url::Params, ToParts};
2118 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2119
2120 let mut dd = common::DefaultDelegate;
2121 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2122 dlg.begin(common::MethodInfo {
2123 id: "datafusion.projects.locations.instances.dnsPeerings.delete",
2124 http_method: hyper::Method::DELETE,
2125 });
2126
2127 for &field in ["alt", "name"].iter() {
2128 if self._additional_params.contains_key(field) {
2129 dlg.finished(false);
2130 return Err(common::Error::FieldClash(field));
2131 }
2132 }
2133
2134 let mut params = Params::with_capacity(3 + self._additional_params.len());
2135 params.push("name", self._name);
2136
2137 params.extend(self._additional_params.iter());
2138
2139 params.push("alt", "json");
2140 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
2141 if self._scopes.is_empty() {
2142 self._scopes
2143 .insert(Scope::CloudPlatform.as_ref().to_string());
2144 }
2145
2146 #[allow(clippy::single_element_loop)]
2147 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2148 url = params.uri_replacement(url, param_name, find_this, true);
2149 }
2150 {
2151 let to_remove = ["name"];
2152 params.remove_params(&to_remove);
2153 }
2154
2155 let url = params.parse_with_url(&url);
2156
2157 loop {
2158 let token = match self
2159 .hub
2160 .auth
2161 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2162 .await
2163 {
2164 Ok(token) => token,
2165 Err(e) => match dlg.token(e) {
2166 Ok(token) => token,
2167 Err(e) => {
2168 dlg.finished(false);
2169 return Err(common::Error::MissingToken(e));
2170 }
2171 },
2172 };
2173 let mut req_result = {
2174 let client = &self.hub.client;
2175 dlg.pre_request();
2176 let mut req_builder = hyper::Request::builder()
2177 .method(hyper::Method::DELETE)
2178 .uri(url.as_str())
2179 .header(USER_AGENT, self.hub._user_agent.clone());
2180
2181 if let Some(token) = token.as_ref() {
2182 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2183 }
2184
2185 let request = req_builder
2186 .header(CONTENT_LENGTH, 0_u64)
2187 .body(common::to_body::<String>(None));
2188
2189 client.request(request.unwrap()).await
2190 };
2191
2192 match req_result {
2193 Err(err) => {
2194 if let common::Retry::After(d) = dlg.http_error(&err) {
2195 sleep(d).await;
2196 continue;
2197 }
2198 dlg.finished(false);
2199 return Err(common::Error::HttpError(err));
2200 }
2201 Ok(res) => {
2202 let (mut parts, body) = res.into_parts();
2203 let mut body = common::Body::new(body);
2204 if !parts.status.is_success() {
2205 let bytes = common::to_bytes(body).await.unwrap_or_default();
2206 let error = serde_json::from_str(&common::to_string(&bytes));
2207 let response = common::to_response(parts, bytes.into());
2208
2209 if let common::Retry::After(d) =
2210 dlg.http_failure(&response, error.as_ref().ok())
2211 {
2212 sleep(d).await;
2213 continue;
2214 }
2215
2216 dlg.finished(false);
2217
2218 return Err(match error {
2219 Ok(value) => common::Error::BadRequest(value),
2220 _ => common::Error::Failure(response),
2221 });
2222 }
2223 let response = {
2224 let bytes = common::to_bytes(body).await.unwrap_or_default();
2225 let encoded = common::to_string(&bytes);
2226 match serde_json::from_str(&encoded) {
2227 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2228 Err(error) => {
2229 dlg.response_json_decode_error(&encoded, &error);
2230 return Err(common::Error::JsonDecodeError(
2231 encoded.to_string(),
2232 error,
2233 ));
2234 }
2235 }
2236 };
2237
2238 dlg.finished(true);
2239 return Ok(response);
2240 }
2241 }
2242 }
2243 }
2244
2245 /// Required. The name of the DNS peering zone to delete. Format: projects/{project}/locations/{location}/instances/{instance}/dnsPeerings/{dns_peering}
2246 ///
2247 /// Sets the *name* path property to the given value.
2248 ///
2249 /// Even though the property as already been set when instantiating this call,
2250 /// we provide this method for API completeness.
2251 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2252 self._name = new_value.to_string();
2253 self
2254 }
2255 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2256 /// while executing the actual API request.
2257 ///
2258 /// ````text
2259 /// It should be used to handle progress information, and to implement a certain level of resilience.
2260 /// ````
2261 ///
2262 /// Sets the *delegate* property to the given value.
2263 pub fn delegate(
2264 mut self,
2265 new_value: &'a mut dyn common::Delegate,
2266 ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2267 self._delegate = Some(new_value);
2268 self
2269 }
2270
2271 /// Set any additional parameter of the query string used in the request.
2272 /// It should be used to set parameters which are not yet available through their own
2273 /// setters.
2274 ///
2275 /// Please note that this method must not be used to set any of the known parameters
2276 /// which have their own setter method. If done anyway, the request will fail.
2277 ///
2278 /// # Additional Parameters
2279 ///
2280 /// * *$.xgafv* (query-string) - V1 error format.
2281 /// * *access_token* (query-string) - OAuth access token.
2282 /// * *alt* (query-string) - Data format for response.
2283 /// * *callback* (query-string) - JSONP
2284 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2285 /// * *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.
2286 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2287 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2288 /// * *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.
2289 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2290 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2291 pub fn param<T>(
2292 mut self,
2293 name: T,
2294 value: T,
2295 ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2296 where
2297 T: AsRef<str>,
2298 {
2299 self._additional_params
2300 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2301 self
2302 }
2303
2304 /// Identifies the authorization scope for the method you are building.
2305 ///
2306 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2307 /// [`Scope::CloudPlatform`].
2308 ///
2309 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2310 /// tokens for more than one scope.
2311 ///
2312 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2313 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2314 /// sufficient, a read-write scope will do as well.
2315 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2316 where
2317 St: AsRef<str>,
2318 {
2319 self._scopes.insert(String::from(scope.as_ref()));
2320 self
2321 }
2322 /// Identifies the authorization scope(s) for the method you are building.
2323 ///
2324 /// See [`Self::add_scope()`] for details.
2325 pub fn add_scopes<I, St>(
2326 mut self,
2327 scopes: I,
2328 ) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C>
2329 where
2330 I: IntoIterator<Item = St>,
2331 St: AsRef<str>,
2332 {
2333 self._scopes
2334 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2335 self
2336 }
2337
2338 /// Removes all scopes, and no default scope will be used either.
2339 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2340 /// for details).
2341 pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringDeleteCall<'a, C> {
2342 self._scopes.clear();
2343 self
2344 }
2345}
2346
2347/// Lists DNS peerings for a given resource.
2348///
2349/// A builder for the *locations.instances.dnsPeerings.list* method supported by a *project* resource.
2350/// It is not used directly, but through a [`ProjectMethods`] instance.
2351///
2352/// # Example
2353///
2354/// Instantiate a resource method builder
2355///
2356/// ```test_harness,no_run
2357/// # extern crate hyper;
2358/// # extern crate hyper_rustls;
2359/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2360/// # async fn dox() {
2361/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2362///
2363/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2364/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2365/// # .with_native_roots()
2366/// # .unwrap()
2367/// # .https_only()
2368/// # .enable_http2()
2369/// # .build();
2370///
2371/// # let executor = hyper_util::rt::TokioExecutor::new();
2372/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2373/// # secret,
2374/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2375/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2376/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2377/// # ),
2378/// # ).build().await.unwrap();
2379///
2380/// # let client = hyper_util::client::legacy::Client::builder(
2381/// # hyper_util::rt::TokioExecutor::new()
2382/// # )
2383/// # .build(
2384/// # hyper_rustls::HttpsConnectorBuilder::new()
2385/// # .with_native_roots()
2386/// # .unwrap()
2387/// # .https_or_http()
2388/// # .enable_http2()
2389/// # .build()
2390/// # );
2391/// # let mut hub = DataFusion::new(client, auth);
2392/// // You can configure optional parameters by calling the respective setters at will, and
2393/// // execute the final call using `doit()`.
2394/// // Values shown here are possibly random and not representative !
2395/// let result = hub.projects().locations_instances_dns_peerings_list("parent")
2396/// .page_token("amet.")
2397/// .page_size(-20)
2398/// .doit().await;
2399/// # }
2400/// ```
2401pub struct ProjectLocationInstanceDnsPeeringListCall<'a, C>
2402where
2403 C: 'a,
2404{
2405 hub: &'a DataFusion<C>,
2406 _parent: String,
2407 _page_token: Option<String>,
2408 _page_size: Option<i32>,
2409 _delegate: Option<&'a mut dyn common::Delegate>,
2410 _additional_params: HashMap<String, String>,
2411 _scopes: BTreeSet<String>,
2412}
2413
2414impl<'a, C> common::CallBuilder for ProjectLocationInstanceDnsPeeringListCall<'a, C> {}
2415
2416impl<'a, C> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2417where
2418 C: common::Connector,
2419{
2420 /// Perform the operation you have build so far.
2421 pub async fn doit(mut self) -> common::Result<(common::Response, ListDnsPeeringsResponse)> {
2422 use std::borrow::Cow;
2423 use std::io::{Read, Seek};
2424
2425 use common::{url::Params, ToParts};
2426 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2427
2428 let mut dd = common::DefaultDelegate;
2429 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2430 dlg.begin(common::MethodInfo {
2431 id: "datafusion.projects.locations.instances.dnsPeerings.list",
2432 http_method: hyper::Method::GET,
2433 });
2434
2435 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
2436 if self._additional_params.contains_key(field) {
2437 dlg.finished(false);
2438 return Err(common::Error::FieldClash(field));
2439 }
2440 }
2441
2442 let mut params = Params::with_capacity(5 + self._additional_params.len());
2443 params.push("parent", self._parent);
2444 if let Some(value) = self._page_token.as_ref() {
2445 params.push("pageToken", value);
2446 }
2447 if let Some(value) = self._page_size.as_ref() {
2448 params.push("pageSize", value.to_string());
2449 }
2450
2451 params.extend(self._additional_params.iter());
2452
2453 params.push("alt", "json");
2454 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/dnsPeerings";
2455 if self._scopes.is_empty() {
2456 self._scopes
2457 .insert(Scope::CloudPlatform.as_ref().to_string());
2458 }
2459
2460 #[allow(clippy::single_element_loop)]
2461 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2462 url = params.uri_replacement(url, param_name, find_this, true);
2463 }
2464 {
2465 let to_remove = ["parent"];
2466 params.remove_params(&to_remove);
2467 }
2468
2469 let url = params.parse_with_url(&url);
2470
2471 loop {
2472 let token = match self
2473 .hub
2474 .auth
2475 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2476 .await
2477 {
2478 Ok(token) => token,
2479 Err(e) => match dlg.token(e) {
2480 Ok(token) => token,
2481 Err(e) => {
2482 dlg.finished(false);
2483 return Err(common::Error::MissingToken(e));
2484 }
2485 },
2486 };
2487 let mut req_result = {
2488 let client = &self.hub.client;
2489 dlg.pre_request();
2490 let mut req_builder = hyper::Request::builder()
2491 .method(hyper::Method::GET)
2492 .uri(url.as_str())
2493 .header(USER_AGENT, self.hub._user_agent.clone());
2494
2495 if let Some(token) = token.as_ref() {
2496 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2497 }
2498
2499 let request = req_builder
2500 .header(CONTENT_LENGTH, 0_u64)
2501 .body(common::to_body::<String>(None));
2502
2503 client.request(request.unwrap()).await
2504 };
2505
2506 match req_result {
2507 Err(err) => {
2508 if let common::Retry::After(d) = dlg.http_error(&err) {
2509 sleep(d).await;
2510 continue;
2511 }
2512 dlg.finished(false);
2513 return Err(common::Error::HttpError(err));
2514 }
2515 Ok(res) => {
2516 let (mut parts, body) = res.into_parts();
2517 let mut body = common::Body::new(body);
2518 if !parts.status.is_success() {
2519 let bytes = common::to_bytes(body).await.unwrap_or_default();
2520 let error = serde_json::from_str(&common::to_string(&bytes));
2521 let response = common::to_response(parts, bytes.into());
2522
2523 if let common::Retry::After(d) =
2524 dlg.http_failure(&response, error.as_ref().ok())
2525 {
2526 sleep(d).await;
2527 continue;
2528 }
2529
2530 dlg.finished(false);
2531
2532 return Err(match error {
2533 Ok(value) => common::Error::BadRequest(value),
2534 _ => common::Error::Failure(response),
2535 });
2536 }
2537 let response = {
2538 let bytes = common::to_bytes(body).await.unwrap_or_default();
2539 let encoded = common::to_string(&bytes);
2540 match serde_json::from_str(&encoded) {
2541 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2542 Err(error) => {
2543 dlg.response_json_decode_error(&encoded, &error);
2544 return Err(common::Error::JsonDecodeError(
2545 encoded.to_string(),
2546 error,
2547 ));
2548 }
2549 }
2550 };
2551
2552 dlg.finished(true);
2553 return Ok(response);
2554 }
2555 }
2556 }
2557 }
2558
2559 /// Required. The parent, which owns this collection of dns peerings. Format: projects/{project}/locations/{location}/instances/{instance}
2560 ///
2561 /// Sets the *parent* path property to the given value.
2562 ///
2563 /// Even though the property as already been set when instantiating this call,
2564 /// we provide this method for API completeness.
2565 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2566 self._parent = new_value.to_string();
2567 self
2568 }
2569 /// 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.
2570 ///
2571 /// Sets the *page token* query property to the given value.
2572 pub fn page_token(
2573 mut self,
2574 new_value: &str,
2575 ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2576 self._page_token = Some(new_value.to_string());
2577 self
2578 }
2579 /// 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.
2580 ///
2581 /// Sets the *page size* query property to the given value.
2582 pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2583 self._page_size = Some(new_value);
2584 self
2585 }
2586 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2587 /// while executing the actual API request.
2588 ///
2589 /// ````text
2590 /// It should be used to handle progress information, and to implement a certain level of resilience.
2591 /// ````
2592 ///
2593 /// Sets the *delegate* property to the given value.
2594 pub fn delegate(
2595 mut self,
2596 new_value: &'a mut dyn common::Delegate,
2597 ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2598 self._delegate = Some(new_value);
2599 self
2600 }
2601
2602 /// Set any additional parameter of the query string used in the request.
2603 /// It should be used to set parameters which are not yet available through their own
2604 /// setters.
2605 ///
2606 /// Please note that this method must not be used to set any of the known parameters
2607 /// which have their own setter method. If done anyway, the request will fail.
2608 ///
2609 /// # Additional Parameters
2610 ///
2611 /// * *$.xgafv* (query-string) - V1 error format.
2612 /// * *access_token* (query-string) - OAuth access token.
2613 /// * *alt* (query-string) - Data format for response.
2614 /// * *callback* (query-string) - JSONP
2615 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2616 /// * *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.
2617 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2618 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2619 /// * *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.
2620 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2621 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2622 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2623 where
2624 T: AsRef<str>,
2625 {
2626 self._additional_params
2627 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2628 self
2629 }
2630
2631 /// Identifies the authorization scope for the method you are building.
2632 ///
2633 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2634 /// [`Scope::CloudPlatform`].
2635 ///
2636 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2637 /// tokens for more than one scope.
2638 ///
2639 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2640 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2641 /// sufficient, a read-write scope will do as well.
2642 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2643 where
2644 St: AsRef<str>,
2645 {
2646 self._scopes.insert(String::from(scope.as_ref()));
2647 self
2648 }
2649 /// Identifies the authorization scope(s) for the method you are building.
2650 ///
2651 /// See [`Self::add_scope()`] for details.
2652 pub fn add_scopes<I, St>(
2653 mut self,
2654 scopes: I,
2655 ) -> ProjectLocationInstanceDnsPeeringListCall<'a, C>
2656 where
2657 I: IntoIterator<Item = St>,
2658 St: AsRef<str>,
2659 {
2660 self._scopes
2661 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2662 self
2663 }
2664
2665 /// Removes all scopes, and no default scope will be used either.
2666 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2667 /// for details).
2668 pub fn clear_scopes(mut self) -> ProjectLocationInstanceDnsPeeringListCall<'a, C> {
2669 self._scopes.clear();
2670 self
2671 }
2672}
2673
2674/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2675///
2676/// A builder for the *locations.instances.namespaces.getIamPolicy* method supported by a *project* resource.
2677/// It is not used directly, but through a [`ProjectMethods`] instance.
2678///
2679/// # Example
2680///
2681/// Instantiate a resource method builder
2682///
2683/// ```test_harness,no_run
2684/// # extern crate hyper;
2685/// # extern crate hyper_rustls;
2686/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
2687/// # async fn dox() {
2688/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2689///
2690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2691/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2692/// # .with_native_roots()
2693/// # .unwrap()
2694/// # .https_only()
2695/// # .enable_http2()
2696/// # .build();
2697///
2698/// # let executor = hyper_util::rt::TokioExecutor::new();
2699/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2700/// # secret,
2701/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2702/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2703/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2704/// # ),
2705/// # ).build().await.unwrap();
2706///
2707/// # let client = hyper_util::client::legacy::Client::builder(
2708/// # hyper_util::rt::TokioExecutor::new()
2709/// # )
2710/// # .build(
2711/// # hyper_rustls::HttpsConnectorBuilder::new()
2712/// # .with_native_roots()
2713/// # .unwrap()
2714/// # .https_or_http()
2715/// # .enable_http2()
2716/// # .build()
2717/// # );
2718/// # let mut hub = DataFusion::new(client, auth);
2719/// // You can configure optional parameters by calling the respective setters at will, and
2720/// // execute the final call using `doit()`.
2721/// // Values shown here are possibly random and not representative !
2722/// let result = hub.projects().locations_instances_namespaces_get_iam_policy("resource")
2723/// .options_requested_policy_version(-62)
2724/// .doit().await;
2725/// # }
2726/// ```
2727pub struct ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2728where
2729 C: 'a,
2730{
2731 hub: &'a DataFusion<C>,
2732 _resource: String,
2733 _options_requested_policy_version: Option<i32>,
2734 _delegate: Option<&'a mut dyn common::Delegate>,
2735 _additional_params: HashMap<String, String>,
2736 _scopes: BTreeSet<String>,
2737}
2738
2739impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {}
2740
2741impl<'a, C> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2742where
2743 C: common::Connector,
2744{
2745 /// Perform the operation you have build so far.
2746 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
2747 use std::borrow::Cow;
2748 use std::io::{Read, Seek};
2749
2750 use common::{url::Params, ToParts};
2751 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2752
2753 let mut dd = common::DefaultDelegate;
2754 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2755 dlg.begin(common::MethodInfo {
2756 id: "datafusion.projects.locations.instances.namespaces.getIamPolicy",
2757 http_method: hyper::Method::GET,
2758 });
2759
2760 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
2761 if self._additional_params.contains_key(field) {
2762 dlg.finished(false);
2763 return Err(common::Error::FieldClash(field));
2764 }
2765 }
2766
2767 let mut params = Params::with_capacity(4 + self._additional_params.len());
2768 params.push("resource", self._resource);
2769 if let Some(value) = self._options_requested_policy_version.as_ref() {
2770 params.push("options.requestedPolicyVersion", value.to_string());
2771 }
2772
2773 params.extend(self._additional_params.iter());
2774
2775 params.push("alt", "json");
2776 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
2777 if self._scopes.is_empty() {
2778 self._scopes
2779 .insert(Scope::CloudPlatform.as_ref().to_string());
2780 }
2781
2782 #[allow(clippy::single_element_loop)]
2783 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
2784 url = params.uri_replacement(url, param_name, find_this, true);
2785 }
2786 {
2787 let to_remove = ["resource"];
2788 params.remove_params(&to_remove);
2789 }
2790
2791 let url = params.parse_with_url(&url);
2792
2793 loop {
2794 let token = match self
2795 .hub
2796 .auth
2797 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2798 .await
2799 {
2800 Ok(token) => token,
2801 Err(e) => match dlg.token(e) {
2802 Ok(token) => token,
2803 Err(e) => {
2804 dlg.finished(false);
2805 return Err(common::Error::MissingToken(e));
2806 }
2807 },
2808 };
2809 let mut req_result = {
2810 let client = &self.hub.client;
2811 dlg.pre_request();
2812 let mut req_builder = hyper::Request::builder()
2813 .method(hyper::Method::GET)
2814 .uri(url.as_str())
2815 .header(USER_AGENT, self.hub._user_agent.clone());
2816
2817 if let Some(token) = token.as_ref() {
2818 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2819 }
2820
2821 let request = req_builder
2822 .header(CONTENT_LENGTH, 0_u64)
2823 .body(common::to_body::<String>(None));
2824
2825 client.request(request.unwrap()).await
2826 };
2827
2828 match req_result {
2829 Err(err) => {
2830 if let common::Retry::After(d) = dlg.http_error(&err) {
2831 sleep(d).await;
2832 continue;
2833 }
2834 dlg.finished(false);
2835 return Err(common::Error::HttpError(err));
2836 }
2837 Ok(res) => {
2838 let (mut parts, body) = res.into_parts();
2839 let mut body = common::Body::new(body);
2840 if !parts.status.is_success() {
2841 let bytes = common::to_bytes(body).await.unwrap_or_default();
2842 let error = serde_json::from_str(&common::to_string(&bytes));
2843 let response = common::to_response(parts, bytes.into());
2844
2845 if let common::Retry::After(d) =
2846 dlg.http_failure(&response, error.as_ref().ok())
2847 {
2848 sleep(d).await;
2849 continue;
2850 }
2851
2852 dlg.finished(false);
2853
2854 return Err(match error {
2855 Ok(value) => common::Error::BadRequest(value),
2856 _ => common::Error::Failure(response),
2857 });
2858 }
2859 let response = {
2860 let bytes = common::to_bytes(body).await.unwrap_or_default();
2861 let encoded = common::to_string(&bytes);
2862 match serde_json::from_str(&encoded) {
2863 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2864 Err(error) => {
2865 dlg.response_json_decode_error(&encoded, &error);
2866 return Err(common::Error::JsonDecodeError(
2867 encoded.to_string(),
2868 error,
2869 ));
2870 }
2871 }
2872 };
2873
2874 dlg.finished(true);
2875 return Ok(response);
2876 }
2877 }
2878 }
2879 }
2880
2881 /// 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.
2882 ///
2883 /// Sets the *resource* path property to the given value.
2884 ///
2885 /// Even though the property as already been set when instantiating this call,
2886 /// we provide this method for API completeness.
2887 pub fn resource(
2888 mut self,
2889 new_value: &str,
2890 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2891 self._resource = new_value.to_string();
2892 self
2893 }
2894 /// 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).
2895 ///
2896 /// Sets the *options.requested policy version* query property to the given value.
2897 pub fn options_requested_policy_version(
2898 mut self,
2899 new_value: i32,
2900 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2901 self._options_requested_policy_version = Some(new_value);
2902 self
2903 }
2904 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2905 /// while executing the actual API request.
2906 ///
2907 /// ````text
2908 /// It should be used to handle progress information, and to implement a certain level of resilience.
2909 /// ````
2910 ///
2911 /// Sets the *delegate* property to the given value.
2912 pub fn delegate(
2913 mut self,
2914 new_value: &'a mut dyn common::Delegate,
2915 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2916 self._delegate = Some(new_value);
2917 self
2918 }
2919
2920 /// Set any additional parameter of the query string used in the request.
2921 /// It should be used to set parameters which are not yet available through their own
2922 /// setters.
2923 ///
2924 /// Please note that this method must not be used to set any of the known parameters
2925 /// which have their own setter method. If done anyway, the request will fail.
2926 ///
2927 /// # Additional Parameters
2928 ///
2929 /// * *$.xgafv* (query-string) - V1 error format.
2930 /// * *access_token* (query-string) - OAuth access token.
2931 /// * *alt* (query-string) - Data format for response.
2932 /// * *callback* (query-string) - JSONP
2933 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2934 /// * *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.
2935 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2936 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2937 /// * *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.
2938 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2939 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2940 pub fn param<T>(
2941 mut self,
2942 name: T,
2943 value: T,
2944 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2945 where
2946 T: AsRef<str>,
2947 {
2948 self._additional_params
2949 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2950 self
2951 }
2952
2953 /// Identifies the authorization scope for the method you are building.
2954 ///
2955 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2956 /// [`Scope::CloudPlatform`].
2957 ///
2958 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2959 /// tokens for more than one scope.
2960 ///
2961 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2962 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2963 /// sufficient, a read-write scope will do as well.
2964 pub fn add_scope<St>(
2965 mut self,
2966 scope: St,
2967 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2968 where
2969 St: AsRef<str>,
2970 {
2971 self._scopes.insert(String::from(scope.as_ref()));
2972 self
2973 }
2974 /// Identifies the authorization scope(s) for the method you are building.
2975 ///
2976 /// See [`Self::add_scope()`] for details.
2977 pub fn add_scopes<I, St>(
2978 mut self,
2979 scopes: I,
2980 ) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C>
2981 where
2982 I: IntoIterator<Item = St>,
2983 St: AsRef<str>,
2984 {
2985 self._scopes
2986 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2987 self
2988 }
2989
2990 /// Removes all scopes, and no default scope will be used either.
2991 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2992 /// for details).
2993 pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceGetIamPolicyCall<'a, C> {
2994 self._scopes.clear();
2995 self
2996 }
2997}
2998
2999/// List namespaces in a given instance
3000///
3001/// A builder for the *locations.instances.namespaces.list* method supported by a *project* resource.
3002/// It is not used directly, but through a [`ProjectMethods`] instance.
3003///
3004/// # Example
3005///
3006/// Instantiate a resource method builder
3007///
3008/// ```test_harness,no_run
3009/// # extern crate hyper;
3010/// # extern crate hyper_rustls;
3011/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3012/// # async fn dox() {
3013/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3014///
3015/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3016/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3017/// # .with_native_roots()
3018/// # .unwrap()
3019/// # .https_only()
3020/// # .enable_http2()
3021/// # .build();
3022///
3023/// # let executor = hyper_util::rt::TokioExecutor::new();
3024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3025/// # secret,
3026/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3027/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3028/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3029/// # ),
3030/// # ).build().await.unwrap();
3031///
3032/// # let client = hyper_util::client::legacy::Client::builder(
3033/// # hyper_util::rt::TokioExecutor::new()
3034/// # )
3035/// # .build(
3036/// # hyper_rustls::HttpsConnectorBuilder::new()
3037/// # .with_native_roots()
3038/// # .unwrap()
3039/// # .https_or_http()
3040/// # .enable_http2()
3041/// # .build()
3042/// # );
3043/// # let mut hub = DataFusion::new(client, auth);
3044/// // You can configure optional parameters by calling the respective setters at will, and
3045/// // execute the final call using `doit()`.
3046/// // Values shown here are possibly random and not representative !
3047/// let result = hub.projects().locations_instances_namespaces_list("parent")
3048/// .view("gubergren")
3049/// .page_token("eos")
3050/// .page_size(-4)
3051/// .doit().await;
3052/// # }
3053/// ```
3054pub struct ProjectLocationInstanceNamespaceListCall<'a, C>
3055where
3056 C: 'a,
3057{
3058 hub: &'a DataFusion<C>,
3059 _parent: String,
3060 _view: Option<String>,
3061 _page_token: Option<String>,
3062 _page_size: Option<i32>,
3063 _delegate: Option<&'a mut dyn common::Delegate>,
3064 _additional_params: HashMap<String, String>,
3065 _scopes: BTreeSet<String>,
3066}
3067
3068impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceListCall<'a, C> {}
3069
3070impl<'a, C> ProjectLocationInstanceNamespaceListCall<'a, C>
3071where
3072 C: common::Connector,
3073{
3074 /// Perform the operation you have build so far.
3075 pub async fn doit(mut self) -> common::Result<(common::Response, ListNamespacesResponse)> {
3076 use std::borrow::Cow;
3077 use std::io::{Read, Seek};
3078
3079 use common::{url::Params, ToParts};
3080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3081
3082 let mut dd = common::DefaultDelegate;
3083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3084 dlg.begin(common::MethodInfo {
3085 id: "datafusion.projects.locations.instances.namespaces.list",
3086 http_method: hyper::Method::GET,
3087 });
3088
3089 for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
3090 if self._additional_params.contains_key(field) {
3091 dlg.finished(false);
3092 return Err(common::Error::FieldClash(field));
3093 }
3094 }
3095
3096 let mut params = Params::with_capacity(6 + self._additional_params.len());
3097 params.push("parent", self._parent);
3098 if let Some(value) = self._view.as_ref() {
3099 params.push("view", value);
3100 }
3101 if let Some(value) = self._page_token.as_ref() {
3102 params.push("pageToken", value);
3103 }
3104 if let Some(value) = self._page_size.as_ref() {
3105 params.push("pageSize", value.to_string());
3106 }
3107
3108 params.extend(self._additional_params.iter());
3109
3110 params.push("alt", "json");
3111 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/namespaces";
3112 if self._scopes.is_empty() {
3113 self._scopes
3114 .insert(Scope::CloudPlatform.as_ref().to_string());
3115 }
3116
3117 #[allow(clippy::single_element_loop)]
3118 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3119 url = params.uri_replacement(url, param_name, find_this, true);
3120 }
3121 {
3122 let to_remove = ["parent"];
3123 params.remove_params(&to_remove);
3124 }
3125
3126 let url = params.parse_with_url(&url);
3127
3128 loop {
3129 let token = match self
3130 .hub
3131 .auth
3132 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3133 .await
3134 {
3135 Ok(token) => token,
3136 Err(e) => match dlg.token(e) {
3137 Ok(token) => token,
3138 Err(e) => {
3139 dlg.finished(false);
3140 return Err(common::Error::MissingToken(e));
3141 }
3142 },
3143 };
3144 let mut req_result = {
3145 let client = &self.hub.client;
3146 dlg.pre_request();
3147 let mut req_builder = hyper::Request::builder()
3148 .method(hyper::Method::GET)
3149 .uri(url.as_str())
3150 .header(USER_AGENT, self.hub._user_agent.clone());
3151
3152 if let Some(token) = token.as_ref() {
3153 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3154 }
3155
3156 let request = req_builder
3157 .header(CONTENT_LENGTH, 0_u64)
3158 .body(common::to_body::<String>(None));
3159
3160 client.request(request.unwrap()).await
3161 };
3162
3163 match req_result {
3164 Err(err) => {
3165 if let common::Retry::After(d) = dlg.http_error(&err) {
3166 sleep(d).await;
3167 continue;
3168 }
3169 dlg.finished(false);
3170 return Err(common::Error::HttpError(err));
3171 }
3172 Ok(res) => {
3173 let (mut parts, body) = res.into_parts();
3174 let mut body = common::Body::new(body);
3175 if !parts.status.is_success() {
3176 let bytes = common::to_bytes(body).await.unwrap_or_default();
3177 let error = serde_json::from_str(&common::to_string(&bytes));
3178 let response = common::to_response(parts, bytes.into());
3179
3180 if let common::Retry::After(d) =
3181 dlg.http_failure(&response, error.as_ref().ok())
3182 {
3183 sleep(d).await;
3184 continue;
3185 }
3186
3187 dlg.finished(false);
3188
3189 return Err(match error {
3190 Ok(value) => common::Error::BadRequest(value),
3191 _ => common::Error::Failure(response),
3192 });
3193 }
3194 let response = {
3195 let bytes = common::to_bytes(body).await.unwrap_or_default();
3196 let encoded = common::to_string(&bytes);
3197 match serde_json::from_str(&encoded) {
3198 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3199 Err(error) => {
3200 dlg.response_json_decode_error(&encoded, &error);
3201 return Err(common::Error::JsonDecodeError(
3202 encoded.to_string(),
3203 error,
3204 ));
3205 }
3206 }
3207 };
3208
3209 dlg.finished(true);
3210 return Ok(response);
3211 }
3212 }
3213 }
3214 }
3215
3216 /// Required. The instance to list its namespaces.
3217 ///
3218 /// Sets the *parent* path property to the given value.
3219 ///
3220 /// Even though the property as already been set when instantiating this call,
3221 /// we provide this method for API completeness.
3222 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3223 self._parent = new_value.to_string();
3224 self
3225 }
3226 /// 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)
3227 ///
3228 /// Sets the *view* query property to the given value.
3229 pub fn view(mut self, new_value: &str) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3230 self._view = Some(new_value.to_string());
3231 self
3232 }
3233 /// The next_page_token value to use if there are additional results to retrieve for this list request.
3234 ///
3235 /// Sets the *page token* query property to the given value.
3236 pub fn page_token(
3237 mut self,
3238 new_value: &str,
3239 ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3240 self._page_token = Some(new_value.to_string());
3241 self
3242 }
3243 /// The maximum number of items to return.
3244 ///
3245 /// Sets the *page size* query property to the given value.
3246 pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3247 self._page_size = Some(new_value);
3248 self
3249 }
3250 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3251 /// while executing the actual API request.
3252 ///
3253 /// ````text
3254 /// It should be used to handle progress information, and to implement a certain level of resilience.
3255 /// ````
3256 ///
3257 /// Sets the *delegate* property to the given value.
3258 pub fn delegate(
3259 mut self,
3260 new_value: &'a mut dyn common::Delegate,
3261 ) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3262 self._delegate = Some(new_value);
3263 self
3264 }
3265
3266 /// Set any additional parameter of the query string used in the request.
3267 /// It should be used to set parameters which are not yet available through their own
3268 /// setters.
3269 ///
3270 /// Please note that this method must not be used to set any of the known parameters
3271 /// which have their own setter method. If done anyway, the request will fail.
3272 ///
3273 /// # Additional Parameters
3274 ///
3275 /// * *$.xgafv* (query-string) - V1 error format.
3276 /// * *access_token* (query-string) - OAuth access token.
3277 /// * *alt* (query-string) - Data format for response.
3278 /// * *callback* (query-string) - JSONP
3279 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3280 /// * *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.
3281 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3282 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3283 /// * *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.
3284 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3285 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3286 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3287 where
3288 T: AsRef<str>,
3289 {
3290 self._additional_params
3291 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3292 self
3293 }
3294
3295 /// Identifies the authorization scope for the method you are building.
3296 ///
3297 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3298 /// [`Scope::CloudPlatform`].
3299 ///
3300 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3301 /// tokens for more than one scope.
3302 ///
3303 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3304 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3305 /// sufficient, a read-write scope will do as well.
3306 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3307 where
3308 St: AsRef<str>,
3309 {
3310 self._scopes.insert(String::from(scope.as_ref()));
3311 self
3312 }
3313 /// Identifies the authorization scope(s) for the method you are building.
3314 ///
3315 /// See [`Self::add_scope()`] for details.
3316 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceNamespaceListCall<'a, C>
3317 where
3318 I: IntoIterator<Item = St>,
3319 St: AsRef<str>,
3320 {
3321 self._scopes
3322 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3323 self
3324 }
3325
3326 /// Removes all scopes, and no default scope will be used either.
3327 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3328 /// for details).
3329 pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceListCall<'a, C> {
3330 self._scopes.clear();
3331 self
3332 }
3333}
3334
3335/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3336///
3337/// A builder for the *locations.instances.namespaces.setIamPolicy* method supported by a *project* resource.
3338/// It is not used directly, but through a [`ProjectMethods`] instance.
3339///
3340/// # Example
3341///
3342/// Instantiate a resource method builder
3343///
3344/// ```test_harness,no_run
3345/// # extern crate hyper;
3346/// # extern crate hyper_rustls;
3347/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3348/// use datafusion1_beta1::api::SetIamPolicyRequest;
3349/// # async fn dox() {
3350/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3351///
3352/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3353/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3354/// # .with_native_roots()
3355/// # .unwrap()
3356/// # .https_only()
3357/// # .enable_http2()
3358/// # .build();
3359///
3360/// # let executor = hyper_util::rt::TokioExecutor::new();
3361/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3362/// # secret,
3363/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3364/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3365/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3366/// # ),
3367/// # ).build().await.unwrap();
3368///
3369/// # let client = hyper_util::client::legacy::Client::builder(
3370/// # hyper_util::rt::TokioExecutor::new()
3371/// # )
3372/// # .build(
3373/// # hyper_rustls::HttpsConnectorBuilder::new()
3374/// # .with_native_roots()
3375/// # .unwrap()
3376/// # .https_or_http()
3377/// # .enable_http2()
3378/// # .build()
3379/// # );
3380/// # let mut hub = DataFusion::new(client, auth);
3381/// // As the method needs a request, you would usually fill it with the desired information
3382/// // into the respective structure. Some of the parts shown here might not be applicable !
3383/// // Values shown here are possibly random and not representative !
3384/// let mut req = SetIamPolicyRequest::default();
3385///
3386/// // You can configure optional parameters by calling the respective setters at will, and
3387/// // execute the final call using `doit()`.
3388/// // Values shown here are possibly random and not representative !
3389/// let result = hub.projects().locations_instances_namespaces_set_iam_policy(req, "resource")
3390/// .doit().await;
3391/// # }
3392/// ```
3393pub struct ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3394where
3395 C: 'a,
3396{
3397 hub: &'a DataFusion<C>,
3398 _request: SetIamPolicyRequest,
3399 _resource: String,
3400 _delegate: Option<&'a mut dyn common::Delegate>,
3401 _additional_params: HashMap<String, String>,
3402 _scopes: BTreeSet<String>,
3403}
3404
3405impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {}
3406
3407impl<'a, C> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3408where
3409 C: common::Connector,
3410{
3411 /// Perform the operation you have build so far.
3412 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3413 use std::borrow::Cow;
3414 use std::io::{Read, Seek};
3415
3416 use common::{url::Params, ToParts};
3417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3418
3419 let mut dd = common::DefaultDelegate;
3420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3421 dlg.begin(common::MethodInfo {
3422 id: "datafusion.projects.locations.instances.namespaces.setIamPolicy",
3423 http_method: hyper::Method::POST,
3424 });
3425
3426 for &field in ["alt", "resource"].iter() {
3427 if self._additional_params.contains_key(field) {
3428 dlg.finished(false);
3429 return Err(common::Error::FieldClash(field));
3430 }
3431 }
3432
3433 let mut params = Params::with_capacity(4 + self._additional_params.len());
3434 params.push("resource", self._resource);
3435
3436 params.extend(self._additional_params.iter());
3437
3438 params.push("alt", "json");
3439 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
3440 if self._scopes.is_empty() {
3441 self._scopes
3442 .insert(Scope::CloudPlatform.as_ref().to_string());
3443 }
3444
3445 #[allow(clippy::single_element_loop)]
3446 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3447 url = params.uri_replacement(url, param_name, find_this, true);
3448 }
3449 {
3450 let to_remove = ["resource"];
3451 params.remove_params(&to_remove);
3452 }
3453
3454 let url = params.parse_with_url(&url);
3455
3456 let mut json_mime_type = mime::APPLICATION_JSON;
3457 let mut request_value_reader = {
3458 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3459 common::remove_json_null_values(&mut value);
3460 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3461 serde_json::to_writer(&mut dst, &value).unwrap();
3462 dst
3463 };
3464 let request_size = request_value_reader
3465 .seek(std::io::SeekFrom::End(0))
3466 .unwrap();
3467 request_value_reader
3468 .seek(std::io::SeekFrom::Start(0))
3469 .unwrap();
3470
3471 loop {
3472 let token = match self
3473 .hub
3474 .auth
3475 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3476 .await
3477 {
3478 Ok(token) => token,
3479 Err(e) => match dlg.token(e) {
3480 Ok(token) => token,
3481 Err(e) => {
3482 dlg.finished(false);
3483 return Err(common::Error::MissingToken(e));
3484 }
3485 },
3486 };
3487 request_value_reader
3488 .seek(std::io::SeekFrom::Start(0))
3489 .unwrap();
3490 let mut req_result = {
3491 let client = &self.hub.client;
3492 dlg.pre_request();
3493 let mut req_builder = hyper::Request::builder()
3494 .method(hyper::Method::POST)
3495 .uri(url.as_str())
3496 .header(USER_AGENT, self.hub._user_agent.clone());
3497
3498 if let Some(token) = token.as_ref() {
3499 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3500 }
3501
3502 let request = req_builder
3503 .header(CONTENT_TYPE, json_mime_type.to_string())
3504 .header(CONTENT_LENGTH, request_size as u64)
3505 .body(common::to_body(
3506 request_value_reader.get_ref().clone().into(),
3507 ));
3508
3509 client.request(request.unwrap()).await
3510 };
3511
3512 match req_result {
3513 Err(err) => {
3514 if let common::Retry::After(d) = dlg.http_error(&err) {
3515 sleep(d).await;
3516 continue;
3517 }
3518 dlg.finished(false);
3519 return Err(common::Error::HttpError(err));
3520 }
3521 Ok(res) => {
3522 let (mut parts, body) = res.into_parts();
3523 let mut body = common::Body::new(body);
3524 if !parts.status.is_success() {
3525 let bytes = common::to_bytes(body).await.unwrap_or_default();
3526 let error = serde_json::from_str(&common::to_string(&bytes));
3527 let response = common::to_response(parts, bytes.into());
3528
3529 if let common::Retry::After(d) =
3530 dlg.http_failure(&response, error.as_ref().ok())
3531 {
3532 sleep(d).await;
3533 continue;
3534 }
3535
3536 dlg.finished(false);
3537
3538 return Err(match error {
3539 Ok(value) => common::Error::BadRequest(value),
3540 _ => common::Error::Failure(response),
3541 });
3542 }
3543 let response = {
3544 let bytes = common::to_bytes(body).await.unwrap_or_default();
3545 let encoded = common::to_string(&bytes);
3546 match serde_json::from_str(&encoded) {
3547 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3548 Err(error) => {
3549 dlg.response_json_decode_error(&encoded, &error);
3550 return Err(common::Error::JsonDecodeError(
3551 encoded.to_string(),
3552 error,
3553 ));
3554 }
3555 }
3556 };
3557
3558 dlg.finished(true);
3559 return Ok(response);
3560 }
3561 }
3562 }
3563 }
3564
3565 ///
3566 /// Sets the *request* property to the given value.
3567 ///
3568 /// Even though the property as already been set when instantiating this call,
3569 /// we provide this method for API completeness.
3570 pub fn request(
3571 mut self,
3572 new_value: SetIamPolicyRequest,
3573 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3574 self._request = new_value;
3575 self
3576 }
3577 /// 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.
3578 ///
3579 /// Sets the *resource* path property to the given value.
3580 ///
3581 /// Even though the property as already been set when instantiating this call,
3582 /// we provide this method for API completeness.
3583 pub fn resource(
3584 mut self,
3585 new_value: &str,
3586 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3587 self._resource = new_value.to_string();
3588 self
3589 }
3590 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3591 /// while executing the actual API request.
3592 ///
3593 /// ````text
3594 /// It should be used to handle progress information, and to implement a certain level of resilience.
3595 /// ````
3596 ///
3597 /// Sets the *delegate* property to the given value.
3598 pub fn delegate(
3599 mut self,
3600 new_value: &'a mut dyn common::Delegate,
3601 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3602 self._delegate = Some(new_value);
3603 self
3604 }
3605
3606 /// Set any additional parameter of the query string used in the request.
3607 /// It should be used to set parameters which are not yet available through their own
3608 /// setters.
3609 ///
3610 /// Please note that this method must not be used to set any of the known parameters
3611 /// which have their own setter method. If done anyway, the request will fail.
3612 ///
3613 /// # Additional Parameters
3614 ///
3615 /// * *$.xgafv* (query-string) - V1 error format.
3616 /// * *access_token* (query-string) - OAuth access token.
3617 /// * *alt* (query-string) - Data format for response.
3618 /// * *callback* (query-string) - JSONP
3619 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3620 /// * *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.
3621 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3622 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3623 /// * *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.
3624 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3625 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3626 pub fn param<T>(
3627 mut self,
3628 name: T,
3629 value: T,
3630 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3631 where
3632 T: AsRef<str>,
3633 {
3634 self._additional_params
3635 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3636 self
3637 }
3638
3639 /// Identifies the authorization scope for the method you are building.
3640 ///
3641 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3642 /// [`Scope::CloudPlatform`].
3643 ///
3644 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3645 /// tokens for more than one scope.
3646 ///
3647 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3648 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3649 /// sufficient, a read-write scope will do as well.
3650 pub fn add_scope<St>(
3651 mut self,
3652 scope: St,
3653 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3654 where
3655 St: AsRef<str>,
3656 {
3657 self._scopes.insert(String::from(scope.as_ref()));
3658 self
3659 }
3660 /// Identifies the authorization scope(s) for the method you are building.
3661 ///
3662 /// See [`Self::add_scope()`] for details.
3663 pub fn add_scopes<I, St>(
3664 mut self,
3665 scopes: I,
3666 ) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C>
3667 where
3668 I: IntoIterator<Item = St>,
3669 St: AsRef<str>,
3670 {
3671 self._scopes
3672 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3673 self
3674 }
3675
3676 /// Removes all scopes, and no default scope will be used either.
3677 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3678 /// for details).
3679 pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceSetIamPolicyCall<'a, C> {
3680 self._scopes.clear();
3681 self
3682 }
3683}
3684
3685/// 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.
3686///
3687/// A builder for the *locations.instances.namespaces.testIamPermissions* method supported by a *project* resource.
3688/// It is not used directly, but through a [`ProjectMethods`] instance.
3689///
3690/// # Example
3691///
3692/// Instantiate a resource method builder
3693///
3694/// ```test_harness,no_run
3695/// # extern crate hyper;
3696/// # extern crate hyper_rustls;
3697/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
3698/// use datafusion1_beta1::api::TestIamPermissionsRequest;
3699/// # async fn dox() {
3700/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3701///
3702/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3703/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3704/// # .with_native_roots()
3705/// # .unwrap()
3706/// # .https_only()
3707/// # .enable_http2()
3708/// # .build();
3709///
3710/// # let executor = hyper_util::rt::TokioExecutor::new();
3711/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3712/// # secret,
3713/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3714/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3715/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3716/// # ),
3717/// # ).build().await.unwrap();
3718///
3719/// # let client = hyper_util::client::legacy::Client::builder(
3720/// # hyper_util::rt::TokioExecutor::new()
3721/// # )
3722/// # .build(
3723/// # hyper_rustls::HttpsConnectorBuilder::new()
3724/// # .with_native_roots()
3725/// # .unwrap()
3726/// # .https_or_http()
3727/// # .enable_http2()
3728/// # .build()
3729/// # );
3730/// # let mut hub = DataFusion::new(client, auth);
3731/// // As the method needs a request, you would usually fill it with the desired information
3732/// // into the respective structure. Some of the parts shown here might not be applicable !
3733/// // Values shown here are possibly random and not representative !
3734/// let mut req = TestIamPermissionsRequest::default();
3735///
3736/// // You can configure optional parameters by calling the respective setters at will, and
3737/// // execute the final call using `doit()`.
3738/// // Values shown here are possibly random and not representative !
3739/// let result = hub.projects().locations_instances_namespaces_test_iam_permissions(req, "resource")
3740/// .doit().await;
3741/// # }
3742/// ```
3743pub struct ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3744where
3745 C: 'a,
3746{
3747 hub: &'a DataFusion<C>,
3748 _request: TestIamPermissionsRequest,
3749 _resource: String,
3750 _delegate: Option<&'a mut dyn common::Delegate>,
3751 _additional_params: HashMap<String, String>,
3752 _scopes: BTreeSet<String>,
3753}
3754
3755impl<'a, C> common::CallBuilder for ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {}
3756
3757impl<'a, C> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3758where
3759 C: common::Connector,
3760{
3761 /// Perform the operation you have build so far.
3762 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
3763 use std::borrow::Cow;
3764 use std::io::{Read, Seek};
3765
3766 use common::{url::Params, ToParts};
3767 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3768
3769 let mut dd = common::DefaultDelegate;
3770 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3771 dlg.begin(common::MethodInfo {
3772 id: "datafusion.projects.locations.instances.namespaces.testIamPermissions",
3773 http_method: hyper::Method::POST,
3774 });
3775
3776 for &field in ["alt", "resource"].iter() {
3777 if self._additional_params.contains_key(field) {
3778 dlg.finished(false);
3779 return Err(common::Error::FieldClash(field));
3780 }
3781 }
3782
3783 let mut params = Params::with_capacity(4 + self._additional_params.len());
3784 params.push("resource", self._resource);
3785
3786 params.extend(self._additional_params.iter());
3787
3788 params.push("alt", "json");
3789 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
3790 if self._scopes.is_empty() {
3791 self._scopes
3792 .insert(Scope::CloudPlatform.as_ref().to_string());
3793 }
3794
3795 #[allow(clippy::single_element_loop)]
3796 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
3797 url = params.uri_replacement(url, param_name, find_this, true);
3798 }
3799 {
3800 let to_remove = ["resource"];
3801 params.remove_params(&to_remove);
3802 }
3803
3804 let url = params.parse_with_url(&url);
3805
3806 let mut json_mime_type = mime::APPLICATION_JSON;
3807 let mut request_value_reader = {
3808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3809 common::remove_json_null_values(&mut value);
3810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3811 serde_json::to_writer(&mut dst, &value).unwrap();
3812 dst
3813 };
3814 let request_size = request_value_reader
3815 .seek(std::io::SeekFrom::End(0))
3816 .unwrap();
3817 request_value_reader
3818 .seek(std::io::SeekFrom::Start(0))
3819 .unwrap();
3820
3821 loop {
3822 let token = match self
3823 .hub
3824 .auth
3825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3826 .await
3827 {
3828 Ok(token) => token,
3829 Err(e) => match dlg.token(e) {
3830 Ok(token) => token,
3831 Err(e) => {
3832 dlg.finished(false);
3833 return Err(common::Error::MissingToken(e));
3834 }
3835 },
3836 };
3837 request_value_reader
3838 .seek(std::io::SeekFrom::Start(0))
3839 .unwrap();
3840 let mut req_result = {
3841 let client = &self.hub.client;
3842 dlg.pre_request();
3843 let mut req_builder = hyper::Request::builder()
3844 .method(hyper::Method::POST)
3845 .uri(url.as_str())
3846 .header(USER_AGENT, self.hub._user_agent.clone());
3847
3848 if let Some(token) = token.as_ref() {
3849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3850 }
3851
3852 let request = req_builder
3853 .header(CONTENT_TYPE, json_mime_type.to_string())
3854 .header(CONTENT_LENGTH, request_size as u64)
3855 .body(common::to_body(
3856 request_value_reader.get_ref().clone().into(),
3857 ));
3858
3859 client.request(request.unwrap()).await
3860 };
3861
3862 match req_result {
3863 Err(err) => {
3864 if let common::Retry::After(d) = dlg.http_error(&err) {
3865 sleep(d).await;
3866 continue;
3867 }
3868 dlg.finished(false);
3869 return Err(common::Error::HttpError(err));
3870 }
3871 Ok(res) => {
3872 let (mut parts, body) = res.into_parts();
3873 let mut body = common::Body::new(body);
3874 if !parts.status.is_success() {
3875 let bytes = common::to_bytes(body).await.unwrap_or_default();
3876 let error = serde_json::from_str(&common::to_string(&bytes));
3877 let response = common::to_response(parts, bytes.into());
3878
3879 if let common::Retry::After(d) =
3880 dlg.http_failure(&response, error.as_ref().ok())
3881 {
3882 sleep(d).await;
3883 continue;
3884 }
3885
3886 dlg.finished(false);
3887
3888 return Err(match error {
3889 Ok(value) => common::Error::BadRequest(value),
3890 _ => common::Error::Failure(response),
3891 });
3892 }
3893 let response = {
3894 let bytes = common::to_bytes(body).await.unwrap_or_default();
3895 let encoded = common::to_string(&bytes);
3896 match serde_json::from_str(&encoded) {
3897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3898 Err(error) => {
3899 dlg.response_json_decode_error(&encoded, &error);
3900 return Err(common::Error::JsonDecodeError(
3901 encoded.to_string(),
3902 error,
3903 ));
3904 }
3905 }
3906 };
3907
3908 dlg.finished(true);
3909 return Ok(response);
3910 }
3911 }
3912 }
3913 }
3914
3915 ///
3916 /// Sets the *request* property to the given value.
3917 ///
3918 /// Even though the property as already been set when instantiating this call,
3919 /// we provide this method for API completeness.
3920 pub fn request(
3921 mut self,
3922 new_value: TestIamPermissionsRequest,
3923 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3924 self._request = new_value;
3925 self
3926 }
3927 /// 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.
3928 ///
3929 /// Sets the *resource* path property to the given value.
3930 ///
3931 /// Even though the property as already been set when instantiating this call,
3932 /// we provide this method for API completeness.
3933 pub fn resource(
3934 mut self,
3935 new_value: &str,
3936 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3937 self._resource = new_value.to_string();
3938 self
3939 }
3940 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3941 /// while executing the actual API request.
3942 ///
3943 /// ````text
3944 /// It should be used to handle progress information, and to implement a certain level of resilience.
3945 /// ````
3946 ///
3947 /// Sets the *delegate* property to the given value.
3948 pub fn delegate(
3949 mut self,
3950 new_value: &'a mut dyn common::Delegate,
3951 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
3952 self._delegate = Some(new_value);
3953 self
3954 }
3955
3956 /// Set any additional parameter of the query string used in the request.
3957 /// It should be used to set parameters which are not yet available through their own
3958 /// setters.
3959 ///
3960 /// Please note that this method must not be used to set any of the known parameters
3961 /// which have their own setter method. If done anyway, the request will fail.
3962 ///
3963 /// # Additional Parameters
3964 ///
3965 /// * *$.xgafv* (query-string) - V1 error format.
3966 /// * *access_token* (query-string) - OAuth access token.
3967 /// * *alt* (query-string) - Data format for response.
3968 /// * *callback* (query-string) - JSONP
3969 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3970 /// * *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.
3971 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3972 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3973 /// * *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.
3974 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3975 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3976 pub fn param<T>(
3977 mut self,
3978 name: T,
3979 value: T,
3980 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
3981 where
3982 T: AsRef<str>,
3983 {
3984 self._additional_params
3985 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3986 self
3987 }
3988
3989 /// Identifies the authorization scope for the method you are building.
3990 ///
3991 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3992 /// [`Scope::CloudPlatform`].
3993 ///
3994 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3995 /// tokens for more than one scope.
3996 ///
3997 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3998 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3999 /// sufficient, a read-write scope will do as well.
4000 pub fn add_scope<St>(
4001 mut self,
4002 scope: St,
4003 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
4004 where
4005 St: AsRef<str>,
4006 {
4007 self._scopes.insert(String::from(scope.as_ref()));
4008 self
4009 }
4010 /// Identifies the authorization scope(s) for the method you are building.
4011 ///
4012 /// See [`Self::add_scope()`] for details.
4013 pub fn add_scopes<I, St>(
4014 mut self,
4015 scopes: I,
4016 ) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C>
4017 where
4018 I: IntoIterator<Item = St>,
4019 St: AsRef<str>,
4020 {
4021 self._scopes
4022 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4023 self
4024 }
4025
4026 /// Removes all scopes, and no default scope will be used either.
4027 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4028 /// for details).
4029 pub fn clear_scopes(mut self) -> ProjectLocationInstanceNamespaceTestIamPermissionCall<'a, C> {
4030 self._scopes.clear();
4031 self
4032 }
4033}
4034
4035/// Creates a new Data Fusion instance in the specified project and location.
4036///
4037/// A builder for the *locations.instances.create* method supported by a *project* resource.
4038/// It is not used directly, but through a [`ProjectMethods`] instance.
4039///
4040/// # Example
4041///
4042/// Instantiate a resource method builder
4043///
4044/// ```test_harness,no_run
4045/// # extern crate hyper;
4046/// # extern crate hyper_rustls;
4047/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4048/// use datafusion1_beta1::api::Instance;
4049/// # async fn dox() {
4050/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4051///
4052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4054/// # .with_native_roots()
4055/// # .unwrap()
4056/// # .https_only()
4057/// # .enable_http2()
4058/// # .build();
4059///
4060/// # let executor = hyper_util::rt::TokioExecutor::new();
4061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4062/// # secret,
4063/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4064/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4065/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4066/// # ),
4067/// # ).build().await.unwrap();
4068///
4069/// # let client = hyper_util::client::legacy::Client::builder(
4070/// # hyper_util::rt::TokioExecutor::new()
4071/// # )
4072/// # .build(
4073/// # hyper_rustls::HttpsConnectorBuilder::new()
4074/// # .with_native_roots()
4075/// # .unwrap()
4076/// # .https_or_http()
4077/// # .enable_http2()
4078/// # .build()
4079/// # );
4080/// # let mut hub = DataFusion::new(client, auth);
4081/// // As the method needs a request, you would usually fill it with the desired information
4082/// // into the respective structure. Some of the parts shown here might not be applicable !
4083/// // Values shown here are possibly random and not representative !
4084/// let mut req = Instance::default();
4085///
4086/// // You can configure optional parameters by calling the respective setters at will, and
4087/// // execute the final call using `doit()`.
4088/// // Values shown here are possibly random and not representative !
4089/// let result = hub.projects().locations_instances_create(req, "parent")
4090/// .instance_id("amet")
4091/// .doit().await;
4092/// # }
4093/// ```
4094pub struct ProjectLocationInstanceCreateCall<'a, C>
4095where
4096 C: 'a,
4097{
4098 hub: &'a DataFusion<C>,
4099 _request: Instance,
4100 _parent: String,
4101 _instance_id: Option<String>,
4102 _delegate: Option<&'a mut dyn common::Delegate>,
4103 _additional_params: HashMap<String, String>,
4104 _scopes: BTreeSet<String>,
4105}
4106
4107impl<'a, C> common::CallBuilder for ProjectLocationInstanceCreateCall<'a, C> {}
4108
4109impl<'a, C> ProjectLocationInstanceCreateCall<'a, C>
4110where
4111 C: common::Connector,
4112{
4113 /// Perform the operation you have build so far.
4114 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4115 use std::borrow::Cow;
4116 use std::io::{Read, Seek};
4117
4118 use common::{url::Params, ToParts};
4119 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4120
4121 let mut dd = common::DefaultDelegate;
4122 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4123 dlg.begin(common::MethodInfo {
4124 id: "datafusion.projects.locations.instances.create",
4125 http_method: hyper::Method::POST,
4126 });
4127
4128 for &field in ["alt", "parent", "instanceId"].iter() {
4129 if self._additional_params.contains_key(field) {
4130 dlg.finished(false);
4131 return Err(common::Error::FieldClash(field));
4132 }
4133 }
4134
4135 let mut params = Params::with_capacity(5 + self._additional_params.len());
4136 params.push("parent", self._parent);
4137 if let Some(value) = self._instance_id.as_ref() {
4138 params.push("instanceId", value);
4139 }
4140
4141 params.extend(self._additional_params.iter());
4142
4143 params.push("alt", "json");
4144 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
4145 if self._scopes.is_empty() {
4146 self._scopes
4147 .insert(Scope::CloudPlatform.as_ref().to_string());
4148 }
4149
4150 #[allow(clippy::single_element_loop)]
4151 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4152 url = params.uri_replacement(url, param_name, find_this, true);
4153 }
4154 {
4155 let to_remove = ["parent"];
4156 params.remove_params(&to_remove);
4157 }
4158
4159 let url = params.parse_with_url(&url);
4160
4161 let mut json_mime_type = mime::APPLICATION_JSON;
4162 let mut request_value_reader = {
4163 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4164 common::remove_json_null_values(&mut value);
4165 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4166 serde_json::to_writer(&mut dst, &value).unwrap();
4167 dst
4168 };
4169 let request_size = request_value_reader
4170 .seek(std::io::SeekFrom::End(0))
4171 .unwrap();
4172 request_value_reader
4173 .seek(std::io::SeekFrom::Start(0))
4174 .unwrap();
4175
4176 loop {
4177 let token = match self
4178 .hub
4179 .auth
4180 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4181 .await
4182 {
4183 Ok(token) => token,
4184 Err(e) => match dlg.token(e) {
4185 Ok(token) => token,
4186 Err(e) => {
4187 dlg.finished(false);
4188 return Err(common::Error::MissingToken(e));
4189 }
4190 },
4191 };
4192 request_value_reader
4193 .seek(std::io::SeekFrom::Start(0))
4194 .unwrap();
4195 let mut req_result = {
4196 let client = &self.hub.client;
4197 dlg.pre_request();
4198 let mut req_builder = hyper::Request::builder()
4199 .method(hyper::Method::POST)
4200 .uri(url.as_str())
4201 .header(USER_AGENT, self.hub._user_agent.clone());
4202
4203 if let Some(token) = token.as_ref() {
4204 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4205 }
4206
4207 let request = req_builder
4208 .header(CONTENT_TYPE, json_mime_type.to_string())
4209 .header(CONTENT_LENGTH, request_size as u64)
4210 .body(common::to_body(
4211 request_value_reader.get_ref().clone().into(),
4212 ));
4213
4214 client.request(request.unwrap()).await
4215 };
4216
4217 match req_result {
4218 Err(err) => {
4219 if let common::Retry::After(d) = dlg.http_error(&err) {
4220 sleep(d).await;
4221 continue;
4222 }
4223 dlg.finished(false);
4224 return Err(common::Error::HttpError(err));
4225 }
4226 Ok(res) => {
4227 let (mut parts, body) = res.into_parts();
4228 let mut body = common::Body::new(body);
4229 if !parts.status.is_success() {
4230 let bytes = common::to_bytes(body).await.unwrap_or_default();
4231 let error = serde_json::from_str(&common::to_string(&bytes));
4232 let response = common::to_response(parts, bytes.into());
4233
4234 if let common::Retry::After(d) =
4235 dlg.http_failure(&response, error.as_ref().ok())
4236 {
4237 sleep(d).await;
4238 continue;
4239 }
4240
4241 dlg.finished(false);
4242
4243 return Err(match error {
4244 Ok(value) => common::Error::BadRequest(value),
4245 _ => common::Error::Failure(response),
4246 });
4247 }
4248 let response = {
4249 let bytes = common::to_bytes(body).await.unwrap_or_default();
4250 let encoded = common::to_string(&bytes);
4251 match serde_json::from_str(&encoded) {
4252 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4253 Err(error) => {
4254 dlg.response_json_decode_error(&encoded, &error);
4255 return Err(common::Error::JsonDecodeError(
4256 encoded.to_string(),
4257 error,
4258 ));
4259 }
4260 }
4261 };
4262
4263 dlg.finished(true);
4264 return Ok(response);
4265 }
4266 }
4267 }
4268 }
4269
4270 ///
4271 /// Sets the *request* property to the given value.
4272 ///
4273 /// Even though the property as already been set when instantiating this call,
4274 /// we provide this method for API completeness.
4275 pub fn request(mut self, new_value: Instance) -> ProjectLocationInstanceCreateCall<'a, C> {
4276 self._request = new_value;
4277 self
4278 }
4279 /// Required. The instance's project and location in the format projects/{project}/locations/{location}.
4280 ///
4281 /// Sets the *parent* path property to the given value.
4282 ///
4283 /// Even though the property as already been set when instantiating this call,
4284 /// we provide this method for API completeness.
4285 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
4286 self._parent = new_value.to_string();
4287 self
4288 }
4289 /// 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.
4290 ///
4291 /// Sets the *instance id* query property to the given value.
4292 pub fn instance_id(mut self, new_value: &str) -> ProjectLocationInstanceCreateCall<'a, C> {
4293 self._instance_id = Some(new_value.to_string());
4294 self
4295 }
4296 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4297 /// while executing the actual API request.
4298 ///
4299 /// ````text
4300 /// It should be used to handle progress information, and to implement a certain level of resilience.
4301 /// ````
4302 ///
4303 /// Sets the *delegate* property to the given value.
4304 pub fn delegate(
4305 mut self,
4306 new_value: &'a mut dyn common::Delegate,
4307 ) -> ProjectLocationInstanceCreateCall<'a, C> {
4308 self._delegate = Some(new_value);
4309 self
4310 }
4311
4312 /// Set any additional parameter of the query string used in the request.
4313 /// It should be used to set parameters which are not yet available through their own
4314 /// setters.
4315 ///
4316 /// Please note that this method must not be used to set any of the known parameters
4317 /// which have their own setter method. If done anyway, the request will fail.
4318 ///
4319 /// # Additional Parameters
4320 ///
4321 /// * *$.xgafv* (query-string) - V1 error format.
4322 /// * *access_token* (query-string) - OAuth access token.
4323 /// * *alt* (query-string) - Data format for response.
4324 /// * *callback* (query-string) - JSONP
4325 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4326 /// * *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.
4327 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4328 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4329 /// * *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.
4330 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4331 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4332 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceCreateCall<'a, C>
4333 where
4334 T: AsRef<str>,
4335 {
4336 self._additional_params
4337 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4338 self
4339 }
4340
4341 /// Identifies the authorization scope for the method you are building.
4342 ///
4343 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4344 /// [`Scope::CloudPlatform`].
4345 ///
4346 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4347 /// tokens for more than one scope.
4348 ///
4349 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4350 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4351 /// sufficient, a read-write scope will do as well.
4352 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceCreateCall<'a, C>
4353 where
4354 St: AsRef<str>,
4355 {
4356 self._scopes.insert(String::from(scope.as_ref()));
4357 self
4358 }
4359 /// Identifies the authorization scope(s) for the method you are building.
4360 ///
4361 /// See [`Self::add_scope()`] for details.
4362 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceCreateCall<'a, C>
4363 where
4364 I: IntoIterator<Item = St>,
4365 St: AsRef<str>,
4366 {
4367 self._scopes
4368 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4369 self
4370 }
4371
4372 /// Removes all scopes, and no default scope will be used either.
4373 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4374 /// for details).
4375 pub fn clear_scopes(mut self) -> ProjectLocationInstanceCreateCall<'a, C> {
4376 self._scopes.clear();
4377 self
4378 }
4379}
4380
4381/// Deletes a single Data Fusion instance.
4382///
4383/// A builder for the *locations.instances.delete* method supported by a *project* resource.
4384/// It is not used directly, but through a [`ProjectMethods`] instance.
4385///
4386/// # Example
4387///
4388/// Instantiate a resource method builder
4389///
4390/// ```test_harness,no_run
4391/// # extern crate hyper;
4392/// # extern crate hyper_rustls;
4393/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4394/// # async fn dox() {
4395/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4396///
4397/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4398/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4399/// # .with_native_roots()
4400/// # .unwrap()
4401/// # .https_only()
4402/// # .enable_http2()
4403/// # .build();
4404///
4405/// # let executor = hyper_util::rt::TokioExecutor::new();
4406/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4407/// # secret,
4408/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4409/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4410/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4411/// # ),
4412/// # ).build().await.unwrap();
4413///
4414/// # let client = hyper_util::client::legacy::Client::builder(
4415/// # hyper_util::rt::TokioExecutor::new()
4416/// # )
4417/// # .build(
4418/// # hyper_rustls::HttpsConnectorBuilder::new()
4419/// # .with_native_roots()
4420/// # .unwrap()
4421/// # .https_or_http()
4422/// # .enable_http2()
4423/// # .build()
4424/// # );
4425/// # let mut hub = DataFusion::new(client, auth);
4426/// // You can configure optional parameters by calling the respective setters at will, and
4427/// // execute the final call using `doit()`.
4428/// // Values shown here are possibly random and not representative !
4429/// let result = hub.projects().locations_instances_delete("name")
4430/// .force(true)
4431/// .doit().await;
4432/// # }
4433/// ```
4434pub struct ProjectLocationInstanceDeleteCall<'a, C>
4435where
4436 C: 'a,
4437{
4438 hub: &'a DataFusion<C>,
4439 _name: String,
4440 _force: Option<bool>,
4441 _delegate: Option<&'a mut dyn common::Delegate>,
4442 _additional_params: HashMap<String, String>,
4443 _scopes: BTreeSet<String>,
4444}
4445
4446impl<'a, C> common::CallBuilder for ProjectLocationInstanceDeleteCall<'a, C> {}
4447
4448impl<'a, C> ProjectLocationInstanceDeleteCall<'a, C>
4449where
4450 C: common::Connector,
4451{
4452 /// Perform the operation you have build so far.
4453 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4454 use std::borrow::Cow;
4455 use std::io::{Read, Seek};
4456
4457 use common::{url::Params, ToParts};
4458 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4459
4460 let mut dd = common::DefaultDelegate;
4461 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4462 dlg.begin(common::MethodInfo {
4463 id: "datafusion.projects.locations.instances.delete",
4464 http_method: hyper::Method::DELETE,
4465 });
4466
4467 for &field in ["alt", "name", "force"].iter() {
4468 if self._additional_params.contains_key(field) {
4469 dlg.finished(false);
4470 return Err(common::Error::FieldClash(field));
4471 }
4472 }
4473
4474 let mut params = Params::with_capacity(4 + self._additional_params.len());
4475 params.push("name", self._name);
4476 if let Some(value) = self._force.as_ref() {
4477 params.push("force", value.to_string());
4478 }
4479
4480 params.extend(self._additional_params.iter());
4481
4482 params.push("alt", "json");
4483 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4484 if self._scopes.is_empty() {
4485 self._scopes
4486 .insert(Scope::CloudPlatform.as_ref().to_string());
4487 }
4488
4489 #[allow(clippy::single_element_loop)]
4490 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4491 url = params.uri_replacement(url, param_name, find_this, true);
4492 }
4493 {
4494 let to_remove = ["name"];
4495 params.remove_params(&to_remove);
4496 }
4497
4498 let url = params.parse_with_url(&url);
4499
4500 loop {
4501 let token = match self
4502 .hub
4503 .auth
4504 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4505 .await
4506 {
4507 Ok(token) => token,
4508 Err(e) => match dlg.token(e) {
4509 Ok(token) => token,
4510 Err(e) => {
4511 dlg.finished(false);
4512 return Err(common::Error::MissingToken(e));
4513 }
4514 },
4515 };
4516 let mut req_result = {
4517 let client = &self.hub.client;
4518 dlg.pre_request();
4519 let mut req_builder = hyper::Request::builder()
4520 .method(hyper::Method::DELETE)
4521 .uri(url.as_str())
4522 .header(USER_AGENT, self.hub._user_agent.clone());
4523
4524 if let Some(token) = token.as_ref() {
4525 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4526 }
4527
4528 let request = req_builder
4529 .header(CONTENT_LENGTH, 0_u64)
4530 .body(common::to_body::<String>(None));
4531
4532 client.request(request.unwrap()).await
4533 };
4534
4535 match req_result {
4536 Err(err) => {
4537 if let common::Retry::After(d) = dlg.http_error(&err) {
4538 sleep(d).await;
4539 continue;
4540 }
4541 dlg.finished(false);
4542 return Err(common::Error::HttpError(err));
4543 }
4544 Ok(res) => {
4545 let (mut parts, body) = res.into_parts();
4546 let mut body = common::Body::new(body);
4547 if !parts.status.is_success() {
4548 let bytes = common::to_bytes(body).await.unwrap_or_default();
4549 let error = serde_json::from_str(&common::to_string(&bytes));
4550 let response = common::to_response(parts, bytes.into());
4551
4552 if let common::Retry::After(d) =
4553 dlg.http_failure(&response, error.as_ref().ok())
4554 {
4555 sleep(d).await;
4556 continue;
4557 }
4558
4559 dlg.finished(false);
4560
4561 return Err(match error {
4562 Ok(value) => common::Error::BadRequest(value),
4563 _ => common::Error::Failure(response),
4564 });
4565 }
4566 let response = {
4567 let bytes = common::to_bytes(body).await.unwrap_or_default();
4568 let encoded = common::to_string(&bytes);
4569 match serde_json::from_str(&encoded) {
4570 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4571 Err(error) => {
4572 dlg.response_json_decode_error(&encoded, &error);
4573 return Err(common::Error::JsonDecodeError(
4574 encoded.to_string(),
4575 error,
4576 ));
4577 }
4578 }
4579 };
4580
4581 dlg.finished(true);
4582 return Ok(response);
4583 }
4584 }
4585 }
4586 }
4587
4588 /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}
4589 ///
4590 /// Sets the *name* path property to the given value.
4591 ///
4592 /// Even though the property as already been set when instantiating this call,
4593 /// we provide this method for API completeness.
4594 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceDeleteCall<'a, C> {
4595 self._name = new_value.to_string();
4596 self
4597 }
4598 /// Optional. If set to true, any nested resources from this instance will also be deleted.
4599 ///
4600 /// Sets the *force* query property to the given value.
4601 pub fn force(mut self, new_value: bool) -> ProjectLocationInstanceDeleteCall<'a, C> {
4602 self._force = Some(new_value);
4603 self
4604 }
4605 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4606 /// while executing the actual API request.
4607 ///
4608 /// ````text
4609 /// It should be used to handle progress information, and to implement a certain level of resilience.
4610 /// ````
4611 ///
4612 /// Sets the *delegate* property to the given value.
4613 pub fn delegate(
4614 mut self,
4615 new_value: &'a mut dyn common::Delegate,
4616 ) -> ProjectLocationInstanceDeleteCall<'a, C> {
4617 self._delegate = Some(new_value);
4618 self
4619 }
4620
4621 /// Set any additional parameter of the query string used in the request.
4622 /// It should be used to set parameters which are not yet available through their own
4623 /// setters.
4624 ///
4625 /// Please note that this method must not be used to set any of the known parameters
4626 /// which have their own setter method. If done anyway, the request will fail.
4627 ///
4628 /// # Additional Parameters
4629 ///
4630 /// * *$.xgafv* (query-string) - V1 error format.
4631 /// * *access_token* (query-string) - OAuth access token.
4632 /// * *alt* (query-string) - Data format for response.
4633 /// * *callback* (query-string) - JSONP
4634 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4635 /// * *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.
4636 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4637 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4638 /// * *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.
4639 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4640 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4641 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceDeleteCall<'a, C>
4642 where
4643 T: AsRef<str>,
4644 {
4645 self._additional_params
4646 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4647 self
4648 }
4649
4650 /// Identifies the authorization scope for the method you are building.
4651 ///
4652 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4653 /// [`Scope::CloudPlatform`].
4654 ///
4655 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4656 /// tokens for more than one scope.
4657 ///
4658 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4659 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4660 /// sufficient, a read-write scope will do as well.
4661 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceDeleteCall<'a, C>
4662 where
4663 St: AsRef<str>,
4664 {
4665 self._scopes.insert(String::from(scope.as_ref()));
4666 self
4667 }
4668 /// Identifies the authorization scope(s) for the method you are building.
4669 ///
4670 /// See [`Self::add_scope()`] for details.
4671 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceDeleteCall<'a, C>
4672 where
4673 I: IntoIterator<Item = St>,
4674 St: AsRef<str>,
4675 {
4676 self._scopes
4677 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4678 self
4679 }
4680
4681 /// Removes all scopes, and no default scope will be used either.
4682 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4683 /// for details).
4684 pub fn clear_scopes(mut self) -> ProjectLocationInstanceDeleteCall<'a, C> {
4685 self._scopes.clear();
4686 self
4687 }
4688}
4689
4690/// Gets details of a single Data Fusion instance.
4691///
4692/// A builder for the *locations.instances.get* method supported by a *project* resource.
4693/// It is not used directly, but through a [`ProjectMethods`] instance.
4694///
4695/// # Example
4696///
4697/// Instantiate a resource method builder
4698///
4699/// ```test_harness,no_run
4700/// # extern crate hyper;
4701/// # extern crate hyper_rustls;
4702/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
4703/// # async fn dox() {
4704/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4705///
4706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4708/// # .with_native_roots()
4709/// # .unwrap()
4710/// # .https_only()
4711/// # .enable_http2()
4712/// # .build();
4713///
4714/// # let executor = hyper_util::rt::TokioExecutor::new();
4715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4716/// # secret,
4717/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4718/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4719/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4720/// # ),
4721/// # ).build().await.unwrap();
4722///
4723/// # let client = hyper_util::client::legacy::Client::builder(
4724/// # hyper_util::rt::TokioExecutor::new()
4725/// # )
4726/// # .build(
4727/// # hyper_rustls::HttpsConnectorBuilder::new()
4728/// # .with_native_roots()
4729/// # .unwrap()
4730/// # .https_or_http()
4731/// # .enable_http2()
4732/// # .build()
4733/// # );
4734/// # let mut hub = DataFusion::new(client, auth);
4735/// // You can configure optional parameters by calling the respective setters at will, and
4736/// // execute the final call using `doit()`.
4737/// // Values shown here are possibly random and not representative !
4738/// let result = hub.projects().locations_instances_get("name")
4739/// .doit().await;
4740/// # }
4741/// ```
4742pub struct ProjectLocationInstanceGetCall<'a, C>
4743where
4744 C: 'a,
4745{
4746 hub: &'a DataFusion<C>,
4747 _name: String,
4748 _delegate: Option<&'a mut dyn common::Delegate>,
4749 _additional_params: HashMap<String, String>,
4750 _scopes: BTreeSet<String>,
4751}
4752
4753impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetCall<'a, C> {}
4754
4755impl<'a, C> ProjectLocationInstanceGetCall<'a, C>
4756where
4757 C: common::Connector,
4758{
4759 /// Perform the operation you have build so far.
4760 pub async fn doit(mut self) -> common::Result<(common::Response, Instance)> {
4761 use std::borrow::Cow;
4762 use std::io::{Read, Seek};
4763
4764 use common::{url::Params, ToParts};
4765 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4766
4767 let mut dd = common::DefaultDelegate;
4768 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4769 dlg.begin(common::MethodInfo {
4770 id: "datafusion.projects.locations.instances.get",
4771 http_method: hyper::Method::GET,
4772 });
4773
4774 for &field in ["alt", "name"].iter() {
4775 if self._additional_params.contains_key(field) {
4776 dlg.finished(false);
4777 return Err(common::Error::FieldClash(field));
4778 }
4779 }
4780
4781 let mut params = Params::with_capacity(3 + self._additional_params.len());
4782 params.push("name", self._name);
4783
4784 params.extend(self._additional_params.iter());
4785
4786 params.push("alt", "json");
4787 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
4788 if self._scopes.is_empty() {
4789 self._scopes
4790 .insert(Scope::CloudPlatform.as_ref().to_string());
4791 }
4792
4793 #[allow(clippy::single_element_loop)]
4794 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4795 url = params.uri_replacement(url, param_name, find_this, true);
4796 }
4797 {
4798 let to_remove = ["name"];
4799 params.remove_params(&to_remove);
4800 }
4801
4802 let url = params.parse_with_url(&url);
4803
4804 loop {
4805 let token = match self
4806 .hub
4807 .auth
4808 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4809 .await
4810 {
4811 Ok(token) => token,
4812 Err(e) => match dlg.token(e) {
4813 Ok(token) => token,
4814 Err(e) => {
4815 dlg.finished(false);
4816 return Err(common::Error::MissingToken(e));
4817 }
4818 },
4819 };
4820 let mut req_result = {
4821 let client = &self.hub.client;
4822 dlg.pre_request();
4823 let mut req_builder = hyper::Request::builder()
4824 .method(hyper::Method::GET)
4825 .uri(url.as_str())
4826 .header(USER_AGENT, self.hub._user_agent.clone());
4827
4828 if let Some(token) = token.as_ref() {
4829 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4830 }
4831
4832 let request = req_builder
4833 .header(CONTENT_LENGTH, 0_u64)
4834 .body(common::to_body::<String>(None));
4835
4836 client.request(request.unwrap()).await
4837 };
4838
4839 match req_result {
4840 Err(err) => {
4841 if let common::Retry::After(d) = dlg.http_error(&err) {
4842 sleep(d).await;
4843 continue;
4844 }
4845 dlg.finished(false);
4846 return Err(common::Error::HttpError(err));
4847 }
4848 Ok(res) => {
4849 let (mut parts, body) = res.into_parts();
4850 let mut body = common::Body::new(body);
4851 if !parts.status.is_success() {
4852 let bytes = common::to_bytes(body).await.unwrap_or_default();
4853 let error = serde_json::from_str(&common::to_string(&bytes));
4854 let response = common::to_response(parts, bytes.into());
4855
4856 if let common::Retry::After(d) =
4857 dlg.http_failure(&response, error.as_ref().ok())
4858 {
4859 sleep(d).await;
4860 continue;
4861 }
4862
4863 dlg.finished(false);
4864
4865 return Err(match error {
4866 Ok(value) => common::Error::BadRequest(value),
4867 _ => common::Error::Failure(response),
4868 });
4869 }
4870 let response = {
4871 let bytes = common::to_bytes(body).await.unwrap_or_default();
4872 let encoded = common::to_string(&bytes);
4873 match serde_json::from_str(&encoded) {
4874 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4875 Err(error) => {
4876 dlg.response_json_decode_error(&encoded, &error);
4877 return Err(common::Error::JsonDecodeError(
4878 encoded.to_string(),
4879 error,
4880 ));
4881 }
4882 }
4883 };
4884
4885 dlg.finished(true);
4886 return Ok(response);
4887 }
4888 }
4889 }
4890 }
4891
4892 /// Required. The instance resource name in the format projects/{project}/locations/{location}/instances/{instance}.
4893 ///
4894 /// Sets the *name* path property to the given value.
4895 ///
4896 /// Even though the property as already been set when instantiating this call,
4897 /// we provide this method for API completeness.
4898 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceGetCall<'a, C> {
4899 self._name = new_value.to_string();
4900 self
4901 }
4902 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4903 /// while executing the actual API request.
4904 ///
4905 /// ````text
4906 /// It should be used to handle progress information, and to implement a certain level of resilience.
4907 /// ````
4908 ///
4909 /// Sets the *delegate* property to the given value.
4910 pub fn delegate(
4911 mut self,
4912 new_value: &'a mut dyn common::Delegate,
4913 ) -> ProjectLocationInstanceGetCall<'a, C> {
4914 self._delegate = Some(new_value);
4915 self
4916 }
4917
4918 /// Set any additional parameter of the query string used in the request.
4919 /// It should be used to set parameters which are not yet available through their own
4920 /// setters.
4921 ///
4922 /// Please note that this method must not be used to set any of the known parameters
4923 /// which have their own setter method. If done anyway, the request will fail.
4924 ///
4925 /// # Additional Parameters
4926 ///
4927 /// * *$.xgafv* (query-string) - V1 error format.
4928 /// * *access_token* (query-string) - OAuth access token.
4929 /// * *alt* (query-string) - Data format for response.
4930 /// * *callback* (query-string) - JSONP
4931 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4932 /// * *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.
4933 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4934 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4935 /// * *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.
4936 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4937 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4938 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetCall<'a, C>
4939 where
4940 T: AsRef<str>,
4941 {
4942 self._additional_params
4943 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4944 self
4945 }
4946
4947 /// Identifies the authorization scope for the method you are building.
4948 ///
4949 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4950 /// [`Scope::CloudPlatform`].
4951 ///
4952 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4953 /// tokens for more than one scope.
4954 ///
4955 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4956 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4957 /// sufficient, a read-write scope will do as well.
4958 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetCall<'a, C>
4959 where
4960 St: AsRef<str>,
4961 {
4962 self._scopes.insert(String::from(scope.as_ref()));
4963 self
4964 }
4965 /// Identifies the authorization scope(s) for the method you are building.
4966 ///
4967 /// See [`Self::add_scope()`] for details.
4968 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetCall<'a, C>
4969 where
4970 I: IntoIterator<Item = St>,
4971 St: AsRef<str>,
4972 {
4973 self._scopes
4974 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4975 self
4976 }
4977
4978 /// Removes all scopes, and no default scope will be used either.
4979 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4980 /// for details).
4981 pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetCall<'a, C> {
4982 self._scopes.clear();
4983 self
4984 }
4985}
4986
4987/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4988///
4989/// A builder for the *locations.instances.getIamPolicy* method supported by a *project* resource.
4990/// It is not used directly, but through a [`ProjectMethods`] instance.
4991///
4992/// # Example
4993///
4994/// Instantiate a resource method builder
4995///
4996/// ```test_harness,no_run
4997/// # extern crate hyper;
4998/// # extern crate hyper_rustls;
4999/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5000/// # async fn dox() {
5001/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5002///
5003/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5004/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5005/// # .with_native_roots()
5006/// # .unwrap()
5007/// # .https_only()
5008/// # .enable_http2()
5009/// # .build();
5010///
5011/// # let executor = hyper_util::rt::TokioExecutor::new();
5012/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5013/// # secret,
5014/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5015/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5016/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5017/// # ),
5018/// # ).build().await.unwrap();
5019///
5020/// # let client = hyper_util::client::legacy::Client::builder(
5021/// # hyper_util::rt::TokioExecutor::new()
5022/// # )
5023/// # .build(
5024/// # hyper_rustls::HttpsConnectorBuilder::new()
5025/// # .with_native_roots()
5026/// # .unwrap()
5027/// # .https_or_http()
5028/// # .enable_http2()
5029/// # .build()
5030/// # );
5031/// # let mut hub = DataFusion::new(client, auth);
5032/// // You can configure optional parameters by calling the respective setters at will, and
5033/// // execute the final call using `doit()`.
5034/// // Values shown here are possibly random and not representative !
5035/// let result = hub.projects().locations_instances_get_iam_policy("resource")
5036/// .options_requested_policy_version(-12)
5037/// .doit().await;
5038/// # }
5039/// ```
5040pub struct ProjectLocationInstanceGetIamPolicyCall<'a, C>
5041where
5042 C: 'a,
5043{
5044 hub: &'a DataFusion<C>,
5045 _resource: String,
5046 _options_requested_policy_version: Option<i32>,
5047 _delegate: Option<&'a mut dyn common::Delegate>,
5048 _additional_params: HashMap<String, String>,
5049 _scopes: BTreeSet<String>,
5050}
5051
5052impl<'a, C> common::CallBuilder for ProjectLocationInstanceGetIamPolicyCall<'a, C> {}
5053
5054impl<'a, C> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5055where
5056 C: common::Connector,
5057{
5058 /// Perform the operation you have build so far.
5059 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5060 use std::borrow::Cow;
5061 use std::io::{Read, Seek};
5062
5063 use common::{url::Params, ToParts};
5064 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5065
5066 let mut dd = common::DefaultDelegate;
5067 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5068 dlg.begin(common::MethodInfo {
5069 id: "datafusion.projects.locations.instances.getIamPolicy",
5070 http_method: hyper::Method::GET,
5071 });
5072
5073 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
5074 if self._additional_params.contains_key(field) {
5075 dlg.finished(false);
5076 return Err(common::Error::FieldClash(field));
5077 }
5078 }
5079
5080 let mut params = Params::with_capacity(4 + self._additional_params.len());
5081 params.push("resource", self._resource);
5082 if let Some(value) = self._options_requested_policy_version.as_ref() {
5083 params.push("options.requestedPolicyVersion", value.to_string());
5084 }
5085
5086 params.extend(self._additional_params.iter());
5087
5088 params.push("alt", "json");
5089 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:getIamPolicy";
5090 if self._scopes.is_empty() {
5091 self._scopes
5092 .insert(Scope::CloudPlatform.as_ref().to_string());
5093 }
5094
5095 #[allow(clippy::single_element_loop)]
5096 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5097 url = params.uri_replacement(url, param_name, find_this, true);
5098 }
5099 {
5100 let to_remove = ["resource"];
5101 params.remove_params(&to_remove);
5102 }
5103
5104 let url = params.parse_with_url(&url);
5105
5106 loop {
5107 let token = match self
5108 .hub
5109 .auth
5110 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5111 .await
5112 {
5113 Ok(token) => token,
5114 Err(e) => match dlg.token(e) {
5115 Ok(token) => token,
5116 Err(e) => {
5117 dlg.finished(false);
5118 return Err(common::Error::MissingToken(e));
5119 }
5120 },
5121 };
5122 let mut req_result = {
5123 let client = &self.hub.client;
5124 dlg.pre_request();
5125 let mut req_builder = hyper::Request::builder()
5126 .method(hyper::Method::GET)
5127 .uri(url.as_str())
5128 .header(USER_AGENT, self.hub._user_agent.clone());
5129
5130 if let Some(token) = token.as_ref() {
5131 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5132 }
5133
5134 let request = req_builder
5135 .header(CONTENT_LENGTH, 0_u64)
5136 .body(common::to_body::<String>(None));
5137
5138 client.request(request.unwrap()).await
5139 };
5140
5141 match req_result {
5142 Err(err) => {
5143 if let common::Retry::After(d) = dlg.http_error(&err) {
5144 sleep(d).await;
5145 continue;
5146 }
5147 dlg.finished(false);
5148 return Err(common::Error::HttpError(err));
5149 }
5150 Ok(res) => {
5151 let (mut parts, body) = res.into_parts();
5152 let mut body = common::Body::new(body);
5153 if !parts.status.is_success() {
5154 let bytes = common::to_bytes(body).await.unwrap_or_default();
5155 let error = serde_json::from_str(&common::to_string(&bytes));
5156 let response = common::to_response(parts, bytes.into());
5157
5158 if let common::Retry::After(d) =
5159 dlg.http_failure(&response, error.as_ref().ok())
5160 {
5161 sleep(d).await;
5162 continue;
5163 }
5164
5165 dlg.finished(false);
5166
5167 return Err(match error {
5168 Ok(value) => common::Error::BadRequest(value),
5169 _ => common::Error::Failure(response),
5170 });
5171 }
5172 let response = {
5173 let bytes = common::to_bytes(body).await.unwrap_or_default();
5174 let encoded = common::to_string(&bytes);
5175 match serde_json::from_str(&encoded) {
5176 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5177 Err(error) => {
5178 dlg.response_json_decode_error(&encoded, &error);
5179 return Err(common::Error::JsonDecodeError(
5180 encoded.to_string(),
5181 error,
5182 ));
5183 }
5184 }
5185 };
5186
5187 dlg.finished(true);
5188 return Ok(response);
5189 }
5190 }
5191 }
5192 }
5193
5194 /// 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.
5195 ///
5196 /// Sets the *resource* path property to the given value.
5197 ///
5198 /// Even though the property as already been set when instantiating this call,
5199 /// we provide this method for API completeness.
5200 pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5201 self._resource = new_value.to_string();
5202 self
5203 }
5204 /// 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).
5205 ///
5206 /// Sets the *options.requested policy version* query property to the given value.
5207 pub fn options_requested_policy_version(
5208 mut self,
5209 new_value: i32,
5210 ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5211 self._options_requested_policy_version = Some(new_value);
5212 self
5213 }
5214 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5215 /// while executing the actual API request.
5216 ///
5217 /// ````text
5218 /// It should be used to handle progress information, and to implement a certain level of resilience.
5219 /// ````
5220 ///
5221 /// Sets the *delegate* property to the given value.
5222 pub fn delegate(
5223 mut self,
5224 new_value: &'a mut dyn common::Delegate,
5225 ) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5226 self._delegate = Some(new_value);
5227 self
5228 }
5229
5230 /// Set any additional parameter of the query string used in the request.
5231 /// It should be used to set parameters which are not yet available through their own
5232 /// setters.
5233 ///
5234 /// Please note that this method must not be used to set any of the known parameters
5235 /// which have their own setter method. If done anyway, the request will fail.
5236 ///
5237 /// # Additional Parameters
5238 ///
5239 /// * *$.xgafv* (query-string) - V1 error format.
5240 /// * *access_token* (query-string) - OAuth access token.
5241 /// * *alt* (query-string) - Data format for response.
5242 /// * *callback* (query-string) - JSONP
5243 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5244 /// * *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.
5245 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5246 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5247 /// * *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.
5248 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5249 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5250 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5251 where
5252 T: AsRef<str>,
5253 {
5254 self._additional_params
5255 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5256 self
5257 }
5258
5259 /// Identifies the authorization scope for the method you are building.
5260 ///
5261 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5262 /// [`Scope::CloudPlatform`].
5263 ///
5264 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5265 /// tokens for more than one scope.
5266 ///
5267 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5268 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5269 /// sufficient, a read-write scope will do as well.
5270 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5271 where
5272 St: AsRef<str>,
5273 {
5274 self._scopes.insert(String::from(scope.as_ref()));
5275 self
5276 }
5277 /// Identifies the authorization scope(s) for the method you are building.
5278 ///
5279 /// See [`Self::add_scope()`] for details.
5280 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceGetIamPolicyCall<'a, C>
5281 where
5282 I: IntoIterator<Item = St>,
5283 St: AsRef<str>,
5284 {
5285 self._scopes
5286 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5287 self
5288 }
5289
5290 /// Removes all scopes, and no default scope will be used either.
5291 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5292 /// for details).
5293 pub fn clear_scopes(mut self) -> ProjectLocationInstanceGetIamPolicyCall<'a, C> {
5294 self._scopes.clear();
5295 self
5296 }
5297}
5298
5299/// Lists Data Fusion instances in the specified project and location.
5300///
5301/// A builder for the *locations.instances.list* method supported by a *project* resource.
5302/// It is not used directly, but through a [`ProjectMethods`] instance.
5303///
5304/// # Example
5305///
5306/// Instantiate a resource method builder
5307///
5308/// ```test_harness,no_run
5309/// # extern crate hyper;
5310/// # extern crate hyper_rustls;
5311/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5312/// # async fn dox() {
5313/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5314///
5315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5317/// # .with_native_roots()
5318/// # .unwrap()
5319/// # .https_only()
5320/// # .enable_http2()
5321/// # .build();
5322///
5323/// # let executor = hyper_util::rt::TokioExecutor::new();
5324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5325/// # secret,
5326/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5327/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5328/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5329/// # ),
5330/// # ).build().await.unwrap();
5331///
5332/// # let client = hyper_util::client::legacy::Client::builder(
5333/// # hyper_util::rt::TokioExecutor::new()
5334/// # )
5335/// # .build(
5336/// # hyper_rustls::HttpsConnectorBuilder::new()
5337/// # .with_native_roots()
5338/// # .unwrap()
5339/// # .https_or_http()
5340/// # .enable_http2()
5341/// # .build()
5342/// # );
5343/// # let mut hub = DataFusion::new(client, auth);
5344/// // You can configure optional parameters by calling the respective setters at will, and
5345/// // execute the final call using `doit()`.
5346/// // Values shown here are possibly random and not representative !
5347/// let result = hub.projects().locations_instances_list("parent")
5348/// .page_token("est")
5349/// .page_size(-50)
5350/// .order_by("ipsum")
5351/// .filter("est")
5352/// .doit().await;
5353/// # }
5354/// ```
5355pub struct ProjectLocationInstanceListCall<'a, C>
5356where
5357 C: 'a,
5358{
5359 hub: &'a DataFusion<C>,
5360 _parent: String,
5361 _page_token: Option<String>,
5362 _page_size: Option<i32>,
5363 _order_by: Option<String>,
5364 _filter: Option<String>,
5365 _delegate: Option<&'a mut dyn common::Delegate>,
5366 _additional_params: HashMap<String, String>,
5367 _scopes: BTreeSet<String>,
5368}
5369
5370impl<'a, C> common::CallBuilder for ProjectLocationInstanceListCall<'a, C> {}
5371
5372impl<'a, C> ProjectLocationInstanceListCall<'a, C>
5373where
5374 C: common::Connector,
5375{
5376 /// Perform the operation you have build so far.
5377 pub async fn doit(mut self) -> common::Result<(common::Response, ListInstancesResponse)> {
5378 use std::borrow::Cow;
5379 use std::io::{Read, Seek};
5380
5381 use common::{url::Params, ToParts};
5382 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5383
5384 let mut dd = common::DefaultDelegate;
5385 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5386 dlg.begin(common::MethodInfo {
5387 id: "datafusion.projects.locations.instances.list",
5388 http_method: hyper::Method::GET,
5389 });
5390
5391 for &field in [
5392 "alt",
5393 "parent",
5394 "pageToken",
5395 "pageSize",
5396 "orderBy",
5397 "filter",
5398 ]
5399 .iter()
5400 {
5401 if self._additional_params.contains_key(field) {
5402 dlg.finished(false);
5403 return Err(common::Error::FieldClash(field));
5404 }
5405 }
5406
5407 let mut params = Params::with_capacity(7 + self._additional_params.len());
5408 params.push("parent", self._parent);
5409 if let Some(value) = self._page_token.as_ref() {
5410 params.push("pageToken", value);
5411 }
5412 if let Some(value) = self._page_size.as_ref() {
5413 params.push("pageSize", value.to_string());
5414 }
5415 if let Some(value) = self._order_by.as_ref() {
5416 params.push("orderBy", value);
5417 }
5418 if let Some(value) = self._filter.as_ref() {
5419 params.push("filter", value);
5420 }
5421
5422 params.extend(self._additional_params.iter());
5423
5424 params.push("alt", "json");
5425 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/instances";
5426 if self._scopes.is_empty() {
5427 self._scopes
5428 .insert(Scope::CloudPlatform.as_ref().to_string());
5429 }
5430
5431 #[allow(clippy::single_element_loop)]
5432 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5433 url = params.uri_replacement(url, param_name, find_this, true);
5434 }
5435 {
5436 let to_remove = ["parent"];
5437 params.remove_params(&to_remove);
5438 }
5439
5440 let url = params.parse_with_url(&url);
5441
5442 loop {
5443 let token = match self
5444 .hub
5445 .auth
5446 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5447 .await
5448 {
5449 Ok(token) => token,
5450 Err(e) => match dlg.token(e) {
5451 Ok(token) => token,
5452 Err(e) => {
5453 dlg.finished(false);
5454 return Err(common::Error::MissingToken(e));
5455 }
5456 },
5457 };
5458 let mut req_result = {
5459 let client = &self.hub.client;
5460 dlg.pre_request();
5461 let mut req_builder = hyper::Request::builder()
5462 .method(hyper::Method::GET)
5463 .uri(url.as_str())
5464 .header(USER_AGENT, self.hub._user_agent.clone());
5465
5466 if let Some(token) = token.as_ref() {
5467 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5468 }
5469
5470 let request = req_builder
5471 .header(CONTENT_LENGTH, 0_u64)
5472 .body(common::to_body::<String>(None));
5473
5474 client.request(request.unwrap()).await
5475 };
5476
5477 match req_result {
5478 Err(err) => {
5479 if let common::Retry::After(d) = dlg.http_error(&err) {
5480 sleep(d).await;
5481 continue;
5482 }
5483 dlg.finished(false);
5484 return Err(common::Error::HttpError(err));
5485 }
5486 Ok(res) => {
5487 let (mut parts, body) = res.into_parts();
5488 let mut body = common::Body::new(body);
5489 if !parts.status.is_success() {
5490 let bytes = common::to_bytes(body).await.unwrap_or_default();
5491 let error = serde_json::from_str(&common::to_string(&bytes));
5492 let response = common::to_response(parts, bytes.into());
5493
5494 if let common::Retry::After(d) =
5495 dlg.http_failure(&response, error.as_ref().ok())
5496 {
5497 sleep(d).await;
5498 continue;
5499 }
5500
5501 dlg.finished(false);
5502
5503 return Err(match error {
5504 Ok(value) => common::Error::BadRequest(value),
5505 _ => common::Error::Failure(response),
5506 });
5507 }
5508 let response = {
5509 let bytes = common::to_bytes(body).await.unwrap_or_default();
5510 let encoded = common::to_string(&bytes);
5511 match serde_json::from_str(&encoded) {
5512 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5513 Err(error) => {
5514 dlg.response_json_decode_error(&encoded, &error);
5515 return Err(common::Error::JsonDecodeError(
5516 encoded.to_string(),
5517 error,
5518 ));
5519 }
5520 }
5521 };
5522
5523 dlg.finished(true);
5524 return Ok(response);
5525 }
5526 }
5527 }
5528 }
5529
5530 /// 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.
5531 ///
5532 /// Sets the *parent* path property to the given value.
5533 ///
5534 /// Even though the property as already been set when instantiating this call,
5535 /// we provide this method for API completeness.
5536 pub fn parent(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5537 self._parent = new_value.to_string();
5538 self
5539 }
5540 /// The next_page_token value to use if there are additional results to retrieve for this list request.
5541 ///
5542 /// Sets the *page token* query property to the given value.
5543 pub fn page_token(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5544 self._page_token = Some(new_value.to_string());
5545 self
5546 }
5547 /// The maximum number of items to return.
5548 ///
5549 /// Sets the *page size* query property to the given value.
5550 pub fn page_size(mut self, new_value: i32) -> ProjectLocationInstanceListCall<'a, C> {
5551 self._page_size = Some(new_value);
5552 self
5553 }
5554 /// Sort results. Supported values are "name", "name desc", or "" (unsorted).
5555 ///
5556 /// Sets the *order by* query property to the given value.
5557 pub fn order_by(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5558 self._order_by = Some(new_value.to_string());
5559 self
5560 }
5561 /// List filter.
5562 ///
5563 /// Sets the *filter* query property to the given value.
5564 pub fn filter(mut self, new_value: &str) -> ProjectLocationInstanceListCall<'a, C> {
5565 self._filter = Some(new_value.to_string());
5566 self
5567 }
5568 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5569 /// while executing the actual API request.
5570 ///
5571 /// ````text
5572 /// It should be used to handle progress information, and to implement a certain level of resilience.
5573 /// ````
5574 ///
5575 /// Sets the *delegate* property to the given value.
5576 pub fn delegate(
5577 mut self,
5578 new_value: &'a mut dyn common::Delegate,
5579 ) -> ProjectLocationInstanceListCall<'a, C> {
5580 self._delegate = Some(new_value);
5581 self
5582 }
5583
5584 /// Set any additional parameter of the query string used in the request.
5585 /// It should be used to set parameters which are not yet available through their own
5586 /// setters.
5587 ///
5588 /// Please note that this method must not be used to set any of the known parameters
5589 /// which have their own setter method. If done anyway, the request will fail.
5590 ///
5591 /// # Additional Parameters
5592 ///
5593 /// * *$.xgafv* (query-string) - V1 error format.
5594 /// * *access_token* (query-string) - OAuth access token.
5595 /// * *alt* (query-string) - Data format for response.
5596 /// * *callback* (query-string) - JSONP
5597 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5598 /// * *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.
5599 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5600 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5601 /// * *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.
5602 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5603 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5604 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceListCall<'a, C>
5605 where
5606 T: AsRef<str>,
5607 {
5608 self._additional_params
5609 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5610 self
5611 }
5612
5613 /// Identifies the authorization scope for the method you are building.
5614 ///
5615 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5616 /// [`Scope::CloudPlatform`].
5617 ///
5618 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5619 /// tokens for more than one scope.
5620 ///
5621 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5622 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5623 /// sufficient, a read-write scope will do as well.
5624 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceListCall<'a, C>
5625 where
5626 St: AsRef<str>,
5627 {
5628 self._scopes.insert(String::from(scope.as_ref()));
5629 self
5630 }
5631 /// Identifies the authorization scope(s) for the method you are building.
5632 ///
5633 /// See [`Self::add_scope()`] for details.
5634 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceListCall<'a, C>
5635 where
5636 I: IntoIterator<Item = St>,
5637 St: AsRef<str>,
5638 {
5639 self._scopes
5640 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5641 self
5642 }
5643
5644 /// Removes all scopes, and no default scope will be used either.
5645 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5646 /// for details).
5647 pub fn clear_scopes(mut self) -> ProjectLocationInstanceListCall<'a, C> {
5648 self._scopes.clear();
5649 self
5650 }
5651}
5652
5653/// Updates a single Data Fusion instance.
5654///
5655/// A builder for the *locations.instances.patch* method supported by a *project* resource.
5656/// It is not used directly, but through a [`ProjectMethods`] instance.
5657///
5658/// # Example
5659///
5660/// Instantiate a resource method builder
5661///
5662/// ```test_harness,no_run
5663/// # extern crate hyper;
5664/// # extern crate hyper_rustls;
5665/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
5666/// use datafusion1_beta1::api::Instance;
5667/// # async fn dox() {
5668/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5669///
5670/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5671/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5672/// # .with_native_roots()
5673/// # .unwrap()
5674/// # .https_only()
5675/// # .enable_http2()
5676/// # .build();
5677///
5678/// # let executor = hyper_util::rt::TokioExecutor::new();
5679/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5680/// # secret,
5681/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5682/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5683/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5684/// # ),
5685/// # ).build().await.unwrap();
5686///
5687/// # let client = hyper_util::client::legacy::Client::builder(
5688/// # hyper_util::rt::TokioExecutor::new()
5689/// # )
5690/// # .build(
5691/// # hyper_rustls::HttpsConnectorBuilder::new()
5692/// # .with_native_roots()
5693/// # .unwrap()
5694/// # .https_or_http()
5695/// # .enable_http2()
5696/// # .build()
5697/// # );
5698/// # let mut hub = DataFusion::new(client, auth);
5699/// // As the method needs a request, you would usually fill it with the desired information
5700/// // into the respective structure. Some of the parts shown here might not be applicable !
5701/// // Values shown here are possibly random and not representative !
5702/// let mut req = Instance::default();
5703///
5704/// // You can configure optional parameters by calling the respective setters at will, and
5705/// // execute the final call using `doit()`.
5706/// // Values shown here are possibly random and not representative !
5707/// let result = hub.projects().locations_instances_patch(req, "name")
5708/// .update_mask(FieldMask::new::<&str>(&[]))
5709/// .doit().await;
5710/// # }
5711/// ```
5712pub struct ProjectLocationInstancePatchCall<'a, C>
5713where
5714 C: 'a,
5715{
5716 hub: &'a DataFusion<C>,
5717 _request: Instance,
5718 _name: String,
5719 _update_mask: Option<common::FieldMask>,
5720 _delegate: Option<&'a mut dyn common::Delegate>,
5721 _additional_params: HashMap<String, String>,
5722 _scopes: BTreeSet<String>,
5723}
5724
5725impl<'a, C> common::CallBuilder for ProjectLocationInstancePatchCall<'a, C> {}
5726
5727impl<'a, C> ProjectLocationInstancePatchCall<'a, C>
5728where
5729 C: common::Connector,
5730{
5731 /// Perform the operation you have build so far.
5732 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5733 use std::borrow::Cow;
5734 use std::io::{Read, Seek};
5735
5736 use common::{url::Params, ToParts};
5737 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5738
5739 let mut dd = common::DefaultDelegate;
5740 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5741 dlg.begin(common::MethodInfo {
5742 id: "datafusion.projects.locations.instances.patch",
5743 http_method: hyper::Method::PATCH,
5744 });
5745
5746 for &field in ["alt", "name", "updateMask"].iter() {
5747 if self._additional_params.contains_key(field) {
5748 dlg.finished(false);
5749 return Err(common::Error::FieldClash(field));
5750 }
5751 }
5752
5753 let mut params = Params::with_capacity(5 + self._additional_params.len());
5754 params.push("name", self._name);
5755 if let Some(value) = self._update_mask.as_ref() {
5756 params.push("updateMask", value.to_string());
5757 }
5758
5759 params.extend(self._additional_params.iter());
5760
5761 params.push("alt", "json");
5762 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
5763 if self._scopes.is_empty() {
5764 self._scopes
5765 .insert(Scope::CloudPlatform.as_ref().to_string());
5766 }
5767
5768 #[allow(clippy::single_element_loop)]
5769 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5770 url = params.uri_replacement(url, param_name, find_this, true);
5771 }
5772 {
5773 let to_remove = ["name"];
5774 params.remove_params(&to_remove);
5775 }
5776
5777 let url = params.parse_with_url(&url);
5778
5779 let mut json_mime_type = mime::APPLICATION_JSON;
5780 let mut request_value_reader = {
5781 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5782 common::remove_json_null_values(&mut value);
5783 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5784 serde_json::to_writer(&mut dst, &value).unwrap();
5785 dst
5786 };
5787 let request_size = request_value_reader
5788 .seek(std::io::SeekFrom::End(0))
5789 .unwrap();
5790 request_value_reader
5791 .seek(std::io::SeekFrom::Start(0))
5792 .unwrap();
5793
5794 loop {
5795 let token = match self
5796 .hub
5797 .auth
5798 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5799 .await
5800 {
5801 Ok(token) => token,
5802 Err(e) => match dlg.token(e) {
5803 Ok(token) => token,
5804 Err(e) => {
5805 dlg.finished(false);
5806 return Err(common::Error::MissingToken(e));
5807 }
5808 },
5809 };
5810 request_value_reader
5811 .seek(std::io::SeekFrom::Start(0))
5812 .unwrap();
5813 let mut req_result = {
5814 let client = &self.hub.client;
5815 dlg.pre_request();
5816 let mut req_builder = hyper::Request::builder()
5817 .method(hyper::Method::PATCH)
5818 .uri(url.as_str())
5819 .header(USER_AGENT, self.hub._user_agent.clone());
5820
5821 if let Some(token) = token.as_ref() {
5822 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5823 }
5824
5825 let request = req_builder
5826 .header(CONTENT_TYPE, json_mime_type.to_string())
5827 .header(CONTENT_LENGTH, request_size as u64)
5828 .body(common::to_body(
5829 request_value_reader.get_ref().clone().into(),
5830 ));
5831
5832 client.request(request.unwrap()).await
5833 };
5834
5835 match req_result {
5836 Err(err) => {
5837 if let common::Retry::After(d) = dlg.http_error(&err) {
5838 sleep(d).await;
5839 continue;
5840 }
5841 dlg.finished(false);
5842 return Err(common::Error::HttpError(err));
5843 }
5844 Ok(res) => {
5845 let (mut parts, body) = res.into_parts();
5846 let mut body = common::Body::new(body);
5847 if !parts.status.is_success() {
5848 let bytes = common::to_bytes(body).await.unwrap_or_default();
5849 let error = serde_json::from_str(&common::to_string(&bytes));
5850 let response = common::to_response(parts, bytes.into());
5851
5852 if let common::Retry::After(d) =
5853 dlg.http_failure(&response, error.as_ref().ok())
5854 {
5855 sleep(d).await;
5856 continue;
5857 }
5858
5859 dlg.finished(false);
5860
5861 return Err(match error {
5862 Ok(value) => common::Error::BadRequest(value),
5863 _ => common::Error::Failure(response),
5864 });
5865 }
5866 let response = {
5867 let bytes = common::to_bytes(body).await.unwrap_or_default();
5868 let encoded = common::to_string(&bytes);
5869 match serde_json::from_str(&encoded) {
5870 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5871 Err(error) => {
5872 dlg.response_json_decode_error(&encoded, &error);
5873 return Err(common::Error::JsonDecodeError(
5874 encoded.to_string(),
5875 error,
5876 ));
5877 }
5878 }
5879 };
5880
5881 dlg.finished(true);
5882 return Ok(response);
5883 }
5884 }
5885 }
5886 }
5887
5888 ///
5889 /// Sets the *request* property to the given value.
5890 ///
5891 /// Even though the property as already been set when instantiating this call,
5892 /// we provide this method for API completeness.
5893 pub fn request(mut self, new_value: Instance) -> ProjectLocationInstancePatchCall<'a, C> {
5894 self._request = new_value;
5895 self
5896 }
5897 /// Output only. The name of this instance is in the form of projects/{project}/locations/{location}/instances/{instance}.
5898 ///
5899 /// Sets the *name* path property to the given value.
5900 ///
5901 /// Even though the property as already been set when instantiating this call,
5902 /// we provide this method for API completeness.
5903 pub fn name(mut self, new_value: &str) -> ProjectLocationInstancePatchCall<'a, C> {
5904 self._name = new_value.to_string();
5905 self
5906 }
5907 /// 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.
5908 ///
5909 /// Sets the *update mask* query property to the given value.
5910 pub fn update_mask(
5911 mut self,
5912 new_value: common::FieldMask,
5913 ) -> ProjectLocationInstancePatchCall<'a, C> {
5914 self._update_mask = Some(new_value);
5915 self
5916 }
5917 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5918 /// while executing the actual API request.
5919 ///
5920 /// ````text
5921 /// It should be used to handle progress information, and to implement a certain level of resilience.
5922 /// ````
5923 ///
5924 /// Sets the *delegate* property to the given value.
5925 pub fn delegate(
5926 mut self,
5927 new_value: &'a mut dyn common::Delegate,
5928 ) -> ProjectLocationInstancePatchCall<'a, C> {
5929 self._delegate = Some(new_value);
5930 self
5931 }
5932
5933 /// Set any additional parameter of the query string used in the request.
5934 /// It should be used to set parameters which are not yet available through their own
5935 /// setters.
5936 ///
5937 /// Please note that this method must not be used to set any of the known parameters
5938 /// which have their own setter method. If done anyway, the request will fail.
5939 ///
5940 /// # Additional Parameters
5941 ///
5942 /// * *$.xgafv* (query-string) - V1 error format.
5943 /// * *access_token* (query-string) - OAuth access token.
5944 /// * *alt* (query-string) - Data format for response.
5945 /// * *callback* (query-string) - JSONP
5946 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5947 /// * *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.
5948 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5949 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5950 /// * *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.
5951 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5952 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5953 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstancePatchCall<'a, C>
5954 where
5955 T: AsRef<str>,
5956 {
5957 self._additional_params
5958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5959 self
5960 }
5961
5962 /// Identifies the authorization scope for the method you are building.
5963 ///
5964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5965 /// [`Scope::CloudPlatform`].
5966 ///
5967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5968 /// tokens for more than one scope.
5969 ///
5970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5972 /// sufficient, a read-write scope will do as well.
5973 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstancePatchCall<'a, C>
5974 where
5975 St: AsRef<str>,
5976 {
5977 self._scopes.insert(String::from(scope.as_ref()));
5978 self
5979 }
5980 /// Identifies the authorization scope(s) for the method you are building.
5981 ///
5982 /// See [`Self::add_scope()`] for details.
5983 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstancePatchCall<'a, C>
5984 where
5985 I: IntoIterator<Item = St>,
5986 St: AsRef<str>,
5987 {
5988 self._scopes
5989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5990 self
5991 }
5992
5993 /// Removes all scopes, and no default scope will be used either.
5994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5995 /// for details).
5996 pub fn clear_scopes(mut self) -> ProjectLocationInstancePatchCall<'a, C> {
5997 self._scopes.clear();
5998 self
5999 }
6000}
6001
6002/// Restart a single Data Fusion instance. At the end of an operation instance is fully restarted.
6003///
6004/// A builder for the *locations.instances.restart* method supported by a *project* resource.
6005/// It is not used directly, but through a [`ProjectMethods`] instance.
6006///
6007/// # Example
6008///
6009/// Instantiate a resource method builder
6010///
6011/// ```test_harness,no_run
6012/// # extern crate hyper;
6013/// # extern crate hyper_rustls;
6014/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6015/// use datafusion1_beta1::api::RestartInstanceRequest;
6016/// # async fn dox() {
6017/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6018///
6019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6020/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6021/// # .with_native_roots()
6022/// # .unwrap()
6023/// # .https_only()
6024/// # .enable_http2()
6025/// # .build();
6026///
6027/// # let executor = hyper_util::rt::TokioExecutor::new();
6028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6029/// # secret,
6030/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6031/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6032/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6033/// # ),
6034/// # ).build().await.unwrap();
6035///
6036/// # let client = hyper_util::client::legacy::Client::builder(
6037/// # hyper_util::rt::TokioExecutor::new()
6038/// # )
6039/// # .build(
6040/// # hyper_rustls::HttpsConnectorBuilder::new()
6041/// # .with_native_roots()
6042/// # .unwrap()
6043/// # .https_or_http()
6044/// # .enable_http2()
6045/// # .build()
6046/// # );
6047/// # let mut hub = DataFusion::new(client, auth);
6048/// // As the method needs a request, you would usually fill it with the desired information
6049/// // into the respective structure. Some of the parts shown here might not be applicable !
6050/// // Values shown here are possibly random and not representative !
6051/// let mut req = RestartInstanceRequest::default();
6052///
6053/// // You can configure optional parameters by calling the respective setters at will, and
6054/// // execute the final call using `doit()`.
6055/// // Values shown here are possibly random and not representative !
6056/// let result = hub.projects().locations_instances_restart(req, "name")
6057/// .doit().await;
6058/// # }
6059/// ```
6060pub struct ProjectLocationInstanceRestartCall<'a, C>
6061where
6062 C: 'a,
6063{
6064 hub: &'a DataFusion<C>,
6065 _request: RestartInstanceRequest,
6066 _name: String,
6067 _delegate: Option<&'a mut dyn common::Delegate>,
6068 _additional_params: HashMap<String, String>,
6069 _scopes: BTreeSet<String>,
6070}
6071
6072impl<'a, C> common::CallBuilder for ProjectLocationInstanceRestartCall<'a, C> {}
6073
6074impl<'a, C> ProjectLocationInstanceRestartCall<'a, C>
6075where
6076 C: common::Connector,
6077{
6078 /// Perform the operation you have build so far.
6079 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6080 use std::borrow::Cow;
6081 use std::io::{Read, Seek};
6082
6083 use common::{url::Params, ToParts};
6084 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6085
6086 let mut dd = common::DefaultDelegate;
6087 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6088 dlg.begin(common::MethodInfo {
6089 id: "datafusion.projects.locations.instances.restart",
6090 http_method: hyper::Method::POST,
6091 });
6092
6093 for &field in ["alt", "name"].iter() {
6094 if self._additional_params.contains_key(field) {
6095 dlg.finished(false);
6096 return Err(common::Error::FieldClash(field));
6097 }
6098 }
6099
6100 let mut params = Params::with_capacity(4 + self._additional_params.len());
6101 params.push("name", self._name);
6102
6103 params.extend(self._additional_params.iter());
6104
6105 params.push("alt", "json");
6106 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:restart";
6107 if self._scopes.is_empty() {
6108 self._scopes
6109 .insert(Scope::CloudPlatform.as_ref().to_string());
6110 }
6111
6112 #[allow(clippy::single_element_loop)]
6113 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6114 url = params.uri_replacement(url, param_name, find_this, true);
6115 }
6116 {
6117 let to_remove = ["name"];
6118 params.remove_params(&to_remove);
6119 }
6120
6121 let url = params.parse_with_url(&url);
6122
6123 let mut json_mime_type = mime::APPLICATION_JSON;
6124 let mut request_value_reader = {
6125 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6126 common::remove_json_null_values(&mut value);
6127 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6128 serde_json::to_writer(&mut dst, &value).unwrap();
6129 dst
6130 };
6131 let request_size = request_value_reader
6132 .seek(std::io::SeekFrom::End(0))
6133 .unwrap();
6134 request_value_reader
6135 .seek(std::io::SeekFrom::Start(0))
6136 .unwrap();
6137
6138 loop {
6139 let token = match self
6140 .hub
6141 .auth
6142 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6143 .await
6144 {
6145 Ok(token) => token,
6146 Err(e) => match dlg.token(e) {
6147 Ok(token) => token,
6148 Err(e) => {
6149 dlg.finished(false);
6150 return Err(common::Error::MissingToken(e));
6151 }
6152 },
6153 };
6154 request_value_reader
6155 .seek(std::io::SeekFrom::Start(0))
6156 .unwrap();
6157 let mut req_result = {
6158 let client = &self.hub.client;
6159 dlg.pre_request();
6160 let mut req_builder = hyper::Request::builder()
6161 .method(hyper::Method::POST)
6162 .uri(url.as_str())
6163 .header(USER_AGENT, self.hub._user_agent.clone());
6164
6165 if let Some(token) = token.as_ref() {
6166 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6167 }
6168
6169 let request = req_builder
6170 .header(CONTENT_TYPE, json_mime_type.to_string())
6171 .header(CONTENT_LENGTH, request_size as u64)
6172 .body(common::to_body(
6173 request_value_reader.get_ref().clone().into(),
6174 ));
6175
6176 client.request(request.unwrap()).await
6177 };
6178
6179 match req_result {
6180 Err(err) => {
6181 if let common::Retry::After(d) = dlg.http_error(&err) {
6182 sleep(d).await;
6183 continue;
6184 }
6185 dlg.finished(false);
6186 return Err(common::Error::HttpError(err));
6187 }
6188 Ok(res) => {
6189 let (mut parts, body) = res.into_parts();
6190 let mut body = common::Body::new(body);
6191 if !parts.status.is_success() {
6192 let bytes = common::to_bytes(body).await.unwrap_or_default();
6193 let error = serde_json::from_str(&common::to_string(&bytes));
6194 let response = common::to_response(parts, bytes.into());
6195
6196 if let common::Retry::After(d) =
6197 dlg.http_failure(&response, error.as_ref().ok())
6198 {
6199 sleep(d).await;
6200 continue;
6201 }
6202
6203 dlg.finished(false);
6204
6205 return Err(match error {
6206 Ok(value) => common::Error::BadRequest(value),
6207 _ => common::Error::Failure(response),
6208 });
6209 }
6210 let response = {
6211 let bytes = common::to_bytes(body).await.unwrap_or_default();
6212 let encoded = common::to_string(&bytes);
6213 match serde_json::from_str(&encoded) {
6214 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6215 Err(error) => {
6216 dlg.response_json_decode_error(&encoded, &error);
6217 return Err(common::Error::JsonDecodeError(
6218 encoded.to_string(),
6219 error,
6220 ));
6221 }
6222 }
6223 };
6224
6225 dlg.finished(true);
6226 return Ok(response);
6227 }
6228 }
6229 }
6230 }
6231
6232 ///
6233 /// Sets the *request* property to the given value.
6234 ///
6235 /// Even though the property as already been set when instantiating this call,
6236 /// we provide this method for API completeness.
6237 pub fn request(
6238 mut self,
6239 new_value: RestartInstanceRequest,
6240 ) -> ProjectLocationInstanceRestartCall<'a, C> {
6241 self._request = new_value;
6242 self
6243 }
6244 /// Required. Name of the Data Fusion instance which need to be restarted in the form of projects/{project}/locations/{location}/instances/{instance}
6245 ///
6246 /// Sets the *name* path property to the given value.
6247 ///
6248 /// Even though the property as already been set when instantiating this call,
6249 /// we provide this method for API completeness.
6250 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceRestartCall<'a, C> {
6251 self._name = new_value.to_string();
6252 self
6253 }
6254 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6255 /// while executing the actual API request.
6256 ///
6257 /// ````text
6258 /// It should be used to handle progress information, and to implement a certain level of resilience.
6259 /// ````
6260 ///
6261 /// Sets the *delegate* property to the given value.
6262 pub fn delegate(
6263 mut self,
6264 new_value: &'a mut dyn common::Delegate,
6265 ) -> ProjectLocationInstanceRestartCall<'a, C> {
6266 self._delegate = Some(new_value);
6267 self
6268 }
6269
6270 /// Set any additional parameter of the query string used in the request.
6271 /// It should be used to set parameters which are not yet available through their own
6272 /// setters.
6273 ///
6274 /// Please note that this method must not be used to set any of the known parameters
6275 /// which have their own setter method. If done anyway, the request will fail.
6276 ///
6277 /// # Additional Parameters
6278 ///
6279 /// * *$.xgafv* (query-string) - V1 error format.
6280 /// * *access_token* (query-string) - OAuth access token.
6281 /// * *alt* (query-string) - Data format for response.
6282 /// * *callback* (query-string) - JSONP
6283 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6284 /// * *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.
6285 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6286 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6287 /// * *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.
6288 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6289 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6290 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceRestartCall<'a, C>
6291 where
6292 T: AsRef<str>,
6293 {
6294 self._additional_params
6295 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6296 self
6297 }
6298
6299 /// Identifies the authorization scope for the method you are building.
6300 ///
6301 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6302 /// [`Scope::CloudPlatform`].
6303 ///
6304 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6305 /// tokens for more than one scope.
6306 ///
6307 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6308 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6309 /// sufficient, a read-write scope will do as well.
6310 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceRestartCall<'a, C>
6311 where
6312 St: AsRef<str>,
6313 {
6314 self._scopes.insert(String::from(scope.as_ref()));
6315 self
6316 }
6317 /// Identifies the authorization scope(s) for the method you are building.
6318 ///
6319 /// See [`Self::add_scope()`] for details.
6320 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceRestartCall<'a, C>
6321 where
6322 I: IntoIterator<Item = St>,
6323 St: AsRef<str>,
6324 {
6325 self._scopes
6326 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6327 self
6328 }
6329
6330 /// Removes all scopes, and no default scope will be used either.
6331 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6332 /// for details).
6333 pub fn clear_scopes(mut self) -> ProjectLocationInstanceRestartCall<'a, C> {
6334 self._scopes.clear();
6335 self
6336 }
6337}
6338
6339/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6340///
6341/// A builder for the *locations.instances.setIamPolicy* method supported by a *project* resource.
6342/// It is not used directly, but through a [`ProjectMethods`] instance.
6343///
6344/// # Example
6345///
6346/// Instantiate a resource method builder
6347///
6348/// ```test_harness,no_run
6349/// # extern crate hyper;
6350/// # extern crate hyper_rustls;
6351/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6352/// use datafusion1_beta1::api::SetIamPolicyRequest;
6353/// # async fn dox() {
6354/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6355///
6356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6357/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6358/// # .with_native_roots()
6359/// # .unwrap()
6360/// # .https_only()
6361/// # .enable_http2()
6362/// # .build();
6363///
6364/// # let executor = hyper_util::rt::TokioExecutor::new();
6365/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6366/// # secret,
6367/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6368/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6369/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6370/// # ),
6371/// # ).build().await.unwrap();
6372///
6373/// # let client = hyper_util::client::legacy::Client::builder(
6374/// # hyper_util::rt::TokioExecutor::new()
6375/// # )
6376/// # .build(
6377/// # hyper_rustls::HttpsConnectorBuilder::new()
6378/// # .with_native_roots()
6379/// # .unwrap()
6380/// # .https_or_http()
6381/// # .enable_http2()
6382/// # .build()
6383/// # );
6384/// # let mut hub = DataFusion::new(client, auth);
6385/// // As the method needs a request, you would usually fill it with the desired information
6386/// // into the respective structure. Some of the parts shown here might not be applicable !
6387/// // Values shown here are possibly random and not representative !
6388/// let mut req = SetIamPolicyRequest::default();
6389///
6390/// // You can configure optional parameters by calling the respective setters at will, and
6391/// // execute the final call using `doit()`.
6392/// // Values shown here are possibly random and not representative !
6393/// let result = hub.projects().locations_instances_set_iam_policy(req, "resource")
6394/// .doit().await;
6395/// # }
6396/// ```
6397pub struct ProjectLocationInstanceSetIamPolicyCall<'a, C>
6398where
6399 C: 'a,
6400{
6401 hub: &'a DataFusion<C>,
6402 _request: SetIamPolicyRequest,
6403 _resource: String,
6404 _delegate: Option<&'a mut dyn common::Delegate>,
6405 _additional_params: HashMap<String, String>,
6406 _scopes: BTreeSet<String>,
6407}
6408
6409impl<'a, C> common::CallBuilder for ProjectLocationInstanceSetIamPolicyCall<'a, C> {}
6410
6411impl<'a, C> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6412where
6413 C: common::Connector,
6414{
6415 /// Perform the operation you have build so far.
6416 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6417 use std::borrow::Cow;
6418 use std::io::{Read, Seek};
6419
6420 use common::{url::Params, ToParts};
6421 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6422
6423 let mut dd = common::DefaultDelegate;
6424 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6425 dlg.begin(common::MethodInfo {
6426 id: "datafusion.projects.locations.instances.setIamPolicy",
6427 http_method: hyper::Method::POST,
6428 });
6429
6430 for &field in ["alt", "resource"].iter() {
6431 if self._additional_params.contains_key(field) {
6432 dlg.finished(false);
6433 return Err(common::Error::FieldClash(field));
6434 }
6435 }
6436
6437 let mut params = Params::with_capacity(4 + self._additional_params.len());
6438 params.push("resource", self._resource);
6439
6440 params.extend(self._additional_params.iter());
6441
6442 params.push("alt", "json");
6443 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:setIamPolicy";
6444 if self._scopes.is_empty() {
6445 self._scopes
6446 .insert(Scope::CloudPlatform.as_ref().to_string());
6447 }
6448
6449 #[allow(clippy::single_element_loop)]
6450 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6451 url = params.uri_replacement(url, param_name, find_this, true);
6452 }
6453 {
6454 let to_remove = ["resource"];
6455 params.remove_params(&to_remove);
6456 }
6457
6458 let url = params.parse_with_url(&url);
6459
6460 let mut json_mime_type = mime::APPLICATION_JSON;
6461 let mut request_value_reader = {
6462 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6463 common::remove_json_null_values(&mut value);
6464 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6465 serde_json::to_writer(&mut dst, &value).unwrap();
6466 dst
6467 };
6468 let request_size = request_value_reader
6469 .seek(std::io::SeekFrom::End(0))
6470 .unwrap();
6471 request_value_reader
6472 .seek(std::io::SeekFrom::Start(0))
6473 .unwrap();
6474
6475 loop {
6476 let token = match self
6477 .hub
6478 .auth
6479 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6480 .await
6481 {
6482 Ok(token) => token,
6483 Err(e) => match dlg.token(e) {
6484 Ok(token) => token,
6485 Err(e) => {
6486 dlg.finished(false);
6487 return Err(common::Error::MissingToken(e));
6488 }
6489 },
6490 };
6491 request_value_reader
6492 .seek(std::io::SeekFrom::Start(0))
6493 .unwrap();
6494 let mut req_result = {
6495 let client = &self.hub.client;
6496 dlg.pre_request();
6497 let mut req_builder = hyper::Request::builder()
6498 .method(hyper::Method::POST)
6499 .uri(url.as_str())
6500 .header(USER_AGENT, self.hub._user_agent.clone());
6501
6502 if let Some(token) = token.as_ref() {
6503 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6504 }
6505
6506 let request = req_builder
6507 .header(CONTENT_TYPE, json_mime_type.to_string())
6508 .header(CONTENT_LENGTH, request_size as u64)
6509 .body(common::to_body(
6510 request_value_reader.get_ref().clone().into(),
6511 ));
6512
6513 client.request(request.unwrap()).await
6514 };
6515
6516 match req_result {
6517 Err(err) => {
6518 if let common::Retry::After(d) = dlg.http_error(&err) {
6519 sleep(d).await;
6520 continue;
6521 }
6522 dlg.finished(false);
6523 return Err(common::Error::HttpError(err));
6524 }
6525 Ok(res) => {
6526 let (mut parts, body) = res.into_parts();
6527 let mut body = common::Body::new(body);
6528 if !parts.status.is_success() {
6529 let bytes = common::to_bytes(body).await.unwrap_or_default();
6530 let error = serde_json::from_str(&common::to_string(&bytes));
6531 let response = common::to_response(parts, bytes.into());
6532
6533 if let common::Retry::After(d) =
6534 dlg.http_failure(&response, error.as_ref().ok())
6535 {
6536 sleep(d).await;
6537 continue;
6538 }
6539
6540 dlg.finished(false);
6541
6542 return Err(match error {
6543 Ok(value) => common::Error::BadRequest(value),
6544 _ => common::Error::Failure(response),
6545 });
6546 }
6547 let response = {
6548 let bytes = common::to_bytes(body).await.unwrap_or_default();
6549 let encoded = common::to_string(&bytes);
6550 match serde_json::from_str(&encoded) {
6551 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6552 Err(error) => {
6553 dlg.response_json_decode_error(&encoded, &error);
6554 return Err(common::Error::JsonDecodeError(
6555 encoded.to_string(),
6556 error,
6557 ));
6558 }
6559 }
6560 };
6561
6562 dlg.finished(true);
6563 return Ok(response);
6564 }
6565 }
6566 }
6567 }
6568
6569 ///
6570 /// Sets the *request* property to the given value.
6571 ///
6572 /// Even though the property as already been set when instantiating this call,
6573 /// we provide this method for API completeness.
6574 pub fn request(
6575 mut self,
6576 new_value: SetIamPolicyRequest,
6577 ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6578 self._request = new_value;
6579 self
6580 }
6581 /// 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.
6582 ///
6583 /// Sets the *resource* path property to the given value.
6584 ///
6585 /// Even though the property as already been set when instantiating this call,
6586 /// we provide this method for API completeness.
6587 pub fn resource(mut self, new_value: &str) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6588 self._resource = new_value.to_string();
6589 self
6590 }
6591 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6592 /// while executing the actual API request.
6593 ///
6594 /// ````text
6595 /// It should be used to handle progress information, and to implement a certain level of resilience.
6596 /// ````
6597 ///
6598 /// Sets the *delegate* property to the given value.
6599 pub fn delegate(
6600 mut self,
6601 new_value: &'a mut dyn common::Delegate,
6602 ) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6603 self._delegate = Some(new_value);
6604 self
6605 }
6606
6607 /// Set any additional parameter of the query string used in the request.
6608 /// It should be used to set parameters which are not yet available through their own
6609 /// setters.
6610 ///
6611 /// Please note that this method must not be used to set any of the known parameters
6612 /// which have their own setter method. If done anyway, the request will fail.
6613 ///
6614 /// # Additional Parameters
6615 ///
6616 /// * *$.xgafv* (query-string) - V1 error format.
6617 /// * *access_token* (query-string) - OAuth access token.
6618 /// * *alt* (query-string) - Data format for response.
6619 /// * *callback* (query-string) - JSONP
6620 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6621 /// * *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.
6622 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6623 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6624 /// * *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.
6625 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6626 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6627 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6628 where
6629 T: AsRef<str>,
6630 {
6631 self._additional_params
6632 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6633 self
6634 }
6635
6636 /// Identifies the authorization scope for the method you are building.
6637 ///
6638 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6639 /// [`Scope::CloudPlatform`].
6640 ///
6641 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6642 /// tokens for more than one scope.
6643 ///
6644 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6645 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6646 /// sufficient, a read-write scope will do as well.
6647 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6648 where
6649 St: AsRef<str>,
6650 {
6651 self._scopes.insert(String::from(scope.as_ref()));
6652 self
6653 }
6654 /// Identifies the authorization scope(s) for the method you are building.
6655 ///
6656 /// See [`Self::add_scope()`] for details.
6657 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceSetIamPolicyCall<'a, C>
6658 where
6659 I: IntoIterator<Item = St>,
6660 St: AsRef<str>,
6661 {
6662 self._scopes
6663 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6664 self
6665 }
6666
6667 /// Removes all scopes, and no default scope will be used either.
6668 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6669 /// for details).
6670 pub fn clear_scopes(mut self) -> ProjectLocationInstanceSetIamPolicyCall<'a, C> {
6671 self._scopes.clear();
6672 self
6673 }
6674}
6675
6676/// 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.
6677///
6678/// A builder for the *locations.instances.testIamPermissions* method supported by a *project* resource.
6679/// It is not used directly, but through a [`ProjectMethods`] instance.
6680///
6681/// # Example
6682///
6683/// Instantiate a resource method builder
6684///
6685/// ```test_harness,no_run
6686/// # extern crate hyper;
6687/// # extern crate hyper_rustls;
6688/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
6689/// use datafusion1_beta1::api::TestIamPermissionsRequest;
6690/// # async fn dox() {
6691/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6692///
6693/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6694/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6695/// # .with_native_roots()
6696/// # .unwrap()
6697/// # .https_only()
6698/// # .enable_http2()
6699/// # .build();
6700///
6701/// # let executor = hyper_util::rt::TokioExecutor::new();
6702/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6703/// # secret,
6704/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6705/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6706/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6707/// # ),
6708/// # ).build().await.unwrap();
6709///
6710/// # let client = hyper_util::client::legacy::Client::builder(
6711/// # hyper_util::rt::TokioExecutor::new()
6712/// # )
6713/// # .build(
6714/// # hyper_rustls::HttpsConnectorBuilder::new()
6715/// # .with_native_roots()
6716/// # .unwrap()
6717/// # .https_or_http()
6718/// # .enable_http2()
6719/// # .build()
6720/// # );
6721/// # let mut hub = DataFusion::new(client, auth);
6722/// // As the method needs a request, you would usually fill it with the desired information
6723/// // into the respective structure. Some of the parts shown here might not be applicable !
6724/// // Values shown here are possibly random and not representative !
6725/// let mut req = TestIamPermissionsRequest::default();
6726///
6727/// // You can configure optional parameters by calling the respective setters at will, and
6728/// // execute the final call using `doit()`.
6729/// // Values shown here are possibly random and not representative !
6730/// let result = hub.projects().locations_instances_test_iam_permissions(req, "resource")
6731/// .doit().await;
6732/// # }
6733/// ```
6734pub struct ProjectLocationInstanceTestIamPermissionCall<'a, C>
6735where
6736 C: 'a,
6737{
6738 hub: &'a DataFusion<C>,
6739 _request: TestIamPermissionsRequest,
6740 _resource: String,
6741 _delegate: Option<&'a mut dyn common::Delegate>,
6742 _additional_params: HashMap<String, String>,
6743 _scopes: BTreeSet<String>,
6744}
6745
6746impl<'a, C> common::CallBuilder for ProjectLocationInstanceTestIamPermissionCall<'a, C> {}
6747
6748impl<'a, C> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6749where
6750 C: common::Connector,
6751{
6752 /// Perform the operation you have build so far.
6753 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6754 use std::borrow::Cow;
6755 use std::io::{Read, Seek};
6756
6757 use common::{url::Params, ToParts};
6758 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6759
6760 let mut dd = common::DefaultDelegate;
6761 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6762 dlg.begin(common::MethodInfo {
6763 id: "datafusion.projects.locations.instances.testIamPermissions",
6764 http_method: hyper::Method::POST,
6765 });
6766
6767 for &field in ["alt", "resource"].iter() {
6768 if self._additional_params.contains_key(field) {
6769 dlg.finished(false);
6770 return Err(common::Error::FieldClash(field));
6771 }
6772 }
6773
6774 let mut params = Params::with_capacity(4 + self._additional_params.len());
6775 params.push("resource", self._resource);
6776
6777 params.extend(self._additional_params.iter());
6778
6779 params.push("alt", "json");
6780 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:testIamPermissions";
6781 if self._scopes.is_empty() {
6782 self._scopes
6783 .insert(Scope::CloudPlatform.as_ref().to_string());
6784 }
6785
6786 #[allow(clippy::single_element_loop)]
6787 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6788 url = params.uri_replacement(url, param_name, find_this, true);
6789 }
6790 {
6791 let to_remove = ["resource"];
6792 params.remove_params(&to_remove);
6793 }
6794
6795 let url = params.parse_with_url(&url);
6796
6797 let mut json_mime_type = mime::APPLICATION_JSON;
6798 let mut request_value_reader = {
6799 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6800 common::remove_json_null_values(&mut value);
6801 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6802 serde_json::to_writer(&mut dst, &value).unwrap();
6803 dst
6804 };
6805 let request_size = request_value_reader
6806 .seek(std::io::SeekFrom::End(0))
6807 .unwrap();
6808 request_value_reader
6809 .seek(std::io::SeekFrom::Start(0))
6810 .unwrap();
6811
6812 loop {
6813 let token = match self
6814 .hub
6815 .auth
6816 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6817 .await
6818 {
6819 Ok(token) => token,
6820 Err(e) => match dlg.token(e) {
6821 Ok(token) => token,
6822 Err(e) => {
6823 dlg.finished(false);
6824 return Err(common::Error::MissingToken(e));
6825 }
6826 },
6827 };
6828 request_value_reader
6829 .seek(std::io::SeekFrom::Start(0))
6830 .unwrap();
6831 let mut req_result = {
6832 let client = &self.hub.client;
6833 dlg.pre_request();
6834 let mut req_builder = hyper::Request::builder()
6835 .method(hyper::Method::POST)
6836 .uri(url.as_str())
6837 .header(USER_AGENT, self.hub._user_agent.clone());
6838
6839 if let Some(token) = token.as_ref() {
6840 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6841 }
6842
6843 let request = req_builder
6844 .header(CONTENT_TYPE, json_mime_type.to_string())
6845 .header(CONTENT_LENGTH, request_size as u64)
6846 .body(common::to_body(
6847 request_value_reader.get_ref().clone().into(),
6848 ));
6849
6850 client.request(request.unwrap()).await
6851 };
6852
6853 match req_result {
6854 Err(err) => {
6855 if let common::Retry::After(d) = dlg.http_error(&err) {
6856 sleep(d).await;
6857 continue;
6858 }
6859 dlg.finished(false);
6860 return Err(common::Error::HttpError(err));
6861 }
6862 Ok(res) => {
6863 let (mut parts, body) = res.into_parts();
6864 let mut body = common::Body::new(body);
6865 if !parts.status.is_success() {
6866 let bytes = common::to_bytes(body).await.unwrap_or_default();
6867 let error = serde_json::from_str(&common::to_string(&bytes));
6868 let response = common::to_response(parts, bytes.into());
6869
6870 if let common::Retry::After(d) =
6871 dlg.http_failure(&response, error.as_ref().ok())
6872 {
6873 sleep(d).await;
6874 continue;
6875 }
6876
6877 dlg.finished(false);
6878
6879 return Err(match error {
6880 Ok(value) => common::Error::BadRequest(value),
6881 _ => common::Error::Failure(response),
6882 });
6883 }
6884 let response = {
6885 let bytes = common::to_bytes(body).await.unwrap_or_default();
6886 let encoded = common::to_string(&bytes);
6887 match serde_json::from_str(&encoded) {
6888 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6889 Err(error) => {
6890 dlg.response_json_decode_error(&encoded, &error);
6891 return Err(common::Error::JsonDecodeError(
6892 encoded.to_string(),
6893 error,
6894 ));
6895 }
6896 }
6897 };
6898
6899 dlg.finished(true);
6900 return Ok(response);
6901 }
6902 }
6903 }
6904 }
6905
6906 ///
6907 /// Sets the *request* property to the given value.
6908 ///
6909 /// Even though the property as already been set when instantiating this call,
6910 /// we provide this method for API completeness.
6911 pub fn request(
6912 mut self,
6913 new_value: TestIamPermissionsRequest,
6914 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6915 self._request = new_value;
6916 self
6917 }
6918 /// 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.
6919 ///
6920 /// Sets the *resource* path property to the given value.
6921 ///
6922 /// Even though the property as already been set when instantiating this call,
6923 /// we provide this method for API completeness.
6924 pub fn resource(
6925 mut self,
6926 new_value: &str,
6927 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6928 self._resource = new_value.to_string();
6929 self
6930 }
6931 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6932 /// while executing the actual API request.
6933 ///
6934 /// ````text
6935 /// It should be used to handle progress information, and to implement a certain level of resilience.
6936 /// ````
6937 ///
6938 /// Sets the *delegate* property to the given value.
6939 pub fn delegate(
6940 mut self,
6941 new_value: &'a mut dyn common::Delegate,
6942 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
6943 self._delegate = Some(new_value);
6944 self
6945 }
6946
6947 /// Set any additional parameter of the query string used in the request.
6948 /// It should be used to set parameters which are not yet available through their own
6949 /// setters.
6950 ///
6951 /// Please note that this method must not be used to set any of the known parameters
6952 /// which have their own setter method. If done anyway, the request will fail.
6953 ///
6954 /// # Additional Parameters
6955 ///
6956 /// * *$.xgafv* (query-string) - V1 error format.
6957 /// * *access_token* (query-string) - OAuth access token.
6958 /// * *alt* (query-string) - Data format for response.
6959 /// * *callback* (query-string) - JSONP
6960 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6961 /// * *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.
6962 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6963 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6964 /// * *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.
6965 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6966 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6967 pub fn param<T>(
6968 mut self,
6969 name: T,
6970 value: T,
6971 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6972 where
6973 T: AsRef<str>,
6974 {
6975 self._additional_params
6976 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6977 self
6978 }
6979
6980 /// Identifies the authorization scope for the method you are building.
6981 ///
6982 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6983 /// [`Scope::CloudPlatform`].
6984 ///
6985 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6986 /// tokens for more than one scope.
6987 ///
6988 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6989 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6990 /// sufficient, a read-write scope will do as well.
6991 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
6992 where
6993 St: AsRef<str>,
6994 {
6995 self._scopes.insert(String::from(scope.as_ref()));
6996 self
6997 }
6998 /// Identifies the authorization scope(s) for the method you are building.
6999 ///
7000 /// See [`Self::add_scope()`] for details.
7001 pub fn add_scopes<I, St>(
7002 mut self,
7003 scopes: I,
7004 ) -> ProjectLocationInstanceTestIamPermissionCall<'a, C>
7005 where
7006 I: IntoIterator<Item = St>,
7007 St: AsRef<str>,
7008 {
7009 self._scopes
7010 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7011 self
7012 }
7013
7014 /// Removes all scopes, and no default scope will be used either.
7015 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7016 /// for details).
7017 pub fn clear_scopes(mut self) -> ProjectLocationInstanceTestIamPermissionCall<'a, C> {
7018 self._scopes.clear();
7019 self
7020 }
7021}
7022
7023/// Upgrade a single Data Fusion instance. At the end of an operation instance is fully upgraded.
7024///
7025/// A builder for the *locations.instances.upgrade* method supported by a *project* resource.
7026/// It is not used directly, but through a [`ProjectMethods`] instance.
7027///
7028/// # Example
7029///
7030/// Instantiate a resource method builder
7031///
7032/// ```test_harness,no_run
7033/// # extern crate hyper;
7034/// # extern crate hyper_rustls;
7035/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7036/// use datafusion1_beta1::api::UpgradeInstanceRequest;
7037/// # async fn dox() {
7038/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7039///
7040/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7041/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7042/// # .with_native_roots()
7043/// # .unwrap()
7044/// # .https_only()
7045/// # .enable_http2()
7046/// # .build();
7047///
7048/// # let executor = hyper_util::rt::TokioExecutor::new();
7049/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7050/// # secret,
7051/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7052/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7053/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7054/// # ),
7055/// # ).build().await.unwrap();
7056///
7057/// # let client = hyper_util::client::legacy::Client::builder(
7058/// # hyper_util::rt::TokioExecutor::new()
7059/// # )
7060/// # .build(
7061/// # hyper_rustls::HttpsConnectorBuilder::new()
7062/// # .with_native_roots()
7063/// # .unwrap()
7064/// # .https_or_http()
7065/// # .enable_http2()
7066/// # .build()
7067/// # );
7068/// # let mut hub = DataFusion::new(client, auth);
7069/// // As the method needs a request, you would usually fill it with the desired information
7070/// // into the respective structure. Some of the parts shown here might not be applicable !
7071/// // Values shown here are possibly random and not representative !
7072/// let mut req = UpgradeInstanceRequest::default();
7073///
7074/// // You can configure optional parameters by calling the respective setters at will, and
7075/// // execute the final call using `doit()`.
7076/// // Values shown here are possibly random and not representative !
7077/// let result = hub.projects().locations_instances_upgrade(req, "name")
7078/// .doit().await;
7079/// # }
7080/// ```
7081pub struct ProjectLocationInstanceUpgradeCall<'a, C>
7082where
7083 C: 'a,
7084{
7085 hub: &'a DataFusion<C>,
7086 _request: UpgradeInstanceRequest,
7087 _name: String,
7088 _delegate: Option<&'a mut dyn common::Delegate>,
7089 _additional_params: HashMap<String, String>,
7090 _scopes: BTreeSet<String>,
7091}
7092
7093impl<'a, C> common::CallBuilder for ProjectLocationInstanceUpgradeCall<'a, C> {}
7094
7095impl<'a, C> ProjectLocationInstanceUpgradeCall<'a, C>
7096where
7097 C: common::Connector,
7098{
7099 /// Perform the operation you have build so far.
7100 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7101 use std::borrow::Cow;
7102 use std::io::{Read, Seek};
7103
7104 use common::{url::Params, ToParts};
7105 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7106
7107 let mut dd = common::DefaultDelegate;
7108 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7109 dlg.begin(common::MethodInfo {
7110 id: "datafusion.projects.locations.instances.upgrade",
7111 http_method: hyper::Method::POST,
7112 });
7113
7114 for &field in ["alt", "name"].iter() {
7115 if self._additional_params.contains_key(field) {
7116 dlg.finished(false);
7117 return Err(common::Error::FieldClash(field));
7118 }
7119 }
7120
7121 let mut params = Params::with_capacity(4 + self._additional_params.len());
7122 params.push("name", self._name);
7123
7124 params.extend(self._additional_params.iter());
7125
7126 params.push("alt", "json");
7127 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:upgrade";
7128 if self._scopes.is_empty() {
7129 self._scopes
7130 .insert(Scope::CloudPlatform.as_ref().to_string());
7131 }
7132
7133 #[allow(clippy::single_element_loop)]
7134 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7135 url = params.uri_replacement(url, param_name, find_this, true);
7136 }
7137 {
7138 let to_remove = ["name"];
7139 params.remove_params(&to_remove);
7140 }
7141
7142 let url = params.parse_with_url(&url);
7143
7144 let mut json_mime_type = mime::APPLICATION_JSON;
7145 let mut request_value_reader = {
7146 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7147 common::remove_json_null_values(&mut value);
7148 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7149 serde_json::to_writer(&mut dst, &value).unwrap();
7150 dst
7151 };
7152 let request_size = request_value_reader
7153 .seek(std::io::SeekFrom::End(0))
7154 .unwrap();
7155 request_value_reader
7156 .seek(std::io::SeekFrom::Start(0))
7157 .unwrap();
7158
7159 loop {
7160 let token = match self
7161 .hub
7162 .auth
7163 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7164 .await
7165 {
7166 Ok(token) => token,
7167 Err(e) => match dlg.token(e) {
7168 Ok(token) => token,
7169 Err(e) => {
7170 dlg.finished(false);
7171 return Err(common::Error::MissingToken(e));
7172 }
7173 },
7174 };
7175 request_value_reader
7176 .seek(std::io::SeekFrom::Start(0))
7177 .unwrap();
7178 let mut req_result = {
7179 let client = &self.hub.client;
7180 dlg.pre_request();
7181 let mut req_builder = hyper::Request::builder()
7182 .method(hyper::Method::POST)
7183 .uri(url.as_str())
7184 .header(USER_AGENT, self.hub._user_agent.clone());
7185
7186 if let Some(token) = token.as_ref() {
7187 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7188 }
7189
7190 let request = req_builder
7191 .header(CONTENT_TYPE, json_mime_type.to_string())
7192 .header(CONTENT_LENGTH, request_size as u64)
7193 .body(common::to_body(
7194 request_value_reader.get_ref().clone().into(),
7195 ));
7196
7197 client.request(request.unwrap()).await
7198 };
7199
7200 match req_result {
7201 Err(err) => {
7202 if let common::Retry::After(d) = dlg.http_error(&err) {
7203 sleep(d).await;
7204 continue;
7205 }
7206 dlg.finished(false);
7207 return Err(common::Error::HttpError(err));
7208 }
7209 Ok(res) => {
7210 let (mut parts, body) = res.into_parts();
7211 let mut body = common::Body::new(body);
7212 if !parts.status.is_success() {
7213 let bytes = common::to_bytes(body).await.unwrap_or_default();
7214 let error = serde_json::from_str(&common::to_string(&bytes));
7215 let response = common::to_response(parts, bytes.into());
7216
7217 if let common::Retry::After(d) =
7218 dlg.http_failure(&response, error.as_ref().ok())
7219 {
7220 sleep(d).await;
7221 continue;
7222 }
7223
7224 dlg.finished(false);
7225
7226 return Err(match error {
7227 Ok(value) => common::Error::BadRequest(value),
7228 _ => common::Error::Failure(response),
7229 });
7230 }
7231 let response = {
7232 let bytes = common::to_bytes(body).await.unwrap_or_default();
7233 let encoded = common::to_string(&bytes);
7234 match serde_json::from_str(&encoded) {
7235 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7236 Err(error) => {
7237 dlg.response_json_decode_error(&encoded, &error);
7238 return Err(common::Error::JsonDecodeError(
7239 encoded.to_string(),
7240 error,
7241 ));
7242 }
7243 }
7244 };
7245
7246 dlg.finished(true);
7247 return Ok(response);
7248 }
7249 }
7250 }
7251 }
7252
7253 ///
7254 /// Sets the *request* property to the given value.
7255 ///
7256 /// Even though the property as already been set when instantiating this call,
7257 /// we provide this method for API completeness.
7258 pub fn request(
7259 mut self,
7260 new_value: UpgradeInstanceRequest,
7261 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
7262 self._request = new_value;
7263 self
7264 }
7265 /// 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.
7266 ///
7267 /// Sets the *name* path property to the given value.
7268 ///
7269 /// Even though the property as already been set when instantiating this call,
7270 /// we provide this method for API completeness.
7271 pub fn name(mut self, new_value: &str) -> ProjectLocationInstanceUpgradeCall<'a, C> {
7272 self._name = new_value.to_string();
7273 self
7274 }
7275 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7276 /// while executing the actual API request.
7277 ///
7278 /// ````text
7279 /// It should be used to handle progress information, and to implement a certain level of resilience.
7280 /// ````
7281 ///
7282 /// Sets the *delegate* property to the given value.
7283 pub fn delegate(
7284 mut self,
7285 new_value: &'a mut dyn common::Delegate,
7286 ) -> ProjectLocationInstanceUpgradeCall<'a, C> {
7287 self._delegate = Some(new_value);
7288 self
7289 }
7290
7291 /// Set any additional parameter of the query string used in the request.
7292 /// It should be used to set parameters which are not yet available through their own
7293 /// setters.
7294 ///
7295 /// Please note that this method must not be used to set any of the known parameters
7296 /// which have their own setter method. If done anyway, the request will fail.
7297 ///
7298 /// # Additional Parameters
7299 ///
7300 /// * *$.xgafv* (query-string) - V1 error format.
7301 /// * *access_token* (query-string) - OAuth access token.
7302 /// * *alt* (query-string) - Data format for response.
7303 /// * *callback* (query-string) - JSONP
7304 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7305 /// * *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.
7306 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7307 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7308 /// * *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.
7309 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7310 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7311 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationInstanceUpgradeCall<'a, C>
7312 where
7313 T: AsRef<str>,
7314 {
7315 self._additional_params
7316 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7317 self
7318 }
7319
7320 /// Identifies the authorization scope for the method you are building.
7321 ///
7322 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7323 /// [`Scope::CloudPlatform`].
7324 ///
7325 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7326 /// tokens for more than one scope.
7327 ///
7328 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7329 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7330 /// sufficient, a read-write scope will do as well.
7331 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationInstanceUpgradeCall<'a, C>
7332 where
7333 St: AsRef<str>,
7334 {
7335 self._scopes.insert(String::from(scope.as_ref()));
7336 self
7337 }
7338 /// Identifies the authorization scope(s) for the method you are building.
7339 ///
7340 /// See [`Self::add_scope()`] for details.
7341 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationInstanceUpgradeCall<'a, C>
7342 where
7343 I: IntoIterator<Item = St>,
7344 St: AsRef<str>,
7345 {
7346 self._scopes
7347 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7348 self
7349 }
7350
7351 /// Removes all scopes, and no default scope will be used either.
7352 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7353 /// for details).
7354 pub fn clear_scopes(mut self) -> ProjectLocationInstanceUpgradeCall<'a, C> {
7355 self._scopes.clear();
7356 self
7357 }
7358}
7359
7360/// 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`.
7361///
7362/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
7363/// It is not used directly, but through a [`ProjectMethods`] instance.
7364///
7365/// # Example
7366///
7367/// Instantiate a resource method builder
7368///
7369/// ```test_harness,no_run
7370/// # extern crate hyper;
7371/// # extern crate hyper_rustls;
7372/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7373/// use datafusion1_beta1::api::CancelOperationRequest;
7374/// # async fn dox() {
7375/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7376///
7377/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7378/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7379/// # .with_native_roots()
7380/// # .unwrap()
7381/// # .https_only()
7382/// # .enable_http2()
7383/// # .build();
7384///
7385/// # let executor = hyper_util::rt::TokioExecutor::new();
7386/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7387/// # secret,
7388/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7389/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7390/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7391/// # ),
7392/// # ).build().await.unwrap();
7393///
7394/// # let client = hyper_util::client::legacy::Client::builder(
7395/// # hyper_util::rt::TokioExecutor::new()
7396/// # )
7397/// # .build(
7398/// # hyper_rustls::HttpsConnectorBuilder::new()
7399/// # .with_native_roots()
7400/// # .unwrap()
7401/// # .https_or_http()
7402/// # .enable_http2()
7403/// # .build()
7404/// # );
7405/// # let mut hub = DataFusion::new(client, auth);
7406/// // As the method needs a request, you would usually fill it with the desired information
7407/// // into the respective structure. Some of the parts shown here might not be applicable !
7408/// // Values shown here are possibly random and not representative !
7409/// let mut req = CancelOperationRequest::default();
7410///
7411/// // You can configure optional parameters by calling the respective setters at will, and
7412/// // execute the final call using `doit()`.
7413/// // Values shown here are possibly random and not representative !
7414/// let result = hub.projects().locations_operations_cancel(req, "name")
7415/// .doit().await;
7416/// # }
7417/// ```
7418pub struct ProjectLocationOperationCancelCall<'a, C>
7419where
7420 C: 'a,
7421{
7422 hub: &'a DataFusion<C>,
7423 _request: CancelOperationRequest,
7424 _name: String,
7425 _delegate: Option<&'a mut dyn common::Delegate>,
7426 _additional_params: HashMap<String, String>,
7427 _scopes: BTreeSet<String>,
7428}
7429
7430impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
7431
7432impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
7433where
7434 C: common::Connector,
7435{
7436 /// Perform the operation you have build so far.
7437 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7438 use std::borrow::Cow;
7439 use std::io::{Read, Seek};
7440
7441 use common::{url::Params, ToParts};
7442 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7443
7444 let mut dd = common::DefaultDelegate;
7445 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7446 dlg.begin(common::MethodInfo {
7447 id: "datafusion.projects.locations.operations.cancel",
7448 http_method: hyper::Method::POST,
7449 });
7450
7451 for &field in ["alt", "name"].iter() {
7452 if self._additional_params.contains_key(field) {
7453 dlg.finished(false);
7454 return Err(common::Error::FieldClash(field));
7455 }
7456 }
7457
7458 let mut params = Params::with_capacity(4 + self._additional_params.len());
7459 params.push("name", self._name);
7460
7461 params.extend(self._additional_params.iter());
7462
7463 params.push("alt", "json");
7464 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}:cancel";
7465 if self._scopes.is_empty() {
7466 self._scopes
7467 .insert(Scope::CloudPlatform.as_ref().to_string());
7468 }
7469
7470 #[allow(clippy::single_element_loop)]
7471 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7472 url = params.uri_replacement(url, param_name, find_this, true);
7473 }
7474 {
7475 let to_remove = ["name"];
7476 params.remove_params(&to_remove);
7477 }
7478
7479 let url = params.parse_with_url(&url);
7480
7481 let mut json_mime_type = mime::APPLICATION_JSON;
7482 let mut request_value_reader = {
7483 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7484 common::remove_json_null_values(&mut value);
7485 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7486 serde_json::to_writer(&mut dst, &value).unwrap();
7487 dst
7488 };
7489 let request_size = request_value_reader
7490 .seek(std::io::SeekFrom::End(0))
7491 .unwrap();
7492 request_value_reader
7493 .seek(std::io::SeekFrom::Start(0))
7494 .unwrap();
7495
7496 loop {
7497 let token = match self
7498 .hub
7499 .auth
7500 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7501 .await
7502 {
7503 Ok(token) => token,
7504 Err(e) => match dlg.token(e) {
7505 Ok(token) => token,
7506 Err(e) => {
7507 dlg.finished(false);
7508 return Err(common::Error::MissingToken(e));
7509 }
7510 },
7511 };
7512 request_value_reader
7513 .seek(std::io::SeekFrom::Start(0))
7514 .unwrap();
7515 let mut req_result = {
7516 let client = &self.hub.client;
7517 dlg.pre_request();
7518 let mut req_builder = hyper::Request::builder()
7519 .method(hyper::Method::POST)
7520 .uri(url.as_str())
7521 .header(USER_AGENT, self.hub._user_agent.clone());
7522
7523 if let Some(token) = token.as_ref() {
7524 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7525 }
7526
7527 let request = req_builder
7528 .header(CONTENT_TYPE, json_mime_type.to_string())
7529 .header(CONTENT_LENGTH, request_size as u64)
7530 .body(common::to_body(
7531 request_value_reader.get_ref().clone().into(),
7532 ));
7533
7534 client.request(request.unwrap()).await
7535 };
7536
7537 match req_result {
7538 Err(err) => {
7539 if let common::Retry::After(d) = dlg.http_error(&err) {
7540 sleep(d).await;
7541 continue;
7542 }
7543 dlg.finished(false);
7544 return Err(common::Error::HttpError(err));
7545 }
7546 Ok(res) => {
7547 let (mut parts, body) = res.into_parts();
7548 let mut body = common::Body::new(body);
7549 if !parts.status.is_success() {
7550 let bytes = common::to_bytes(body).await.unwrap_or_default();
7551 let error = serde_json::from_str(&common::to_string(&bytes));
7552 let response = common::to_response(parts, bytes.into());
7553
7554 if let common::Retry::After(d) =
7555 dlg.http_failure(&response, error.as_ref().ok())
7556 {
7557 sleep(d).await;
7558 continue;
7559 }
7560
7561 dlg.finished(false);
7562
7563 return Err(match error {
7564 Ok(value) => common::Error::BadRequest(value),
7565 _ => common::Error::Failure(response),
7566 });
7567 }
7568 let response = {
7569 let bytes = common::to_bytes(body).await.unwrap_or_default();
7570 let encoded = common::to_string(&bytes);
7571 match serde_json::from_str(&encoded) {
7572 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7573 Err(error) => {
7574 dlg.response_json_decode_error(&encoded, &error);
7575 return Err(common::Error::JsonDecodeError(
7576 encoded.to_string(),
7577 error,
7578 ));
7579 }
7580 }
7581 };
7582
7583 dlg.finished(true);
7584 return Ok(response);
7585 }
7586 }
7587 }
7588 }
7589
7590 ///
7591 /// Sets the *request* property to the given value.
7592 ///
7593 /// Even though the property as already been set when instantiating this call,
7594 /// we provide this method for API completeness.
7595 pub fn request(
7596 mut self,
7597 new_value: CancelOperationRequest,
7598 ) -> ProjectLocationOperationCancelCall<'a, C> {
7599 self._request = new_value;
7600 self
7601 }
7602 /// The name of the operation resource to be cancelled.
7603 ///
7604 /// Sets the *name* path property to the given value.
7605 ///
7606 /// Even though the property as already been set when instantiating this call,
7607 /// we provide this method for API completeness.
7608 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
7609 self._name = new_value.to_string();
7610 self
7611 }
7612 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7613 /// while executing the actual API request.
7614 ///
7615 /// ````text
7616 /// It should be used to handle progress information, and to implement a certain level of resilience.
7617 /// ````
7618 ///
7619 /// Sets the *delegate* property to the given value.
7620 pub fn delegate(
7621 mut self,
7622 new_value: &'a mut dyn common::Delegate,
7623 ) -> ProjectLocationOperationCancelCall<'a, C> {
7624 self._delegate = Some(new_value);
7625 self
7626 }
7627
7628 /// Set any additional parameter of the query string used in the request.
7629 /// It should be used to set parameters which are not yet available through their own
7630 /// setters.
7631 ///
7632 /// Please note that this method must not be used to set any of the known parameters
7633 /// which have their own setter method. If done anyway, the request will fail.
7634 ///
7635 /// # Additional Parameters
7636 ///
7637 /// * *$.xgafv* (query-string) - V1 error format.
7638 /// * *access_token* (query-string) - OAuth access token.
7639 /// * *alt* (query-string) - Data format for response.
7640 /// * *callback* (query-string) - JSONP
7641 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7642 /// * *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.
7643 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7644 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7645 /// * *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.
7646 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7647 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7648 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
7649 where
7650 T: AsRef<str>,
7651 {
7652 self._additional_params
7653 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7654 self
7655 }
7656
7657 /// Identifies the authorization scope for the method you are building.
7658 ///
7659 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7660 /// [`Scope::CloudPlatform`].
7661 ///
7662 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7663 /// tokens for more than one scope.
7664 ///
7665 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7666 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7667 /// sufficient, a read-write scope will do as well.
7668 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
7669 where
7670 St: AsRef<str>,
7671 {
7672 self._scopes.insert(String::from(scope.as_ref()));
7673 self
7674 }
7675 /// Identifies the authorization scope(s) for the method you are building.
7676 ///
7677 /// See [`Self::add_scope()`] for details.
7678 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
7679 where
7680 I: IntoIterator<Item = St>,
7681 St: AsRef<str>,
7682 {
7683 self._scopes
7684 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7685 self
7686 }
7687
7688 /// Removes all scopes, and no default scope will be used either.
7689 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7690 /// for details).
7691 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
7692 self._scopes.clear();
7693 self
7694 }
7695}
7696
7697/// 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`.
7698///
7699/// A builder for the *locations.operations.delete* method supported by a *project* resource.
7700/// It is not used directly, but through a [`ProjectMethods`] instance.
7701///
7702/// # Example
7703///
7704/// Instantiate a resource method builder
7705///
7706/// ```test_harness,no_run
7707/// # extern crate hyper;
7708/// # extern crate hyper_rustls;
7709/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
7710/// # async fn dox() {
7711/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7712///
7713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7715/// # .with_native_roots()
7716/// # .unwrap()
7717/// # .https_only()
7718/// # .enable_http2()
7719/// # .build();
7720///
7721/// # let executor = hyper_util::rt::TokioExecutor::new();
7722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7723/// # secret,
7724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7725/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7726/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7727/// # ),
7728/// # ).build().await.unwrap();
7729///
7730/// # let client = hyper_util::client::legacy::Client::builder(
7731/// # hyper_util::rt::TokioExecutor::new()
7732/// # )
7733/// # .build(
7734/// # hyper_rustls::HttpsConnectorBuilder::new()
7735/// # .with_native_roots()
7736/// # .unwrap()
7737/// # .https_or_http()
7738/// # .enable_http2()
7739/// # .build()
7740/// # );
7741/// # let mut hub = DataFusion::new(client, auth);
7742/// // You can configure optional parameters by calling the respective setters at will, and
7743/// // execute the final call using `doit()`.
7744/// // Values shown here are possibly random and not representative !
7745/// let result = hub.projects().locations_operations_delete("name")
7746/// .doit().await;
7747/// # }
7748/// ```
7749pub struct ProjectLocationOperationDeleteCall<'a, C>
7750where
7751 C: 'a,
7752{
7753 hub: &'a DataFusion<C>,
7754 _name: String,
7755 _delegate: Option<&'a mut dyn common::Delegate>,
7756 _additional_params: HashMap<String, String>,
7757 _scopes: BTreeSet<String>,
7758}
7759
7760impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
7761
7762impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
7763where
7764 C: common::Connector,
7765{
7766 /// Perform the operation you have build so far.
7767 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7768 use std::borrow::Cow;
7769 use std::io::{Read, Seek};
7770
7771 use common::{url::Params, ToParts};
7772 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7773
7774 let mut dd = common::DefaultDelegate;
7775 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7776 dlg.begin(common::MethodInfo {
7777 id: "datafusion.projects.locations.operations.delete",
7778 http_method: hyper::Method::DELETE,
7779 });
7780
7781 for &field in ["alt", "name"].iter() {
7782 if self._additional_params.contains_key(field) {
7783 dlg.finished(false);
7784 return Err(common::Error::FieldClash(field));
7785 }
7786 }
7787
7788 let mut params = Params::with_capacity(3 + self._additional_params.len());
7789 params.push("name", self._name);
7790
7791 params.extend(self._additional_params.iter());
7792
7793 params.push("alt", "json");
7794 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
7795 if self._scopes.is_empty() {
7796 self._scopes
7797 .insert(Scope::CloudPlatform.as_ref().to_string());
7798 }
7799
7800 #[allow(clippy::single_element_loop)]
7801 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7802 url = params.uri_replacement(url, param_name, find_this, true);
7803 }
7804 {
7805 let to_remove = ["name"];
7806 params.remove_params(&to_remove);
7807 }
7808
7809 let url = params.parse_with_url(&url);
7810
7811 loop {
7812 let token = match self
7813 .hub
7814 .auth
7815 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7816 .await
7817 {
7818 Ok(token) => token,
7819 Err(e) => match dlg.token(e) {
7820 Ok(token) => token,
7821 Err(e) => {
7822 dlg.finished(false);
7823 return Err(common::Error::MissingToken(e));
7824 }
7825 },
7826 };
7827 let mut req_result = {
7828 let client = &self.hub.client;
7829 dlg.pre_request();
7830 let mut req_builder = hyper::Request::builder()
7831 .method(hyper::Method::DELETE)
7832 .uri(url.as_str())
7833 .header(USER_AGENT, self.hub._user_agent.clone());
7834
7835 if let Some(token) = token.as_ref() {
7836 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7837 }
7838
7839 let request = req_builder
7840 .header(CONTENT_LENGTH, 0_u64)
7841 .body(common::to_body::<String>(None));
7842
7843 client.request(request.unwrap()).await
7844 };
7845
7846 match req_result {
7847 Err(err) => {
7848 if let common::Retry::After(d) = dlg.http_error(&err) {
7849 sleep(d).await;
7850 continue;
7851 }
7852 dlg.finished(false);
7853 return Err(common::Error::HttpError(err));
7854 }
7855 Ok(res) => {
7856 let (mut parts, body) = res.into_parts();
7857 let mut body = common::Body::new(body);
7858 if !parts.status.is_success() {
7859 let bytes = common::to_bytes(body).await.unwrap_or_default();
7860 let error = serde_json::from_str(&common::to_string(&bytes));
7861 let response = common::to_response(parts, bytes.into());
7862
7863 if let common::Retry::After(d) =
7864 dlg.http_failure(&response, error.as_ref().ok())
7865 {
7866 sleep(d).await;
7867 continue;
7868 }
7869
7870 dlg.finished(false);
7871
7872 return Err(match error {
7873 Ok(value) => common::Error::BadRequest(value),
7874 _ => common::Error::Failure(response),
7875 });
7876 }
7877 let response = {
7878 let bytes = common::to_bytes(body).await.unwrap_or_default();
7879 let encoded = common::to_string(&bytes);
7880 match serde_json::from_str(&encoded) {
7881 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7882 Err(error) => {
7883 dlg.response_json_decode_error(&encoded, &error);
7884 return Err(common::Error::JsonDecodeError(
7885 encoded.to_string(),
7886 error,
7887 ));
7888 }
7889 }
7890 };
7891
7892 dlg.finished(true);
7893 return Ok(response);
7894 }
7895 }
7896 }
7897 }
7898
7899 /// The name of the operation resource to be deleted.
7900 ///
7901 /// Sets the *name* path property to the given value.
7902 ///
7903 /// Even though the property as already been set when instantiating this call,
7904 /// we provide this method for API completeness.
7905 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
7906 self._name = new_value.to_string();
7907 self
7908 }
7909 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7910 /// while executing the actual API request.
7911 ///
7912 /// ````text
7913 /// It should be used to handle progress information, and to implement a certain level of resilience.
7914 /// ````
7915 ///
7916 /// Sets the *delegate* property to the given value.
7917 pub fn delegate(
7918 mut self,
7919 new_value: &'a mut dyn common::Delegate,
7920 ) -> ProjectLocationOperationDeleteCall<'a, C> {
7921 self._delegate = Some(new_value);
7922 self
7923 }
7924
7925 /// Set any additional parameter of the query string used in the request.
7926 /// It should be used to set parameters which are not yet available through their own
7927 /// setters.
7928 ///
7929 /// Please note that this method must not be used to set any of the known parameters
7930 /// which have their own setter method. If done anyway, the request will fail.
7931 ///
7932 /// # Additional Parameters
7933 ///
7934 /// * *$.xgafv* (query-string) - V1 error format.
7935 /// * *access_token* (query-string) - OAuth access token.
7936 /// * *alt* (query-string) - Data format for response.
7937 /// * *callback* (query-string) - JSONP
7938 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7939 /// * *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.
7940 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7941 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7942 /// * *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.
7943 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7944 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7945 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
7946 where
7947 T: AsRef<str>,
7948 {
7949 self._additional_params
7950 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7951 self
7952 }
7953
7954 /// Identifies the authorization scope for the method you are building.
7955 ///
7956 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7957 /// [`Scope::CloudPlatform`].
7958 ///
7959 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7960 /// tokens for more than one scope.
7961 ///
7962 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7963 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7964 /// sufficient, a read-write scope will do as well.
7965 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
7966 where
7967 St: AsRef<str>,
7968 {
7969 self._scopes.insert(String::from(scope.as_ref()));
7970 self
7971 }
7972 /// Identifies the authorization scope(s) for the method you are building.
7973 ///
7974 /// See [`Self::add_scope()`] for details.
7975 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
7976 where
7977 I: IntoIterator<Item = St>,
7978 St: AsRef<str>,
7979 {
7980 self._scopes
7981 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7982 self
7983 }
7984
7985 /// Removes all scopes, and no default scope will be used either.
7986 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7987 /// for details).
7988 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
7989 self._scopes.clear();
7990 self
7991 }
7992}
7993
7994/// 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.
7995///
7996/// A builder for the *locations.operations.get* method supported by a *project* resource.
7997/// It is not used directly, but through a [`ProjectMethods`] instance.
7998///
7999/// # Example
8000///
8001/// Instantiate a resource method builder
8002///
8003/// ```test_harness,no_run
8004/// # extern crate hyper;
8005/// # extern crate hyper_rustls;
8006/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8007/// # async fn dox() {
8008/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8009///
8010/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8011/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8012/// # .with_native_roots()
8013/// # .unwrap()
8014/// # .https_only()
8015/// # .enable_http2()
8016/// # .build();
8017///
8018/// # let executor = hyper_util::rt::TokioExecutor::new();
8019/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8020/// # secret,
8021/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8022/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8023/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8024/// # ),
8025/// # ).build().await.unwrap();
8026///
8027/// # let client = hyper_util::client::legacy::Client::builder(
8028/// # hyper_util::rt::TokioExecutor::new()
8029/// # )
8030/// # .build(
8031/// # hyper_rustls::HttpsConnectorBuilder::new()
8032/// # .with_native_roots()
8033/// # .unwrap()
8034/// # .https_or_http()
8035/// # .enable_http2()
8036/// # .build()
8037/// # );
8038/// # let mut hub = DataFusion::new(client, auth);
8039/// // You can configure optional parameters by calling the respective setters at will, and
8040/// // execute the final call using `doit()`.
8041/// // Values shown here are possibly random and not representative !
8042/// let result = hub.projects().locations_operations_get("name")
8043/// .doit().await;
8044/// # }
8045/// ```
8046pub struct ProjectLocationOperationGetCall<'a, C>
8047where
8048 C: 'a,
8049{
8050 hub: &'a DataFusion<C>,
8051 _name: String,
8052 _delegate: Option<&'a mut dyn common::Delegate>,
8053 _additional_params: HashMap<String, String>,
8054 _scopes: BTreeSet<String>,
8055}
8056
8057impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
8058
8059impl<'a, C> ProjectLocationOperationGetCall<'a, C>
8060where
8061 C: common::Connector,
8062{
8063 /// Perform the operation you have build so far.
8064 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8065 use std::borrow::Cow;
8066 use std::io::{Read, Seek};
8067
8068 use common::{url::Params, ToParts};
8069 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8070
8071 let mut dd = common::DefaultDelegate;
8072 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8073 dlg.begin(common::MethodInfo {
8074 id: "datafusion.projects.locations.operations.get",
8075 http_method: hyper::Method::GET,
8076 });
8077
8078 for &field in ["alt", "name"].iter() {
8079 if self._additional_params.contains_key(field) {
8080 dlg.finished(false);
8081 return Err(common::Error::FieldClash(field));
8082 }
8083 }
8084
8085 let mut params = Params::with_capacity(3 + self._additional_params.len());
8086 params.push("name", self._name);
8087
8088 params.extend(self._additional_params.iter());
8089
8090 params.push("alt", "json");
8091 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
8092 if self._scopes.is_empty() {
8093 self._scopes
8094 .insert(Scope::CloudPlatform.as_ref().to_string());
8095 }
8096
8097 #[allow(clippy::single_element_loop)]
8098 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8099 url = params.uri_replacement(url, param_name, find_this, true);
8100 }
8101 {
8102 let to_remove = ["name"];
8103 params.remove_params(&to_remove);
8104 }
8105
8106 let url = params.parse_with_url(&url);
8107
8108 loop {
8109 let token = match self
8110 .hub
8111 .auth
8112 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8113 .await
8114 {
8115 Ok(token) => token,
8116 Err(e) => match dlg.token(e) {
8117 Ok(token) => token,
8118 Err(e) => {
8119 dlg.finished(false);
8120 return Err(common::Error::MissingToken(e));
8121 }
8122 },
8123 };
8124 let mut req_result = {
8125 let client = &self.hub.client;
8126 dlg.pre_request();
8127 let mut req_builder = hyper::Request::builder()
8128 .method(hyper::Method::GET)
8129 .uri(url.as_str())
8130 .header(USER_AGENT, self.hub._user_agent.clone());
8131
8132 if let Some(token) = token.as_ref() {
8133 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8134 }
8135
8136 let request = req_builder
8137 .header(CONTENT_LENGTH, 0_u64)
8138 .body(common::to_body::<String>(None));
8139
8140 client.request(request.unwrap()).await
8141 };
8142
8143 match req_result {
8144 Err(err) => {
8145 if let common::Retry::After(d) = dlg.http_error(&err) {
8146 sleep(d).await;
8147 continue;
8148 }
8149 dlg.finished(false);
8150 return Err(common::Error::HttpError(err));
8151 }
8152 Ok(res) => {
8153 let (mut parts, body) = res.into_parts();
8154 let mut body = common::Body::new(body);
8155 if !parts.status.is_success() {
8156 let bytes = common::to_bytes(body).await.unwrap_or_default();
8157 let error = serde_json::from_str(&common::to_string(&bytes));
8158 let response = common::to_response(parts, bytes.into());
8159
8160 if let common::Retry::After(d) =
8161 dlg.http_failure(&response, error.as_ref().ok())
8162 {
8163 sleep(d).await;
8164 continue;
8165 }
8166
8167 dlg.finished(false);
8168
8169 return Err(match error {
8170 Ok(value) => common::Error::BadRequest(value),
8171 _ => common::Error::Failure(response),
8172 });
8173 }
8174 let response = {
8175 let bytes = common::to_bytes(body).await.unwrap_or_default();
8176 let encoded = common::to_string(&bytes);
8177 match serde_json::from_str(&encoded) {
8178 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8179 Err(error) => {
8180 dlg.response_json_decode_error(&encoded, &error);
8181 return Err(common::Error::JsonDecodeError(
8182 encoded.to_string(),
8183 error,
8184 ));
8185 }
8186 }
8187 };
8188
8189 dlg.finished(true);
8190 return Ok(response);
8191 }
8192 }
8193 }
8194 }
8195
8196 /// The name of the operation resource.
8197 ///
8198 /// Sets the *name* path property to the given value.
8199 ///
8200 /// Even though the property as already been set when instantiating this call,
8201 /// we provide this method for API completeness.
8202 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
8203 self._name = new_value.to_string();
8204 self
8205 }
8206 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8207 /// while executing the actual API request.
8208 ///
8209 /// ````text
8210 /// It should be used to handle progress information, and to implement a certain level of resilience.
8211 /// ````
8212 ///
8213 /// Sets the *delegate* property to the given value.
8214 pub fn delegate(
8215 mut self,
8216 new_value: &'a mut dyn common::Delegate,
8217 ) -> ProjectLocationOperationGetCall<'a, C> {
8218 self._delegate = Some(new_value);
8219 self
8220 }
8221
8222 /// Set any additional parameter of the query string used in the request.
8223 /// It should be used to set parameters which are not yet available through their own
8224 /// setters.
8225 ///
8226 /// Please note that this method must not be used to set any of the known parameters
8227 /// which have their own setter method. If done anyway, the request will fail.
8228 ///
8229 /// # Additional Parameters
8230 ///
8231 /// * *$.xgafv* (query-string) - V1 error format.
8232 /// * *access_token* (query-string) - OAuth access token.
8233 /// * *alt* (query-string) - Data format for response.
8234 /// * *callback* (query-string) - JSONP
8235 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8236 /// * *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.
8237 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8238 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8239 /// * *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.
8240 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8241 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8242 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
8243 where
8244 T: AsRef<str>,
8245 {
8246 self._additional_params
8247 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8248 self
8249 }
8250
8251 /// Identifies the authorization scope for the method you are building.
8252 ///
8253 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8254 /// [`Scope::CloudPlatform`].
8255 ///
8256 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8257 /// tokens for more than one scope.
8258 ///
8259 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8260 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8261 /// sufficient, a read-write scope will do as well.
8262 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
8263 where
8264 St: AsRef<str>,
8265 {
8266 self._scopes.insert(String::from(scope.as_ref()));
8267 self
8268 }
8269 /// Identifies the authorization scope(s) for the method you are building.
8270 ///
8271 /// See [`Self::add_scope()`] for details.
8272 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
8273 where
8274 I: IntoIterator<Item = St>,
8275 St: AsRef<str>,
8276 {
8277 self._scopes
8278 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8279 self
8280 }
8281
8282 /// Removes all scopes, and no default scope will be used either.
8283 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8284 /// for details).
8285 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
8286 self._scopes.clear();
8287 self
8288 }
8289}
8290
8291/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
8292///
8293/// A builder for the *locations.operations.list* method supported by a *project* resource.
8294/// It is not used directly, but through a [`ProjectMethods`] instance.
8295///
8296/// # Example
8297///
8298/// Instantiate a resource method builder
8299///
8300/// ```test_harness,no_run
8301/// # extern crate hyper;
8302/// # extern crate hyper_rustls;
8303/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8304/// # async fn dox() {
8305/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8306///
8307/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8308/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8309/// # .with_native_roots()
8310/// # .unwrap()
8311/// # .https_only()
8312/// # .enable_http2()
8313/// # .build();
8314///
8315/// # let executor = hyper_util::rt::TokioExecutor::new();
8316/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8317/// # secret,
8318/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8319/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8320/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8321/// # ),
8322/// # ).build().await.unwrap();
8323///
8324/// # let client = hyper_util::client::legacy::Client::builder(
8325/// # hyper_util::rt::TokioExecutor::new()
8326/// # )
8327/// # .build(
8328/// # hyper_rustls::HttpsConnectorBuilder::new()
8329/// # .with_native_roots()
8330/// # .unwrap()
8331/// # .https_or_http()
8332/// # .enable_http2()
8333/// # .build()
8334/// # );
8335/// # let mut hub = DataFusion::new(client, auth);
8336/// // You can configure optional parameters by calling the respective setters at will, and
8337/// // execute the final call using `doit()`.
8338/// // Values shown here are possibly random and not representative !
8339/// let result = hub.projects().locations_operations_list("name")
8340/// .return_partial_success(true)
8341/// .page_token("Stet")
8342/// .page_size(-13)
8343/// .filter("et")
8344/// .doit().await;
8345/// # }
8346/// ```
8347pub struct ProjectLocationOperationListCall<'a, C>
8348where
8349 C: 'a,
8350{
8351 hub: &'a DataFusion<C>,
8352 _name: String,
8353 _return_partial_success: Option<bool>,
8354 _page_token: Option<String>,
8355 _page_size: Option<i32>,
8356 _filter: Option<String>,
8357 _delegate: Option<&'a mut dyn common::Delegate>,
8358 _additional_params: HashMap<String, String>,
8359 _scopes: BTreeSet<String>,
8360}
8361
8362impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
8363
8364impl<'a, C> ProjectLocationOperationListCall<'a, C>
8365where
8366 C: common::Connector,
8367{
8368 /// Perform the operation you have build so far.
8369 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
8370 use std::borrow::Cow;
8371 use std::io::{Read, Seek};
8372
8373 use common::{url::Params, ToParts};
8374 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8375
8376 let mut dd = common::DefaultDelegate;
8377 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8378 dlg.begin(common::MethodInfo {
8379 id: "datafusion.projects.locations.operations.list",
8380 http_method: hyper::Method::GET,
8381 });
8382
8383 for &field in [
8384 "alt",
8385 "name",
8386 "returnPartialSuccess",
8387 "pageToken",
8388 "pageSize",
8389 "filter",
8390 ]
8391 .iter()
8392 {
8393 if self._additional_params.contains_key(field) {
8394 dlg.finished(false);
8395 return Err(common::Error::FieldClash(field));
8396 }
8397 }
8398
8399 let mut params = Params::with_capacity(7 + self._additional_params.len());
8400 params.push("name", self._name);
8401 if let Some(value) = self._return_partial_success.as_ref() {
8402 params.push("returnPartialSuccess", value.to_string());
8403 }
8404 if let Some(value) = self._page_token.as_ref() {
8405 params.push("pageToken", value);
8406 }
8407 if let Some(value) = self._page_size.as_ref() {
8408 params.push("pageSize", value.to_string());
8409 }
8410 if let Some(value) = self._filter.as_ref() {
8411 params.push("filter", value);
8412 }
8413
8414 params.extend(self._additional_params.iter());
8415
8416 params.push("alt", "json");
8417 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/operations";
8418 if self._scopes.is_empty() {
8419 self._scopes
8420 .insert(Scope::CloudPlatform.as_ref().to_string());
8421 }
8422
8423 #[allow(clippy::single_element_loop)]
8424 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8425 url = params.uri_replacement(url, param_name, find_this, true);
8426 }
8427 {
8428 let to_remove = ["name"];
8429 params.remove_params(&to_remove);
8430 }
8431
8432 let url = params.parse_with_url(&url);
8433
8434 loop {
8435 let token = match self
8436 .hub
8437 .auth
8438 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8439 .await
8440 {
8441 Ok(token) => token,
8442 Err(e) => match dlg.token(e) {
8443 Ok(token) => token,
8444 Err(e) => {
8445 dlg.finished(false);
8446 return Err(common::Error::MissingToken(e));
8447 }
8448 },
8449 };
8450 let mut req_result = {
8451 let client = &self.hub.client;
8452 dlg.pre_request();
8453 let mut req_builder = hyper::Request::builder()
8454 .method(hyper::Method::GET)
8455 .uri(url.as_str())
8456 .header(USER_AGENT, self.hub._user_agent.clone());
8457
8458 if let Some(token) = token.as_ref() {
8459 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8460 }
8461
8462 let request = req_builder
8463 .header(CONTENT_LENGTH, 0_u64)
8464 .body(common::to_body::<String>(None));
8465
8466 client.request(request.unwrap()).await
8467 };
8468
8469 match req_result {
8470 Err(err) => {
8471 if let common::Retry::After(d) = dlg.http_error(&err) {
8472 sleep(d).await;
8473 continue;
8474 }
8475 dlg.finished(false);
8476 return Err(common::Error::HttpError(err));
8477 }
8478 Ok(res) => {
8479 let (mut parts, body) = res.into_parts();
8480 let mut body = common::Body::new(body);
8481 if !parts.status.is_success() {
8482 let bytes = common::to_bytes(body).await.unwrap_or_default();
8483 let error = serde_json::from_str(&common::to_string(&bytes));
8484 let response = common::to_response(parts, bytes.into());
8485
8486 if let common::Retry::After(d) =
8487 dlg.http_failure(&response, error.as_ref().ok())
8488 {
8489 sleep(d).await;
8490 continue;
8491 }
8492
8493 dlg.finished(false);
8494
8495 return Err(match error {
8496 Ok(value) => common::Error::BadRequest(value),
8497 _ => common::Error::Failure(response),
8498 });
8499 }
8500 let response = {
8501 let bytes = common::to_bytes(body).await.unwrap_or_default();
8502 let encoded = common::to_string(&bytes);
8503 match serde_json::from_str(&encoded) {
8504 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8505 Err(error) => {
8506 dlg.response_json_decode_error(&encoded, &error);
8507 return Err(common::Error::JsonDecodeError(
8508 encoded.to_string(),
8509 error,
8510 ));
8511 }
8512 }
8513 };
8514
8515 dlg.finished(true);
8516 return Ok(response);
8517 }
8518 }
8519 }
8520 }
8521
8522 /// The name of the operation's parent resource.
8523 ///
8524 /// Sets the *name* path property to the given value.
8525 ///
8526 /// Even though the property as already been set when instantiating this call,
8527 /// we provide this method for API completeness.
8528 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8529 self._name = new_value.to_string();
8530 self
8531 }
8532 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the [ListOperationsResponse.unreachable] field. This can only be `true` when reading across collections e.g. when `parent` is set to `"projects/example/locations/-"`. This field is not by default supported and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
8533 ///
8534 /// Sets the *return partial success* query property to the given value.
8535 pub fn return_partial_success(
8536 mut self,
8537 new_value: bool,
8538 ) -> ProjectLocationOperationListCall<'a, C> {
8539 self._return_partial_success = Some(new_value);
8540 self
8541 }
8542 /// The standard list page token.
8543 ///
8544 /// Sets the *page token* query property to the given value.
8545 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8546 self._page_token = Some(new_value.to_string());
8547 self
8548 }
8549 /// The standard list page size.
8550 ///
8551 /// Sets the *page size* query property to the given value.
8552 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
8553 self._page_size = Some(new_value);
8554 self
8555 }
8556 /// The standard list filter.
8557 ///
8558 /// Sets the *filter* query property to the given value.
8559 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
8560 self._filter = Some(new_value.to_string());
8561 self
8562 }
8563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8564 /// while executing the actual API request.
8565 ///
8566 /// ````text
8567 /// It should be used to handle progress information, and to implement a certain level of resilience.
8568 /// ````
8569 ///
8570 /// Sets the *delegate* property to the given value.
8571 pub fn delegate(
8572 mut self,
8573 new_value: &'a mut dyn common::Delegate,
8574 ) -> ProjectLocationOperationListCall<'a, C> {
8575 self._delegate = Some(new_value);
8576 self
8577 }
8578
8579 /// Set any additional parameter of the query string used in the request.
8580 /// It should be used to set parameters which are not yet available through their own
8581 /// setters.
8582 ///
8583 /// Please note that this method must not be used to set any of the known parameters
8584 /// which have their own setter method. If done anyway, the request will fail.
8585 ///
8586 /// # Additional Parameters
8587 ///
8588 /// * *$.xgafv* (query-string) - V1 error format.
8589 /// * *access_token* (query-string) - OAuth access token.
8590 /// * *alt* (query-string) - Data format for response.
8591 /// * *callback* (query-string) - JSONP
8592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8593 /// * *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.
8594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8596 /// * *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.
8597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8599 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
8600 where
8601 T: AsRef<str>,
8602 {
8603 self._additional_params
8604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8605 self
8606 }
8607
8608 /// Identifies the authorization scope for the method you are building.
8609 ///
8610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8611 /// [`Scope::CloudPlatform`].
8612 ///
8613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8614 /// tokens for more than one scope.
8615 ///
8616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8618 /// sufficient, a read-write scope will do as well.
8619 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
8620 where
8621 St: AsRef<str>,
8622 {
8623 self._scopes.insert(String::from(scope.as_ref()));
8624 self
8625 }
8626 /// Identifies the authorization scope(s) for the method you are building.
8627 ///
8628 /// See [`Self::add_scope()`] for details.
8629 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
8630 where
8631 I: IntoIterator<Item = St>,
8632 St: AsRef<str>,
8633 {
8634 self._scopes
8635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8636 self
8637 }
8638
8639 /// Removes all scopes, and no default scope will be used either.
8640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8641 /// for details).
8642 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
8643 self._scopes.clear();
8644 self
8645 }
8646}
8647
8648/// Lists possible versions for Data Fusion instances in the specified project and location.
8649///
8650/// A builder for the *locations.versions.list* method supported by a *project* resource.
8651/// It is not used directly, but through a [`ProjectMethods`] instance.
8652///
8653/// # Example
8654///
8655/// Instantiate a resource method builder
8656///
8657/// ```test_harness,no_run
8658/// # extern crate hyper;
8659/// # extern crate hyper_rustls;
8660/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8661/// # async fn dox() {
8662/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8663///
8664/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8665/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8666/// # .with_native_roots()
8667/// # .unwrap()
8668/// # .https_only()
8669/// # .enable_http2()
8670/// # .build();
8671///
8672/// # let executor = hyper_util::rt::TokioExecutor::new();
8673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8674/// # secret,
8675/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8676/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8677/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8678/// # ),
8679/// # ).build().await.unwrap();
8680///
8681/// # let client = hyper_util::client::legacy::Client::builder(
8682/// # hyper_util::rt::TokioExecutor::new()
8683/// # )
8684/// # .build(
8685/// # hyper_rustls::HttpsConnectorBuilder::new()
8686/// # .with_native_roots()
8687/// # .unwrap()
8688/// # .https_or_http()
8689/// # .enable_http2()
8690/// # .build()
8691/// # );
8692/// # let mut hub = DataFusion::new(client, auth);
8693/// // You can configure optional parameters by calling the respective setters at will, and
8694/// // execute the final call using `doit()`.
8695/// // Values shown here are possibly random and not representative !
8696/// let result = hub.projects().locations_versions_list("parent")
8697/// .page_token("et")
8698/// .page_size(-68)
8699/// .latest_patch_only(false)
8700/// .doit().await;
8701/// # }
8702/// ```
8703pub struct ProjectLocationVersionListCall<'a, C>
8704where
8705 C: 'a,
8706{
8707 hub: &'a DataFusion<C>,
8708 _parent: String,
8709 _page_token: Option<String>,
8710 _page_size: Option<i32>,
8711 _latest_patch_only: Option<bool>,
8712 _delegate: Option<&'a mut dyn common::Delegate>,
8713 _additional_params: HashMap<String, String>,
8714 _scopes: BTreeSet<String>,
8715}
8716
8717impl<'a, C> common::CallBuilder for ProjectLocationVersionListCall<'a, C> {}
8718
8719impl<'a, C> ProjectLocationVersionListCall<'a, C>
8720where
8721 C: common::Connector,
8722{
8723 /// Perform the operation you have build so far.
8724 pub async fn doit(
8725 mut self,
8726 ) -> common::Result<(common::Response, ListAvailableVersionsResponse)> {
8727 use std::borrow::Cow;
8728 use std::io::{Read, Seek};
8729
8730 use common::{url::Params, ToParts};
8731 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8732
8733 let mut dd = common::DefaultDelegate;
8734 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8735 dlg.begin(common::MethodInfo {
8736 id: "datafusion.projects.locations.versions.list",
8737 http_method: hyper::Method::GET,
8738 });
8739
8740 for &field in ["alt", "parent", "pageToken", "pageSize", "latestPatchOnly"].iter() {
8741 if self._additional_params.contains_key(field) {
8742 dlg.finished(false);
8743 return Err(common::Error::FieldClash(field));
8744 }
8745 }
8746
8747 let mut params = Params::with_capacity(6 + self._additional_params.len());
8748 params.push("parent", self._parent);
8749 if let Some(value) = self._page_token.as_ref() {
8750 params.push("pageToken", value);
8751 }
8752 if let Some(value) = self._page_size.as_ref() {
8753 params.push("pageSize", value.to_string());
8754 }
8755 if let Some(value) = self._latest_patch_only.as_ref() {
8756 params.push("latestPatchOnly", value.to_string());
8757 }
8758
8759 params.extend(self._additional_params.iter());
8760
8761 params.push("alt", "json");
8762 let mut url = self.hub._base_url.clone() + "v1beta1/{+parent}/versions";
8763 if self._scopes.is_empty() {
8764 self._scopes
8765 .insert(Scope::CloudPlatform.as_ref().to_string());
8766 }
8767
8768 #[allow(clippy::single_element_loop)]
8769 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8770 url = params.uri_replacement(url, param_name, find_this, true);
8771 }
8772 {
8773 let to_remove = ["parent"];
8774 params.remove_params(&to_remove);
8775 }
8776
8777 let url = params.parse_with_url(&url);
8778
8779 loop {
8780 let token = match self
8781 .hub
8782 .auth
8783 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8784 .await
8785 {
8786 Ok(token) => token,
8787 Err(e) => match dlg.token(e) {
8788 Ok(token) => token,
8789 Err(e) => {
8790 dlg.finished(false);
8791 return Err(common::Error::MissingToken(e));
8792 }
8793 },
8794 };
8795 let mut req_result = {
8796 let client = &self.hub.client;
8797 dlg.pre_request();
8798 let mut req_builder = hyper::Request::builder()
8799 .method(hyper::Method::GET)
8800 .uri(url.as_str())
8801 .header(USER_AGENT, self.hub._user_agent.clone());
8802
8803 if let Some(token) = token.as_ref() {
8804 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8805 }
8806
8807 let request = req_builder
8808 .header(CONTENT_LENGTH, 0_u64)
8809 .body(common::to_body::<String>(None));
8810
8811 client.request(request.unwrap()).await
8812 };
8813
8814 match req_result {
8815 Err(err) => {
8816 if let common::Retry::After(d) = dlg.http_error(&err) {
8817 sleep(d).await;
8818 continue;
8819 }
8820 dlg.finished(false);
8821 return Err(common::Error::HttpError(err));
8822 }
8823 Ok(res) => {
8824 let (mut parts, body) = res.into_parts();
8825 let mut body = common::Body::new(body);
8826 if !parts.status.is_success() {
8827 let bytes = common::to_bytes(body).await.unwrap_or_default();
8828 let error = serde_json::from_str(&common::to_string(&bytes));
8829 let response = common::to_response(parts, bytes.into());
8830
8831 if let common::Retry::After(d) =
8832 dlg.http_failure(&response, error.as_ref().ok())
8833 {
8834 sleep(d).await;
8835 continue;
8836 }
8837
8838 dlg.finished(false);
8839
8840 return Err(match error {
8841 Ok(value) => common::Error::BadRequest(value),
8842 _ => common::Error::Failure(response),
8843 });
8844 }
8845 let response = {
8846 let bytes = common::to_bytes(body).await.unwrap_or_default();
8847 let encoded = common::to_string(&bytes);
8848 match serde_json::from_str(&encoded) {
8849 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8850 Err(error) => {
8851 dlg.response_json_decode_error(&encoded, &error);
8852 return Err(common::Error::JsonDecodeError(
8853 encoded.to_string(),
8854 error,
8855 ));
8856 }
8857 }
8858 };
8859
8860 dlg.finished(true);
8861 return Ok(response);
8862 }
8863 }
8864 }
8865 }
8866
8867 /// Required. The project and location for which to retrieve instance information in the format projects/{project}/locations/{location}.
8868 ///
8869 /// Sets the *parent* path property to the given value.
8870 ///
8871 /// Even though the property as already been set when instantiating this call,
8872 /// we provide this method for API completeness.
8873 pub fn parent(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
8874 self._parent = new_value.to_string();
8875 self
8876 }
8877 /// The next_page_token value to use if there are additional results to retrieve for this list request.
8878 ///
8879 /// Sets the *page token* query property to the given value.
8880 pub fn page_token(mut self, new_value: &str) -> ProjectLocationVersionListCall<'a, C> {
8881 self._page_token = Some(new_value.to_string());
8882 self
8883 }
8884 /// The maximum number of items to return.
8885 ///
8886 /// Sets the *page size* query property to the given value.
8887 pub fn page_size(mut self, new_value: i32) -> ProjectLocationVersionListCall<'a, C> {
8888 self._page_size = Some(new_value);
8889 self
8890 }
8891 /// 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]
8892 ///
8893 /// Sets the *latest patch only* query property to the given value.
8894 pub fn latest_patch_only(mut self, new_value: bool) -> ProjectLocationVersionListCall<'a, C> {
8895 self._latest_patch_only = Some(new_value);
8896 self
8897 }
8898 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8899 /// while executing the actual API request.
8900 ///
8901 /// ````text
8902 /// It should be used to handle progress information, and to implement a certain level of resilience.
8903 /// ````
8904 ///
8905 /// Sets the *delegate* property to the given value.
8906 pub fn delegate(
8907 mut self,
8908 new_value: &'a mut dyn common::Delegate,
8909 ) -> ProjectLocationVersionListCall<'a, C> {
8910 self._delegate = Some(new_value);
8911 self
8912 }
8913
8914 /// Set any additional parameter of the query string used in the request.
8915 /// It should be used to set parameters which are not yet available through their own
8916 /// setters.
8917 ///
8918 /// Please note that this method must not be used to set any of the known parameters
8919 /// which have their own setter method. If done anyway, the request will fail.
8920 ///
8921 /// # Additional Parameters
8922 ///
8923 /// * *$.xgafv* (query-string) - V1 error format.
8924 /// * *access_token* (query-string) - OAuth access token.
8925 /// * *alt* (query-string) - Data format for response.
8926 /// * *callback* (query-string) - JSONP
8927 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8928 /// * *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.
8929 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8930 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8931 /// * *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.
8932 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8933 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8934 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVersionListCall<'a, C>
8935 where
8936 T: AsRef<str>,
8937 {
8938 self._additional_params
8939 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8940 self
8941 }
8942
8943 /// Identifies the authorization scope for the method you are building.
8944 ///
8945 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8946 /// [`Scope::CloudPlatform`].
8947 ///
8948 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8949 /// tokens for more than one scope.
8950 ///
8951 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8952 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8953 /// sufficient, a read-write scope will do as well.
8954 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVersionListCall<'a, C>
8955 where
8956 St: AsRef<str>,
8957 {
8958 self._scopes.insert(String::from(scope.as_ref()));
8959 self
8960 }
8961 /// Identifies the authorization scope(s) for the method you are building.
8962 ///
8963 /// See [`Self::add_scope()`] for details.
8964 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationVersionListCall<'a, C>
8965 where
8966 I: IntoIterator<Item = St>,
8967 St: AsRef<str>,
8968 {
8969 self._scopes
8970 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8971 self
8972 }
8973
8974 /// Removes all scopes, and no default scope will be used either.
8975 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8976 /// for details).
8977 pub fn clear_scopes(mut self) -> ProjectLocationVersionListCall<'a, C> {
8978 self._scopes.clear();
8979 self
8980 }
8981}
8982
8983/// Gets information about a location.
8984///
8985/// A builder for the *locations.get* method supported by a *project* resource.
8986/// It is not used directly, but through a [`ProjectMethods`] instance.
8987///
8988/// # Example
8989///
8990/// Instantiate a resource method builder
8991///
8992/// ```test_harness,no_run
8993/// # extern crate hyper;
8994/// # extern crate hyper_rustls;
8995/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
8996/// # async fn dox() {
8997/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8998///
8999/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9000/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9001/// # .with_native_roots()
9002/// # .unwrap()
9003/// # .https_only()
9004/// # .enable_http2()
9005/// # .build();
9006///
9007/// # let executor = hyper_util::rt::TokioExecutor::new();
9008/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9009/// # secret,
9010/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9011/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9012/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9013/// # ),
9014/// # ).build().await.unwrap();
9015///
9016/// # let client = hyper_util::client::legacy::Client::builder(
9017/// # hyper_util::rt::TokioExecutor::new()
9018/// # )
9019/// # .build(
9020/// # hyper_rustls::HttpsConnectorBuilder::new()
9021/// # .with_native_roots()
9022/// # .unwrap()
9023/// # .https_or_http()
9024/// # .enable_http2()
9025/// # .build()
9026/// # );
9027/// # let mut hub = DataFusion::new(client, auth);
9028/// // You can configure optional parameters by calling the respective setters at will, and
9029/// // execute the final call using `doit()`.
9030/// // Values shown here are possibly random and not representative !
9031/// let result = hub.projects().locations_get("name")
9032/// .doit().await;
9033/// # }
9034/// ```
9035pub struct ProjectLocationGetCall<'a, C>
9036where
9037 C: 'a,
9038{
9039 hub: &'a DataFusion<C>,
9040 _name: String,
9041 _delegate: Option<&'a mut dyn common::Delegate>,
9042 _additional_params: HashMap<String, String>,
9043 _scopes: BTreeSet<String>,
9044}
9045
9046impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
9047
9048impl<'a, C> ProjectLocationGetCall<'a, C>
9049where
9050 C: common::Connector,
9051{
9052 /// Perform the operation you have build so far.
9053 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
9054 use std::borrow::Cow;
9055 use std::io::{Read, Seek};
9056
9057 use common::{url::Params, ToParts};
9058 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9059
9060 let mut dd = common::DefaultDelegate;
9061 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9062 dlg.begin(common::MethodInfo {
9063 id: "datafusion.projects.locations.get",
9064 http_method: hyper::Method::GET,
9065 });
9066
9067 for &field in ["alt", "name"].iter() {
9068 if self._additional_params.contains_key(field) {
9069 dlg.finished(false);
9070 return Err(common::Error::FieldClash(field));
9071 }
9072 }
9073
9074 let mut params = Params::with_capacity(3 + self._additional_params.len());
9075 params.push("name", self._name);
9076
9077 params.extend(self._additional_params.iter());
9078
9079 params.push("alt", "json");
9080 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}";
9081 if self._scopes.is_empty() {
9082 self._scopes
9083 .insert(Scope::CloudPlatform.as_ref().to_string());
9084 }
9085
9086 #[allow(clippy::single_element_loop)]
9087 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9088 url = params.uri_replacement(url, param_name, find_this, true);
9089 }
9090 {
9091 let to_remove = ["name"];
9092 params.remove_params(&to_remove);
9093 }
9094
9095 let url = params.parse_with_url(&url);
9096
9097 loop {
9098 let token = match self
9099 .hub
9100 .auth
9101 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9102 .await
9103 {
9104 Ok(token) => token,
9105 Err(e) => match dlg.token(e) {
9106 Ok(token) => token,
9107 Err(e) => {
9108 dlg.finished(false);
9109 return Err(common::Error::MissingToken(e));
9110 }
9111 },
9112 };
9113 let mut req_result = {
9114 let client = &self.hub.client;
9115 dlg.pre_request();
9116 let mut req_builder = hyper::Request::builder()
9117 .method(hyper::Method::GET)
9118 .uri(url.as_str())
9119 .header(USER_AGENT, self.hub._user_agent.clone());
9120
9121 if let Some(token) = token.as_ref() {
9122 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9123 }
9124
9125 let request = req_builder
9126 .header(CONTENT_LENGTH, 0_u64)
9127 .body(common::to_body::<String>(None));
9128
9129 client.request(request.unwrap()).await
9130 };
9131
9132 match req_result {
9133 Err(err) => {
9134 if let common::Retry::After(d) = dlg.http_error(&err) {
9135 sleep(d).await;
9136 continue;
9137 }
9138 dlg.finished(false);
9139 return Err(common::Error::HttpError(err));
9140 }
9141 Ok(res) => {
9142 let (mut parts, body) = res.into_parts();
9143 let mut body = common::Body::new(body);
9144 if !parts.status.is_success() {
9145 let bytes = common::to_bytes(body).await.unwrap_or_default();
9146 let error = serde_json::from_str(&common::to_string(&bytes));
9147 let response = common::to_response(parts, bytes.into());
9148
9149 if let common::Retry::After(d) =
9150 dlg.http_failure(&response, error.as_ref().ok())
9151 {
9152 sleep(d).await;
9153 continue;
9154 }
9155
9156 dlg.finished(false);
9157
9158 return Err(match error {
9159 Ok(value) => common::Error::BadRequest(value),
9160 _ => common::Error::Failure(response),
9161 });
9162 }
9163 let response = {
9164 let bytes = common::to_bytes(body).await.unwrap_or_default();
9165 let encoded = common::to_string(&bytes);
9166 match serde_json::from_str(&encoded) {
9167 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9168 Err(error) => {
9169 dlg.response_json_decode_error(&encoded, &error);
9170 return Err(common::Error::JsonDecodeError(
9171 encoded.to_string(),
9172 error,
9173 ));
9174 }
9175 }
9176 };
9177
9178 dlg.finished(true);
9179 return Ok(response);
9180 }
9181 }
9182 }
9183 }
9184
9185 /// Resource name for the location.
9186 ///
9187 /// Sets the *name* path property to the given value.
9188 ///
9189 /// Even though the property as already been set when instantiating this call,
9190 /// we provide this method for API completeness.
9191 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
9192 self._name = new_value.to_string();
9193 self
9194 }
9195 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9196 /// while executing the actual API request.
9197 ///
9198 /// ````text
9199 /// It should be used to handle progress information, and to implement a certain level of resilience.
9200 /// ````
9201 ///
9202 /// Sets the *delegate* property to the given value.
9203 pub fn delegate(
9204 mut self,
9205 new_value: &'a mut dyn common::Delegate,
9206 ) -> ProjectLocationGetCall<'a, C> {
9207 self._delegate = Some(new_value);
9208 self
9209 }
9210
9211 /// Set any additional parameter of the query string used in the request.
9212 /// It should be used to set parameters which are not yet available through their own
9213 /// setters.
9214 ///
9215 /// Please note that this method must not be used to set any of the known parameters
9216 /// which have their own setter method. If done anyway, the request will fail.
9217 ///
9218 /// # Additional Parameters
9219 ///
9220 /// * *$.xgafv* (query-string) - V1 error format.
9221 /// * *access_token* (query-string) - OAuth access token.
9222 /// * *alt* (query-string) - Data format for response.
9223 /// * *callback* (query-string) - JSONP
9224 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9225 /// * *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.
9226 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9227 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9228 /// * *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.
9229 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9230 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9231 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
9232 where
9233 T: AsRef<str>,
9234 {
9235 self._additional_params
9236 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9237 self
9238 }
9239
9240 /// Identifies the authorization scope for the method you are building.
9241 ///
9242 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9243 /// [`Scope::CloudPlatform`].
9244 ///
9245 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9246 /// tokens for more than one scope.
9247 ///
9248 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9249 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9250 /// sufficient, a read-write scope will do as well.
9251 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
9252 where
9253 St: AsRef<str>,
9254 {
9255 self._scopes.insert(String::from(scope.as_ref()));
9256 self
9257 }
9258 /// Identifies the authorization scope(s) for the method you are building.
9259 ///
9260 /// See [`Self::add_scope()`] for details.
9261 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
9262 where
9263 I: IntoIterator<Item = St>,
9264 St: AsRef<str>,
9265 {
9266 self._scopes
9267 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9268 self
9269 }
9270
9271 /// Removes all scopes, and no default scope will be used either.
9272 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9273 /// for details).
9274 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
9275 self._scopes.clear();
9276 self
9277 }
9278}
9279
9280/// Lists information about the supported locations for this service.
9281///
9282/// A builder for the *locations.list* method supported by a *project* resource.
9283/// It is not used directly, but through a [`ProjectMethods`] instance.
9284///
9285/// # Example
9286///
9287/// Instantiate a resource method builder
9288///
9289/// ```test_harness,no_run
9290/// # extern crate hyper;
9291/// # extern crate hyper_rustls;
9292/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
9293/// # async fn dox() {
9294/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9295///
9296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9297/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9298/// # .with_native_roots()
9299/// # .unwrap()
9300/// # .https_only()
9301/// # .enable_http2()
9302/// # .build();
9303///
9304/// # let executor = hyper_util::rt::TokioExecutor::new();
9305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9306/// # secret,
9307/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9308/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9309/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9310/// # ),
9311/// # ).build().await.unwrap();
9312///
9313/// # let client = hyper_util::client::legacy::Client::builder(
9314/// # hyper_util::rt::TokioExecutor::new()
9315/// # )
9316/// # .build(
9317/// # hyper_rustls::HttpsConnectorBuilder::new()
9318/// # .with_native_roots()
9319/// # .unwrap()
9320/// # .https_or_http()
9321/// # .enable_http2()
9322/// # .build()
9323/// # );
9324/// # let mut hub = DataFusion::new(client, auth);
9325/// // You can configure optional parameters by calling the respective setters at will, and
9326/// // execute the final call using `doit()`.
9327/// // Values shown here are possibly random and not representative !
9328/// let result = hub.projects().locations_list("name")
9329/// .page_token("duo")
9330/// .page_size(-34)
9331/// .filter("et")
9332/// .add_extra_location_types("voluptua.")
9333/// .doit().await;
9334/// # }
9335/// ```
9336pub struct ProjectLocationListCall<'a, C>
9337where
9338 C: 'a,
9339{
9340 hub: &'a DataFusion<C>,
9341 _name: String,
9342 _page_token: Option<String>,
9343 _page_size: Option<i32>,
9344 _filter: Option<String>,
9345 _extra_location_types: Vec<String>,
9346 _delegate: Option<&'a mut dyn common::Delegate>,
9347 _additional_params: HashMap<String, String>,
9348 _scopes: BTreeSet<String>,
9349}
9350
9351impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
9352
9353impl<'a, C> ProjectLocationListCall<'a, C>
9354where
9355 C: common::Connector,
9356{
9357 /// Perform the operation you have build so far.
9358 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
9359 use std::borrow::Cow;
9360 use std::io::{Read, Seek};
9361
9362 use common::{url::Params, ToParts};
9363 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9364
9365 let mut dd = common::DefaultDelegate;
9366 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9367 dlg.begin(common::MethodInfo {
9368 id: "datafusion.projects.locations.list",
9369 http_method: hyper::Method::GET,
9370 });
9371
9372 for &field in [
9373 "alt",
9374 "name",
9375 "pageToken",
9376 "pageSize",
9377 "filter",
9378 "extraLocationTypes",
9379 ]
9380 .iter()
9381 {
9382 if self._additional_params.contains_key(field) {
9383 dlg.finished(false);
9384 return Err(common::Error::FieldClash(field));
9385 }
9386 }
9387
9388 let mut params = Params::with_capacity(7 + self._additional_params.len());
9389 params.push("name", self._name);
9390 if let Some(value) = self._page_token.as_ref() {
9391 params.push("pageToken", value);
9392 }
9393 if let Some(value) = self._page_size.as_ref() {
9394 params.push("pageSize", value.to_string());
9395 }
9396 if let Some(value) = self._filter.as_ref() {
9397 params.push("filter", value);
9398 }
9399 if !self._extra_location_types.is_empty() {
9400 for f in self._extra_location_types.iter() {
9401 params.push("extraLocationTypes", f);
9402 }
9403 }
9404
9405 params.extend(self._additional_params.iter());
9406
9407 params.push("alt", "json");
9408 let mut url = self.hub._base_url.clone() + "v1beta1/{+name}/locations";
9409 if self._scopes.is_empty() {
9410 self._scopes
9411 .insert(Scope::CloudPlatform.as_ref().to_string());
9412 }
9413
9414 #[allow(clippy::single_element_loop)]
9415 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9416 url = params.uri_replacement(url, param_name, find_this, true);
9417 }
9418 {
9419 let to_remove = ["name"];
9420 params.remove_params(&to_remove);
9421 }
9422
9423 let url = params.parse_with_url(&url);
9424
9425 loop {
9426 let token = match self
9427 .hub
9428 .auth
9429 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9430 .await
9431 {
9432 Ok(token) => token,
9433 Err(e) => match dlg.token(e) {
9434 Ok(token) => token,
9435 Err(e) => {
9436 dlg.finished(false);
9437 return Err(common::Error::MissingToken(e));
9438 }
9439 },
9440 };
9441 let mut req_result = {
9442 let client = &self.hub.client;
9443 dlg.pre_request();
9444 let mut req_builder = hyper::Request::builder()
9445 .method(hyper::Method::GET)
9446 .uri(url.as_str())
9447 .header(USER_AGENT, self.hub._user_agent.clone());
9448
9449 if let Some(token) = token.as_ref() {
9450 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9451 }
9452
9453 let request = req_builder
9454 .header(CONTENT_LENGTH, 0_u64)
9455 .body(common::to_body::<String>(None));
9456
9457 client.request(request.unwrap()).await
9458 };
9459
9460 match req_result {
9461 Err(err) => {
9462 if let common::Retry::After(d) = dlg.http_error(&err) {
9463 sleep(d).await;
9464 continue;
9465 }
9466 dlg.finished(false);
9467 return Err(common::Error::HttpError(err));
9468 }
9469 Ok(res) => {
9470 let (mut parts, body) = res.into_parts();
9471 let mut body = common::Body::new(body);
9472 if !parts.status.is_success() {
9473 let bytes = common::to_bytes(body).await.unwrap_or_default();
9474 let error = serde_json::from_str(&common::to_string(&bytes));
9475 let response = common::to_response(parts, bytes.into());
9476
9477 if let common::Retry::After(d) =
9478 dlg.http_failure(&response, error.as_ref().ok())
9479 {
9480 sleep(d).await;
9481 continue;
9482 }
9483
9484 dlg.finished(false);
9485
9486 return Err(match error {
9487 Ok(value) => common::Error::BadRequest(value),
9488 _ => common::Error::Failure(response),
9489 });
9490 }
9491 let response = {
9492 let bytes = common::to_bytes(body).await.unwrap_or_default();
9493 let encoded = common::to_string(&bytes);
9494 match serde_json::from_str(&encoded) {
9495 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9496 Err(error) => {
9497 dlg.response_json_decode_error(&encoded, &error);
9498 return Err(common::Error::JsonDecodeError(
9499 encoded.to_string(),
9500 error,
9501 ));
9502 }
9503 }
9504 };
9505
9506 dlg.finished(true);
9507 return Ok(response);
9508 }
9509 }
9510 }
9511 }
9512
9513 /// The resource that owns the locations collection, if applicable.
9514 ///
9515 /// Sets the *name* path property to the given value.
9516 ///
9517 /// Even though the property as already been set when instantiating this call,
9518 /// we provide this method for API completeness.
9519 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9520 self._name = new_value.to_string();
9521 self
9522 }
9523 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
9524 ///
9525 /// Sets the *page token* query property to the given value.
9526 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9527 self._page_token = Some(new_value.to_string());
9528 self
9529 }
9530 /// The maximum number of results to return. If not set, the service selects a default.
9531 ///
9532 /// Sets the *page size* query property to the given value.
9533 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
9534 self._page_size = Some(new_value);
9535 self
9536 }
9537 /// 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).
9538 ///
9539 /// Sets the *filter* query property to the given value.
9540 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9541 self._filter = Some(new_value.to_string());
9542 self
9543 }
9544 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
9545 ///
9546 /// Append the given value to the *extra location types* query property.
9547 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
9548 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
9549 self._extra_location_types.push(new_value.to_string());
9550 self
9551 }
9552 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9553 /// while executing the actual API request.
9554 ///
9555 /// ````text
9556 /// It should be used to handle progress information, and to implement a certain level of resilience.
9557 /// ````
9558 ///
9559 /// Sets the *delegate* property to the given value.
9560 pub fn delegate(
9561 mut self,
9562 new_value: &'a mut dyn common::Delegate,
9563 ) -> ProjectLocationListCall<'a, C> {
9564 self._delegate = Some(new_value);
9565 self
9566 }
9567
9568 /// Set any additional parameter of the query string used in the request.
9569 /// It should be used to set parameters which are not yet available through their own
9570 /// setters.
9571 ///
9572 /// Please note that this method must not be used to set any of the known parameters
9573 /// which have their own setter method. If done anyway, the request will fail.
9574 ///
9575 /// # Additional Parameters
9576 ///
9577 /// * *$.xgafv* (query-string) - V1 error format.
9578 /// * *access_token* (query-string) - OAuth access token.
9579 /// * *alt* (query-string) - Data format for response.
9580 /// * *callback* (query-string) - JSONP
9581 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9582 /// * *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.
9583 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9584 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9585 /// * *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.
9586 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9587 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9588 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
9589 where
9590 T: AsRef<str>,
9591 {
9592 self._additional_params
9593 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9594 self
9595 }
9596
9597 /// Identifies the authorization scope for the method you are building.
9598 ///
9599 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9600 /// [`Scope::CloudPlatform`].
9601 ///
9602 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9603 /// tokens for more than one scope.
9604 ///
9605 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9606 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9607 /// sufficient, a read-write scope will do as well.
9608 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
9609 where
9610 St: AsRef<str>,
9611 {
9612 self._scopes.insert(String::from(scope.as_ref()));
9613 self
9614 }
9615 /// Identifies the authorization scope(s) for the method you are building.
9616 ///
9617 /// See [`Self::add_scope()`] for details.
9618 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
9619 where
9620 I: IntoIterator<Item = St>,
9621 St: AsRef<str>,
9622 {
9623 self._scopes
9624 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9625 self
9626 }
9627
9628 /// Removes all scopes, and no default scope will be used either.
9629 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9630 /// for details).
9631 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
9632 self._scopes.clear();
9633 self
9634 }
9635}
9636
9637/// Remove IAM policy that is currently set on the given resource.
9638///
9639/// A builder for the *locations.removeIamPolicy* method supported by a *project* resource.
9640/// It is not used directly, but through a [`ProjectMethods`] instance.
9641///
9642/// # Example
9643///
9644/// Instantiate a resource method builder
9645///
9646/// ```test_harness,no_run
9647/// # extern crate hyper;
9648/// # extern crate hyper_rustls;
9649/// # extern crate google_datafusion1_beta1 as datafusion1_beta1;
9650/// use datafusion1_beta1::api::RemoveIamPolicyRequest;
9651/// # async fn dox() {
9652/// # use datafusion1_beta1::{DataFusion, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9653///
9654/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9655/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9656/// # .with_native_roots()
9657/// # .unwrap()
9658/// # .https_only()
9659/// # .enable_http2()
9660/// # .build();
9661///
9662/// # let executor = hyper_util::rt::TokioExecutor::new();
9663/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9664/// # secret,
9665/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9666/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9667/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9668/// # ),
9669/// # ).build().await.unwrap();
9670///
9671/// # let client = hyper_util::client::legacy::Client::builder(
9672/// # hyper_util::rt::TokioExecutor::new()
9673/// # )
9674/// # .build(
9675/// # hyper_rustls::HttpsConnectorBuilder::new()
9676/// # .with_native_roots()
9677/// # .unwrap()
9678/// # .https_or_http()
9679/// # .enable_http2()
9680/// # .build()
9681/// # );
9682/// # let mut hub = DataFusion::new(client, auth);
9683/// // As the method needs a request, you would usually fill it with the desired information
9684/// // into the respective structure. Some of the parts shown here might not be applicable !
9685/// // Values shown here are possibly random and not representative !
9686/// let mut req = RemoveIamPolicyRequest::default();
9687///
9688/// // You can configure optional parameters by calling the respective setters at will, and
9689/// // execute the final call using `doit()`.
9690/// // Values shown here are possibly random and not representative !
9691/// let result = hub.projects().locations_remove_iam_policy(req, "resource")
9692/// .doit().await;
9693/// # }
9694/// ```
9695pub struct ProjectLocationRemoveIamPolicyCall<'a, C>
9696where
9697 C: 'a,
9698{
9699 hub: &'a DataFusion<C>,
9700 _request: RemoveIamPolicyRequest,
9701 _resource: String,
9702 _delegate: Option<&'a mut dyn common::Delegate>,
9703 _additional_params: HashMap<String, String>,
9704 _scopes: BTreeSet<String>,
9705}
9706
9707impl<'a, C> common::CallBuilder for ProjectLocationRemoveIamPolicyCall<'a, C> {}
9708
9709impl<'a, C> ProjectLocationRemoveIamPolicyCall<'a, C>
9710where
9711 C: common::Connector,
9712{
9713 /// Perform the operation you have build so far.
9714 pub async fn doit(mut self) -> common::Result<(common::Response, RemoveIamPolicyResponse)> {
9715 use std::borrow::Cow;
9716 use std::io::{Read, Seek};
9717
9718 use common::{url::Params, ToParts};
9719 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9720
9721 let mut dd = common::DefaultDelegate;
9722 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9723 dlg.begin(common::MethodInfo {
9724 id: "datafusion.projects.locations.removeIamPolicy",
9725 http_method: hyper::Method::POST,
9726 });
9727
9728 for &field in ["alt", "resource"].iter() {
9729 if self._additional_params.contains_key(field) {
9730 dlg.finished(false);
9731 return Err(common::Error::FieldClash(field));
9732 }
9733 }
9734
9735 let mut params = Params::with_capacity(4 + self._additional_params.len());
9736 params.push("resource", self._resource);
9737
9738 params.extend(self._additional_params.iter());
9739
9740 params.push("alt", "json");
9741 let mut url = self.hub._base_url.clone() + "v1beta1/{+resource}:removeIamPolicy";
9742 if self._scopes.is_empty() {
9743 self._scopes
9744 .insert(Scope::CloudPlatform.as_ref().to_string());
9745 }
9746
9747 #[allow(clippy::single_element_loop)]
9748 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9749 url = params.uri_replacement(url, param_name, find_this, true);
9750 }
9751 {
9752 let to_remove = ["resource"];
9753 params.remove_params(&to_remove);
9754 }
9755
9756 let url = params.parse_with_url(&url);
9757
9758 let mut json_mime_type = mime::APPLICATION_JSON;
9759 let mut request_value_reader = {
9760 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9761 common::remove_json_null_values(&mut value);
9762 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9763 serde_json::to_writer(&mut dst, &value).unwrap();
9764 dst
9765 };
9766 let request_size = request_value_reader
9767 .seek(std::io::SeekFrom::End(0))
9768 .unwrap();
9769 request_value_reader
9770 .seek(std::io::SeekFrom::Start(0))
9771 .unwrap();
9772
9773 loop {
9774 let token = match self
9775 .hub
9776 .auth
9777 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9778 .await
9779 {
9780 Ok(token) => token,
9781 Err(e) => match dlg.token(e) {
9782 Ok(token) => token,
9783 Err(e) => {
9784 dlg.finished(false);
9785 return Err(common::Error::MissingToken(e));
9786 }
9787 },
9788 };
9789 request_value_reader
9790 .seek(std::io::SeekFrom::Start(0))
9791 .unwrap();
9792 let mut req_result = {
9793 let client = &self.hub.client;
9794 dlg.pre_request();
9795 let mut req_builder = hyper::Request::builder()
9796 .method(hyper::Method::POST)
9797 .uri(url.as_str())
9798 .header(USER_AGENT, self.hub._user_agent.clone());
9799
9800 if let Some(token) = token.as_ref() {
9801 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9802 }
9803
9804 let request = req_builder
9805 .header(CONTENT_TYPE, json_mime_type.to_string())
9806 .header(CONTENT_LENGTH, request_size as u64)
9807 .body(common::to_body(
9808 request_value_reader.get_ref().clone().into(),
9809 ));
9810
9811 client.request(request.unwrap()).await
9812 };
9813
9814 match req_result {
9815 Err(err) => {
9816 if let common::Retry::After(d) = dlg.http_error(&err) {
9817 sleep(d).await;
9818 continue;
9819 }
9820 dlg.finished(false);
9821 return Err(common::Error::HttpError(err));
9822 }
9823 Ok(res) => {
9824 let (mut parts, body) = res.into_parts();
9825 let mut body = common::Body::new(body);
9826 if !parts.status.is_success() {
9827 let bytes = common::to_bytes(body).await.unwrap_or_default();
9828 let error = serde_json::from_str(&common::to_string(&bytes));
9829 let response = common::to_response(parts, bytes.into());
9830
9831 if let common::Retry::After(d) =
9832 dlg.http_failure(&response, error.as_ref().ok())
9833 {
9834 sleep(d).await;
9835 continue;
9836 }
9837
9838 dlg.finished(false);
9839
9840 return Err(match error {
9841 Ok(value) => common::Error::BadRequest(value),
9842 _ => common::Error::Failure(response),
9843 });
9844 }
9845 let response = {
9846 let bytes = common::to_bytes(body).await.unwrap_or_default();
9847 let encoded = common::to_string(&bytes);
9848 match serde_json::from_str(&encoded) {
9849 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9850 Err(error) => {
9851 dlg.response_json_decode_error(&encoded, &error);
9852 return Err(common::Error::JsonDecodeError(
9853 encoded.to_string(),
9854 error,
9855 ));
9856 }
9857 }
9858 };
9859
9860 dlg.finished(true);
9861 return Ok(response);
9862 }
9863 }
9864 }
9865 }
9866
9867 ///
9868 /// Sets the *request* property to the given value.
9869 ///
9870 /// Even though the property as already been set when instantiating this call,
9871 /// we provide this method for API completeness.
9872 pub fn request(
9873 mut self,
9874 new_value: RemoveIamPolicyRequest,
9875 ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9876 self._request = new_value;
9877 self
9878 }
9879 /// Required. The resource on which IAM policy to be removed is attached to.
9880 ///
9881 /// Sets the *resource* path property to the given value.
9882 ///
9883 /// Even though the property as already been set when instantiating this call,
9884 /// we provide this method for API completeness.
9885 pub fn resource(mut self, new_value: &str) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9886 self._resource = new_value.to_string();
9887 self
9888 }
9889 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9890 /// while executing the actual API request.
9891 ///
9892 /// ````text
9893 /// It should be used to handle progress information, and to implement a certain level of resilience.
9894 /// ````
9895 ///
9896 /// Sets the *delegate* property to the given value.
9897 pub fn delegate(
9898 mut self,
9899 new_value: &'a mut dyn common::Delegate,
9900 ) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9901 self._delegate = Some(new_value);
9902 self
9903 }
9904
9905 /// Set any additional parameter of the query string used in the request.
9906 /// It should be used to set parameters which are not yet available through their own
9907 /// setters.
9908 ///
9909 /// Please note that this method must not be used to set any of the known parameters
9910 /// which have their own setter method. If done anyway, the request will fail.
9911 ///
9912 /// # Additional Parameters
9913 ///
9914 /// * *$.xgafv* (query-string) - V1 error format.
9915 /// * *access_token* (query-string) - OAuth access token.
9916 /// * *alt* (query-string) - Data format for response.
9917 /// * *callback* (query-string) - JSONP
9918 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9919 /// * *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.
9920 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9921 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9922 /// * *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.
9923 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9924 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9925 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9926 where
9927 T: AsRef<str>,
9928 {
9929 self._additional_params
9930 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9931 self
9932 }
9933
9934 /// Identifies the authorization scope for the method you are building.
9935 ///
9936 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9937 /// [`Scope::CloudPlatform`].
9938 ///
9939 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9940 /// tokens for more than one scope.
9941 ///
9942 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9943 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9944 /// sufficient, a read-write scope will do as well.
9945 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9946 where
9947 St: AsRef<str>,
9948 {
9949 self._scopes.insert(String::from(scope.as_ref()));
9950 self
9951 }
9952 /// Identifies the authorization scope(s) for the method you are building.
9953 ///
9954 /// See [`Self::add_scope()`] for details.
9955 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRemoveIamPolicyCall<'a, C>
9956 where
9957 I: IntoIterator<Item = St>,
9958 St: AsRef<str>,
9959 {
9960 self._scopes
9961 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9962 self
9963 }
9964
9965 /// Removes all scopes, and no default scope will be used either.
9966 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9967 /// for details).
9968 pub fn clear_scopes(mut self) -> ProjectLocationRemoveIamPolicyCall<'a, C> {
9969 self._scopes.clear();
9970 self
9971 }
9972}