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